Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added fieldlib rules and sample binary
- Loading branch information
Showing
8 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
/sexplib/lib/lexer.ml | ||
/sexplib/lib/parser.ml | ||
/sexplib/lib/parser.mli | ||
/foobar/foobar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
include_rules | ||
|
||
# Building library modules | ||
: field.mli |> !byte_i |> | ||
: field.ml | field.cmi |> !byte_o |> {cmo} | ||
|
||
# Producing library | ||
: {cmo} |> ocamlc -pack %f -o %o |> fieldslib.cmo | fieldslib.cmi | ||
: fieldslib.cmo |> ocamlc -a %f -o %o |> fieldslib.cma | ||
|
||
# Now i want to install fieldlib.cma to $(LIBDIR)/fieldlib/fieldlib.cma but dont know how |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include_rules | ||
: pa_fields_conv.mli |> !byte_pp |> pa_fields_conv.cmi | ||
: pa_fields_conv.ml | $(LIBDIR)/pa_type_conv.cmi pa_fields_conv.cmi |> !byte_pp |> pa_fields_conv.cmo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
include_rules | ||
|
||
# Sample binary that uses sexplib and fieldslib | ||
|
||
# I'd rather have syntax extension installed to LIBDIR, but can't do that due to circular deps(?!) which I think not really there | ||
OCAMLC_FLAGS += -pp 'camlp4o -I $(LIBDIR) -I $(TOP)/sexplib/syntax -I $(TOP)/fieldslib/syntax pa_type_conv.cmo pa_sexp_conv.cmo pa_fields_conv.cmo' | ||
|
||
# I'd rather install my libraries (.cma) in subdirectories under LIBDIR, but I dont know how. Until then, I'll reference them via search path | ||
SEXP=$(TOP)/sexplib/lib | ||
FLDS=$(TOP)/fieldslib/lib | ||
OCAMLC_FLAGS += -I $(SEXP) -I $(FLDS) | ||
|
||
# Compile binary | ||
: foobar.ml | $(TOP)/sexplib/syntax/pa_sexp_conv.cmo $(LIBDIR)/pa_type_conv.cmo $(TOP)/fieldslib/syntax/pa_fields_conv.cmo $(FLDS)/fieldslib.cm* $(SEXP)/sexplib.cm* |> !byte_io |> foobar.cmo | ||
|
||
# Link binary | ||
OCAMLC_FLAGS = | ||
: $(SEXP)/sexplib.cma $(FLDS)/fieldslib.cma foobar.cmo |> ocamlc -o %o /usr/lib/ocaml/bigarray.cma /usr/lib/ocaml/unix.cma /usr/lib/ocaml/nums.cma %f |> foobar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
open Sexplib | ||
open Conv | ||
|
||
type t = { | ||
a : int; | ||
b : string; | ||
} with sexp, fields | ||
|
||
let _ = | ||
let foo = { a = 1; b="foo" } in | ||
let bar = { a = 2; b="bar" } in | ||
Printf.printf "foo=%s\n" (Sexp.to_string (sexp_of_t foo)); | ||
Printf.printf "bar=%s\n" (Sexp.to_string (sexp_of_t bar)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters