Add poc files
This commit is contained in:
parent
30da2412e3
commit
fa600b98f7
220 changed files with 45679 additions and 0 deletions
24
commons/deprecated/Makefile.old
Normal file
24
commons/deprecated/Makefile.old
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#-----------------------------------------------------------------------------
|
||||
# Other stuff
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
#backtrace
|
||||
MYBACKTRACESRC=backtrace.ml
|
||||
BACKTRACEINCLUDES=-I $(shell ocamlc -where)
|
||||
|
||||
backtrace: commons_backtrace.cma
|
||||
backtrace.opt: commons_backtrace.cmxa
|
||||
|
||||
backtrace_c.o: backtrace_c.c
|
||||
$(CC) $(BACKTRACEINCLUDES) -c $^
|
||||
|
||||
commons_backtrace.cma: $(MYBACKTRACESRC:.ml=.cmo) backtrace_c.o
|
||||
$(OCAMLMKLIB) -o commons_backtrace $^
|
||||
|
||||
commons_backtrace.cmxa: $(MYBACKTRACESRC:.ml=.cmx) backtrace_c.o
|
||||
$(OCAMLMKLIB) -o commons_backtrace $^
|
||||
|
||||
|
||||
clean::
|
||||
rm -f dllcommons_backtrace.so
|
||||
|
||||
39
commons/deprecated/backtrace.ml
Normal file
39
commons/deprecated/backtrace.ml
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
open Common
|
||||
|
||||
(*
|
||||
* src: Jane Street Core library.
|
||||
* update: Normally no more needed in OCaml 3.11 as part of the
|
||||
* default runtime.
|
||||
*)
|
||||
external print : unit -> unit = "print_exception_backtrace_stub" "noalloc"
|
||||
|
||||
|
||||
(* ---------------------------------------------------------------------- *)
|
||||
(* testing *)
|
||||
(* ---------------------------------------------------------------------- *)
|
||||
|
||||
exception MyNot_Found
|
||||
|
||||
let foo1 () =
|
||||
if 1=1
|
||||
then raise MyNot_Found
|
||||
else 2
|
||||
|
||||
let foo2 () =
|
||||
foo1 () + 2
|
||||
|
||||
let test_backtrace () =
|
||||
(try ignore(foo2 ())
|
||||
with exn ->
|
||||
pr2 (Common.exn_to_s exn);
|
||||
print();
|
||||
failwith "other exn"
|
||||
);
|
||||
print_string "ok cool\n";
|
||||
()
|
||||
|
||||
let actions () =
|
||||
[
|
||||
"-test_backtrace", " ",
|
||||
Common.mk_action_0_arg test_backtrace;
|
||||
]
|
||||
9
commons/deprecated/backtrace_c.c
Normal file
9
commons/deprecated/backtrace_c.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include "caml/mlvalues.h"
|
||||
|
||||
CAMLextern void caml_print_exception_backtrace(void);
|
||||
|
||||
CAMLprim value print_exception_backtrace_stub(value /*__unused*/ unit)
|
||||
{
|
||||
caml_print_exception_backtrace();
|
||||
return Val_unit;
|
||||
}
|
||||
48
commons/deprecated/sexp_common.ml
Normal file
48
commons/deprecated/sexp_common.ml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
(* automatically generated by ocamltarzan *)
|
||||
|
||||
open Common
|
||||
|
||||
let sexp_of_either _of_a _of_b =
|
||||
function
|
||||
| Left v1 -> let v1 = _of_a v1 in Sexp.List [ Sexp.Atom "Left"; v1 ]
|
||||
| Right v1 -> let v1 = _of_b v1 in Sexp.List [ Sexp.Atom "Right"; v1 ]
|
||||
|
||||
let sexp_of_either3 _of_a _of_b _of_c =
|
||||
function
|
||||
| Left3 v1 -> let v1 = _of_a v1 in Sexp.List [ Sexp.Atom "Left3"; v1 ]
|
||||
| Middle3 v1 -> let v1 = _of_b v1 in Sexp.List [ Sexp.Atom "Middle3"; v1 ]
|
||||
| Right3 v1 -> let v1 = _of_c v1 in Sexp.List [ Sexp.Atom "Right3"; v1 ]
|
||||
|
||||
|
||||
let sexp_of_filename v = Conv.sexp_of_string v
|
||||
let sexp_of_dirname v = Conv.sexp_of_string v
|
||||
|
||||
let sexp_of_set _of_a = Conv.sexp_of_list _of_a
|
||||
|
||||
let sexp_of_assoc _of_a _of_b =
|
||||
Conv.sexp_of_list
|
||||
(fun (v1, v2) ->
|
||||
let v1 = _of_a v1 and v2 = _of_b v2 in Sexp.List [ v1; v2 ])
|
||||
|
||||
let sexp_of_hashset _of_a = Conv.sexp_of_hashtbl _of_a Conv.sexp_of_bool
|
||||
|
||||
let sexp_of_stack _of_a = Conv.sexp_of_list _of_a
|
||||
|
||||
|
||||
|
||||
let sexp_of_score_result =
|
||||
function
|
||||
| Common2.Ok -> Sexp.Atom "Ok"
|
||||
| Common2.Pb v1 ->
|
||||
let v1 = Conv.sexp_of_string v1 in Sexp.List [ Sexp.Atom "Pb"; v1 ]
|
||||
|
||||
let sexp_of_score v =
|
||||
Conv.sexp_of_hashtbl Conv.sexp_of_string sexp_of_score_result v
|
||||
|
||||
let sexp_of_score_list v =
|
||||
Conv.sexp_of_list
|
||||
(fun (v1, v2) ->
|
||||
let v1 = Conv.sexp_of_string v1
|
||||
and v2 = sexp_of_score_result v2
|
||||
in Sexp.List [ v1; v2 ])
|
||||
v
|
||||
Loading…
Add table
Add a link
Reference in a new issue