Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
GraphEditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Benoit Barbot
GraphEditor
Commits
6ecf231b
Commit
6ecf231b
authored
Nov 20, 2020
by
Benoit Barbot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pb int_buff
parent
b2257a1e
Pipeline
#1783
passed with stage
in 29 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
17 deletions
+34
-17
TAEditor/Makefile
TAEditor/Makefile
+3
-0
TikzEditor/cosmosweb.eliom
TikzEditor/cosmosweb.eliom
+1
-1
editor/SimpleGraph.ml
editor/SimpleGraph.ml
+2
-1
editor/genericSerializer.ml
editor/genericSerializer.ml
+27
-14
editor/utilsWeb.ml
editor/utilsWeb.ml
+1
-1
No files found.
TAEditor/Makefile
View file @
6ecf231b
...
...
@@ -3,6 +3,9 @@ all:
ocamlbuild
-use-ocamlfind
ta_editor.byte
js_of_ocaml
--no-inline
ta_editor.byte
-o
website/ta_editor.js
server
:
all
cd
website
;
python2.7
-m
SimpleHTTPServer
clean
:
ocamlbuild
-clean
rm
-rf
ta_editor.byte website/ta_editor.js
TikzEditor/cosmosweb.eliom
View file @
6ecf231b
...
...
@@ -23,7 +23,7 @@ module Cosmosweb_app =
]
let canvas_elt =
canvas ~a:[a_width width; a_height height]
canvas ~a:[a_
style "background-color: lightslategray; background-image: url(img/grid2.svg) "; a_
width width; a_height height]
[txt "your browser doesn't support canvas"]
let attribute_list_div =
...
...
editor/SimpleGraph.ml
View file @
6ecf231b
...
...
@@ -114,7 +114,8 @@ module S (P:PREGRAPH) =
let
_
,
(
_
,
p
)
=
Data
.
acca
graph
.
state
n
in
p
:=
pos
let
new_node
graph
_
pos
=
let
new_node
graph
_
((
a
,
b
)
as
pos
)
=
Printf
.
printf
"new node: %f; %f
\n
"
a
b
;
let
s
=
Data
.
addk
(()
,
(
ref
(
P
.
init_state
()
)
,
ref
pos
))
graph
.
state
in
`State
(
s
)
let
get_new_node_choice
graph
=
...
...
editor/genericSerializer.ml
View file @
6ecf231b
...
...
@@ -20,26 +20,31 @@ let print_buff s =
Printf
.
printf
"[%i]"
i
)
s
;;
(
1
lsl
10
);;
let
buff_int
b
i
=
if
i
>=
0
&&
i
<
32
then
add_char
b
(
b64_of_ui
i
)
else
if
i
>=
0
&&
i
<
(
1
lsl
10
)
then
(
let
i1
=
i
/
32
+
32
and
i2
=
i
mod
32
in
add_char
b
(
b64_of_ui
i1
);
add_char
b
(
b64_of_ui
i2
);
let
i1
=
i
/
32
+
32
and
i2
=
i
mod
32
in
add_char
b
(
b64_of_ui
i1
);
add_char
b
(
b64_of_ui
i2
);
)
else
let
r
=
max
2
(
int_of_float
((
log
@@
float
@@
abs
@@
i
)
/.
log
2
.
0
)
/
5
)
in
let
r
=
max
2
((
int_of_float
((
log
@@
float
@@
abs
@@
i
)
/.
log
2
.
0
)
+
1
)
/
5
)
in
(*Printf.printf "r:%i " r;*)
add_char
b
(
b64_of_ui
(
32
+
(
if
i
<
0
then
16
else
0
)
+
((
abs
i
)
lsr
(
r
*
5
))));
let
j
=
ref
((
abs
i
)
mod
(
1
lsl
(
5
*
r
)))
in
let
r2
=
ref
(
r
*
5
)
in
while
!
r2
>
0
do
(*
print_string ((string_of_int !r2)^":");
(*
print_string ((string_of_int !r2)^":");
print_endline (string_of_int !j);*)
r2
:=
!
r2
-
5
;
add_char
b
(
b64_of_ui
((
if
!
r2
>
0
then
32
else
0
)
+
(
!
j
lsr
!
r2
)));
j
:=
!
j
mod
(
1
lsl
!
r2
);
done
let
int_buff
s
pos
=
let
r
=
ref
0
in
while
ui_of_b64
s
.
[
pos
+
!
r
]
>=
32
do
incr
r
done
;
...
...
@@ -89,24 +94,31 @@ let check i =
let p1,i1= int_buff str 0 in
if i<>i1 then (
print_buff str;
print_
endline (string_of_int i
);
print_
string ((string_of_int i)^":"
);
print_endline (string_of_int i1);
assert false
);;
let _ =
let i = ref
0
in
while
true
do
let i = ref
(-1025)
in
while
!i < 10000000
do
check !i;
incr i;
done;;
check (10000)
check 1023;;
check 1024;;
check (16383);;
check 16384;;
*)
(*
let _ =
let t = Buffer.create 100 in
for i =
-1025 to 102
0 do
buff_int t
i
;
for i =
16300 to 1700
0 do
buff_int t
(i)
;
done;
let str = (Bytes.to_string @@ Buffer.to_bytes t) in
print_buff str;
...
...
@@ -115,8 +127,9 @@ let _ =
while !pos < String.length str do
let p1,i1= int_buff str !pos in
pos := p1;
print_endline (string_of_int i1);
done*)
print_string ((string_of_int i1)^"\t");
done
*)
let
buff_string
b
str
=
let
n
=
String
.
length
str
in
...
...
editor/utilsWeb.ml
View file @
6ecf231b
...
...
@@ -118,7 +118,7 @@ let text_input ?(class_ = "") ?(on_change = fun _ -> true) ?(_type="text") value
let
update_link
n
f
=
let
link
=
Dom_html
.(
createA
document
)
in
append_node
link
(
txt
n
);
let
currref
=
Js
.
to_string
Dom_html
.
window
##.
location
##.
href
in
let
currref
=
Js
.
to_string
Dom_html
.
window
##.
location
##.
pathname
in
link
##.
onmouseover
:=
Dom
.
handler
(
fun
_
->
let
string_value
=
f
currref
in
link
##.
href
:=
Js
.
string
string_value
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment