Chargement dynamique de primitives C
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3677 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
c345611817
commit
ddd99c7e5d
114
.depend
114
.depend
|
@ -280,15 +280,17 @@ bytecomp/bytelibrarian.cmo: utils/clflags.cmo utils/config.cmi \
|
|||
bytecomp/bytelibrarian.cmx: utils/clflags.cmx utils/config.cmx \
|
||||
bytecomp/emitcode.cmx utils/misc.cmx bytecomp/bytelibrarian.cmi
|
||||
bytecomp/bytelink.cmo: bytecomp/bytesections.cmi utils/ccomp.cmi \
|
||||
utils/clflags.cmo utils/config.cmi bytecomp/emitcode.cmi typing/ident.cmi \
|
||||
bytecomp/instruct.cmi utils/misc.cmi bytecomp/opcodes.cmo \
|
||||
bytecomp/symtable.cmi bytecomp/bytelink.cmi
|
||||
utils/clflags.cmo utils/config.cmi bytecomp/dll.cmi bytecomp/emitcode.cmi \
|
||||
typing/ident.cmi bytecomp/instruct.cmi utils/misc.cmi \
|
||||
bytecomp/opcodes.cmo bytecomp/symtable.cmi bytecomp/bytelink.cmi
|
||||
bytecomp/bytelink.cmx: bytecomp/bytesections.cmx utils/ccomp.cmx \
|
||||
utils/clflags.cmx utils/config.cmx bytecomp/emitcode.cmx typing/ident.cmx \
|
||||
bytecomp/instruct.cmx utils/misc.cmx bytecomp/opcodes.cmx \
|
||||
bytecomp/symtable.cmx bytecomp/bytelink.cmi
|
||||
utils/clflags.cmx utils/config.cmx bytecomp/dll.cmx bytecomp/emitcode.cmx \
|
||||
typing/ident.cmx bytecomp/instruct.cmx utils/misc.cmx \
|
||||
bytecomp/opcodes.cmx bytecomp/symtable.cmx bytecomp/bytelink.cmi
|
||||
bytecomp/bytesections.cmo: utils/config.cmi bytecomp/bytesections.cmi
|
||||
bytecomp/bytesections.cmx: utils/config.cmx bytecomp/bytesections.cmi
|
||||
bytecomp/dll.cmo: utils/config.cmi utils/misc.cmi bytecomp/dll.cmi
|
||||
bytecomp/dll.cmx: utils/config.cmx utils/misc.cmx bytecomp/dll.cmi
|
||||
bytecomp/emitcode.cmo: parsing/asttypes.cmi typing/btype.cmi \
|
||||
utils/clflags.cmo utils/config.cmi typing/env.cmi typing/ident.cmi \
|
||||
bytecomp/instruct.cmi bytecomp/lambda.cmi bytecomp/meta.cmi \
|
||||
|
@ -340,11 +342,11 @@ bytecomp/simplif.cmx: parsing/asttypes.cmi utils/clflags.cmx typing/ident.cmx \
|
|||
bytecomp/switch.cmo: bytecomp/switch.cmi
|
||||
bytecomp/switch.cmx: bytecomp/switch.cmi
|
||||
bytecomp/symtable.cmo: parsing/asttypes.cmi bytecomp/bytesections.cmi \
|
||||
utils/clflags.cmo bytecomp/emitcode.cmi typing/ident.cmi \
|
||||
utils/clflags.cmo bytecomp/dll.cmi bytecomp/emitcode.cmi typing/ident.cmi \
|
||||
bytecomp/lambda.cmi bytecomp/meta.cmi utils/misc.cmi typing/predef.cmi \
|
||||
bytecomp/runtimedef.cmi utils/tbl.cmi bytecomp/symtable.cmi
|
||||
bytecomp/symtable.cmx: parsing/asttypes.cmi bytecomp/bytesections.cmx \
|
||||
utils/clflags.cmx bytecomp/emitcode.cmx typing/ident.cmx \
|
||||
utils/clflags.cmx bytecomp/dll.cmx bytecomp/emitcode.cmx typing/ident.cmx \
|
||||
bytecomp/lambda.cmx bytecomp/meta.cmx utils/misc.cmx typing/predef.cmx \
|
||||
bytecomp/runtimedef.cmx utils/tbl.cmx bytecomp/symtable.cmi
|
||||
bytecomp/translclass.cmo: parsing/asttypes.cmi typing/ident.cmi \
|
||||
|
@ -395,8 +397,8 @@ asmcomp/asmgen.cmi: asmcomp/cmm.cmi bytecomp/lambda.cmi
|
|||
asmcomp/clambda.cmi: parsing/asttypes.cmi typing/ident.cmi \
|
||||
bytecomp/lambda.cmi
|
||||
asmcomp/closure.cmi: asmcomp/clambda.cmi bytecomp/lambda.cmi
|
||||
asmcomp/cmm.cmi: typing/ident.cmi
|
||||
asmcomp/cmmgen.cmi: asmcomp/clambda.cmi asmcomp/cmm.cmi
|
||||
asmcomp/cmm.cmi: typing/ident.cmi
|
||||
asmcomp/codegen.cmi: asmcomp/cmm.cmi
|
||||
asmcomp/comballoc.cmi: asmcomp/mach.cmi
|
||||
asmcomp/compilenv.cmi: asmcomp/clambda.cmi typing/ident.cmi
|
||||
|
@ -410,8 +412,8 @@ asmcomp/printlinear.cmi: asmcomp/linearize.cmi
|
|||
asmcomp/printmach.cmi: asmcomp/mach.cmi asmcomp/reg.cmi
|
||||
asmcomp/proc.cmi: asmcomp/mach.cmi asmcomp/reg.cmi
|
||||
asmcomp/reg.cmi: asmcomp/cmm.cmi
|
||||
asmcomp/reload.cmi: asmcomp/mach.cmi
|
||||
asmcomp/reloadgen.cmi: asmcomp/mach.cmi asmcomp/reg.cmi
|
||||
asmcomp/reload.cmi: asmcomp/mach.cmi
|
||||
asmcomp/schedgen.cmi: asmcomp/linearize.cmi asmcomp/mach.cmi
|
||||
asmcomp/scheduling.cmi: asmcomp/linearize.cmi
|
||||
asmcomp/selectgen.cmi: asmcomp/arch.cmo asmcomp/cmm.cmi typing/ident.cmi \
|
||||
|
@ -419,8 +421,6 @@ asmcomp/selectgen.cmi: asmcomp/arch.cmo asmcomp/cmm.cmi typing/ident.cmi \
|
|||
asmcomp/selection.cmi: asmcomp/cmm.cmi asmcomp/mach.cmi
|
||||
asmcomp/spill.cmi: asmcomp/mach.cmi
|
||||
asmcomp/split.cmi: asmcomp/mach.cmi
|
||||
asmcomp/arch.cmo: utils/config.cmi
|
||||
asmcomp/arch.cmx: utils/config.cmx
|
||||
asmcomp/asmgen.cmo: utils/clflags.cmo asmcomp/closure.cmi asmcomp/cmm.cmi \
|
||||
asmcomp/cmmgen.cmi asmcomp/coloring.cmi asmcomp/comballoc.cmi \
|
||||
utils/config.cmi asmcomp/emit.cmi asmcomp/emitaux.cmi asmcomp/interf.cmi \
|
||||
|
@ -445,12 +445,14 @@ asmcomp/asmlibrarian.cmx: utils/ccomp.cmx asmcomp/clambda.cmx \
|
|||
asmcomp/asmlibrarian.cmi
|
||||
asmcomp/asmlink.cmo: asmcomp/asmgen.cmi utils/ccomp.cmi utils/clflags.cmo \
|
||||
asmcomp/cmmgen.cmi asmcomp/compilenv.cmi utils/config.cmi \
|
||||
asmcomp/emit.cmi asmcomp/emitaux.cmi parsing/location.cmi utils/misc.cmi \
|
||||
asmcomp/proc.cmi bytecomp/runtimedef.cmi asmcomp/asmlink.cmi
|
||||
bytecomp/dll.cmi asmcomp/emit.cmi asmcomp/emitaux.cmi \
|
||||
parsing/location.cmi utils/misc.cmi asmcomp/proc.cmi \
|
||||
bytecomp/runtimedef.cmi asmcomp/asmlink.cmi
|
||||
asmcomp/asmlink.cmx: asmcomp/asmgen.cmx utils/ccomp.cmx utils/clflags.cmx \
|
||||
asmcomp/cmmgen.cmx asmcomp/compilenv.cmx utils/config.cmx \
|
||||
asmcomp/emit.cmx asmcomp/emitaux.cmx parsing/location.cmx utils/misc.cmx \
|
||||
asmcomp/proc.cmx bytecomp/runtimedef.cmx asmcomp/asmlink.cmi
|
||||
bytecomp/dll.cmx asmcomp/emit.cmx asmcomp/emitaux.cmx \
|
||||
parsing/location.cmx utils/misc.cmx asmcomp/proc.cmx \
|
||||
bytecomp/runtimedef.cmx asmcomp/asmlink.cmi
|
||||
asmcomp/clambda.cmo: parsing/asttypes.cmi typing/ident.cmi \
|
||||
bytecomp/lambda.cmi asmcomp/clambda.cmi
|
||||
asmcomp/clambda.cmx: parsing/asttypes.cmi typing/ident.cmx \
|
||||
|
@ -463,8 +465,6 @@ asmcomp/closure.cmx: parsing/asttypes.cmi asmcomp/clambda.cmx \
|
|||
utils/clflags.cmx asmcomp/compilenv.cmx typing/ident.cmx \
|
||||
bytecomp/lambda.cmx utils/misc.cmx typing/primitive.cmx \
|
||||
bytecomp/switch.cmx utils/tbl.cmx asmcomp/closure.cmi
|
||||
asmcomp/cmm.cmo: asmcomp/arch.cmo typing/ident.cmi asmcomp/cmm.cmi
|
||||
asmcomp/cmm.cmx: asmcomp/arch.cmx typing/ident.cmx asmcomp/cmm.cmi
|
||||
asmcomp/cmmgen.cmo: asmcomp/arch.cmo parsing/asttypes.cmi asmcomp/clambda.cmi \
|
||||
utils/clflags.cmo asmcomp/cmm.cmi asmcomp/compilenv.cmi typing/ident.cmi \
|
||||
bytecomp/lambda.cmi utils/misc.cmi typing/primitive.cmi asmcomp/proc.cmi \
|
||||
|
@ -473,6 +473,8 @@ asmcomp/cmmgen.cmx: asmcomp/arch.cmx parsing/asttypes.cmi asmcomp/clambda.cmx \
|
|||
utils/clflags.cmx asmcomp/cmm.cmx asmcomp/compilenv.cmx typing/ident.cmx \
|
||||
bytecomp/lambda.cmx utils/misc.cmx typing/primitive.cmx asmcomp/proc.cmx \
|
||||
bytecomp/switch.cmx typing/types.cmx asmcomp/cmmgen.cmi
|
||||
asmcomp/cmm.cmo: asmcomp/arch.cmo typing/ident.cmi asmcomp/cmm.cmi
|
||||
asmcomp/cmm.cmx: asmcomp/arch.cmx typing/ident.cmx asmcomp/cmm.cmi
|
||||
asmcomp/codegen.cmo: asmcomp/cmm.cmi asmcomp/coloring.cmi asmcomp/emit.cmi \
|
||||
asmcomp/interf.cmi asmcomp/linearize.cmi asmcomp/liveness.cmi \
|
||||
asmcomp/printcmm.cmi asmcomp/printlinear.cmi asmcomp/printmach.cmi \
|
||||
|
@ -493,16 +495,16 @@ asmcomp/compilenv.cmo: asmcomp/clambda.cmi utils/config.cmi typing/env.cmi \
|
|||
typing/ident.cmi utils/misc.cmi asmcomp/compilenv.cmi
|
||||
asmcomp/compilenv.cmx: asmcomp/clambda.cmx utils/config.cmx typing/env.cmx \
|
||||
typing/ident.cmx utils/misc.cmx asmcomp/compilenv.cmi
|
||||
asmcomp/emit.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/compilenv.cmi \
|
||||
utils/config.cmi asmcomp/emitaux.cmi asmcomp/linearize.cmi \
|
||||
parsing/location.cmi asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi \
|
||||
asmcomp/reg.cmi asmcomp/emit.cmi
|
||||
asmcomp/emit.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/compilenv.cmx \
|
||||
utils/config.cmx asmcomp/emitaux.cmx asmcomp/linearize.cmx \
|
||||
parsing/location.cmx asmcomp/mach.cmx utils/misc.cmx asmcomp/proc.cmx \
|
||||
asmcomp/reg.cmx asmcomp/emit.cmi
|
||||
asmcomp/emitaux.cmo: asmcomp/emitaux.cmi
|
||||
asmcomp/emitaux.cmx: asmcomp/emitaux.cmi
|
||||
asmcomp/emit.cmo: asmcomp/arch.cmo utils/clflags.cmo asmcomp/cmm.cmi \
|
||||
asmcomp/compilenv.cmi utils/config.cmi asmcomp/emitaux.cmi \
|
||||
asmcomp/linearize.cmi asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi \
|
||||
asmcomp/reg.cmi asmcomp/emit.cmi
|
||||
asmcomp/emit.cmx: asmcomp/arch.cmx utils/clflags.cmx asmcomp/cmm.cmx \
|
||||
asmcomp/compilenv.cmx utils/config.cmx asmcomp/emitaux.cmx \
|
||||
asmcomp/linearize.cmx asmcomp/mach.cmx utils/misc.cmx asmcomp/proc.cmx \
|
||||
asmcomp/reg.cmx asmcomp/emit.cmi
|
||||
asmcomp/interf.cmo: asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi \
|
||||
asmcomp/reg.cmi asmcomp/interf.cmi
|
||||
asmcomp/interf.cmx: asmcomp/mach.cmx utils/misc.cmx asmcomp/proc.cmx \
|
||||
|
@ -531,28 +533,26 @@ asmcomp/printmach.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/mach.cmi \
|
|||
asmcomp/printmach.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/mach.cmx \
|
||||
asmcomp/printcmm.cmx asmcomp/proc.cmx asmcomp/reg.cmx \
|
||||
asmcomp/printmach.cmi
|
||||
asmcomp/proc.cmo: asmcomp/arch.cmo utils/ccomp.cmi utils/clflags.cmo \
|
||||
asmcomp/cmm.cmi asmcomp/mach.cmi utils/misc.cmi asmcomp/reg.cmi \
|
||||
asmcomp/proc.cmi
|
||||
asmcomp/proc.cmx: asmcomp/arch.cmx utils/ccomp.cmx utils/clflags.cmx \
|
||||
asmcomp/cmm.cmx asmcomp/mach.cmx utils/misc.cmx asmcomp/reg.cmx \
|
||||
asmcomp/proc.cmi
|
||||
asmcomp/proc.cmo: asmcomp/arch.cmo utils/ccomp.cmi asmcomp/cmm.cmi \
|
||||
asmcomp/mach.cmi utils/misc.cmi asmcomp/reg.cmi asmcomp/proc.cmi
|
||||
asmcomp/proc.cmx: asmcomp/arch.cmx utils/ccomp.cmx asmcomp/cmm.cmx \
|
||||
asmcomp/mach.cmx utils/misc.cmx asmcomp/reg.cmx asmcomp/proc.cmi
|
||||
asmcomp/reg.cmo: asmcomp/cmm.cmi asmcomp/reg.cmi
|
||||
asmcomp/reg.cmx: asmcomp/cmm.cmx asmcomp/reg.cmi
|
||||
asmcomp/reload.cmo: asmcomp/reloadgen.cmi asmcomp/reload.cmi
|
||||
asmcomp/reload.cmx: asmcomp/reloadgen.cmx asmcomp/reload.cmi
|
||||
asmcomp/reloadgen.cmo: asmcomp/mach.cmi utils/misc.cmi asmcomp/reg.cmi \
|
||||
asmcomp/reloadgen.cmi
|
||||
asmcomp/reloadgen.cmx: asmcomp/mach.cmx utils/misc.cmx asmcomp/reg.cmx \
|
||||
asmcomp/reloadgen.cmi
|
||||
asmcomp/reload.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/mach.cmi \
|
||||
asmcomp/reg.cmi asmcomp/reloadgen.cmi asmcomp/reload.cmi
|
||||
asmcomp/reload.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/mach.cmx \
|
||||
asmcomp/reg.cmx asmcomp/reloadgen.cmx asmcomp/reload.cmi
|
||||
asmcomp/schedgen.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/linearize.cmi \
|
||||
asmcomp/mach.cmi utils/misc.cmi asmcomp/reg.cmi asmcomp/schedgen.cmi
|
||||
asmcomp/schedgen.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/linearize.cmx \
|
||||
asmcomp/mach.cmx utils/misc.cmx asmcomp/reg.cmx asmcomp/schedgen.cmi
|
||||
asmcomp/scheduling.cmo: asmcomp/arch.cmo asmcomp/mach.cmi \
|
||||
asmcomp/schedgen.cmi asmcomp/scheduling.cmi
|
||||
asmcomp/scheduling.cmx: asmcomp/arch.cmx asmcomp/mach.cmx \
|
||||
asmcomp/schedgen.cmx asmcomp/scheduling.cmi
|
||||
asmcomp/scheduling.cmo: asmcomp/schedgen.cmi asmcomp/scheduling.cmi
|
||||
asmcomp/scheduling.cmx: asmcomp/schedgen.cmx asmcomp/scheduling.cmi
|
||||
asmcomp/selectgen.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi typing/ident.cmi \
|
||||
asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi asmcomp/reg.cmi \
|
||||
utils/tbl.cmi asmcomp/selectgen.cmi
|
||||
|
@ -560,10 +560,10 @@ asmcomp/selectgen.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx typing/ident.cmx \
|
|||
asmcomp/mach.cmx utils/misc.cmx asmcomp/proc.cmx asmcomp/reg.cmx \
|
||||
utils/tbl.cmx asmcomp/selectgen.cmi
|
||||
asmcomp/selection.cmo: asmcomp/arch.cmo asmcomp/cmm.cmi asmcomp/mach.cmi \
|
||||
utils/misc.cmi asmcomp/reg.cmi asmcomp/selectgen.cmi \
|
||||
utils/misc.cmi asmcomp/proc.cmi asmcomp/reg.cmi asmcomp/selectgen.cmi \
|
||||
asmcomp/selection.cmi
|
||||
asmcomp/selection.cmx: asmcomp/arch.cmx asmcomp/cmm.cmx asmcomp/mach.cmx \
|
||||
utils/misc.cmx asmcomp/reg.cmx asmcomp/selectgen.cmx \
|
||||
utils/misc.cmx asmcomp/proc.cmx asmcomp/reg.cmx asmcomp/selectgen.cmx \
|
||||
asmcomp/selection.cmi
|
||||
asmcomp/spill.cmo: asmcomp/mach.cmi utils/misc.cmi asmcomp/proc.cmi \
|
||||
asmcomp/reg.cmi asmcomp/spill.cmi
|
||||
|
@ -601,14 +601,14 @@ driver/errors.cmx: bytecomp/bytelibrarian.cmx bytecomp/bytelink.cmx \
|
|||
bytecomp/translclass.cmx bytecomp/translcore.cmx typing/typeclass.cmx \
|
||||
typing/typecore.cmx typing/typedecl.cmx typing/typemod.cmx \
|
||||
typing/typetexp.cmx utils/warnings.cmx driver/errors.cmi
|
||||
driver/main_args.cmo: driver/main_args.cmi
|
||||
driver/main_args.cmx: driver/main_args.cmi
|
||||
driver/main.cmo: bytecomp/bytelibrarian.cmi bytecomp/bytelink.cmi \
|
||||
utils/clflags.cmo driver/compile.cmi utils/config.cmi driver/errors.cmi \
|
||||
driver/main_args.cmi utils/warnings.cmi driver/main.cmi
|
||||
driver/main.cmx: bytecomp/bytelibrarian.cmx bytecomp/bytelink.cmx \
|
||||
utils/clflags.cmx driver/compile.cmx utils/config.cmx driver/errors.cmx \
|
||||
driver/main_args.cmx utils/warnings.cmx driver/main.cmi
|
||||
driver/main_args.cmo: driver/main_args.cmi
|
||||
driver/main_args.cmx: driver/main_args.cmi
|
||||
driver/optcompile.cmo: asmcomp/asmgen.cmi utils/ccomp.cmi utils/clflags.cmo \
|
||||
asmcomp/compilenv.cmi utils/config.cmi typing/env.cmi \
|
||||
parsing/location.cmi utils/misc.cmi parsing/parse.cmi \
|
||||
|
@ -664,32 +664,34 @@ toplevel/genprintval.cmx: typing/btype.cmx typing/ctype.cmx \
|
|||
utils/misc.cmx typing/outcometree.cmi typing/path.cmx typing/predef.cmx \
|
||||
typing/printtyp.cmx typing/types.cmx toplevel/genprintval.cmi
|
||||
toplevel/topdirs.cmo: bytecomp/bytelink.cmi utils/clflags.cmo \
|
||||
utils/config.cmi typing/ctype.cmi bytecomp/emitcode.cmi typing/env.cmi \
|
||||
typing/ident.cmi parsing/longident.cmi bytecomp/meta.cmi utils/misc.cmi \
|
||||
bytecomp/opcodes.cmo typing/path.cmi typing/printtyp.cmi \
|
||||
utils/config.cmi typing/ctype.cmi bytecomp/dll.cmi bytecomp/emitcode.cmi \
|
||||
typing/env.cmi typing/ident.cmi parsing/longident.cmi bytecomp/meta.cmi \
|
||||
utils/misc.cmi bytecomp/opcodes.cmo typing/path.cmi typing/printtyp.cmi \
|
||||
bytecomp/symtable.cmi toplevel/toploop.cmi toplevel/trace.cmi \
|
||||
typing/types.cmi utils/warnings.cmi toplevel/topdirs.cmi
|
||||
toplevel/topdirs.cmx: bytecomp/bytelink.cmx utils/clflags.cmx \
|
||||
utils/config.cmx typing/ctype.cmx bytecomp/emitcode.cmx typing/env.cmx \
|
||||
typing/ident.cmx parsing/longident.cmx bytecomp/meta.cmx utils/misc.cmx \
|
||||
bytecomp/opcodes.cmx typing/path.cmx typing/printtyp.cmx \
|
||||
utils/config.cmx typing/ctype.cmx bytecomp/dll.cmx bytecomp/emitcode.cmx \
|
||||
typing/env.cmx typing/ident.cmx parsing/longident.cmx bytecomp/meta.cmx \
|
||||
utils/misc.cmx bytecomp/opcodes.cmx typing/path.cmx typing/printtyp.cmx \
|
||||
bytecomp/symtable.cmx toplevel/toploop.cmx toplevel/trace.cmx \
|
||||
typing/types.cmx utils/warnings.cmx toplevel/topdirs.cmi
|
||||
toplevel/toploop.cmo: bytecomp/bytegen.cmi utils/clflags.cmo \
|
||||
driver/compile.cmi utils/config.cmi bytecomp/emitcode.cmi typing/env.cmi \
|
||||
driver/errors.cmi toplevel/genprintval.cmi typing/ident.cmi \
|
||||
parsing/lexer.cmi parsing/location.cmi parsing/longident.cmi \
|
||||
bytecomp/meta.cmi utils/misc.cmi typing/outcometree.cmi parsing/parse.cmi \
|
||||
driver/compile.cmi utils/config.cmi bytecomp/dll.cmi \
|
||||
bytecomp/emitcode.cmi typing/env.cmi driver/errors.cmi \
|
||||
toplevel/genprintval.cmi typing/ident.cmi parsing/lexer.cmi \
|
||||
parsing/location.cmi parsing/longident.cmi bytecomp/meta.cmi \
|
||||
utils/misc.cmi typing/outcometree.cmi parsing/parse.cmi \
|
||||
parsing/parsetree.cmi typing/path.cmi typing/predef.cmi \
|
||||
parsing/printast.cmi bytecomp/printinstr.cmi bytecomp/printlambda.cmi \
|
||||
typing/printtyp.cmi bytecomp/simplif.cmi bytecomp/symtable.cmi \
|
||||
bytecomp/translmod.cmi typing/typedtree.cmi typing/typemod.cmi \
|
||||
typing/types.cmi utils/warnings.cmi toplevel/toploop.cmi
|
||||
toplevel/toploop.cmx: bytecomp/bytegen.cmx utils/clflags.cmx \
|
||||
driver/compile.cmx utils/config.cmx bytecomp/emitcode.cmx typing/env.cmx \
|
||||
driver/errors.cmx toplevel/genprintval.cmx typing/ident.cmx \
|
||||
parsing/lexer.cmx parsing/location.cmx parsing/longident.cmx \
|
||||
bytecomp/meta.cmx utils/misc.cmx typing/outcometree.cmi parsing/parse.cmx \
|
||||
driver/compile.cmx utils/config.cmx bytecomp/dll.cmx \
|
||||
bytecomp/emitcode.cmx typing/env.cmx driver/errors.cmx \
|
||||
toplevel/genprintval.cmx typing/ident.cmx parsing/lexer.cmx \
|
||||
parsing/location.cmx parsing/longident.cmx bytecomp/meta.cmx \
|
||||
utils/misc.cmx typing/outcometree.cmi parsing/parse.cmx \
|
||||
parsing/parsetree.cmi typing/path.cmx typing/predef.cmx \
|
||||
parsing/printast.cmx bytecomp/printinstr.cmx bytecomp/printlambda.cmx \
|
||||
typing/printtyp.cmx bytecomp/simplif.cmx bytecomp/symtable.cmx \
|
||||
|
|
9
Changes
9
Changes
|
@ -8,15 +8,17 @@ Type-checker:
|
|||
module A: sig module type T = sig module T: M end end
|
||||
module B: A.T
|
||||
- Improved efficiency of module type-checking via lazy computation of
|
||||
certain summary information.
|
||||
certain signature summary information.
|
||||
|
||||
Byte-code compiler:
|
||||
- Protect against VM stack overflow caused by module initialization code
|
||||
with many local variables.
|
||||
- Support for dynamic loading of the C part of mixed Caml/C libraries.
|
||||
|
||||
Native-code compiler:
|
||||
- Attempt to recover gracefully from system stack overflow. Currently
|
||||
works on x86 under Linux and BSD.
|
||||
- Alpha: work around "as" bug in Tru64 5.1.
|
||||
|
||||
Toplevel environment:
|
||||
- Revised printing of inferred types and evaluation results
|
||||
|
@ -26,10 +28,15 @@ Tools:
|
|||
- ocamldep: added -pp option to handle preprocessed source files.
|
||||
|
||||
Run-time system:
|
||||
- Support for dynamic loading of the C part of mixed Caml/C libraries.
|
||||
Currently works under Linux, FreeBSD, Windows, Tru64, Solaris and Irix.
|
||||
- Implemented registration of global C roots with a skip list,
|
||||
runs much faster when there are many global C roots.
|
||||
- Autoconfiguration script: fixed wrong detection of Mac OS X; problem
|
||||
with the Sparc, gcc 3.0, and float alignment fixed.
|
||||
|
||||
Other libraries:
|
||||
- All libraries revised to allow dynamic loading of the C part.
|
||||
- Graphics under X Windows: revised event handling, should no longer lose
|
||||
mouse events between two calls to wait_next_event(); wait_next_event()
|
||||
now interruptible by signals.
|
||||
|
|
8
Makefile
8
Makefile
|
@ -57,7 +57,7 @@ COMP=bytecomp/lambda.cmo bytecomp/printlambda.cmo \
|
|||
bytecomp/typeopt.cmo bytecomp/switch.cmo bytecomp/matching.cmo \
|
||||
bytecomp/translobj.cmo bytecomp/translcore.cmo \
|
||||
bytecomp/translclass.cmo bytecomp/translmod.cmo \
|
||||
bytecomp/simplif.cmo bytecomp/runtimedef.cmo
|
||||
bytecomp/simplif.cmo bytecomp/runtimedef.cmo bytecomp/dll.cmo
|
||||
|
||||
BYTECOMP=bytecomp/meta.cmo bytecomp/instruct.cmo bytecomp/bytegen.cmo \
|
||||
bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo \
|
||||
|
@ -102,7 +102,7 @@ EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo \
|
|||
utils/config.cmo utils/clflags.cmo \
|
||||
typing/ident.cmo typing/path.cmo typing/types.cmo typing/btype.cmo \
|
||||
typing/predef.cmo bytecomp/runtimedef.cmo bytecomp/bytesections.cmo \
|
||||
bytecomp/symtable.cmo toplevel/expunge.cmo
|
||||
bytecomp/dll.cmo bytecomp/symtable.cmo toplevel/expunge.cmo
|
||||
|
||||
PERVASIVES=arg array buffer callback char digest filename format gc hashtbl \
|
||||
lexing list map obj parsing pervasives printexc printf queue random \
|
||||
|
@ -212,6 +212,7 @@ install: FORCE
|
|||
if test -d $(LIBDIR); then : ; else $(MKDIR) $(LIBDIR); fi
|
||||
if test -d $(MANDIR); then : ; else $(MKDIR) $(MANDIR); fi
|
||||
cd byterun; $(MAKE) install
|
||||
echo "$(LIBDIR)" > $(LIBDIR)/ld.conf
|
||||
cp ocamlc $(BINDIR)/ocamlc$(EXE)
|
||||
cp ocaml $(BINDIR)/ocaml$(EXE)
|
||||
cd stdlib; $(MAKE) install
|
||||
|
@ -277,9 +278,11 @@ utils/config.ml: utils/config.mlp config/Makefile
|
|||
-e 's|%%BYTERUN%%|$(BINDIR)/ocamlrun|' \
|
||||
-e 's|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS)|' \
|
||||
-e 's|%%BYTELINK%%|$(BYTECC) $(BYTECCLINKOPTS)|' \
|
||||
-e 's|%%BYTECCRPATH%%|$(BYTECCRPATH)|' \
|
||||
-e 's|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|' \
|
||||
-e 's|%%NATIVELINK%%|$(NATIVECC) $(NATIVECCLINKOPTS)|' \
|
||||
-e 's|%%PARTIALLD%%|ld -r $(NATIVECCLINKOPTS)|' \
|
||||
-e 's|%%NATIVECCRPATH%%|$(NATIVECCRPATH)|' \
|
||||
-e 's|%%BYTECCLIBS%%|$(BYTECCLIBS)|' \
|
||||
-e 's|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|' \
|
||||
-e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \
|
||||
|
@ -289,6 +292,7 @@ utils/config.ml: utils/config.mlp config/Makefile
|
|||
-e 's|%%EXT_OBJ%%|.o|' \
|
||||
-e 's|%%EXT_ASM%%|.s|' \
|
||||
-e 's|%%EXT_LIB%%|.a|' \
|
||||
-e 's|%%EXT_DLL%%|.so|' \
|
||||
utils/config.mlp > utils/config.ml
|
||||
@chmod -w utils/config.ml
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ COMP=bytecomp\lambda.cmo bytecomp\printlambda.cmo \
|
|||
|
||||
BYTECOMP=bytecomp\meta.cmo bytecomp\instruct.cmo bytecomp\bytegen.cmo \
|
||||
bytecomp\printinstr.cmo bytecomp\opcodes.cmo bytecomp\emitcode.cmo \
|
||||
bytecomp\bytesections.cmo bytecomp\symtable.cmo \
|
||||
bytecomp\bytesections.cmo bytecomp\dll.cmo bytecomp\symtable.cmo \
|
||||
bytecomp\bytelibrarian.cmo bytecomp\bytelink.cmo
|
||||
|
||||
ASMCOMP=asmcomp\arch.cmo asmcomp\cmm.cmo asmcomp\printcmm.cmo \
|
||||
|
@ -99,7 +99,7 @@ EXPUNGEOBJS=utils\misc.cmo utils\tbl.cmo \
|
|||
utils\config.cmo utils\clflags.cmo \
|
||||
typing\ident.cmo typing\path.cmo typing\types.cmo typing\btype.cmo \
|
||||
typing\predef.cmo bytecomp\runtimedef.cmo bytecomp\bytesections.cmo \
|
||||
bytecomp\symtable.cmo toplevel\expunge.cmo
|
||||
bytecomp\dll.cmo bytecomp\symtable.cmo toplevel\expunge.cmo
|
||||
|
||||
PERVASIVES=arg array buffer callback char digest filename format gc hashtbl \
|
||||
lexing list map obj parsing pervasives printexc printf queue random \
|
||||
|
@ -206,6 +206,7 @@ install: installbyt installopt
|
|||
|
||||
installbyt:
|
||||
cd byterun & $(MAKEREC) install
|
||||
echo $(LIBDIR)> $(LIBDIR)\ld.conf
|
||||
cp ocamlc $(BINDIR)\ocamlc.exe
|
||||
cp ocaml $(BINDIR)\ocaml.exe
|
||||
cd stdlib & $(MAKEREC) install
|
||||
|
@ -267,7 +268,7 @@ partialclean::
|
|||
|
||||
utils\config.ml: utils\config.mlp config\Makefile.nt
|
||||
@rm -f utils\config.ml
|
||||
sed -e "s|%%%%LIBDIR%%%%|$(LIBDIR:\=/)|" \
|
||||
sed -e "s|%%%%LIBDIR%%%%|$(LIBDIR:\=\\\\\\\\)|" \
|
||||
-e "s|%%%%BYTERUN%%%%|ocamlrun|" \
|
||||
-e "s|%%%%BYTECC%%%%|$(BYTECC) $(BYTECCCOMPOPTS)|" \
|
||||
-e "s|%%%%BYTELINK%%%%|$(BYTECC) $(BYTECCLINKOPTS)|" \
|
||||
|
@ -282,6 +283,7 @@ utils\config.ml: utils\config.mlp config\Makefile.nt
|
|||
-e "s|%%%%EXT_OBJ%%%%|.obj|" \
|
||||
-e "s|%%%%EXT_ASM%%%%|.asm|" \
|
||||
-e "s|%%%%EXT_LIB%%%%|.lib|" \
|
||||
-e "s|%%%%EXT_DLL%%%%|.dll|" \
|
||||
utils\config.mlp > utils\config.ml
|
||||
@attrib +r utils\config.ml
|
||||
|
||||
|
|
16
README.win32
16
README.win32
|
@ -73,8 +73,9 @@ supported. Windows NT on non-Intel processors has not been tested.
|
|||
The base bytecode system (ocamlc, ocaml, ocamllex, ocamlyacc, ...)
|
||||
runs without any additional tools.
|
||||
|
||||
Linking Caml bytecode with C code (ocamlc -custom) requires the
|
||||
Microsoft Visual C++ compiler version 6.
|
||||
Statically linking Caml bytecode with C code (ocamlc -custom) requires the
|
||||
Microsoft Visual C++ compiler version 6. Dynamic loading of DLLs is
|
||||
supported out of the box, without additional software.
|
||||
|
||||
The native-code compiler (ocamlopt) requires Visual C++ version 6
|
||||
and the Microsoft assembler MASM version 6.11 or later.
|
||||
|
@ -127,9 +128,14 @@ The command-line tools can be recompiled from the Unix source
|
|||
distribution (ocaml-X.YZ.tar.gz), which also contains the files modified
|
||||
for Windows.
|
||||
|
||||
In addition to Visual C++ (version 4, 5 or 6) and MASM 6, you will
|
||||
need the CygWin port of GNU tools, available from
|
||||
http://sourceware.cygnus.com/cygwin/
|
||||
You will need the following software components to perform the recompilation:
|
||||
- Windows NT or 2000 (the Makefiles do not work under Windows 95, 98, ME
|
||||
due to differences between NT and 9x command-line interpreters);
|
||||
- Visual C++ version 6
|
||||
- MASM version 6.11 (see above)
|
||||
- The CygWin port of GNU tools, available from
|
||||
http://sourceware.cygnus.com/cygwin/
|
||||
- TCL/TK version 8.3 (for the LablTK GUI) (see above).
|
||||
|
||||
To recompile, first copy manually the files config/m-nt.h and config/s-nt.h
|
||||
to config/m.h and config/s.h. Edit config/Makefile.nt as needed.
|
||||
|
|
|
@ -233,7 +233,7 @@ let call_linker file_list startup_file =
|
|||
(String.concat " " (List.rev file_list))
|
||||
| _ ->
|
||||
if not !Clflags.output_c_object then
|
||||
Printf.sprintf "%s %s -o %s -I%s %s %s %s %s %s %s %s"
|
||||
Printf.sprintf "%s %s -o %s -I%s %s %s %s %s %s %s %s %s"
|
||||
!Clflags.c_linker
|
||||
(if !Clflags.gprofile then "-pg" else "")
|
||||
!Clflags.exec_name
|
||||
|
@ -244,6 +244,12 @@ let call_linker file_list startup_file =
|
|||
(String.concat " "
|
||||
(List.map (fun dir -> if dir = "" then "" else "-L" ^ dir)
|
||||
!load_path))
|
||||
(String.concat " "
|
||||
(List.map (fun dir -> if dir = "" then "" else
|
||||
Config.native_c_rpath ^ dir)
|
||||
(!Clflags.dllpaths @
|
||||
Dll.ld_library_path_contents() @
|
||||
Dll.ld_conf_contents())))
|
||||
(String.concat " " (List.rev !Clflags.ccobjs))
|
||||
runtime_lib
|
||||
c_lib
|
||||
|
|
|
@ -122,7 +122,9 @@ minor_gc.o: minor_gc.c ../byterun/config.h ../byterun/../config/m.h \
|
|||
../byterun/freelist.h ../byterun/minor_gc.h ../byterun/gc_ctrl.h \
|
||||
../byterun/signals.h
|
||||
misc.o: misc.c ../byterun/config.h ../byterun/../config/m.h \
|
||||
../byterun/../config/s.h ../byterun/misc.h
|
||||
../byterun/../config/s.h ../byterun/misc.h ../byterun/memory.h \
|
||||
../byterun/gc.h ../byterun/mlvalues.h ../byterun/major_gc.h \
|
||||
../byterun/freelist.h ../byterun/minor_gc.h
|
||||
obj.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h \
|
||||
../byterun/mlvalues.h ../byterun/fail.h ../byterun/gc.h \
|
||||
|
@ -293,7 +295,9 @@ minor_gc.d.o: minor_gc.c ../byterun/config.h ../byterun/../config/m.h \
|
|||
../byterun/freelist.h ../byterun/minor_gc.h ../byterun/gc_ctrl.h \
|
||||
../byterun/signals.h
|
||||
misc.d.o: misc.c ../byterun/config.h ../byterun/../config/m.h \
|
||||
../byterun/../config/s.h ../byterun/misc.h
|
||||
../byterun/../config/s.h ../byterun/misc.h ../byterun/memory.h \
|
||||
../byterun/gc.h ../byterun/mlvalues.h ../byterun/major_gc.h \
|
||||
../byterun/freelist.h ../byterun/minor_gc.h
|
||||
obj.d.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h \
|
||||
../byterun/mlvalues.h ../byterun/fail.h ../byterun/gc.h \
|
||||
|
@ -464,7 +468,9 @@ minor_gc.p.o: minor_gc.c ../byterun/config.h ../byterun/../config/m.h \
|
|||
../byterun/freelist.h ../byterun/minor_gc.h ../byterun/gc_ctrl.h \
|
||||
../byterun/signals.h
|
||||
misc.p.o: misc.c ../byterun/config.h ../byterun/../config/m.h \
|
||||
../byterun/../config/s.h ../byterun/misc.h
|
||||
../byterun/../config/s.h ../byterun/misc.h ../byterun/memory.h \
|
||||
../byterun/gc.h ../byterun/mlvalues.h ../byterun/major_gc.h \
|
||||
../byterun/freelist.h ../byterun/minor_gc.h
|
||||
obj.p.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \
|
||||
../byterun/../config/m.h ../byterun/../config/s.h \
|
||||
../byterun/mlvalues.h ../byterun/fail.h ../byterun/gc.h \
|
||||
|
|
BIN
boot/ocamlc
BIN
boot/ocamlc
Binary file not shown.
BIN
boot/ocamllex
BIN
boot/ocamllex
Binary file not shown.
|
@ -38,6 +38,7 @@ let copy_compunit ic oc compunit =
|
|||
|
||||
(* Add C objects and options and "custom" info from a library descriptor *)
|
||||
|
||||
let lib_sharedobjs = ref []
|
||||
let lib_ccobjs = ref []
|
||||
let lib_ccopts = ref []
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ type error =
|
|||
| Inconsistent_import of string * string * string
|
||||
| Custom_runtime
|
||||
| File_exists of string
|
||||
| Cannot_open_dll of string
|
||||
| Require_custom
|
||||
|
||||
exception Error of error
|
||||
|
||||
|
@ -36,16 +38,14 @@ type link_action =
|
|||
| Link_archive of string * compilation_unit list
|
||||
(* Name of .cma file and descriptors of the units to be linked. *)
|
||||
|
||||
(* Add C objects and options and "custom" info from a library descriptor *)
|
||||
(* Ignore them if -noautolink or -use-runtime were given *)
|
||||
(* Add C objects and options from a library descriptor *)
|
||||
(* Ignore them if -noautolink was given *)
|
||||
|
||||
let lib_ccobjs = ref []
|
||||
let lib_ccopts = ref []
|
||||
|
||||
let add_ccobjs l =
|
||||
if not !Clflags.no_auto_link && String.length !Clflags.use_runtime = 0
|
||||
&& String.length !Clflags.use_prims = 0
|
||||
then begin
|
||||
if not !Clflags.no_auto_link then begin
|
||||
if l.lib_custom then Clflags.custom_runtime := true;
|
||||
lib_ccobjs := l.lib_ccobjs @ !lib_ccobjs;
|
||||
lib_ccopts := l.lib_ccopts @ !lib_ccopts
|
||||
|
@ -65,8 +65,8 @@ let add_ccobjs l =
|
|||
and b.cma was built with ocamlc -i ... objb1 objb2
|
||||
lib_ccobjs starts as [],
|
||||
becomes objb2 objb1 when b.cma is scanned,
|
||||
then obja2 obja1 objb2 objb1 when b.cma is scanned.
|
||||
Clflags.ccobjs was initially obj2 obj1,
|
||||
then obja2 obja1 objb2 objb1 when a.cma is scanned.
|
||||
Clflags.ccobjs was initially obj2 obj1.
|
||||
and is set to obj2 obj1 obja2 obja1 objb2 objb1.
|
||||
Finally, the C compiler is given objb1 objb2 obja1 obja2 obj1 obj2,
|
||||
which is what we need. (If b depends on a, a.cma must appear before
|
||||
|
@ -249,16 +249,14 @@ let output_debug_info oc =
|
|||
!debug_info;
|
||||
debug_info := []
|
||||
|
||||
(* Transform a file name into an absolute file name *)
|
||||
(* Output a list of strings with 0-termination *)
|
||||
|
||||
let make_absolute file =
|
||||
if Filename.is_relative file
|
||||
then Filename.concat (Sys.getcwd()) file
|
||||
else file
|
||||
let output_stringlist oc l =
|
||||
List.iter (fun s -> output_string oc s; output_byte oc 0) l
|
||||
|
||||
(* Create a bytecode executable file *)
|
||||
|
||||
let link_bytecode tolink exec_name copy_header =
|
||||
let link_bytecode tolink exec_name standalone =
|
||||
if Sys.os_type = "MacOS" then begin
|
||||
(* Create it as a text file for bytecode scripts *)
|
||||
let c = open_out_gen [Open_wronly; Open_creat] 0o777 exec_name in
|
||||
|
@ -267,35 +265,45 @@ let link_bytecode tolink exec_name copy_header =
|
|||
let outchan = open_out_gen [Open_wronly; Open_trunc; Open_creat; Open_binary]
|
||||
0o777 exec_name in
|
||||
try
|
||||
(* Copy the header *)
|
||||
if copy_header then begin
|
||||
if standalone then begin
|
||||
(* Copy the header *)
|
||||
try
|
||||
let header =
|
||||
if String.length !Clflags.use_runtime > 0
|
||||
then "camlheader_ur" else "camlheader" in
|
||||
let inchan = open_in_bin (find_in_path !load_path header) in
|
||||
let inchan = open_in_bin (find_in_path !load_path "camlheader") in
|
||||
copy_file inchan outchan;
|
||||
close_in inchan
|
||||
with Not_found | Sys_error _ -> ()
|
||||
end;
|
||||
Bytesections.init_record outchan;
|
||||
(* The path to the bytecode interpreter (in use_runtime mode) *)
|
||||
if String.length !Clflags.use_runtime > 0 then begin
|
||||
output_string outchan (make_absolute !Clflags.use_runtime);
|
||||
output_char outchan '\n';
|
||||
Bytesections.record outchan "RNTM"
|
||||
end;
|
||||
(* The bytecode *)
|
||||
let start_code = pos_out outchan in
|
||||
Symtable.init();
|
||||
Hashtbl.clear crc_interfaces;
|
||||
let sharedobjs = Dll.extract_dll_names !Clflags.ccobjs in
|
||||
if standalone then begin
|
||||
(* Initialize the DLL machinery *)
|
||||
if List.length sharedobjs < List.length !Clflags.ccobjs
|
||||
then raise (Error Require_custom);
|
||||
Dll.add_path !load_path;
|
||||
try Dll.open_dlls sharedobjs
|
||||
with Failure reason -> raise(Error(Cannot_open_dll reason))
|
||||
end;
|
||||
let output_fun = output_string outchan
|
||||
and currpos_fun () = pos_out outchan - start_code in
|
||||
List.iter (link_file output_fun currpos_fun) tolink;
|
||||
if standalone then Dll.close_all_dlls();
|
||||
(* The final STOP instruction *)
|
||||
output_byte outchan Opcodes.opSTOP;
|
||||
output_byte outchan 0; output_byte outchan 0; output_byte outchan 0;
|
||||
Bytesections.record outchan "CODE";
|
||||
(* DLL stuff *)
|
||||
if standalone then begin
|
||||
(* The extra search path for DLLs *)
|
||||
output_stringlist outchan !Clflags.dllpaths;
|
||||
Bytesections.record outchan "DLPT";
|
||||
(* The names of the DLLs *)
|
||||
output_stringlist outchan sharedobjs;
|
||||
Bytesections.record outchan "DLLS"
|
||||
end;
|
||||
(* The names of all primitives *)
|
||||
Symtable.output_primitive_names outchan;
|
||||
Bytesections.record outchan "PRIM";
|
||||
|
@ -399,7 +407,7 @@ let build_custom_runtime prim_name exec_name =
|
|||
"Unix" | "Cygwin" ->
|
||||
Ccomp.command
|
||||
(Printf.sprintf
|
||||
"%s -o %s -I%s %s %s %s %s -lcamlrun %s"
|
||||
"%s -o %s -I%s %s %s %s %s %s -lcamlrun %s"
|
||||
!Clflags.c_linker
|
||||
exec_name
|
||||
Config.standard_library
|
||||
|
@ -408,6 +416,12 @@ let build_custom_runtime prim_name exec_name =
|
|||
(String.concat " "
|
||||
(List.map (fun dir -> if dir = "" then "" else "-L" ^ dir)
|
||||
!load_path))
|
||||
(String.concat " "
|
||||
(List.map (fun dir -> if dir = "" then "" else
|
||||
Config.bytecomp_c_rpath ^ dir)
|
||||
(!Clflags.dllpaths @
|
||||
Dll.ld_library_path_contents() @
|
||||
Dll.ld_conf_contents())))
|
||||
(String.concat " " (List.rev !Clflags.ccobjs))
|
||||
Config.bytecomp_c_libraries)
|
||||
| "Win32" ->
|
||||
|
@ -541,3 +555,7 @@ let report_error ppf = function
|
|||
fprintf ppf "Error while building custom runtime system"
|
||||
| File_exists file ->
|
||||
fprintf ppf "Cannot overwrite existing file %s" file
|
||||
| Cannot_open_dll file ->
|
||||
fprintf ppf "Error on dynamically loaded library: %s" file
|
||||
| Require_custom ->
|
||||
fprintf ppf "Linking with non-Caml, non-shared object files requires the -custom flag"
|
||||
|
|
|
@ -25,6 +25,8 @@ type error =
|
|||
| Inconsistent_import of string * string * string
|
||||
| Custom_runtime
|
||||
| File_exists of string
|
||||
| Cannot_open_dll of string
|
||||
| Require_custom
|
||||
|
||||
exception Error of error
|
||||
|
||||
|
|
|
@ -78,6 +78,14 @@ let seek_section ic name =
|
|||
seek_sec (in_channel_length ic - 16 - 8 * List.length !section_table)
|
||||
!section_table
|
||||
|
||||
(* Return the contents of a section, as a string *)
|
||||
|
||||
let read_section ic name =
|
||||
let len = seek_section ic name in
|
||||
let res = String.create len in
|
||||
really_input ic res 0 len;
|
||||
res
|
||||
|
||||
(* Return the position of the beginning of the first section *)
|
||||
|
||||
let pos_first_section ic =
|
||||
|
|
|
@ -44,5 +44,8 @@ val seek_section: in_channel -> string -> int
|
|||
and return the length of that section. Raise Not_found if no
|
||||
such section exists. *)
|
||||
|
||||
val read_section: in_channel -> string -> string
|
||||
(* Return the contents of a section, as a string *)
|
||||
|
||||
val pos_first_section: in_channel -> int
|
||||
(* Return the position of the beginning of the first section *)
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
(***********************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2001 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed *)
|
||||
(* under the terms of the Q Public License version 1.0. *)
|
||||
(* *)
|
||||
(***********************************************************************)
|
||||
|
||||
(* $Id$ *)
|
||||
|
||||
(* Handling of dynamically-linked libraries *)
|
||||
|
||||
type dll_handle
|
||||
type dll_address
|
||||
|
||||
external dll_open: string -> dll_handle = "dynlink_open_lib"
|
||||
external dll_close: dll_handle -> unit = "dynlink_close_lib"
|
||||
external dll_sym: dll_handle -> string -> dll_address = "dynlink_lookup_symbol"
|
||||
external add_primitive: dll_address -> int = "dynlink_add_primitive"
|
||||
external get_current_dlls: unit -> dll_handle array
|
||||
= "dynlink_get_current_libs"
|
||||
|
||||
(* Current search path for DLLs *)
|
||||
let search_path = ref ([] : string list)
|
||||
|
||||
(* DLLs currently opened *)
|
||||
let opened_dlls = ref ([] : dll_handle list)
|
||||
|
||||
(* File names for those DLLs *)
|
||||
let names_of_opened_dlls = ref ([] : string list)
|
||||
|
||||
(* Add the given directories to the search path for DLLs. *)
|
||||
let add_path dirs =
|
||||
search_path := dirs @ !search_path
|
||||
|
||||
(* Read the [ld.conf] file and return the corresponding list of directories *)
|
||||
|
||||
let ld_conf_contents () =
|
||||
let path = ref [] in
|
||||
begin try
|
||||
let ic = open_in (Filename.concat Config.standard_library "ld.conf") in
|
||||
begin try
|
||||
while true do
|
||||
path := input_line ic :: !path
|
||||
done
|
||||
with End_of_file -> ()
|
||||
end;
|
||||
close_in ic
|
||||
with Sys_error _ -> ()
|
||||
end;
|
||||
List.rev !path
|
||||
|
||||
(* Split the CAML_LD_LIBRARY_PATH environment variable and return
|
||||
the corresponding list of directories. *)
|
||||
|
||||
let split str sep =
|
||||
let rec split_rec pos =
|
||||
if pos >= String.length str then [] else begin
|
||||
try
|
||||
let newpos = String.index_from str pos sep in
|
||||
String.sub str pos (newpos - pos) ::
|
||||
split_rec (newpos + 1)
|
||||
with Not_found ->
|
||||
[String.sub str pos (String.length str - pos)]
|
||||
end in
|
||||
split_rec 0
|
||||
|
||||
let ld_library_path_contents () =
|
||||
let path_separator =
|
||||
match Sys.os_type with
|
||||
"Unix" | "Cygwin" -> ':' | "Win32" -> ';' | _ -> assert false in
|
||||
try
|
||||
split (Sys.getenv "CAML_LD_LIBRARY_PATH") path_separator
|
||||
with Not_found ->
|
||||
[]
|
||||
|
||||
(* Extract names of DLLs from a list of C object files and libraries *)
|
||||
|
||||
let extract_dll_names files =
|
||||
List.fold_right
|
||||
(fun file res ->
|
||||
if Filename.check_suffix file Config.ext_dll then
|
||||
Filename.chop_suffix file Config.ext_dll :: res
|
||||
else if String.length file >= 2 && String.sub file 0 2 = "-l" then
|
||||
("lib" ^ String.sub file 2 (String.length file - 2)) :: res
|
||||
else
|
||||
res)
|
||||
files []
|
||||
|
||||
(* Open a list of DLLs, adding them to opened_dlls.
|
||||
Raise [Failure msg] in case of error. *)
|
||||
|
||||
let open_dll name =
|
||||
let name = name ^ Config.ext_dll in
|
||||
let fullname =
|
||||
try Misc.find_in_path !search_path name with Not_found -> name in
|
||||
if not (List.mem fullname !names_of_opened_dlls) then begin
|
||||
let dll = dll_open fullname in
|
||||
names_of_opened_dlls := fullname :: !names_of_opened_dlls;
|
||||
opened_dlls := dll :: !opened_dlls
|
||||
end
|
||||
|
||||
let open_dlls names =
|
||||
List.iter open_dll (List.rev names)
|
||||
|
||||
(* Close all DLLs *)
|
||||
|
||||
let close_all_dlls () =
|
||||
List.iter dll_close !opened_dlls;
|
||||
opened_dlls := [];
|
||||
names_of_opened_dlls := []
|
||||
|
||||
(* Find a primitive in the currently opened DLLs.
|
||||
Raise [Not_found] if not found. *)
|
||||
|
||||
let find_primitive prim_name =
|
||||
let rec find = function
|
||||
[] ->
|
||||
raise Not_found
|
||||
| dll :: rem ->
|
||||
try dll_sym dll prim_name with Failure _ -> find rem in
|
||||
find !opened_dlls
|
||||
|
||||
(* If linking in core (dynlink or toplevel), synchronize the VM
|
||||
table of primitive with the linker's table of primitive
|
||||
by storing the given primitive function at the given position
|
||||
in the VM table of primitives. *)
|
||||
|
||||
let linking_in_core = ref false
|
||||
|
||||
let synchronize_primitive num symb =
|
||||
if !linking_in_core then begin
|
||||
let actual_num = add_primitive symb in
|
||||
assert (actual_num = num)
|
||||
end
|
||||
|
||||
(* Initialization for linking in core (dynlink or toplevel) *)
|
||||
|
||||
let init_toplevel dllpath =
|
||||
search_path :=
|
||||
ld_library_path_contents() @ split dllpath '\000' @ ld_conf_contents();
|
||||
opened_dlls := Array.to_list (get_current_dlls());
|
||||
names_of_opened_dlls := [];
|
||||
linking_in_core := true
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
(***********************************************************************)
|
||||
(* *)
|
||||
(* Objective Caml *)
|
||||
(* *)
|
||||
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
||||
(* *)
|
||||
(* Copyright 2001 Institut National de Recherche en Informatique et *)
|
||||
(* en Automatique. All rights reserved. This file is distributed *)
|
||||
(* under the terms of the Q Public License version 1.0. *)
|
||||
(* *)
|
||||
(***********************************************************************)
|
||||
|
||||
(* $Id$ *)
|
||||
|
||||
(* Handling of dynamically-linked libraries *)
|
||||
|
||||
(* Extract names of DLLs from a list of C object files and libraries *)
|
||||
val extract_dll_names: string list -> string list
|
||||
|
||||
(* Open a list of DLLs, adding them to opened_dlls.
|
||||
Raise [Failure msg] in case of error. *)
|
||||
val open_dlls: string list -> unit
|
||||
|
||||
(* Close all DLLs *)
|
||||
val close_all_dlls: unit -> unit
|
||||
|
||||
(* The abstract type representing C function pointers *)
|
||||
type dll_address
|
||||
|
||||
(* Find a primitive in the currently opened DLLs and return its address.
|
||||
Raise [Not_found] if not found. *)
|
||||
val find_primitive: string -> dll_address
|
||||
|
||||
(* If linking in core (dynlink or toplevel), synchronize the VM
|
||||
table of primitive with the linker's table of primitive
|
||||
by storing the given primitive function at the given position
|
||||
in the VM table of primitives. *)
|
||||
val synchronize_primitive: int -> dll_address -> unit
|
||||
|
||||
(* Add the given directories to the search path for DLLs. *)
|
||||
val add_path: string list -> unit
|
||||
|
||||
(* Read the [ld.conf] file and return the corresponding list of directories *)
|
||||
val ld_conf_contents: unit -> string list
|
||||
|
||||
(* Split the CAML_LD_LIBRARY_PATH environment variable and return
|
||||
the corresponding list of directories *)
|
||||
val ld_library_path_contents: unit -> string list
|
||||
|
||||
(* Initialization for linking in core (dynlink or toplevel).
|
||||
Initialize the search path to the same path that was used to start
|
||||
the running program (CAML_LD_LIBRARY_PATH + directories in executable +
|
||||
contents of ld.conf file). Take note of the DLLs that were opened
|
||||
when starting the running program. *)
|
||||
val init_toplevel: string -> unit
|
||||
|
|
@ -19,6 +19,5 @@ external static_free : string -> unit = "static_free"
|
|||
external static_resize : string -> int -> string = "static_resize"
|
||||
type closure = unit -> Obj.t
|
||||
external reify_bytecode : string -> int -> closure = "reify_bytecode"
|
||||
external available_primitives : unit -> string array = "available_primitives"
|
||||
external invoke_traced_function : Obj.t -> Obj.t -> Obj.t -> Obj.t
|
||||
= "invoke_traced_function"
|
||||
|
|
|
@ -21,6 +21,5 @@ external static_free : string -> unit = "static_free"
|
|||
external static_resize : string -> int -> string = "static_resize"
|
||||
type closure = unit -> Obj.t
|
||||
external reify_bytecode : string -> int -> closure = "reify_bytecode"
|
||||
external available_primitives : unit -> string array = "available_primitives"
|
||||
external invoke_traced_function : Obj.t -> Obj.t -> Obj.t -> Obj.t
|
||||
= "invoke_traced_function"
|
||||
|
|
|
@ -19,7 +19,6 @@ open Asttypes
|
|||
open Lambda
|
||||
open Emitcode
|
||||
|
||||
|
||||
(* Functions for batch linking *)
|
||||
|
||||
type error =
|
||||
|
@ -33,7 +32,7 @@ exception Error of error
|
|||
|
||||
type 'a numtable =
|
||||
{ num_cnt: int; (* The next number *)
|
||||
num_tbl: ('a, int) Tbl.t } (* The table of already numbered objects *)
|
||||
num_tbl: ('a, int) Tbl.t } (* The table of already numbered objects *)
|
||||
|
||||
let empty_numtable = { num_cnt = 0; num_tbl = Tbl.empty }
|
||||
|
||||
|
@ -80,9 +79,16 @@ let num_of_prim name =
|
|||
try
|
||||
find_numtable !c_prim_table name
|
||||
with Not_found ->
|
||||
if !Clflags.custom_runtime
|
||||
then enter_numtable c_prim_table name
|
||||
else raise(Error(Unavailable_primitive name))
|
||||
if !Clflags.custom_runtime then
|
||||
enter_numtable c_prim_table name
|
||||
else begin
|
||||
let symb =
|
||||
try Dll.find_primitive name
|
||||
with Not_found -> raise(Error(Unavailable_primitive name)) in
|
||||
let num = enter_numtable c_prim_table name in
|
||||
Dll.synchronize_primitive num symb;
|
||||
num
|
||||
end
|
||||
|
||||
let require_primitive name =
|
||||
if name.[0] <> '%' then ignore(num_of_prim name)
|
||||
|
@ -110,12 +116,12 @@ let output_primitive_table outchan =
|
|||
fprintf outchan "extern long %s();\n" prim.(i)
|
||||
done;
|
||||
fprintf outchan "typedef long (*primitive)();\n";
|
||||
fprintf outchan "primitive cprim[] = {\n";
|
||||
fprintf outchan "primitive builtin_cprim[] = {\n";
|
||||
for i = 0 to Array.length prim - 1 do
|
||||
fprintf outchan " %s,\n" prim.(i)
|
||||
done;
|
||||
fprintf outchan " (primitive) 0 };\n";
|
||||
fprintf outchan "char * names_of_cprim[] = {\n";
|
||||
fprintf outchan "char * names_of_builtin_cprim[] = {\n";
|
||||
for i = 0 to Array.length prim - 1 do
|
||||
fprintf outchan " \"%s\",\n" prim.(i)
|
||||
done;
|
||||
|
@ -138,33 +144,8 @@ let init () =
|
|||
let cst = Const_block(0, [Const_base(Const_string name)]) in
|
||||
literal_table := (c, cst) :: !literal_table)
|
||||
Runtimedef.builtin_exceptions;
|
||||
(* Enter the known C primitives *)
|
||||
if String.length !Clflags.use_prims > 0 then begin
|
||||
let ic = open_in !Clflags.use_prims in
|
||||
try
|
||||
while true do
|
||||
set_prim_table (input_line ic)
|
||||
done
|
||||
with End_of_file -> close_in ic
|
||||
| x -> close_in ic; raise x
|
||||
end else if String.length !Clflags.use_runtime > 0 then begin
|
||||
let primfile = Filename.temp_file "camlprims" "" in
|
||||
try
|
||||
if Sys.command(Printf.sprintf "%s -p > %s"
|
||||
!Clflags.use_runtime primfile) <> 0
|
||||
then raise(Error(Wrong_vm !Clflags.use_runtime));
|
||||
let ic = open_in primfile in
|
||||
try
|
||||
while true do
|
||||
set_prim_table (input_line ic)
|
||||
done
|
||||
with End_of_file -> remove_file primfile; close_in ic
|
||||
| x -> close_in ic; raise x
|
||||
with x -> remove_file primfile; raise x
|
||||
end else begin
|
||||
Array.iter set_prim_table
|
||||
Runtimedef.builtin_primitives
|
||||
end
|
||||
(* Initialize the known C primitives *)
|
||||
Array.iter set_prim_table Runtimedef.builtin_primitives
|
||||
|
||||
(* Relocate a block of object bytecode *)
|
||||
|
||||
|
@ -239,19 +220,28 @@ let update_global_table () =
|
|||
(* Initialize the linker for toplevel use *)
|
||||
|
||||
let init_toplevel () =
|
||||
(* Read back the known global symbols from the executable file *)
|
||||
(* Read back the known global symbols and the known primitives
|
||||
from the executable file *)
|
||||
let ic = open_in_bin Sys.argv.(0) in
|
||||
begin try
|
||||
Bytesections.read_toc ic;
|
||||
ignore(Bytesections.seek_section ic "SYMB");
|
||||
global_table := (input_value ic : Ident.t numtable)
|
||||
global_table := (input_value ic : Ident.t numtable);
|
||||
let prims = Bytesections.read_section ic "PRIM" in
|
||||
let pos = ref 0 in
|
||||
while !pos < String.length prims do
|
||||
let i = String.index_from prims !pos '\000' in
|
||||
set_prim_table (String.sub prims !pos (i - !pos));
|
||||
pos := i + 1
|
||||
done
|
||||
with Bytesections.Bad_magic_number | Not_found | Failure _ ->
|
||||
fatal_error "Toplevel bytecode executable is corrupted"
|
||||
end;
|
||||
let dllpath =
|
||||
try Bytesections.read_section ic "DLPT" with Not_found -> "" in
|
||||
close_in ic;
|
||||
(* Enter the known C primitives *)
|
||||
Array.iter set_prim_table
|
||||
(Meta.available_primitives())
|
||||
(* Initialize the Dll machinery for toplevel use *)
|
||||
Dll.init_toplevel dllpath
|
||||
|
||||
(* Find the value of a global identifier *)
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ custom.o: custom.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
|||
debugger.o: debugger.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fail.h fix_code.h instruct.h intext.h io.h stacks.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
dynlink.o: dynlink.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h osdeps.h prims.h
|
||||
extern.o: extern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
|
@ -80,7 +83,8 @@ meta.o: meta.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
|||
minor_gc.o: minor_gc.c config.h ../config/m.h ../config/s.h fail.h \
|
||||
misc.h mlvalues.h finalise.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h gc_ctrl.h signals.h
|
||||
misc.o: misc.c config.h ../config/m.h ../config/s.h misc.h
|
||||
misc.o: misc.c config.h ../config/m.h ../config/s.h misc.h memory.h \
|
||||
gc.h mlvalues.h major_gc.h freelist.h minor_gc.h
|
||||
mpwtool.o: mpwtool.c
|
||||
obj.o: obj.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h major_gc.h freelist.h memory.h minor_gc.h \
|
||||
|
@ -101,10 +105,10 @@ signals.o: signals.c alloc.h misc.h config.h ../config/m.h \
|
|||
stacks.o: stacks.c config.h ../config/m.h ../config/s.h fail.h misc.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
startup.o: startup.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h exec.h \
|
||||
fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h intext.h io.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h prims.h printexc.h \
|
||||
reverse.h signals.h stacks.h sys.h startup.h
|
||||
misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
|
||||
dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
|
||||
intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
|
||||
prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h
|
||||
str.o: str.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h
|
||||
sys.o: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
|
@ -112,10 +116,12 @@ sys.o: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
|||
gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
terminfo.o: terminfo.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h fail.h io.h
|
||||
unix.o: unix.c config.h ../config/m.h ../config/s.h memory.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h
|
||||
weak.o: weak.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
win32.o: win32.c signals.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h
|
||||
win32.o: win32.c memory.h config.h ../config/m.h ../config/s.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h signals.h
|
||||
alloc.d.o: alloc.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h major_gc.h freelist.h memory.h gc.h minor_gc.h \
|
||||
stacks.h
|
||||
|
@ -140,6 +146,9 @@ custom.d.o: custom.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
|||
debugger.d.o: debugger.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fail.h fix_code.h instruct.h intext.h io.h stacks.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
dynlink.d.o: dynlink.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h osdeps.h prims.h
|
||||
extern.d.o: extern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
|
@ -199,7 +208,8 @@ meta.d.o: meta.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
|||
minor_gc.d.o: minor_gc.c config.h ../config/m.h ../config/s.h fail.h \
|
||||
misc.h mlvalues.h finalise.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h gc_ctrl.h signals.h
|
||||
misc.d.o: misc.c config.h ../config/m.h ../config/s.h misc.h
|
||||
misc.d.o: misc.c config.h ../config/m.h ../config/s.h misc.h memory.h \
|
||||
gc.h mlvalues.h major_gc.h freelist.h minor_gc.h
|
||||
mpwtool.d.o: mpwtool.c
|
||||
obj.d.o: obj.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h major_gc.h freelist.h memory.h minor_gc.h \
|
||||
|
@ -220,10 +230,10 @@ signals.d.o: signals.c alloc.h misc.h config.h ../config/m.h \
|
|||
stacks.d.o: stacks.c config.h ../config/m.h ../config/s.h fail.h misc.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
startup.d.o: startup.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h exec.h \
|
||||
fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h intext.h io.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h prims.h printexc.h \
|
||||
reverse.h signals.h stacks.h sys.h startup.h
|
||||
misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
|
||||
dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
|
||||
intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
|
||||
prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h
|
||||
str.d.o: str.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h
|
||||
sys.d.o: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
|
@ -231,7 +241,9 @@ sys.d.o: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
|||
gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
terminfo.d.o: terminfo.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h fail.h io.h
|
||||
unix.d.o: unix.c config.h ../config/m.h ../config/s.h memory.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h
|
||||
weak.d.o: weak.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
win32.d.o: win32.c signals.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h
|
||||
win32.d.o: win32.c memory.h config.h ../config/m.h ../config/s.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h signals.h
|
||||
|
|
|
@ -1,199 +1,498 @@
|
|||
alloc.obj: alloc.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h major_gc.h freelist.h memory.h gc.h minor_gc.h stacks.h
|
||||
array.obj: array.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
alloc.dobj: alloc.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h major_gc.h freelist.h memory.h gc.h minor_gc.h \
|
||||
stacks.h
|
||||
array.dobj: array.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
callback.obj: callback.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
interp.h instruct.h fix_code.h stacks.h
|
||||
compact.obj: compact.c config.h ../config/m.h ../config/s.h freelist.h \
|
||||
misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h memory.h minor_gc.h \
|
||||
roots.h weak.h
|
||||
compare.obj: compare.c fail.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h memory.h gc.h major_gc.h freelist.h \
|
||||
backtrace.dobj: backtrace.c config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h misc.h alloc.h io.h instruct.h intext.h fix_code.h exec.h \
|
||||
startup.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
sys.h backtrace.h
|
||||
callback.dobj: callback.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h interp.h instruct.h fix_code.h stacks.h
|
||||
compact.dobj: compact.c config.h ../config/m.h ../config/s.h finalise.h \
|
||||
roots.h misc.h memory.h gc.h mlvalues.h major_gc.h freelist.h \
|
||||
minor_gc.h gc_ctrl.h weak.h
|
||||
compare.dobj: compare.c custom.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h
|
||||
debugger.obj: debugger.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
custom.dobj: custom.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h
|
||||
debugger.dobj: debugger.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fail.h fix_code.h instruct.h intext.h io.h stacks.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
extern.obj: extern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h intext.h io.h fix_code.h memory.h major_gc.h \
|
||||
freelist.h minor_gc.h reverse.h
|
||||
fail.obj: fail.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
dynlink.dobj: dynlink.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h osdeps.h prims.h
|
||||
extern.dobj: extern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
fail.dobj: fail.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h io.h gc.h memory.h major_gc.h freelist.h minor_gc.h \
|
||||
signals.h stacks.h
|
||||
fix_code.obj: fix_code.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
printexc.h signals.h stacks.h
|
||||
finalise.dobj: finalise.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h signals.h
|
||||
fix_code.dobj: fix_code.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fix_code.h instruct.h md5.h io.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
floats.obj: floats.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
floats.dobj: floats.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
stacks.h
|
||||
freelist.obj: freelist.c config.h ../config/m.h ../config/s.h freelist.h \
|
||||
reverse.h stacks.h
|
||||
freelist.dobj: freelist.c config.h ../config/m.h ../config/s.h freelist.h \
|
||||
misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h
|
||||
gc_ctrl.obj: gc_ctrl.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h compact.h gc.h gc_ctrl.h major_gc.h \
|
||||
freelist.h minor_gc.h stacks.h memory.h
|
||||
hash.obj: hash.c mlvalues.h config.h ../config/m.h ../config/s.h misc.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
instrtrace.obj: instrtrace.c
|
||||
intern.obj: intern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h intext.h io.h fix_code.h memory.h major_gc.h \
|
||||
freelist.h minor_gc.h reverse.h
|
||||
interp.obj: interp.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h callback.h debugger.h fail.h fix_code.h instrtrace.h \
|
||||
instruct.h interp.h major_gc.h freelist.h memory.h gc.h minor_gc.h \
|
||||
prims.h signals.h stacks.h jumptbl.h
|
||||
ints.obj: ints.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
io.obj: io.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h fail.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
signals.h sys.h
|
||||
lexing.obj: lexing.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
gc_ctrl.dobj: gc_ctrl.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h compact.h custom.h finalise.h roots.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h gc_ctrl.h stacks.h
|
||||
globroots.dobj: globroots.c memory.h config.h ../config/m.h ../config/s.h \
|
||||
gc.h mlvalues.h misc.h major_gc.h freelist.h minor_gc.h globroots.h
|
||||
hash.dobj: hash.c mlvalues.h config.h ../config/m.h ../config/s.h misc.h \
|
||||
custom.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
instrtrace.dobj: instrtrace.c
|
||||
intern.dobj: intern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
interp.dobj: interp.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h backtrace.h callback.h debugger.h fail.h fix_code.h \
|
||||
instrtrace.h instruct.h interp.h major_gc.h freelist.h memory.h gc.h \
|
||||
minor_gc.h prims.h signals.h stacks.h jumptbl.h
|
||||
ints.dobj: ints.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h intext.h io.h fix_code.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h
|
||||
io.dobj: io.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h custom.h fail.h io.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h signals.h sys.h
|
||||
lexing.dobj: lexing.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
macintosh.obj: macintosh.c
|
||||
main.obj: main.c misc.h config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
macintosh.dobj: macintosh.c misc.h config.h ../config/m.h ../config/s.h \
|
||||
rotatecursor.h
|
||||
main.dobj: main.c misc.h config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
sys.h
|
||||
major_gc.obj: major_gc.c compact.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h fail.h mlvalues.h freelist.h gc.h gc_ctrl.h major_gc.h roots.h \
|
||||
memory.h minor_gc.h weak.h
|
||||
md5.obj: md5.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
major_gc.dobj: major_gc.c compact.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h custom.h mlvalues.h fail.h finalise.h roots.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h gc_ctrl.h weak.h
|
||||
md5.dobj: md5.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h md5.h io.h reverse.h
|
||||
memory.obj: memory.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
memory.dobj: memory.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h freelist.h gc.h gc_ctrl.h major_gc.h memory.h minor_gc.h \
|
||||
signals.h
|
||||
meta.obj: meta.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
meta.dobj: meta.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h fix_code.h interp.h major_gc.h freelist.h memory.h \
|
||||
gc.h minor_gc.h prims.h stacks.h
|
||||
minor_gc.obj: minor_gc.c config.h ../config/m.h ../config/s.h fail.h \
|
||||
misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h freelist.h memory.h \
|
||||
minor_gc.h roots.h signals.h
|
||||
misc.obj: misc.c config.h ../config/m.h ../config/s.h misc.h
|
||||
obj.obj: obj.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
minor_gc.dobj: minor_gc.c config.h ../config/m.h ../config/s.h fail.h \
|
||||
misc.h mlvalues.h finalise.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h gc_ctrl.h signals.h
|
||||
misc.dobj: misc.c config.h ../config/m.h ../config/s.h misc.h memory.h \
|
||||
gc.h mlvalues.h major_gc.h freelist.h minor_gc.h
|
||||
mpwtool.dobj: mpwtool.c
|
||||
obj.dobj: obj.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h major_gc.h freelist.h memory.h minor_gc.h \
|
||||
prims.h
|
||||
parsing.obj: parsing.c config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
parsing.dobj: parsing.c config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
misc.h memory.h gc.h major_gc.h freelist.h minor_gc.h alloc.h
|
||||
prims.obj: prims.c mlvalues.h config.h ../config/m.h ../config/s.h \
|
||||
prims.dobj: prims.c mlvalues.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h prims.h
|
||||
printexc.obj: printexc.c fail.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h
|
||||
roots.obj: roots.c memory.h config.h ../config/m.h ../config/s.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h roots.h stacks.h
|
||||
rotatecursor.obj: rotatecursor.c rotatecursor.h
|
||||
signals.obj: signals.c alloc.h misc.h config.h ../config/m.h \
|
||||
printexc.dobj: printexc.c backtrace.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h debugger.h fail.h printexc.h
|
||||
roots.dobj: roots.c finalise.h roots.h misc.h config.h ../config/m.h \
|
||||
../config/s.h memory.h gc.h mlvalues.h major_gc.h freelist.h \
|
||||
minor_gc.h globroots.h stacks.h
|
||||
rotatecursor.dobj: rotatecursor.c rotatecursor.h
|
||||
signals.dobj: signals.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h callback.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h roots.h signals.h sys.h
|
||||
stacks.obj: stacks.c config.h ../config/m.h ../config/s.h fail.h misc.h \
|
||||
stacks.dobj: stacks.c config.h ../config/m.h ../config/s.h fail.h misc.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
startup.obj: startup.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h debugger.h exec.h fail.h fix_code.h gc_ctrl.h \
|
||||
interp.h intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
prims.h stacks.h sys.h
|
||||
str.obj: str.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
startup.dobj: startup.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
|
||||
dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
|
||||
intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
|
||||
prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h
|
||||
str.dobj: str.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h
|
||||
sys.obj: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
sys.dobj: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h debugger.h fail.h instruct.h signals.h stacks.h memory.h \
|
||||
gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
terminfo.obj: terminfo.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
terminfo.dobj: terminfo.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h fail.h io.h
|
||||
weak.obj: weak.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
unix.dobj: unix.c config.h ../config/m.h ../config/s.h memory.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h
|
||||
weak.dobj: weak.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
wincmdline.obj: wincmdline.c
|
||||
alloc.d.obj: alloc.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h major_gc.h freelist.h memory.h gc.h minor_gc.h stacks.h
|
||||
array.d.obj: array.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
win32.dobj: win32.c memory.h config.h ../config/m.h ../config/s.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h signals.h
|
||||
alloc.d.dobj: alloc.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h major_gc.h freelist.h memory.h gc.h minor_gc.h \
|
||||
stacks.h
|
||||
array.d.dobj: array.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
callback.d.obj: callback.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
interp.h instruct.h fix_code.h stacks.h
|
||||
compact.d.obj: compact.c config.h ../config/m.h ../config/s.h freelist.h \
|
||||
misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h memory.h minor_gc.h \
|
||||
roots.h weak.h
|
||||
compare.d.obj: compare.c fail.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h memory.h gc.h major_gc.h freelist.h \
|
||||
backtrace.d.dobj: backtrace.c config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h misc.h alloc.h io.h instruct.h intext.h fix_code.h exec.h \
|
||||
startup.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
sys.h backtrace.h
|
||||
callback.d.dobj: callback.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h interp.h instruct.h fix_code.h stacks.h
|
||||
compact.d.dobj: compact.c config.h ../config/m.h ../config/s.h finalise.h \
|
||||
roots.h misc.h memory.h gc.h mlvalues.h major_gc.h freelist.h \
|
||||
minor_gc.h gc_ctrl.h weak.h
|
||||
compare.d.dobj: compare.c custom.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h
|
||||
debugger.d.obj: debugger.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
custom.d.dobj: custom.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h
|
||||
debugger.d.dobj: debugger.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fail.h fix_code.h instruct.h intext.h io.h stacks.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
extern.d.obj: extern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h intext.h io.h fix_code.h memory.h major_gc.h \
|
||||
freelist.h minor_gc.h reverse.h
|
||||
fail.d.obj: fail.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
dynlink.d.dobj: dynlink.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h osdeps.h prims.h
|
||||
extern.d.dobj: extern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
fail.d.dobj: fail.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h io.h gc.h memory.h major_gc.h freelist.h minor_gc.h \
|
||||
signals.h stacks.h
|
||||
fix_code.d.obj: fix_code.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
printexc.h signals.h stacks.h
|
||||
finalise.d.dobj: finalise.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h signals.h
|
||||
fix_code.d.dobj: fix_code.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fix_code.h instruct.h md5.h io.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
floats.d.obj: floats.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
floats.d.dobj: floats.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
stacks.h
|
||||
freelist.d.obj: freelist.c config.h ../config/m.h ../config/s.h freelist.h \
|
||||
reverse.h stacks.h
|
||||
freelist.d.dobj: freelist.c config.h ../config/m.h ../config/s.h freelist.h \
|
||||
misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h
|
||||
gc_ctrl.d.obj: gc_ctrl.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h compact.h gc.h gc_ctrl.h major_gc.h \
|
||||
freelist.h minor_gc.h stacks.h memory.h
|
||||
hash.d.obj: hash.c mlvalues.h config.h ../config/m.h ../config/s.h misc.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
instrtrace.d.obj: instrtrace.c instruct.h misc.h config.h ../config/m.h \
|
||||
gc_ctrl.d.dobj: gc_ctrl.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h compact.h custom.h finalise.h roots.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h gc_ctrl.h stacks.h
|
||||
globroots.d.dobj: globroots.c memory.h config.h ../config/m.h ../config/s.h \
|
||||
gc.h mlvalues.h misc.h major_gc.h freelist.h minor_gc.h globroots.h
|
||||
hash.d.dobj: hash.c mlvalues.h config.h ../config/m.h ../config/s.h misc.h \
|
||||
custom.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
instrtrace.d.dobj: instrtrace.c instruct.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h opnames.h
|
||||
intern.d.obj: intern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h intext.h io.h fix_code.h memory.h major_gc.h \
|
||||
freelist.h minor_gc.h reverse.h
|
||||
interp.d.obj: interp.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h callback.h debugger.h fail.h fix_code.h instrtrace.h \
|
||||
instruct.h interp.h major_gc.h freelist.h memory.h gc.h minor_gc.h \
|
||||
prims.h signals.h stacks.h
|
||||
ints.d.obj: ints.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
io.d.obj: io.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h fail.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
signals.h sys.h
|
||||
lexing.d.obj: lexing.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
intern.d.dobj: intern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
interp.d.dobj: interp.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h backtrace.h callback.h debugger.h fail.h fix_code.h \
|
||||
instrtrace.h instruct.h interp.h major_gc.h freelist.h memory.h gc.h \
|
||||
minor_gc.h prims.h signals.h stacks.h
|
||||
ints.d.dobj: ints.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h intext.h io.h fix_code.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h
|
||||
io.d.dobj: io.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h custom.h fail.h io.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h signals.h sys.h
|
||||
lexing.d.dobj: lexing.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
macintosh.d.obj: macintosh.c
|
||||
main.d.obj: main.c misc.h config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
macintosh.d.dobj: macintosh.c misc.h config.h ../config/m.h ../config/s.h \
|
||||
rotatecursor.h
|
||||
main.d.dobj: main.c misc.h config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
sys.h
|
||||
major_gc.d.obj: major_gc.c compact.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h fail.h mlvalues.h freelist.h gc.h gc_ctrl.h major_gc.h roots.h \
|
||||
memory.h minor_gc.h weak.h
|
||||
md5.d.obj: md5.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
major_gc.d.dobj: major_gc.c compact.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h custom.h mlvalues.h fail.h finalise.h roots.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h gc_ctrl.h weak.h
|
||||
md5.d.dobj: md5.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h md5.h io.h reverse.h
|
||||
memory.d.obj: memory.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
memory.d.dobj: memory.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h freelist.h gc.h gc_ctrl.h major_gc.h memory.h minor_gc.h \
|
||||
signals.h
|
||||
meta.d.obj: meta.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
meta.d.dobj: meta.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h fix_code.h interp.h major_gc.h freelist.h memory.h \
|
||||
gc.h minor_gc.h prims.h stacks.h
|
||||
minor_gc.d.obj: minor_gc.c config.h ../config/m.h ../config/s.h fail.h \
|
||||
misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h freelist.h memory.h \
|
||||
minor_gc.h roots.h signals.h
|
||||
misc.d.obj: misc.c config.h ../config/m.h ../config/s.h misc.h
|
||||
obj.d.obj: obj.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
minor_gc.d.dobj: minor_gc.c config.h ../config/m.h ../config/s.h fail.h \
|
||||
misc.h mlvalues.h finalise.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h gc_ctrl.h signals.h
|
||||
misc.d.dobj: misc.c config.h ../config/m.h ../config/s.h misc.h memory.h \
|
||||
gc.h mlvalues.h major_gc.h freelist.h minor_gc.h
|
||||
mpwtool.d.dobj: mpwtool.c
|
||||
obj.d.dobj: obj.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h major_gc.h freelist.h memory.h minor_gc.h \
|
||||
prims.h
|
||||
parsing.d.obj: parsing.c config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
parsing.d.dobj: parsing.c config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
misc.h memory.h gc.h major_gc.h freelist.h minor_gc.h alloc.h
|
||||
prims.d.obj: prims.c mlvalues.h config.h ../config/m.h ../config/s.h \
|
||||
prims.d.dobj: prims.c mlvalues.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h prims.h
|
||||
printexc.d.obj: printexc.c fail.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h
|
||||
roots.d.obj: roots.c memory.h config.h ../config/m.h ../config/s.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h roots.h stacks.h
|
||||
rotatecursor.d.obj: rotatecursor.c rotatecursor.h
|
||||
signals.d.obj: signals.c alloc.h misc.h config.h ../config/m.h \
|
||||
printexc.d.dobj: printexc.c backtrace.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h debugger.h fail.h printexc.h
|
||||
roots.d.dobj: roots.c finalise.h roots.h misc.h config.h ../config/m.h \
|
||||
../config/s.h memory.h gc.h mlvalues.h major_gc.h freelist.h \
|
||||
minor_gc.h globroots.h stacks.h
|
||||
rotatecursor.d.dobj: rotatecursor.c rotatecursor.h
|
||||
signals.d.dobj: signals.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h callback.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h roots.h signals.h sys.h
|
||||
stacks.d.obj: stacks.c config.h ../config/m.h ../config/s.h fail.h misc.h \
|
||||
stacks.d.dobj: stacks.c config.h ../config/m.h ../config/s.h fail.h misc.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
startup.d.obj: startup.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h debugger.h exec.h fail.h fix_code.h gc_ctrl.h \
|
||||
interp.h intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
prims.h stacks.h sys.h
|
||||
str.d.obj: str.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
startup.d.dobj: startup.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
|
||||
dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
|
||||
intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
|
||||
prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h
|
||||
str.d.dobj: str.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h
|
||||
sys.d.obj: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
sys.d.dobj: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h debugger.h fail.h instruct.h signals.h stacks.h memory.h \
|
||||
gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
terminfo.d.obj: terminfo.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
terminfo.d.dobj: terminfo.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h fail.h io.h
|
||||
weak.d.obj: weak.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
unix.d.dobj: unix.c config.h ../config/m.h ../config/s.h memory.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h
|
||||
weak.d.dobj: weak.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
wincmdline.d.obj: wincmdline.c
|
||||
win32.d.dobj: win32.c memory.h config.h ../config/m.h ../config/s.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h signals.h
|
||||
alloc.sobj: alloc.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h major_gc.h freelist.h memory.h gc.h minor_gc.h \
|
||||
stacks.h
|
||||
array.sobj: array.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
backtrace.sobj: backtrace.c config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h misc.h alloc.h io.h instruct.h intext.h fix_code.h exec.h \
|
||||
startup.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
sys.h backtrace.h
|
||||
callback.sobj: callback.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h interp.h instruct.h fix_code.h stacks.h
|
||||
compact.sobj: compact.c config.h ../config/m.h ../config/s.h finalise.h \
|
||||
roots.h misc.h memory.h gc.h mlvalues.h major_gc.h freelist.h \
|
||||
minor_gc.h gc_ctrl.h weak.h
|
||||
compare.sobj: compare.c custom.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h
|
||||
custom.sobj: custom.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h
|
||||
debugger.sobj: debugger.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fail.h fix_code.h instruct.h intext.h io.h stacks.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
dynlink.sobj: dynlink.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h osdeps.h prims.h
|
||||
extern.sobj: extern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
fail.sobj: fail.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h io.h gc.h memory.h major_gc.h freelist.h minor_gc.h \
|
||||
printexc.h signals.h stacks.h
|
||||
finalise.sobj: finalise.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h signals.h
|
||||
fix_code.sobj: fix_code.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fix_code.h instruct.h md5.h io.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
floats.sobj: floats.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
reverse.h stacks.h
|
||||
freelist.sobj: freelist.c config.h ../config/m.h ../config/s.h freelist.h \
|
||||
misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h
|
||||
gc_ctrl.sobj: gc_ctrl.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h compact.h custom.h finalise.h roots.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h gc_ctrl.h stacks.h
|
||||
globroots.sobj: globroots.c memory.h config.h ../config/m.h ../config/s.h \
|
||||
gc.h mlvalues.h misc.h major_gc.h freelist.h minor_gc.h globroots.h
|
||||
hash.sobj: hash.c mlvalues.h config.h ../config/m.h ../config/s.h misc.h \
|
||||
custom.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
instrtrace.sobj: instrtrace.c
|
||||
intern.sobj: intern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
interp.sobj: interp.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h backtrace.h callback.h debugger.h fail.h fix_code.h \
|
||||
instrtrace.h instruct.h interp.h major_gc.h freelist.h memory.h gc.h \
|
||||
minor_gc.h prims.h signals.h stacks.h jumptbl.h
|
||||
ints.sobj: ints.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h intext.h io.h fix_code.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h
|
||||
io.sobj: io.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h custom.h fail.h io.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h signals.h sys.h
|
||||
lexing.sobj: lexing.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
macintosh.sobj: macintosh.c misc.h config.h ../config/m.h ../config/s.h \
|
||||
rotatecursor.h
|
||||
main.sobj: main.c misc.h config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
sys.h
|
||||
major_gc.sobj: major_gc.c compact.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h custom.h mlvalues.h fail.h finalise.h roots.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h gc_ctrl.h weak.h
|
||||
md5.sobj: md5.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h md5.h io.h reverse.h
|
||||
memory.sobj: memory.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h freelist.h gc.h gc_ctrl.h major_gc.h memory.h minor_gc.h \
|
||||
signals.h
|
||||
meta.sobj: meta.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h fix_code.h interp.h major_gc.h freelist.h memory.h \
|
||||
gc.h minor_gc.h prims.h stacks.h
|
||||
minor_gc.sobj: minor_gc.c config.h ../config/m.h ../config/s.h fail.h \
|
||||
misc.h mlvalues.h finalise.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h gc_ctrl.h signals.h
|
||||
misc.sobj: misc.c config.h ../config/m.h ../config/s.h misc.h memory.h \
|
||||
gc.h mlvalues.h major_gc.h freelist.h minor_gc.h
|
||||
mpwtool.sobj: mpwtool.c
|
||||
obj.sobj: obj.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h major_gc.h freelist.h memory.h minor_gc.h \
|
||||
prims.h
|
||||
parsing.sobj: parsing.c config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
misc.h memory.h gc.h major_gc.h freelist.h minor_gc.h alloc.h
|
||||
prims.sobj: prims.c mlvalues.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h prims.h
|
||||
printexc.sobj: printexc.c backtrace.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h debugger.h fail.h printexc.h
|
||||
roots.sobj: roots.c finalise.h roots.h misc.h config.h ../config/m.h \
|
||||
../config/s.h memory.h gc.h mlvalues.h major_gc.h freelist.h \
|
||||
minor_gc.h globroots.h stacks.h
|
||||
rotatecursor.sobj: rotatecursor.c rotatecursor.h
|
||||
signals.sobj: signals.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h callback.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h roots.h signals.h sys.h
|
||||
stacks.sobj: stacks.c config.h ../config/m.h ../config/s.h fail.h misc.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
startup.sobj: startup.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
|
||||
dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
|
||||
intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
|
||||
prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h
|
||||
str.sobj: str.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h
|
||||
sys.sobj: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h debugger.h fail.h instruct.h signals.h stacks.h memory.h \
|
||||
gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
terminfo.sobj: terminfo.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h fail.h io.h
|
||||
unix.sobj: unix.c config.h ../config/m.h ../config/s.h memory.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h
|
||||
weak.sobj: weak.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
win32.sobj: win32.c memory.h config.h ../config/m.h ../config/s.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h signals.h
|
||||
alloc.d.sobj: alloc.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h major_gc.h freelist.h memory.h gc.h minor_gc.h \
|
||||
stacks.h
|
||||
array.d.sobj: array.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
backtrace.d.sobj: backtrace.c config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h misc.h alloc.h io.h instruct.h intext.h fix_code.h exec.h \
|
||||
startup.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
sys.h backtrace.h
|
||||
callback.d.sobj: callback.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h interp.h instruct.h fix_code.h stacks.h
|
||||
compact.d.sobj: compact.c config.h ../config/m.h ../config/s.h finalise.h \
|
||||
roots.h misc.h memory.h gc.h mlvalues.h major_gc.h freelist.h \
|
||||
minor_gc.h gc_ctrl.h weak.h
|
||||
compare.d.sobj: compare.c custom.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h
|
||||
custom.d.sobj: custom.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h
|
||||
debugger.d.sobj: debugger.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fail.h fix_code.h instruct.h intext.h io.h stacks.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
dynlink.d.sobj: dynlink.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h dynlink.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h osdeps.h prims.h
|
||||
extern.d.sobj: extern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
fail.d.sobj: fail.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h io.h gc.h memory.h major_gc.h freelist.h minor_gc.h \
|
||||
printexc.h signals.h stacks.h
|
||||
finalise.d.sobj: finalise.c callback.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h fail.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h signals.h
|
||||
fix_code.d.sobj: fix_code.c config.h ../config/m.h ../config/s.h debugger.h \
|
||||
misc.h mlvalues.h fix_code.h instruct.h md5.h io.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
floats.d.sobj: floats.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h \
|
||||
reverse.h stacks.h
|
||||
freelist.d.sobj: freelist.c config.h ../config/m.h ../config/s.h freelist.h \
|
||||
misc.h mlvalues.h gc.h gc_ctrl.h major_gc.h
|
||||
gc_ctrl.d.sobj: gc_ctrl.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h compact.h custom.h finalise.h roots.h \
|
||||
memory.h gc.h major_gc.h freelist.h minor_gc.h gc_ctrl.h stacks.h
|
||||
globroots.d.sobj: globroots.c memory.h config.h ../config/m.h ../config/s.h \
|
||||
gc.h mlvalues.h misc.h major_gc.h freelist.h minor_gc.h globroots.h
|
||||
hash.d.sobj: hash.c mlvalues.h config.h ../config/m.h ../config/s.h misc.h \
|
||||
custom.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
instrtrace.d.sobj: instrtrace.c instruct.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h opnames.h
|
||||
intern.d.sobj: intern.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h gc.h intext.h io.h fix_code.h memory.h \
|
||||
major_gc.h freelist.h minor_gc.h reverse.h
|
||||
interp.d.sobj: interp.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h backtrace.h callback.h debugger.h fail.h fix_code.h \
|
||||
instrtrace.h instruct.h interp.h major_gc.h freelist.h memory.h gc.h \
|
||||
minor_gc.h prims.h signals.h stacks.h
|
||||
ints.d.sobj: ints.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h custom.h fail.h intext.h io.h fix_code.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h
|
||||
io.d.sobj: io.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h custom.h fail.h io.h memory.h gc.h major_gc.h freelist.h \
|
||||
minor_gc.h signals.h sys.h
|
||||
lexing.d.sobj: lexing.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
macintosh.d.sobj: macintosh.c misc.h config.h ../config/m.h ../config/s.h \
|
||||
rotatecursor.h
|
||||
main.d.sobj: main.c misc.h config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
sys.h
|
||||
major_gc.d.sobj: major_gc.c compact.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h custom.h mlvalues.h fail.h finalise.h roots.h memory.h gc.h \
|
||||
major_gc.h freelist.h minor_gc.h gc_ctrl.h weak.h
|
||||
md5.d.sobj: md5.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h md5.h io.h reverse.h
|
||||
memory.d.sobj: memory.c fail.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h freelist.h gc.h gc_ctrl.h major_gc.h memory.h minor_gc.h \
|
||||
signals.h
|
||||
meta.d.sobj: meta.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h fix_code.h interp.h major_gc.h freelist.h memory.h \
|
||||
gc.h minor_gc.h prims.h stacks.h
|
||||
minor_gc.d.sobj: minor_gc.c config.h ../config/m.h ../config/s.h fail.h \
|
||||
misc.h mlvalues.h finalise.h roots.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h gc_ctrl.h signals.h
|
||||
misc.d.sobj: misc.c config.h ../config/m.h ../config/s.h misc.h memory.h \
|
||||
gc.h mlvalues.h major_gc.h freelist.h minor_gc.h
|
||||
mpwtool.d.sobj: mpwtool.c
|
||||
obj.d.sobj: obj.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h gc.h major_gc.h freelist.h memory.h minor_gc.h \
|
||||
prims.h
|
||||
parsing.d.sobj: parsing.c config.h ../config/m.h ../config/s.h mlvalues.h \
|
||||
misc.h memory.h gc.h major_gc.h freelist.h minor_gc.h alloc.h
|
||||
prims.d.sobj: prims.c mlvalues.h config.h ../config/m.h ../config/s.h \
|
||||
misc.h prims.h
|
||||
printexc.d.sobj: printexc.c backtrace.h mlvalues.h config.h ../config/m.h \
|
||||
../config/s.h misc.h debugger.h fail.h printexc.h
|
||||
roots.d.sobj: roots.c finalise.h roots.h misc.h config.h ../config/m.h \
|
||||
../config/s.h memory.h gc.h mlvalues.h major_gc.h freelist.h \
|
||||
minor_gc.h globroots.h stacks.h
|
||||
rotatecursor.d.sobj: rotatecursor.c rotatecursor.h
|
||||
signals.d.sobj: signals.c alloc.h misc.h config.h ../config/m.h \
|
||||
../config/s.h mlvalues.h callback.h fail.h memory.h gc.h major_gc.h \
|
||||
freelist.h minor_gc.h roots.h signals.h sys.h
|
||||
stacks.d.sobj: stacks.c config.h ../config/m.h ../config/s.h fail.h misc.h \
|
||||
mlvalues.h stacks.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
startup.d.sobj: startup.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h backtrace.h callback.h custom.h debugger.h \
|
||||
dynlink.h exec.h fail.h fix_code.h gc_ctrl.h instrtrace.h interp.h \
|
||||
intext.h io.h memory.h gc.h major_gc.h freelist.h minor_gc.h osdeps.h \
|
||||
prims.h printexc.h reverse.h signals.h stacks.h sys.h startup.h
|
||||
str.d.sobj: str.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h
|
||||
sys.d.sobj: sys.c config.h ../config/m.h ../config/s.h alloc.h misc.h \
|
||||
mlvalues.h debugger.h fail.h instruct.h signals.h stacks.h memory.h \
|
||||
gc.h major_gc.h freelist.h minor_gc.h sys.h
|
||||
terminfo.d.sobj: terminfo.c config.h ../config/m.h ../config/s.h alloc.h \
|
||||
misc.h mlvalues.h fail.h io.h
|
||||
unix.d.sobj: unix.c config.h ../config/m.h ../config/s.h memory.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h
|
||||
weak.d.sobj: weak.c alloc.h misc.h config.h ../config/m.h ../config/s.h \
|
||||
mlvalues.h fail.h memory.h gc.h major_gc.h freelist.h minor_gc.h
|
||||
win32.d.sobj: win32.c memory.h config.h ../config/m.h ../config/s.h gc.h \
|
||||
mlvalues.h misc.h major_gc.h freelist.h minor_gc.h osdeps.h signals.h
|
||||
|
|
|
@ -23,13 +23,15 @@ OBJS=interp.o misc.o stacks.o fix_code.o startup.o main.o \
|
|||
fail.o signals.o printexc.o backtrace.o \
|
||||
compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
|
||||
hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
|
||||
lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o
|
||||
lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
|
||||
dynlink.o unix.o
|
||||
|
||||
DOBJS=$(OBJS:.o=.d.o) instrtrace.d.o
|
||||
|
||||
PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
|
||||
intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
|
||||
signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c
|
||||
signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
|
||||
dynlink.c
|
||||
|
||||
PUBLIC_INCLUDES=mlvalues.h alloc.h misc.h callback.h fail.h custom.h
|
||||
|
||||
|
@ -69,17 +71,17 @@ clean:
|
|||
rm -f primitives prims.c opnames.h jumptbl.h
|
||||
|
||||
primitives : $(PRIMS)
|
||||
sed -n -e '/\/\* ML \*\//s/.* \([a-z0-9_][a-z0-9_]*\) *(.*/\1/p' \
|
||||
sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
|
||||
$(PRIMS) > primitives
|
||||
|
||||
prims.c : primitives
|
||||
(echo '#include "mlvalues.h"'; \
|
||||
echo '#include "prims.h"'; \
|
||||
sed -e 's/.*/extern value &();/' primitives; \
|
||||
echo 'c_primitive cprim[] = {'; \
|
||||
echo 'c_primitive builtin_cprim[] = {'; \
|
||||
sed -e 's/.*/ &,/' primitives; \
|
||||
echo ' 0 };'; \
|
||||
echo 'char * names_of_cprim[] = {'; \
|
||||
echo 'char * names_of_builtin_cprim[] = {'; \
|
||||
sed -e 's/.*/ "&",/' primitives; \
|
||||
echo ' 0 };') > prims.c
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
!include ..\config\Makefile.nt
|
||||
|
||||
CC=$(BYTECC)
|
||||
CFLAGS=$(BYTECCCOMPOPTS)
|
||||
CFLAGS=-DIN_OCAMLRUN -DOCAML_STDLIB_DIR="\"$(LIBDIR:\=\\)\""
|
||||
|
||||
OBJS=interp.obj misc.obj stacks.obj fix_code.obj startup.obj main.obj \
|
||||
fail.obj signals.obj freelist.obj major_gc.obj minor_gc.obj \
|
||||
|
@ -23,15 +23,16 @@ OBJS=interp.obj misc.obj stacks.obj fix_code.obj startup.obj main.obj \
|
|||
str.obj array.obj io.obj extern.obj intern.obj hash.obj sys.obj \
|
||||
meta.obj parsing.obj gc_ctrl.obj terminfo.obj md5.obj obj.obj lexing.obj \
|
||||
win32.obj printexc.obj callback.obj debugger.obj weak.obj compact.obj \
|
||||
finalise.obj custom.obj backtrace.obj globroots.obj
|
||||
finalise.obj custom.obj backtrace.obj globroots.obj dynlink.obj
|
||||
|
||||
PRIMS=alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
|
||||
intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
|
||||
signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c
|
||||
signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
|
||||
dynlink.c
|
||||
|
||||
PUBLIC_INCLUDES=mlvalues.h alloc.h misc.h callback.h fail.h custom.h
|
||||
|
||||
all: ocamlrun.exe
|
||||
all: ocamlrun.exe libcamlrun.lib
|
||||
if not exist ..\stdlib\caml mkdir ..\stdlib\caml
|
||||
cp $(PUBLIC_INCLUDES) ..\stdlib\caml
|
||||
sed -e "/#include .*\/m.h/r ..\config\m.h" \
|
||||
|
@ -41,11 +42,15 @@ all: ocamlrun.exe
|
|||
-e "/#define Alloc_small/,/^}/d" \
|
||||
-e "/Modify/,/^}/d" memory.h > ..\stdlib\caml\memory.h
|
||||
|
||||
ocamlrun.exe: libcamlrun.lib prims.obj
|
||||
$(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) -o ocamlrun.exe prims.obj libcamlrun.lib $(CCLIBS)
|
||||
ocamlrun.exe: $(OBJS:.obj=.dobj) prims.dobj
|
||||
link /nologo /out:ocamlrun.exe $(OBJS:.obj=.dobj) prims.dobj $(CCLIBS)
|
||||
|
||||
libcamlrun.lib: $(OBJS:.obj=.sobj)
|
||||
$(MKLIB)libcamlrun.lib $(OBJS:.obj=.sobj)
|
||||
|
||||
install:
|
||||
cp ocamlrun.exe $(BINDIR)\ocamlrun.exe
|
||||
cp ocamlrun.lib $(LIBDIR)\ocamlrun.lib
|
||||
cp libcamlrun.lib $(LIBDIR)\libcamlrun.lib
|
||||
if not exist $(LIBDIR)\caml mkdir $(LIBDIR)\caml
|
||||
cp $(PUBLIC_INCLUDES) $(LIBDIR)\caml
|
||||
|
@ -56,25 +61,22 @@ install:
|
|||
-e "/#define Alloc_small/,/^}/d" \
|
||||
-e "/Modify/,/^}/d" memory.h > $(LIBDIR)\caml\memory.h
|
||||
|
||||
libcamlrun.lib: $(OBJS)
|
||||
$(MKLIB)libcamlrun.lib $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f ocamlrun.exe *.obj *.lib
|
||||
rm -f *.exe *.dobj *.sobj *.lib
|
||||
rm -f primitives prims.c opnames.h jumptbl.h
|
||||
|
||||
primitives : $(PRIMS)
|
||||
sed -n -e "/\/\* ML \*\//s/.* \([a-z0-9_][a-z0-9_]*\) *(.*/\1/p" \
|
||||
sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" \
|
||||
$(PRIMS) > primitives
|
||||
|
||||
prims.c : primitives
|
||||
echo #include "mlvalues.h" > prims.c
|
||||
echo #include "prims.h" >> prims.c
|
||||
sed -e "s/.*/extern value &();/" primitives >> prims.c
|
||||
echo c_primitive cprim[] = { >> prims.c
|
||||
echo c_primitive builtin_cprim[] = { >> prims.c
|
||||
sed -e "s/.*/ &,/" primitives >> prims.c
|
||||
echo 0 }; >> prims.c
|
||||
echo char * names_of_cprim[] = { >> prims.c
|
||||
echo char * names_of_builtin_cprim[] = { >> prims.c
|
||||
sed -e "s/.*/ \"^&\",/" primitives >> prims.c
|
||||
echo 0 }; >> prims.c
|
||||
|
||||
|
@ -89,7 +91,17 @@ jumptbl.h : instruct.h
|
|||
sed -n -e "/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp" \
|
||||
-e "/^}/q" instruct.h > jumptbl.h
|
||||
|
||||
.SUFFIXES: .dobj .sobj
|
||||
|
||||
.c.dobj:
|
||||
$(CC) $(CFLAGS) $(DLLCCCOMPOPTS) -c $<
|
||||
mv $*.obj $*.dobj
|
||||
.c.sobj:
|
||||
$(CC) $(CFLAGS) $(BYTECCCOMPOPTS) -c $<
|
||||
mv $*.obj $*.sobj
|
||||
|
||||
depend:
|
||||
sed -e "s/\.o/.obj/g" .depend > .depend.nt
|
||||
sed -e "s/\.o/.dobj/g" .depend > .depend.nt
|
||||
sed -e "s/\.o/.sobj/g" .depend >> .depend.nt
|
||||
|
||||
!include .depend.nt
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define Setup_for_gc
|
||||
#define Restore_after_gc
|
||||
|
||||
value alloc (mlsize_t wosize, tag_t tag)
|
||||
CAMLexport value alloc (mlsize_t wosize, tag_t tag)
|
||||
{
|
||||
value result;
|
||||
mlsize_t i;
|
||||
|
@ -48,7 +48,7 @@ value alloc (mlsize_t wosize, tag_t tag)
|
|||
return result;
|
||||
}
|
||||
|
||||
value alloc_small (mlsize_t wosize, tag_t tag)
|
||||
CAMLexport value alloc_small (mlsize_t wosize, tag_t tag)
|
||||
{
|
||||
value result;
|
||||
|
||||
|
@ -59,12 +59,12 @@ value alloc_small (mlsize_t wosize, tag_t tag)
|
|||
return result;
|
||||
}
|
||||
|
||||
value alloc_tuple(mlsize_t n)
|
||||
CAMLexport value alloc_tuple(mlsize_t n)
|
||||
{
|
||||
return alloc(n, 0);
|
||||
}
|
||||
|
||||
value alloc_string (mlsize_t len)
|
||||
CAMLexport value alloc_string (mlsize_t len)
|
||||
{
|
||||
value result;
|
||||
mlsize_t offset_index;
|
||||
|
@ -82,13 +82,14 @@ value alloc_string (mlsize_t len)
|
|||
return result;
|
||||
}
|
||||
|
||||
value alloc_final (mlsize_t len, final_fun fun, mlsize_t mem, mlsize_t max)
|
||||
CAMLexport value alloc_final (mlsize_t len, final_fun fun,
|
||||
mlsize_t mem, mlsize_t max)
|
||||
{
|
||||
return alloc_custom(final_custom_operations(fun),
|
||||
len * sizeof(value), mem, max);
|
||||
}
|
||||
|
||||
value copy_string(char const *s)
|
||||
CAMLexport value copy_string(char const *s)
|
||||
{
|
||||
int len;
|
||||
value res;
|
||||
|
@ -99,7 +100,7 @@ value copy_string(char const *s)
|
|||
return res;
|
||||
}
|
||||
|
||||
value alloc_array(value (*funct)(char const *), char const ** arr)
|
||||
CAMLexport value alloc_array(value (*funct)(char const *), char const ** arr)
|
||||
{
|
||||
CAMLparam0 ();
|
||||
mlsize_t nbr, n;
|
||||
|
@ -122,12 +123,12 @@ value alloc_array(value (*funct)(char const *), char const ** arr)
|
|||
}
|
||||
}
|
||||
|
||||
value copy_string_array(char const ** arr)
|
||||
CAMLexport value copy_string_array(char const ** arr)
|
||||
{
|
||||
return alloc_array(copy_string, arr);
|
||||
}
|
||||
|
||||
int convert_flag_list(value list, int *flags)
|
||||
CAMLexport int convert_flag_list(value list, int *flags)
|
||||
{
|
||||
int res;
|
||||
res = 0;
|
||||
|
@ -140,7 +141,7 @@ int convert_flag_list(value list, int *flags)
|
|||
|
||||
/* For compiling let rec over values */
|
||||
|
||||
value alloc_dummy(value size) /* ML */
|
||||
CAMLprim value alloc_dummy(value size)
|
||||
{
|
||||
mlsize_t wosize = Int_val(size);
|
||||
|
||||
|
@ -148,7 +149,7 @@ value alloc_dummy(value size) /* ML */
|
|||
return alloc (wosize, 0);
|
||||
}
|
||||
|
||||
value update_dummy(value dummy, value newval) /* ML */
|
||||
CAMLprim value update_dummy(value dummy, value newval)
|
||||
{
|
||||
mlsize_t size, i;
|
||||
size = Wosize_val(newval);
|
||||
|
|
|
@ -19,24 +19,25 @@
|
|||
#include "misc.h"
|
||||
#include "mlvalues.h"
|
||||
|
||||
value alloc (mlsize_t, tag_t);
|
||||
value alloc_small (mlsize_t, tag_t);
|
||||
value alloc_tuple (mlsize_t);
|
||||
value alloc_string (mlsize_t);
|
||||
value copy_string (char const *);
|
||||
value copy_string_array (char const **);
|
||||
value copy_double (double);
|
||||
value copy_int32 (int32); /* defined in [ints.c] */
|
||||
value copy_int64 (int64); /* defined in [ints.c] */
|
||||
value copy_nativeint (long); /* defined in [ints.c] */
|
||||
value alloc_array (value (*funct) (char const *), char const ** array);
|
||||
CAMLextern value alloc (mlsize_t, tag_t);
|
||||
CAMLextern value alloc_small (mlsize_t, tag_t);
|
||||
CAMLextern value alloc_tuple (mlsize_t);
|
||||
CAMLextern value alloc_string (mlsize_t);
|
||||
CAMLextern value copy_string (char const *);
|
||||
CAMLextern value copy_string_array (char const **);
|
||||
CAMLextern value copy_double (double);
|
||||
CAMLextern value copy_int32 (int32); /* defined in [ints.c] */
|
||||
CAMLextern value copy_int64 (int64); /* defined in [ints.c] */
|
||||
CAMLextern value copy_nativeint (long); /* defined in [ints.c] */
|
||||
CAMLextern value alloc_array (value (*funct) (char const *),
|
||||
char const ** array);
|
||||
|
||||
typedef void (*final_fun)(value);
|
||||
value alloc_final (mlsize_t /*size in words*/,
|
||||
final_fun, /*finalization function*/
|
||||
mlsize_t, /*resources consumed*/
|
||||
mlsize_t /*max resources*/);
|
||||
CAMLextern value alloc_final (mlsize_t /*size in words*/,
|
||||
final_fun, /*finalization function*/
|
||||
mlsize_t, /*resources consumed*/
|
||||
mlsize_t /*max resources*/);
|
||||
|
||||
int convert_flag_list (value, int *);
|
||||
CAMLextern int convert_flag_list (value, int *);
|
||||
|
||||
#endif /* _alloc_ */
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
|
||||
#ifndef NATIVE_CODE
|
||||
|
||||
value array_get_addr(value array, value index) /* ML */
|
||||
CAMLprim value array_get_addr(value array, value index)
|
||||
{
|
||||
long idx = Long_val(index);
|
||||
if (idx < 0 || idx >= Wosize_val(array)) invalid_argument("Array.get");
|
||||
return Field(array, idx);
|
||||
}
|
||||
|
||||
value array_get_float(value array, value index) /* ML */
|
||||
CAMLprim value array_get_float(value array, value index)
|
||||
{
|
||||
long idx = Long_val(index);
|
||||
double d;
|
||||
|
@ -47,7 +47,7 @@ value array_get_float(value array, value index) /* ML */
|
|||
return res;
|
||||
}
|
||||
|
||||
value array_get(value array, value index) /* ML */
|
||||
CAMLprim value array_get(value array, value index)
|
||||
{
|
||||
if (Tag_val(array) == Double_array_tag)
|
||||
return array_get_float(array, index);
|
||||
|
@ -55,7 +55,7 @@ value array_get(value array, value index) /* ML */
|
|||
return array_get_addr(array, index);
|
||||
}
|
||||
|
||||
value array_set_addr(value array, value index, value newval) /* ML */
|
||||
CAMLprim value array_set_addr(value array, value index, value newval)
|
||||
{
|
||||
long idx = Long_val(index);
|
||||
if (idx < 0 || idx >= Wosize_val(array)) invalid_argument("Array.set");
|
||||
|
@ -63,7 +63,7 @@ value array_set_addr(value array, value index, value newval) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value array_set_float(value array, value index, value newval) /* ML */
|
||||
CAMLprim value array_set_float(value array, value index, value newval)
|
||||
{
|
||||
long idx = Long_val(index);
|
||||
if (idx < 0 || idx >= Wosize_val(array) / Double_wosize)
|
||||
|
@ -72,7 +72,7 @@ value array_set_float(value array, value index, value newval) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value array_set(value array, value index, value newval) /* ML */
|
||||
CAMLprim value array_set(value array, value index, value newval)
|
||||
{
|
||||
if (Tag_val(array) == Double_array_tag)
|
||||
return array_set_float(array, index, newval);
|
||||
|
@ -80,7 +80,7 @@ value array_set(value array, value index, value newval) /* ML */
|
|||
return array_set_addr(array, index, newval);
|
||||
}
|
||||
|
||||
value array_unsafe_get_float(value array, value index) /* ML */
|
||||
CAMLprim value array_unsafe_get_float(value array, value index)
|
||||
{
|
||||
double d;
|
||||
value res;
|
||||
|
@ -95,7 +95,7 @@ value array_unsafe_get_float(value array, value index) /* ML */
|
|||
return res;
|
||||
}
|
||||
|
||||
value array_unsafe_get(value array, value index) /* ML */
|
||||
CAMLprim value array_unsafe_get(value array, value index)
|
||||
{
|
||||
if (Tag_val(array) == Double_array_tag)
|
||||
return array_unsafe_get_float(array, index);
|
||||
|
@ -103,20 +103,20 @@ value array_unsafe_get(value array, value index) /* ML */
|
|||
return Field(array, Long_val(index));
|
||||
}
|
||||
|
||||
value array_unsafe_set_addr(value array, value index, value newval) /* ML */
|
||||
CAMLprim value array_unsafe_set_addr(value array, value index, value newval)
|
||||
{
|
||||
long idx = Long_val(index);
|
||||
Modify(&Field(array, idx), newval);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value array_unsafe_set_float(value array, value index, value newval) /* ML */
|
||||
CAMLprim value array_unsafe_set_float(value array, value index, value newval)
|
||||
{
|
||||
Store_double_field(array, Long_val(index), Double_val(newval));
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value array_unsafe_set(value array, value index, value newval) /* ML */
|
||||
CAMLprim value array_unsafe_set(value array, value index, value newval)
|
||||
{
|
||||
if (Tag_val(array) == Double_array_tag)
|
||||
return array_unsafe_set_float(array, index, newval);
|
||||
|
@ -126,7 +126,7 @@ value array_unsafe_set(value array, value index, value newval) /* ML */
|
|||
|
||||
#endif
|
||||
|
||||
value make_vect(value len, value init) /* ML */
|
||||
CAMLprim value make_vect(value len, value init)
|
||||
{
|
||||
CAMLparam2 (len, init);
|
||||
CAMLlocal1 (res);
|
||||
|
@ -168,7 +168,7 @@ value make_vect(value len, value init) /* ML */
|
|||
CAMLreturn (res);
|
||||
}
|
||||
|
||||
value make_array(value init) /* ML */
|
||||
CAMLprim value make_array(value init)
|
||||
{
|
||||
CAMLparam1 (init);
|
||||
mlsize_t wsize, size, i;
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
#include "sys.h"
|
||||
#include "backtrace.h"
|
||||
|
||||
int backtrace_active = 0;
|
||||
int backtrace_pos = 0;
|
||||
code_t * backtrace_buffer = NULL;
|
||||
CAMLexport int backtrace_active = 0;
|
||||
CAMLexport int backtrace_pos = 0;
|
||||
CAMLexport code_t * backtrace_buffer = NULL;
|
||||
#define BACKTRACE_BUFFER_SIZE 1024
|
||||
|
||||
/* Location of fields in the Instruct.debug_event record */
|
||||
|
@ -162,7 +162,7 @@ static void print_location(value events, code_t pc)
|
|||
|
||||
/* Print a backtrace */
|
||||
|
||||
void print_exception_backtrace(void)
|
||||
CAMLexport void print_exception_backtrace(void)
|
||||
{
|
||||
value events;
|
||||
int i, nrepeat;
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include "mlvalues.h"
|
||||
|
||||
extern int backtrace_active;
|
||||
extern int backtrace_pos;
|
||||
extern code_t * backtrace_buffer;
|
||||
CAMLextern int backtrace_active;
|
||||
CAMLextern int backtrace_pos;
|
||||
CAMLextern code_t * backtrace_buffer;
|
||||
|
||||
extern void stash_backtrace(code_t pc, value * sp);
|
||||
extern void print_exception_backtrace(void);
|
||||
CAMLextern void print_exception_backtrace(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -51,7 +51,7 @@ static void thread_callback(void)
|
|||
|
||||
#endif
|
||||
|
||||
value callbackN_exn(value closure, int narg, value args[])
|
||||
CAMLexport value callbackN_exn(value closure, int narg, value args[])
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -68,14 +68,14 @@ value callbackN_exn(value closure, int narg, value args[])
|
|||
return interprete(callback_code, sizeof(callback_code));
|
||||
}
|
||||
|
||||
value callback_exn(value closure, value arg1)
|
||||
CAMLexport value callback_exn(value closure, value arg1)
|
||||
{
|
||||
value arg[1];
|
||||
arg[0] = arg1;
|
||||
return callbackN_exn(closure, 1, arg);
|
||||
}
|
||||
|
||||
value callback2_exn(value closure, value arg1, value arg2)
|
||||
CAMLexport value callback2_exn(value closure, value arg1, value arg2)
|
||||
{
|
||||
value arg[2];
|
||||
arg[0] = arg1;
|
||||
|
@ -83,7 +83,8 @@ value callback2_exn(value closure, value arg1, value arg2)
|
|||
return callbackN_exn(closure, 2, arg);
|
||||
}
|
||||
|
||||
value callback3_exn(value closure, value arg1, value arg2, value arg3)
|
||||
CAMLexport value callback3_exn(value closure,
|
||||
value arg1, value arg2, value arg3)
|
||||
{
|
||||
value arg[3];
|
||||
arg[0] = arg1;
|
||||
|
@ -96,7 +97,7 @@ value callback3_exn(value closure, value arg1, value arg2, value arg3)
|
|||
|
||||
/* Native-code callbacks. callback[123]_exn are implemented in asm. */
|
||||
|
||||
value callbackN_exn(value closure, int narg, value args[])
|
||||
CAMLexport value callbackN_exn(value closure, int narg, value args[])
|
||||
{
|
||||
CAMLparam1 (closure);
|
||||
CAMLxparamN (args, narg);
|
||||
|
@ -131,28 +132,28 @@ value callbackN_exn(value closure, int narg, value args[])
|
|||
|
||||
/* Exception-propagating variants of the above */
|
||||
|
||||
value callback (value closure, value arg)
|
||||
CAMLexport value callback (value closure, value arg)
|
||||
{
|
||||
value res = callback_exn(closure, arg);
|
||||
if (Is_exception_result(res)) mlraise(Extract_exception(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
value callback2 (value closure, value arg1, value arg2)
|
||||
CAMLexport value callback2 (value closure, value arg1, value arg2)
|
||||
{
|
||||
value res = callback2_exn(closure, arg1, arg2);
|
||||
if (Is_exception_result(res)) mlraise(Extract_exception(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
value callback3 (value closure, value arg1, value arg2, value arg3)
|
||||
CAMLexport value callback3 (value closure, value arg1, value arg2, value arg3)
|
||||
{
|
||||
value res = callback3_exn(closure, arg1, arg2, arg3);
|
||||
if (Is_exception_result(res)) mlraise(Extract_exception(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
value callbackN (value closure, int narg, value args[])
|
||||
CAMLexport value callbackN (value closure, int narg, value args[])
|
||||
{
|
||||
value res = callbackN_exn(closure, narg, args);
|
||||
if (Is_exception_result(res)) mlraise(Extract_exception(res));
|
||||
|
@ -178,7 +179,7 @@ static unsigned int hash_value_name(char *name)
|
|||
return h % Named_value_size;
|
||||
}
|
||||
|
||||
value register_named_value(value vname, value val) /* ML */
|
||||
CAMLprim value register_named_value(value vname, value val)
|
||||
{
|
||||
struct named_value * nv;
|
||||
char * name = String_val(vname);
|
||||
|
@ -194,7 +195,7 @@ value register_named_value(value vname, value val) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value * caml_named_value(char *name)
|
||||
CAMLexport value * caml_named_value(char *name)
|
||||
{
|
||||
struct named_value * nv;
|
||||
for (nv = named_value_table[hash_value_name(name)];
|
||||
|
|
|
@ -19,26 +19,28 @@
|
|||
|
||||
#include "mlvalues.h"
|
||||
|
||||
value callback (value closure, value arg);
|
||||
value callback2 (value closure, value arg1, value arg2);
|
||||
value callback3 (value closure, value arg1, value arg2, value arg3);
|
||||
value callbackN (value closure, int narg, value args[]);
|
||||
CAMLextern value callback (value closure, value arg);
|
||||
CAMLextern value callback2 (value closure, value arg1, value arg2);
|
||||
CAMLextern value callback3 (value closure, value arg1, value arg2, value arg3);
|
||||
CAMLextern value callbackN (value closure, int narg, value args[]);
|
||||
|
||||
value callback_exn (value closure, value arg);
|
||||
value callback2_exn (value closure, value arg1, value arg2);
|
||||
value callback3_exn (value closure, value arg1, value arg2, value arg3);
|
||||
value callbackN_exn (value closure, int narg, value args[]);
|
||||
CAMLextern value callback_exn (value closure, value arg);
|
||||
CAMLextern value callback2_exn (value closure, value arg1, value arg2);
|
||||
CAMLextern value callback3_exn (value closure,
|
||||
value arg1, value arg2, value arg3);
|
||||
CAMLextern value callbackN_exn (value closure, int narg, value args[]);
|
||||
|
||||
#define Make_exception_result(v) ((v) | 2)
|
||||
#define Is_exception_result(v) (((v) & 3) == 2)
|
||||
#define Extract_exception(v) ((v) & ~3)
|
||||
char * format_caml_exception(value exn);
|
||||
|
||||
value * caml_named_value (char * name);
|
||||
CAMLextern char * format_caml_exception(value exn); /* in [printexc.c] */
|
||||
|
||||
void caml_main (char ** argv);
|
||||
void caml_startup (char ** argv);
|
||||
CAMLextern value * caml_named_value (char * name);
|
||||
|
||||
extern int callback_depth;
|
||||
CAMLextern void caml_main (char ** argv);
|
||||
CAMLextern void caml_startup (char ** argv);
|
||||
|
||||
CAMLextern int callback_depth;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include "config.h"
|
||||
#include "misc.h"
|
||||
|
||||
void compact_heap (void);
|
||||
void compact_heap_maybe (void);
|
||||
extern void compact_heap (void);
|
||||
extern void compact_heap_maybe (void);
|
||||
|
||||
|
||||
#endif /* _compact_ */
|
||||
|
|
|
@ -182,7 +182,7 @@ static long compare_val(value v1, value v2)
|
|||
}
|
||||
}
|
||||
|
||||
value compare(value v1, value v2) /* ML */
|
||||
CAMLprim value compare(value v1, value v2)
|
||||
{
|
||||
long res = compare_val(v1, v2);
|
||||
/* Free stack if needed */
|
||||
|
@ -195,42 +195,42 @@ value compare(value v1, value v2) /* ML */
|
|||
return Val_int(0);
|
||||
}
|
||||
|
||||
value equal(value v1, value v2) /* ML */
|
||||
CAMLprim value equal(value v1, value v2)
|
||||
{
|
||||
long res = compare_val(v1, v2);
|
||||
if (compare_stack != compare_stack_init) compare_free_stack();
|
||||
return Val_int(res == 0);
|
||||
}
|
||||
|
||||
value notequal(value v1, value v2) /* ML */
|
||||
CAMLprim value notequal(value v1, value v2)
|
||||
{
|
||||
long res = compare_val(v1, v2);
|
||||
if (compare_stack != compare_stack_init) compare_free_stack();
|
||||
return Val_int(res != 0);
|
||||
}
|
||||
|
||||
value lessthan(value v1, value v2) /* ML */
|
||||
CAMLprim value lessthan(value v1, value v2)
|
||||
{
|
||||
long res = compare_val(v1, v2);
|
||||
if (compare_stack != compare_stack_init) compare_free_stack();
|
||||
return Val_int(res < 0);
|
||||
}
|
||||
|
||||
value lessequal(value v1, value v2) /* ML */
|
||||
CAMLprim value lessequal(value v1, value v2)
|
||||
{
|
||||
long res = compare_val(v1, v2);
|
||||
if (compare_stack != compare_stack_init) compare_free_stack();
|
||||
return Val_int(res <= 0);
|
||||
}
|
||||
|
||||
value greaterthan(value v1, value v2) /* ML */
|
||||
CAMLprim value greaterthan(value v1, value v2)
|
||||
{
|
||||
long res = compare_val(v1, v2);
|
||||
if (compare_stack != compare_stack_init) compare_free_stack();
|
||||
return Val_int(res > 0);
|
||||
}
|
||||
|
||||
value greaterequal(value v1, value v2) /* ML */
|
||||
CAMLprim value greaterequal(value v1, value v2)
|
||||
{
|
||||
long res = compare_val(v1, v2);
|
||||
if (compare_stack != compare_stack_init) compare_free_stack();
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#include "memory.h"
|
||||
#include "mlvalues.h"
|
||||
|
||||
value alloc_custom(struct custom_operations * ops,
|
||||
unsigned long size,
|
||||
mlsize_t mem,
|
||||
mlsize_t max)
|
||||
CAMLextern value alloc_custom(struct custom_operations * ops,
|
||||
unsigned long size,
|
||||
mlsize_t mem,
|
||||
mlsize_t max)
|
||||
{
|
||||
mlsize_t wosize;
|
||||
value result;
|
||||
|
@ -41,14 +41,14 @@ value alloc_custom(struct custom_operations * ops,
|
|||
return result;
|
||||
}
|
||||
|
||||
int custom_compare_default(value v1, value v2)
|
||||
CAMLextern int custom_compare_default(value v1, value v2)
|
||||
{
|
||||
failwith("equal: abstract value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void custom_serialize_default(value v, unsigned long * wsize_32,
|
||||
unsigned long * wsize_64)
|
||||
CAMLextern void custom_serialize_default(value v, unsigned long * wsize_32,
|
||||
unsigned long * wsize_64)
|
||||
{
|
||||
failwith("output_value: abstract value");
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ struct custom_operations_list {
|
|||
|
||||
static struct custom_operations_list * custom_ops_table = NULL;
|
||||
|
||||
void register_custom_operations(struct custom_operations * ops)
|
||||
CAMLextern void register_custom_operations(struct custom_operations * ops)
|
||||
{
|
||||
struct custom_operations_list * l =
|
||||
stat_alloc(sizeof(struct custom_operations_list));
|
||||
|
|
|
@ -30,23 +30,23 @@ struct custom_operations {
|
|||
};
|
||||
|
||||
#define custom_finalize_default NULL
|
||||
extern int custom_compare_default(value v1, value v2);
|
||||
CAMLextern int custom_compare_default(value v1, value v2);
|
||||
#define custom_hash_default NULL
|
||||
extern void custom_serialize_default(value v, unsigned long * wsize_32,
|
||||
unsigned long * wsize_64);
|
||||
CAMLextern void custom_serialize_default(value v, unsigned long * wsize_32,
|
||||
unsigned long * wsize_64);
|
||||
#define custom_deserialize_default NULL
|
||||
|
||||
#define Custom_ops_val(v) (*((struct custom_operations **) (v)))
|
||||
|
||||
value alloc_custom(struct custom_operations * ops,
|
||||
unsigned long size, /*size in bytes*/
|
||||
mlsize_t mem, /*resources consumed*/
|
||||
mlsize_t max /*max resources*/);
|
||||
CAMLextern value alloc_custom(struct custom_operations * ops,
|
||||
unsigned long size, /*size in bytes*/
|
||||
mlsize_t mem, /*resources consumed*/
|
||||
mlsize_t max /*max resources*/);
|
||||
|
||||
void register_custom_operations(struct custom_operations * ops);
|
||||
struct custom_operations * find_custom_operations(char * ident);
|
||||
struct custom_operations * final_custom_operations(void (*fn)(value));
|
||||
CAMLextern void register_custom_operations(struct custom_operations * ops);
|
||||
extern struct custom_operations * find_custom_operations(char * ident);
|
||||
extern struct custom_operations * final_custom_operations(void (*fn)(value));
|
||||
|
||||
void init_custom_operations(void);
|
||||
extern void init_custom_operations(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,212 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* Objective Caml */
|
||||
/* */
|
||||
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
||||
/* */
|
||||
/* Copyright 2000 Institut National de Recherche en Informatique et */
|
||||
/* en Automatique. All rights reserved. This file is distributed */
|
||||
/* under the terms of the GNU Library General Public License. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* Dynamic loading of C primitives. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "config.h"
|
||||
#ifdef HAS_UNISTD
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "alloc.h"
|
||||
#include "dynlink.h"
|
||||
#include "fail.h"
|
||||
#include "mlvalues.h"
|
||||
#include "memory.h"
|
||||
#include "misc.h"
|
||||
#include "osdeps.h"
|
||||
#include "prims.h"
|
||||
|
||||
/* The table of primitives */
|
||||
struct ext_table prim_table;
|
||||
|
||||
/* The table of shared libraries currently opened */
|
||||
static struct ext_table shared_libs;
|
||||
|
||||
/* The search path for shared libraries */
|
||||
struct ext_table shared_libs_path;
|
||||
|
||||
/* Look up the given primitive name in the built-in primitive table,
|
||||
then in the opened shared libraries (shared_libs) */
|
||||
static c_primitive lookup_primitive(char * name)
|
||||
{
|
||||
int i;
|
||||
void * res;
|
||||
|
||||
for (i = 0; names_of_builtin_cprim[i] != NULL; i++) {
|
||||
if (strcmp(name, names_of_builtin_cprim[i]) == 0)
|
||||
return builtin_cprim[i];
|
||||
}
|
||||
for (i = 0; i < shared_libs.size; i++) {
|
||||
res = caml_dlsym(shared_libs.contents[i], name);
|
||||
if (res != NULL) return (c_primitive) res;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Parse the OCAML_STDLIB_DIR/ld.conf file and add the directories
|
||||
listed there to the search path */
|
||||
|
||||
#define LD_CONF_NAME "ld.conf"
|
||||
|
||||
static char * parse_ld_conf(void)
|
||||
{
|
||||
char * stdlib, * ldconfname, * config, * p, * q;
|
||||
struct stat st;
|
||||
int ldconf, nread;
|
||||
|
||||
stdlib = getenv("CAMLLIB");
|
||||
if (stdlib == NULL) stdlib = OCAML_STDLIB_DIR;
|
||||
ldconfname = stat_alloc(strlen(stdlib) + 2 + sizeof(LD_CONF_NAME));
|
||||
strcpy(ldconfname, stdlib);
|
||||
strcat(ldconfname, "/" LD_CONF_NAME);
|
||||
if (stat(ldconfname, &st) == -1) {
|
||||
stat_free(ldconfname);
|
||||
return NULL;
|
||||
}
|
||||
ldconf = open(ldconfname, O_RDONLY, 0);
|
||||
if (ldconf == -1)
|
||||
fatal_error_arg("Fatal error: cannot read loader config file %s\n",
|
||||
ldconfname);
|
||||
config = stat_alloc(st.st_size + 1);
|
||||
nread = read(ldconf, config, st.st_size);
|
||||
if (nread == -1)
|
||||
fatal_error_arg("Fatal error: error while reading loader config file %s\n",
|
||||
ldconfname);
|
||||
config[nread] = 0;
|
||||
q = config;
|
||||
for (p = config; *p != 0; p++) {
|
||||
if (*p == '\n') {
|
||||
*p = 0;
|
||||
ext_table_add(&shared_libs_path, q);
|
||||
q = p + 1;
|
||||
}
|
||||
}
|
||||
close(ldconf);
|
||||
stat_free(ldconfname);
|
||||
return config;
|
||||
}
|
||||
|
||||
/* Open the given shared library and add it to shared_libs.
|
||||
Abort on error. */
|
||||
static void open_shared_lib(char * name)
|
||||
{
|
||||
char * realname;
|
||||
void * handle;
|
||||
|
||||
realname = search_dll_in_path(&shared_libs_path, name);
|
||||
gc_message(0x100, "Loading shared library %s\n", (unsigned long) realname);
|
||||
handle = caml_dlopen(realname);
|
||||
if (handle == NULL)
|
||||
fatal_error_arg2("Fatal error: cannot load shared library %s\n", name,
|
||||
"Reason: %s\n", caml_dlerror());
|
||||
ext_table_add(&shared_libs, handle);
|
||||
stat_free(realname);
|
||||
}
|
||||
|
||||
/* Build the table of primitives, given a search path and a list
|
||||
of shared libraries (both 0-separated in a char array).
|
||||
Abort the runtime system on error. */
|
||||
void build_primitive_table(char * lib_path,
|
||||
char * libs,
|
||||
char * req_prims)
|
||||
{
|
||||
char * tofree1, * tofree2;
|
||||
char * p;
|
||||
|
||||
/* Initialize the search path for dynamic libraries:
|
||||
- directories specified on the command line with the -I option
|
||||
- directories specified in the CAML_LD_LIBRARY_PATH
|
||||
- directories specified in the executable
|
||||
- directories specified in the file <stdlib>/ld.conf */
|
||||
tofree1 = decompose_path(&shared_libs_path, getenv("CAML_LD_LIBRARY_PATH"));
|
||||
if (lib_path != NULL)
|
||||
for (p = lib_path; *p != 0; p += strlen(p) + 1)
|
||||
ext_table_add(&shared_libs_path, p);
|
||||
tofree2 = parse_ld_conf();
|
||||
/* Open the shared libraries */
|
||||
ext_table_init(&shared_libs, 8);
|
||||
if (libs != NULL)
|
||||
for (p = libs; *p != 0; p += strlen(p) + 1)
|
||||
open_shared_lib(p);
|
||||
/* Build the primitive table */
|
||||
ext_table_init(&prim_table, 0x180);
|
||||
for (p = req_prims; *p != 0; p += strlen(p) + 1) {
|
||||
c_primitive prim = lookup_primitive(p);
|
||||
if (prim == NULL)
|
||||
fatal_error_arg("Fatal error: unknown C primitive `%s'\n", p);
|
||||
ext_table_add(&prim_table, (void *) prim);
|
||||
}
|
||||
/* Clean up */
|
||||
stat_free(tofree1);
|
||||
stat_free(tofree2);
|
||||
ext_table_free(&shared_libs_path, 0);
|
||||
}
|
||||
|
||||
/** dlopen interface for the bytecode linker **/
|
||||
|
||||
#define Handle_val(v) (*((void **) (v)))
|
||||
|
||||
CAMLprim value dynlink_open_lib(value filename)
|
||||
{
|
||||
void * handle;
|
||||
value result;
|
||||
|
||||
handle = caml_dlopen(String_val(filename));
|
||||
if (handle == NULL) failwith(caml_dlerror());
|
||||
result = alloc_small(1, Abstract_tag);
|
||||
Handle_val(result) = handle;
|
||||
return result;
|
||||
}
|
||||
|
||||
CAMLprim value dynlink_close_lib(value handle)
|
||||
{
|
||||
caml_dlclose(Handle_val(handle));
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
CAMLprim value dynlink_lookup_symbol(value handle, value symbolname)
|
||||
{
|
||||
void * symb;
|
||||
value result;
|
||||
symb = caml_dlsym(Handle_val(handle), String_val(symbolname));
|
||||
if (symb == NULL) failwith(caml_dlerror());
|
||||
result = alloc_small(1, Abstract_tag);
|
||||
Handle_val(result) = symb;
|
||||
return result;
|
||||
}
|
||||
|
||||
CAMLprim value dynlink_add_primitive(value handle)
|
||||
{
|
||||
return Val_int(ext_table_add(&prim_table, Handle_val(handle)));
|
||||
}
|
||||
|
||||
CAMLprim value dynlink_get_current_libs(value unit)
|
||||
{
|
||||
CAMLparam0();
|
||||
CAMLlocal1(res);
|
||||
int i;
|
||||
|
||||
res = alloc_tuple(shared_libs.size);
|
||||
for (i = 0; i < shared_libs.size; i++) {
|
||||
value v = alloc_small(1, Abstract_tag);
|
||||
Handle_val(v) = shared_libs.contents[i];
|
||||
Store_field(res, i, v);
|
||||
}
|
||||
CAMLreturn(res);
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* Objective Caml */
|
||||
/* */
|
||||
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
||||
/* */
|
||||
/* Copyright 2000 Institut National de Recherche en Informatique et */
|
||||
/* en Automatique. All rights reserved. This file is distributed */
|
||||
/* under the terms of the GNU Library General Public License. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* Dynamic loading of C primitives. */
|
||||
|
||||
#ifndef _dynlink_
|
||||
#define _dynlink_
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
/* Build the table of primitives, given a search path, a list
|
||||
of shared libraries, and a list of primitive names
|
||||
(all three 0-separated in char arrays).
|
||||
Abort the runtime system on error. */
|
||||
extern void build_primitive_table(char * lib_path,
|
||||
char * libs,
|
||||
char * req_prims);
|
||||
|
||||
/* The search path for shared libraries */
|
||||
extern struct ext_table shared_libs_path;
|
||||
|
||||
#endif
|
|
@ -415,7 +415,7 @@ void output_val(struct channel *chan, value v, value flags)
|
|||
stat_free(block);
|
||||
}
|
||||
|
||||
value output_value(value vchan, value v, value flags) /* ML */
|
||||
CAMLprim value output_value(value vchan, value v, value flags)
|
||||
{
|
||||
CAMLparam3 (vchan, v, flags);
|
||||
struct channel * channel = Channel(vchan);
|
||||
|
@ -426,7 +426,7 @@ value output_value(value vchan, value v, value flags) /* ML */
|
|||
CAMLreturn (Val_unit);
|
||||
}
|
||||
|
||||
value output_value_to_string(value v, value flags) /* ML */
|
||||
CAMLprim value output_value_to_string(value v, value flags)
|
||||
{
|
||||
long len;
|
||||
value res;
|
||||
|
@ -438,7 +438,8 @@ value output_value_to_string(value v, value flags) /* ML */
|
|||
return res;
|
||||
}
|
||||
|
||||
value output_value_to_buffer(value buf, value ofs, value len, value v, value flags) /* ML */
|
||||
CAMLprim value output_value_to_buffer(value buf, value ofs, value len,
|
||||
value v, value flags)
|
||||
{
|
||||
long len_res;
|
||||
extern_block = &Byte(buf, Long_val(ofs));
|
||||
|
@ -449,8 +450,8 @@ value output_value_to_buffer(value buf, value ofs, value len, value v, value fla
|
|||
return Val_long(len_res);
|
||||
}
|
||||
|
||||
void output_value_to_malloc(value v, value flags,
|
||||
/*out*/ char ** buf, /*out*/ long * len)
|
||||
CAMLexport void output_value_to_malloc(value v, value flags,
|
||||
/*out*/ char ** buf, /*out*/ long * len)
|
||||
{
|
||||
long len_res;
|
||||
alloc_extern_block();
|
||||
|
@ -461,14 +462,14 @@ void output_value_to_malloc(value v, value flags,
|
|||
|
||||
/* Functions for writing user-defined marshallers */
|
||||
|
||||
void serialize_int_1(int i)
|
||||
CAMLexport void serialize_int_1(int i)
|
||||
{
|
||||
if (extern_ptr + 1 > extern_limit) resize_extern_block(1);
|
||||
extern_ptr[0] = i;
|
||||
extern_ptr += 1;
|
||||
}
|
||||
|
||||
void serialize_int_2(int i)
|
||||
CAMLexport void serialize_int_2(int i)
|
||||
{
|
||||
if (extern_ptr + 2 > extern_limit) resize_extern_block(2);
|
||||
extern_ptr[0] = i >> 8;
|
||||
|
@ -476,7 +477,7 @@ void serialize_int_2(int i)
|
|||
extern_ptr += 2;
|
||||
}
|
||||
|
||||
void serialize_int_4(int32 i)
|
||||
CAMLexport void serialize_int_4(int32 i)
|
||||
{
|
||||
if (extern_ptr + 4 > extern_limit) resize_extern_block(4);
|
||||
extern_ptr[0] = i >> 24;
|
||||
|
@ -486,29 +487,29 @@ void serialize_int_4(int32 i)
|
|||
extern_ptr += 4;
|
||||
}
|
||||
|
||||
void serialize_int_8(int64 i)
|
||||
CAMLexport void serialize_int_8(int64 i)
|
||||
{
|
||||
serialize_block_8(&i, 1);
|
||||
}
|
||||
|
||||
void serialize_float_4(float f)
|
||||
CAMLexport void serialize_float_4(float f)
|
||||
{
|
||||
serialize_block_4(&f, 1);
|
||||
}
|
||||
|
||||
void serialize_float_8(double f)
|
||||
CAMLexport void serialize_float_8(double f)
|
||||
{
|
||||
serialize_block_8(&f, 1);
|
||||
}
|
||||
|
||||
void serialize_block_1(void * data, long len)
|
||||
CAMLexport void serialize_block_1(void * data, long len)
|
||||
{
|
||||
if (extern_ptr + len > extern_limit) resize_extern_block(len);
|
||||
memmove(extern_ptr, data, len);
|
||||
extern_ptr += len;
|
||||
}
|
||||
|
||||
void serialize_block_2(void * data, long len)
|
||||
CAMLexport void serialize_block_2(void * data, long len)
|
||||
{
|
||||
unsigned char * p;
|
||||
char * q;
|
||||
|
@ -523,7 +524,7 @@ void serialize_block_2(void * data, long len)
|
|||
#endif
|
||||
}
|
||||
|
||||
void serialize_block_4(void * data, long len)
|
||||
CAMLexport void serialize_block_4(void * data, long len)
|
||||
{
|
||||
unsigned char * p;
|
||||
char * q;
|
||||
|
@ -538,7 +539,7 @@ void serialize_block_4(void * data, long len)
|
|||
#endif
|
||||
}
|
||||
|
||||
void serialize_block_8(void * data, long len)
|
||||
CAMLexport void serialize_block_8(void * data, long len)
|
||||
{
|
||||
unsigned char * p;
|
||||
char * q;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
struct longjmp_buffer * external_raise = NULL;
|
||||
value exn_bucket;
|
||||
|
||||
void mlraise(value v)
|
||||
CAMLexport void mlraise(value v)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
extern int volatile async_signal_mode; /* from signals.c */
|
||||
|
@ -40,7 +40,7 @@ void mlraise(value v)
|
|||
siglongjmp(external_raise->buf, 1);
|
||||
}
|
||||
|
||||
void raise_constant(value tag)
|
||||
CAMLexport void raise_constant(value tag)
|
||||
{
|
||||
CAMLparam1 (tag);
|
||||
CAMLlocal1 (bucket);
|
||||
|
@ -50,7 +50,7 @@ void raise_constant(value tag)
|
|||
mlraise(bucket);
|
||||
}
|
||||
|
||||
void raise_with_arg(value tag, value arg)
|
||||
CAMLexport void raise_with_arg(value tag, value arg)
|
||||
{
|
||||
CAMLparam2 (tag, arg);
|
||||
CAMLlocal1 (bucket);
|
||||
|
@ -61,7 +61,7 @@ void raise_with_arg(value tag, value arg)
|
|||
mlraise(bucket);
|
||||
}
|
||||
|
||||
void raise_with_string(value tag, char *msg)
|
||||
CAMLexport void raise_with_string(value tag, char *msg)
|
||||
{
|
||||
CAMLparam1 (tag);
|
||||
CAMLlocal1 (vmsg);
|
||||
|
@ -70,12 +70,12 @@ void raise_with_string(value tag, char *msg)
|
|||
raise_with_arg(tag, vmsg);
|
||||
}
|
||||
|
||||
void failwith (char *msg)
|
||||
CAMLexport void failwith (char *msg)
|
||||
{
|
||||
raise_with_string(Field(global_data, FAILURE_EXN), msg);
|
||||
}
|
||||
|
||||
void invalid_argument (char *msg)
|
||||
CAMLexport void invalid_argument (char *msg)
|
||||
{
|
||||
raise_with_string(Field(global_data, INVALID_EXN), msg);
|
||||
}
|
||||
|
@ -89,39 +89,39 @@ static struct {
|
|||
value exn;
|
||||
} out_of_memory_bucket = { 0, 0 };
|
||||
|
||||
void raise_out_of_memory(void)
|
||||
CAMLexport void raise_out_of_memory(void)
|
||||
{
|
||||
if (out_of_memory_bucket.exn == 0)
|
||||
fatal_error("Fatal error: out of memory while raising Out_of_memory\n");
|
||||
mlraise((value) &(out_of_memory_bucket.exn));
|
||||
}
|
||||
|
||||
void raise_stack_overflow(void)
|
||||
CAMLexport void raise_stack_overflow(void)
|
||||
{
|
||||
raise_constant(Field(global_data, STACK_OVERFLOW_EXN));
|
||||
}
|
||||
|
||||
void raise_sys_error(value msg)
|
||||
CAMLexport void raise_sys_error(value msg)
|
||||
{
|
||||
raise_with_arg(Field(global_data, SYS_ERROR_EXN), msg);
|
||||
}
|
||||
|
||||
void raise_end_of_file(void)
|
||||
CAMLexport void raise_end_of_file(void)
|
||||
{
|
||||
raise_constant(Field(global_data, END_OF_FILE_EXN));
|
||||
}
|
||||
|
||||
void raise_zero_divide(void)
|
||||
CAMLexport void raise_zero_divide(void)
|
||||
{
|
||||
raise_constant(Field(global_data, ZERO_DIVIDE_EXN));
|
||||
}
|
||||
|
||||
void raise_not_found(void)
|
||||
CAMLexport void raise_not_found(void)
|
||||
{
|
||||
raise_constant(Field(global_data, NOT_FOUND_EXN));
|
||||
}
|
||||
|
||||
void raise_sys_blocked_io(void)
|
||||
CAMLexport void raise_sys_blocked_io(void)
|
||||
{
|
||||
raise_constant(Field(global_data, SYS_BLOCKED_IO));
|
||||
}
|
||||
|
|
|
@ -44,25 +44,25 @@ struct longjmp_buffer {
|
|||
#define siglongjmp(buf,val) longjmp(buf,val)
|
||||
#endif
|
||||
|
||||
extern struct longjmp_buffer * external_raise;
|
||||
CAMLextern struct longjmp_buffer * external_raise;
|
||||
extern value exn_bucket;
|
||||
|
||||
void mlraise (value bucket) Noreturn;
|
||||
void raise_constant (value tag) Noreturn;
|
||||
void raise_with_arg (value tag, value arg) Noreturn;
|
||||
void raise_with_string (value tag, char * msg) Noreturn;
|
||||
void failwith (char *) Noreturn;
|
||||
void invalid_argument (char *) Noreturn;
|
||||
void raise_out_of_memory (void) Noreturn;
|
||||
void raise_stack_overflow (void) Noreturn;
|
||||
void raise_sys_error (value) Noreturn;
|
||||
void raise_end_of_file (void) Noreturn;
|
||||
void raise_zero_divide (void) Noreturn;
|
||||
void raise_not_found (void) Noreturn;
|
||||
void init_exceptions (void);
|
||||
void array_bound_error (void) Noreturn;
|
||||
void raise_sys_blocked_io (void) Noreturn;
|
||||
CAMLextern void mlraise (value bucket) Noreturn;
|
||||
CAMLextern void raise_constant (value tag) Noreturn;
|
||||
CAMLextern void raise_with_arg (value tag, value arg) Noreturn;
|
||||
CAMLextern void raise_with_string (value tag, char * msg) Noreturn;
|
||||
CAMLextern void failwith (char *) Noreturn;
|
||||
CAMLextern void invalid_argument (char *) Noreturn;
|
||||
CAMLextern void raise_out_of_memory (void) Noreturn;
|
||||
CAMLextern void raise_stack_overflow (void) Noreturn;
|
||||
CAMLextern void raise_sys_error (value) Noreturn;
|
||||
CAMLextern void raise_end_of_file (void) Noreturn;
|
||||
CAMLextern void raise_zero_divide (void) Noreturn;
|
||||
CAMLextern void raise_not_found (void) Noreturn;
|
||||
CAMLextern void init_exceptions (void);
|
||||
CAMLextern void array_bound_error (void) Noreturn;
|
||||
CAMLextern void raise_sys_blocked_io (void) Noreturn;
|
||||
|
||||
extern void (*caml_reset_sigmask)(void);
|
||||
CAMLextern void (*caml_reset_sigmask)(void);
|
||||
|
||||
#endif /* _fail_ */
|
||||
|
|
|
@ -134,7 +134,7 @@ void final_empty_young (void)
|
|||
}
|
||||
|
||||
/* Put (f,v) in the recent set. */
|
||||
value final_register (value f, value v) /* ML */
|
||||
CAMLprim value final_register (value f, value v)
|
||||
{
|
||||
if (!(Is_block (v) && (Is_in_heap (v) || Is_young (v)))){
|
||||
invalid_argument ("Gc.finalise");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#ifdef ARCH_ALIGN_DOUBLE
|
||||
|
||||
double Double_val(value val)
|
||||
CAMLexport double Double_val(value val)
|
||||
{
|
||||
union { value v[2]; double d; } buffer;
|
||||
|
||||
|
@ -35,7 +35,7 @@ double Double_val(value val)
|
|||
return buffer.d;
|
||||
}
|
||||
|
||||
void Store_double_val(value val, double dbl)
|
||||
CAMLexport void Store_double_val(value val, double dbl)
|
||||
{
|
||||
union { value v[2]; double d; } buffer;
|
||||
|
||||
|
@ -47,7 +47,7 @@ void Store_double_val(value val, double dbl)
|
|||
|
||||
#endif
|
||||
|
||||
value copy_double(double d)
|
||||
CAMLexport value copy_double(double d)
|
||||
{
|
||||
value res;
|
||||
|
||||
|
@ -60,7 +60,7 @@ value copy_double(double d)
|
|||
return res;
|
||||
}
|
||||
|
||||
value format_float(value fmt, value arg) /* ML */
|
||||
CAMLprim value format_float(value fmt, value arg)
|
||||
{
|
||||
#define MAX_DIGITS 350
|
||||
/* Max number of decimal digits in a "natural" (not artificially padded)
|
||||
|
@ -101,67 +101,67 @@ value format_float(value fmt, value arg) /* ML */
|
|||
return res;
|
||||
}
|
||||
|
||||
value float_of_string(value s) /* ML */
|
||||
CAMLprim value float_of_string(value s)
|
||||
{
|
||||
return copy_double(atof(String_val(s)));
|
||||
}
|
||||
|
||||
value int_of_float(value f) /* ML */
|
||||
CAMLprim value int_of_float(value f)
|
||||
{
|
||||
return Val_long((long) Double_val(f));
|
||||
}
|
||||
|
||||
value float_of_int(value n) /* ML */
|
||||
CAMLprim value float_of_int(value n)
|
||||
{
|
||||
return copy_double((double) Long_val(n));
|
||||
}
|
||||
|
||||
value neg_float(value f) /* ML */
|
||||
CAMLprim value neg_float(value f)
|
||||
{
|
||||
return copy_double(- Double_val(f));
|
||||
}
|
||||
|
||||
value abs_float(value f) /* ML */
|
||||
CAMLprim value abs_float(value f)
|
||||
{
|
||||
return copy_double(fabs(Double_val(f)));
|
||||
}
|
||||
|
||||
value add_float(value f, value g) /* ML */
|
||||
CAMLprim value add_float(value f, value g)
|
||||
{
|
||||
return copy_double(Double_val(f) + Double_val(g));
|
||||
}
|
||||
|
||||
value sub_float(value f, value g) /* ML */
|
||||
CAMLprim value sub_float(value f, value g)
|
||||
{
|
||||
return copy_double(Double_val(f) - Double_val(g));
|
||||
}
|
||||
|
||||
value mul_float(value f, value g) /* ML */
|
||||
CAMLprim value mul_float(value f, value g)
|
||||
{
|
||||
return copy_double(Double_val(f) * Double_val(g));
|
||||
}
|
||||
|
||||
value div_float(value f, value g) /* ML */
|
||||
CAMLprim value div_float(value f, value g)
|
||||
{
|
||||
return copy_double(Double_val(f) / Double_val(g));
|
||||
}
|
||||
|
||||
value exp_float(value f) /* ML */
|
||||
CAMLprim value exp_float(value f)
|
||||
{
|
||||
return copy_double(exp(Double_val(f)));
|
||||
}
|
||||
|
||||
value floor_float(value f) /* ML */
|
||||
CAMLprim value floor_float(value f)
|
||||
{
|
||||
return copy_double(floor(Double_val(f)));
|
||||
}
|
||||
|
||||
value fmod_float(value f1, value f2) /* ML */
|
||||
CAMLprim value fmod_float(value f1, value f2)
|
||||
{
|
||||
return copy_double(fmod(Double_val(f1), Double_val(f2)));
|
||||
}
|
||||
|
||||
value frexp_float(value f) /* ML */
|
||||
CAMLprim value frexp_float(value f)
|
||||
{
|
||||
CAMLparam1 (f);
|
||||
CAMLlocal2 (res, mantissa);
|
||||
|
@ -174,22 +174,22 @@ value frexp_float(value f) /* ML */
|
|||
CAMLreturn (res);
|
||||
}
|
||||
|
||||
value ldexp_float(value f, value i) /* ML */
|
||||
CAMLprim value ldexp_float(value f, value i)
|
||||
{
|
||||
return copy_double(ldexp(Double_val(f), Int_val(i)));
|
||||
}
|
||||
|
||||
value log_float(value f) /* ML */
|
||||
CAMLprim value log_float(value f)
|
||||
{
|
||||
return copy_double(log(Double_val(f)));
|
||||
}
|
||||
|
||||
value log10_float(value f) /* ML */
|
||||
CAMLprim value log10_float(value f)
|
||||
{
|
||||
return copy_double(log10(Double_val(f)));
|
||||
}
|
||||
|
||||
value modf_float(value f) /* ML */
|
||||
CAMLprim value modf_float(value f)
|
||||
{
|
||||
#if __SC__
|
||||
_float_eval frem; /* Problem with Apple's <math.h> */
|
||||
|
@ -207,102 +207,102 @@ value modf_float(value f) /* ML */
|
|||
CAMLreturn (res);
|
||||
}
|
||||
|
||||
value sqrt_float(value f) /* ML */
|
||||
CAMLprim value sqrt_float(value f)
|
||||
{
|
||||
return copy_double(sqrt(Double_val(f)));
|
||||
}
|
||||
|
||||
value power_float(value f, value g) /* ML */
|
||||
CAMLprim value power_float(value f, value g)
|
||||
{
|
||||
return copy_double(pow(Double_val(f), Double_val(g)));
|
||||
}
|
||||
|
||||
value sin_float(value f) /* ML */
|
||||
CAMLprim value sin_float(value f)
|
||||
{
|
||||
return copy_double(sin(Double_val(f)));
|
||||
}
|
||||
|
||||
value sinh_float(value f) /* ML */
|
||||
CAMLprim value sinh_float(value f)
|
||||
{
|
||||
return copy_double(sinh(Double_val(f)));
|
||||
}
|
||||
|
||||
value cos_float(value f) /* ML */
|
||||
CAMLprim value cos_float(value f)
|
||||
{
|
||||
return copy_double(cos(Double_val(f)));
|
||||
}
|
||||
|
||||
value cosh_float(value f) /* ML */
|
||||
CAMLprim value cosh_float(value f)
|
||||
{
|
||||
return copy_double(cosh(Double_val(f)));
|
||||
}
|
||||
|
||||
value tan_float(value f) /* ML */
|
||||
CAMLprim value tan_float(value f)
|
||||
{
|
||||
return copy_double(tan(Double_val(f)));
|
||||
}
|
||||
|
||||
value tanh_float(value f) /* ML */
|
||||
CAMLprim value tanh_float(value f)
|
||||
{
|
||||
return copy_double(tanh(Double_val(f)));
|
||||
}
|
||||
|
||||
value asin_float(value f) /* ML */
|
||||
CAMLprim value asin_float(value f)
|
||||
{
|
||||
return copy_double(asin(Double_val(f)));
|
||||
}
|
||||
|
||||
value acos_float(value f) /* ML */
|
||||
CAMLprim value acos_float(value f)
|
||||
{
|
||||
return copy_double(acos(Double_val(f)));
|
||||
}
|
||||
|
||||
value atan_float(value f) /* ML */
|
||||
CAMLprim value atan_float(value f)
|
||||
{
|
||||
return copy_double(atan(Double_val(f)));
|
||||
}
|
||||
|
||||
value atan2_float(value f, value g) /* ML */
|
||||
CAMLprim value atan2_float(value f, value g)
|
||||
{
|
||||
return copy_double(atan2(Double_val(f), Double_val(g)));
|
||||
}
|
||||
|
||||
value ceil_float(value f) /* ML */
|
||||
CAMLprim value ceil_float(value f)
|
||||
{
|
||||
return copy_double(ceil(Double_val(f)));
|
||||
}
|
||||
|
||||
value eq_float(value f, value g) /* ML */
|
||||
CAMLprim value eq_float(value f, value g)
|
||||
{
|
||||
return Val_bool(Double_val(f) == Double_val(g));
|
||||
}
|
||||
|
||||
value neq_float(value f, value g) /* ML */
|
||||
CAMLprim value neq_float(value f, value g)
|
||||
{
|
||||
return Val_bool(Double_val(f) != Double_val(g));
|
||||
}
|
||||
|
||||
value le_float(value f, value g) /* ML */
|
||||
CAMLprim value le_float(value f, value g)
|
||||
{
|
||||
return Val_bool(Double_val(f) <= Double_val(g));
|
||||
}
|
||||
|
||||
value lt_float(value f, value g) /* ML */
|
||||
CAMLprim value lt_float(value f, value g)
|
||||
{
|
||||
return Val_bool(Double_val(f) < Double_val(g));
|
||||
}
|
||||
|
||||
value ge_float(value f, value g) /* ML */
|
||||
CAMLprim value ge_float(value f, value g)
|
||||
{
|
||||
return Val_bool(Double_val(f) >= Double_val(g));
|
||||
}
|
||||
|
||||
value gt_float(value f, value g) /* ML */
|
||||
CAMLprim value gt_float(value f, value g)
|
||||
{
|
||||
return Val_bool(Double_val(f) > Double_val(g));
|
||||
}
|
||||
|
||||
value float_of_bytes(value s) /* ML */
|
||||
CAMLprim value float_of_bytes(value s)
|
||||
{
|
||||
value d = copy_double(0.0);
|
||||
#ifdef ARCH_BIG_ENDIAN
|
||||
|
@ -315,7 +315,7 @@ value float_of_bytes(value s) /* ML */
|
|||
|
||||
enum { FP_normal, FP_subnormal, FP_zero, FP_infinite, FP_nan };
|
||||
|
||||
value classify_float(value vd) /* ML */
|
||||
CAMLprim value classify_float(value vd)
|
||||
{
|
||||
#ifdef fpclassify
|
||||
switch (fpclassify(Double_val(vd))) {
|
||||
|
|
|
@ -242,13 +242,13 @@ void heap_check (void)
|
|||
}
|
||||
#endif
|
||||
|
||||
value gc_stat(value v) /* ML */
|
||||
CAMLprim value gc_stat(value v)
|
||||
{
|
||||
Assert (v == Val_unit);
|
||||
return heap_stats (1);
|
||||
}
|
||||
|
||||
value gc_counters(value v) /* ML */
|
||||
CAMLprim value gc_counters(value v)
|
||||
{
|
||||
CAMLparam0 (); /* v is ignored */
|
||||
CAMLlocal1 (res);
|
||||
|
@ -266,7 +266,7 @@ value gc_counters(value v) /* ML */
|
|||
CAMLreturn (res);
|
||||
}
|
||||
|
||||
value gc_get(value v) /* ML */
|
||||
CAMLprim value gc_get(value v)
|
||||
{
|
||||
CAMLparam0 (); /* v is ignored */
|
||||
CAMLlocal1 (res);
|
||||
|
@ -313,7 +313,7 @@ static long norm_minsize (long int s)
|
|||
return s;
|
||||
}
|
||||
|
||||
value gc_set(value v) /* ML */
|
||||
CAMLprim value gc_set(value v)
|
||||
{
|
||||
unsigned long newpf, newpm;
|
||||
asize_t newheapincr;
|
||||
|
@ -354,13 +354,13 @@ value gc_set(value v) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value gc_minor(value v) /* ML */
|
||||
CAMLprim value gc_minor(value v)
|
||||
{ Assert (v == Val_unit);
|
||||
minor_collection ();
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value gc_major(value v) /* ML */
|
||||
CAMLprim value gc_major(value v)
|
||||
{ Assert (v == Val_unit);
|
||||
empty_minor_heap ();
|
||||
finish_major_cycle ();
|
||||
|
@ -368,7 +368,7 @@ value gc_major(value v) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value gc_full_major(value v) /* ML */
|
||||
CAMLprim value gc_full_major(value v)
|
||||
{ Assert (v == Val_unit);
|
||||
empty_minor_heap ();
|
||||
finish_major_cycle ();
|
||||
|
@ -379,7 +379,7 @@ value gc_full_major(value v) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value gc_compaction(value v) /* ML */
|
||||
CAMLprim value gc_compaction(value v)
|
||||
{ Assert (v == Val_unit);
|
||||
empty_minor_heap ();
|
||||
finish_major_cycle ();
|
||||
|
|
|
@ -23,7 +23,7 @@ static long hash_univ_limit, hash_univ_count;
|
|||
|
||||
static void hash_aux(value obj);
|
||||
|
||||
value hash_univ_param(value count, value limit, value obj) /* ML */
|
||||
CAMLprim value hash_univ_param(value count, value limit, value obj)
|
||||
{
|
||||
hash_univ_limit = Long_val(limit);
|
||||
hash_univ_count = Long_val(count);
|
||||
|
@ -134,7 +134,7 @@ static void hash_aux(value obj)
|
|||
|
||||
/* Hashing variant tags */
|
||||
|
||||
value hash_variant(char * tag)
|
||||
CAMLexport value hash_variant(char * tag)
|
||||
{
|
||||
value accu;
|
||||
/* Same hashing algorithm as in ../typing/btype.ml, function hash_variant */
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "opnames.h"
|
||||
|
||||
extern code_t start_code;
|
||||
extern char * names_of_cprim[];
|
||||
extern char * names_of_builtin_cprim[];
|
||||
|
||||
long icount = 0;
|
||||
|
||||
|
@ -59,9 +59,9 @@ void disasm_instr(pc)
|
|||
printf(" %d, %d\n", pc[0], pc[1]); break;
|
||||
/* Instructions with a C primitive as operand */
|
||||
case C_CALL1: case C_CALL2: case C_CALL3: case C_CALL4: case C_CALL5:
|
||||
printf(" %s\n", names_of_cprim[pc[0]]); break;
|
||||
printf(" %s\n", names_of_builtin_cprim[pc[0]]); break; /* REVISE */
|
||||
case C_CALLN:
|
||||
printf(" %d, %s\n", pc[0], names_of_cprim[pc[1]]); break;
|
||||
printf(" %d, %s\n", pc[0], names_of_builtin_cprim[pc[1]]); break;
|
||||
default:
|
||||
printf("\n");
|
||||
}
|
||||
|
|
|
@ -371,7 +371,7 @@ value input_val(struct channel *chan)
|
|||
return res;
|
||||
}
|
||||
|
||||
value input_value(value vchan) /* ML */
|
||||
CAMLprim value input_value(value vchan)
|
||||
{
|
||||
CAMLparam1 (vchan);
|
||||
struct channel * chan = Channel(vchan);
|
||||
|
@ -383,7 +383,7 @@ value input_value(value vchan) /* ML */
|
|||
CAMLreturn (res);
|
||||
}
|
||||
|
||||
value input_val_from_string(value str, long int ofs)
|
||||
CAMLexport value input_val_from_string(value str, long int ofs)
|
||||
{
|
||||
CAMLparam1 (str);
|
||||
mlsize_t num_objects, size_32, size_64, whsize;
|
||||
|
@ -410,12 +410,12 @@ value input_val_from_string(value str, long int ofs)
|
|||
CAMLreturn (obj);
|
||||
}
|
||||
|
||||
value input_value_from_string(value str, value ofs) /* ML */
|
||||
CAMLprim value input_value_from_string(value str, value ofs)
|
||||
{
|
||||
return input_val_from_string(str, Long_val(ofs));
|
||||
}
|
||||
|
||||
value input_value_from_malloc(char * data, long ofs)
|
||||
CAMLexport value input_value_from_malloc(char * data, long ofs)
|
||||
{
|
||||
mlsize_t num_objects, size_32, size_64, whsize;
|
||||
value obj;
|
||||
|
@ -442,7 +442,7 @@ value input_value_from_malloc(char * data, long ofs)
|
|||
return obj;
|
||||
}
|
||||
|
||||
value marshal_data_size(value buff, value ofs) /* ML */
|
||||
CAMLprim value marshal_data_size(value buff, value ofs)
|
||||
{
|
||||
uint32 magic;
|
||||
mlsize_t block_len;
|
||||
|
@ -491,71 +491,71 @@ unsigned char * code_checksum(void)
|
|||
|
||||
/* Functions for writing user-defined marshallers */
|
||||
|
||||
int deserialize_uint_1(void)
|
||||
CAMLexport int deserialize_uint_1(void)
|
||||
{
|
||||
return read8u();
|
||||
}
|
||||
|
||||
int deserialize_sint_1(void)
|
||||
CAMLexport int deserialize_sint_1(void)
|
||||
{
|
||||
return read8s();
|
||||
}
|
||||
|
||||
int deserialize_uint_2(void)
|
||||
CAMLexport int deserialize_uint_2(void)
|
||||
{
|
||||
return read16u();
|
||||
}
|
||||
|
||||
int deserialize_sint_2(void)
|
||||
CAMLexport int deserialize_sint_2(void)
|
||||
{
|
||||
return read16s();
|
||||
}
|
||||
|
||||
uint32 deserialize_uint_4(void)
|
||||
CAMLexport uint32 deserialize_uint_4(void)
|
||||
{
|
||||
return read32u();
|
||||
}
|
||||
|
||||
int32 deserialize_sint_4(void)
|
||||
CAMLexport int32 deserialize_sint_4(void)
|
||||
{
|
||||
return read32s();
|
||||
}
|
||||
|
||||
uint64 deserialize_uint_8(void)
|
||||
CAMLexport uint64 deserialize_uint_8(void)
|
||||
{
|
||||
uint64 i;
|
||||
deserialize_block_8(&i, 1);
|
||||
return i;
|
||||
}
|
||||
|
||||
int64 deserialize_sint_8(void)
|
||||
CAMLexport int64 deserialize_sint_8(void)
|
||||
{
|
||||
int64 i;
|
||||
deserialize_block_8(&i, 1);
|
||||
return i;
|
||||
}
|
||||
|
||||
float deserialize_float_4(void)
|
||||
CAMLexport float deserialize_float_4(void)
|
||||
{
|
||||
float f;
|
||||
deserialize_block_4(&f, 1);
|
||||
return f;
|
||||
}
|
||||
|
||||
double deserialize_float_8(void)
|
||||
CAMLexport double deserialize_float_8(void)
|
||||
{
|
||||
double f;
|
||||
deserialize_block_8(&f, 1);
|
||||
return f;
|
||||
}
|
||||
|
||||
void deserialize_block_1(void * data, long len)
|
||||
CAMLexport void deserialize_block_1(void * data, long len)
|
||||
{
|
||||
memmove(data, intern_src, len);
|
||||
intern_src += len;
|
||||
}
|
||||
|
||||
void deserialize_block_2(void * data, long len)
|
||||
CAMLexport void deserialize_block_2(void * data, long len)
|
||||
{
|
||||
unsigned char * p, * q;
|
||||
#ifndef ARCH_BIG_ENDIAN
|
||||
|
@ -568,7 +568,7 @@ void deserialize_block_2(void * data, long len)
|
|||
#endif
|
||||
}
|
||||
|
||||
void deserialize_block_4(void * data, long len)
|
||||
CAMLexport void deserialize_block_4(void * data, long len)
|
||||
{
|
||||
unsigned char * p, * q;
|
||||
#ifndef ARCH_BIG_ENDIAN
|
||||
|
@ -581,7 +581,7 @@ void deserialize_block_4(void * data, long len)
|
|||
#endif
|
||||
}
|
||||
|
||||
void deserialize_block_8(void * data, long len)
|
||||
CAMLexport void deserialize_block_8(void * data, long len)
|
||||
{
|
||||
unsigned char * p, * q;
|
||||
#ifndef ARCH_BIG_ENDIAN
|
||||
|
@ -594,7 +594,7 @@ void deserialize_block_8(void * data, long len)
|
|||
#endif
|
||||
}
|
||||
|
||||
void deserialize_error(char * msg)
|
||||
CAMLexport void deserialize_error(char * msg)
|
||||
{
|
||||
intern_cleanup();
|
||||
failwith(msg);
|
||||
|
|
|
@ -827,34 +827,34 @@ value interprete(code_t prog, asize_t prog_size)
|
|||
|
||||
Instruct(C_CALL1):
|
||||
Setup_for_c_call;
|
||||
accu = cprim[*pc](accu);
|
||||
accu = Primitive(*pc)(accu);
|
||||
Restore_after_c_call;
|
||||
pc++;
|
||||
Next;
|
||||
Instruct(C_CALL2):
|
||||
Setup_for_c_call;
|
||||
accu = cprim[*pc](accu, sp[1]);
|
||||
accu = Primitive(*pc)(accu, sp[1]);
|
||||
Restore_after_c_call;
|
||||
sp += 1;
|
||||
pc++;
|
||||
Next;
|
||||
Instruct(C_CALL3):
|
||||
Setup_for_c_call;
|
||||
accu = cprim[*pc](accu, sp[1], sp[2]);
|
||||
accu = Primitive(*pc)(accu, sp[1], sp[2]);
|
||||
Restore_after_c_call;
|
||||
sp += 2;
|
||||
pc++;
|
||||
Next;
|
||||
Instruct(C_CALL4):
|
||||
Setup_for_c_call;
|
||||
accu = cprim[*pc](accu, sp[1], sp[2], sp[3]);
|
||||
accu = Primitive(*pc)(accu, sp[1], sp[2], sp[3]);
|
||||
Restore_after_c_call;
|
||||
sp += 3;
|
||||
pc++;
|
||||
Next;
|
||||
Instruct(C_CALL5):
|
||||
Setup_for_c_call;
|
||||
accu = cprim[*pc](accu, sp[1], sp[2], sp[3], sp[4]);
|
||||
accu = Primitive(*pc)(accu, sp[1], sp[2], sp[3], sp[4]);
|
||||
Restore_after_c_call;
|
||||
sp += 4;
|
||||
pc++;
|
||||
|
@ -863,7 +863,7 @@ value interprete(code_t prog, asize_t prog_size)
|
|||
int nargs = *pc++;
|
||||
*--sp = accu;
|
||||
Setup_for_c_call;
|
||||
accu = cprim[*pc](sp + 1, nargs);
|
||||
accu = Primitive(*pc)(sp + 1, nargs);
|
||||
Restore_after_c_call;
|
||||
sp += nargs;
|
||||
pc++;
|
||||
|
|
|
@ -81,38 +81,42 @@
|
|||
|
||||
/* The entry points */
|
||||
|
||||
void output_val (struct channel * chan, value v, value flags);
|
||||
value input_val (struct channel * chan);
|
||||
value input_val_from_string (value str, long ofs);
|
||||
CAMLextern void output_val (struct channel * chan, value v, value flags);
|
||||
CAMLextern void output_value_to_malloc(value v, value flags,
|
||||
/*out*/ char ** buf,
|
||||
/*out*/ long * len);
|
||||
CAMLextern value input_val (struct channel * chan);
|
||||
CAMLextern value input_val_from_string (value str, long ofs);
|
||||
CAMLextern value input_value_from_malloc(char * data, long ofs);
|
||||
|
||||
/* Functions for writing user-defined marshallers */
|
||||
|
||||
extern void serialize_int_1(int i);
|
||||
extern void serialize_int_2(int i);
|
||||
extern void serialize_int_4(int32 i);
|
||||
extern void serialize_int_8(int64 i);
|
||||
extern void serialize_float_4(float f);
|
||||
extern void serialize_float_8(double f);
|
||||
extern void serialize_block_1(void * data, long len);
|
||||
extern void serialize_block_2(void * data, long len);
|
||||
extern void serialize_block_4(void * data, long len);
|
||||
extern void serialize_block_8(void * data, long len);
|
||||
CAMLextern void serialize_int_1(int i);
|
||||
CAMLextern void serialize_int_2(int i);
|
||||
CAMLextern void serialize_int_4(int32 i);
|
||||
CAMLextern void serialize_int_8(int64 i);
|
||||
CAMLextern void serialize_float_4(float f);
|
||||
CAMLextern void serialize_float_8(double f);
|
||||
CAMLextern void serialize_block_1(void * data, long len);
|
||||
CAMLextern void serialize_block_2(void * data, long len);
|
||||
CAMLextern void serialize_block_4(void * data, long len);
|
||||
CAMLextern void serialize_block_8(void * data, long len);
|
||||
|
||||
extern int deserialize_uint_1(void);
|
||||
extern int deserialize_sint_1(void);
|
||||
extern int deserialize_uint_2(void);
|
||||
extern int deserialize_sint_2(void);
|
||||
extern uint32 deserialize_uint_4(void);
|
||||
extern int32 deserialize_sint_4(void);
|
||||
extern uint64 deserialize_uint_8(void);
|
||||
extern int64 deserialize_sint_8(void);
|
||||
extern float deserialize_float_4(void);
|
||||
extern double deserialize_float_8(void);
|
||||
extern void deserialize_block_1(void * data, long len);
|
||||
extern void deserialize_block_2(void * data, long len);
|
||||
extern void deserialize_block_4(void * data, long len);
|
||||
extern void deserialize_block_8(void * data, long len);
|
||||
extern void deserialize_error(char * msg);
|
||||
CAMLextern int deserialize_uint_1(void);
|
||||
CAMLextern int deserialize_sint_1(void);
|
||||
CAMLextern int deserialize_uint_2(void);
|
||||
CAMLextern int deserialize_sint_2(void);
|
||||
CAMLextern uint32 deserialize_uint_4(void);
|
||||
CAMLextern int32 deserialize_sint_4(void);
|
||||
CAMLextern uint64 deserialize_uint_8(void);
|
||||
CAMLextern int64 deserialize_sint_8(void);
|
||||
CAMLextern float deserialize_float_4(void);
|
||||
CAMLextern double deserialize_float_8(void);
|
||||
CAMLextern void deserialize_block_1(void * data, long len);
|
||||
CAMLextern void deserialize_block_2(void * data, long len);
|
||||
CAMLextern void deserialize_block_4(void * data, long len);
|
||||
CAMLextern void deserialize_block_8(void * data, long len);
|
||||
CAMLextern void deserialize_error(char * msg);
|
||||
|
||||
/* Auxiliary stuff for sending code pointers */
|
||||
unsigned char * code_checksum (void);
|
||||
|
|
142
byterun/ints.c
142
byterun/ints.c
|
@ -75,7 +75,7 @@ static long parse_long(char * p)
|
|||
return sign < 0 ? -((long) res) : (long) res;
|
||||
}
|
||||
|
||||
value int_of_string(value s) /* ML */
|
||||
CAMLprim value int_of_string(value s)
|
||||
{
|
||||
return Val_long(parse_long(String_val(s)));
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ static char * parse_format(value fmt,
|
|||
return stat_alloc(prec + 1);
|
||||
}
|
||||
|
||||
value format_int(value fmt, value arg) /* ML */
|
||||
CAMLprim value format_int(value fmt, value arg)
|
||||
{
|
||||
char format_string[FORMAT_BUFFER_SIZE];
|
||||
char default_format_buffer[FORMAT_BUFFER_SIZE];
|
||||
|
@ -158,7 +158,7 @@ static unsigned long int32_deserialize(void * dst)
|
|||
return 4;
|
||||
}
|
||||
|
||||
struct custom_operations int32_ops = {
|
||||
CAMLexport struct custom_operations int32_ops = {
|
||||
"_i",
|
||||
custom_finalize_default,
|
||||
int32_compare,
|
||||
|
@ -167,70 +167,70 @@ struct custom_operations int32_ops = {
|
|||
int32_deserialize
|
||||
};
|
||||
|
||||
value copy_int32(int32 i)
|
||||
CAMLexport value copy_int32(int32 i)
|
||||
{
|
||||
value res = alloc_custom(&int32_ops, 4, 0, 1);
|
||||
Int32_val(res) = i;
|
||||
return res;
|
||||
}
|
||||
|
||||
value int32_neg(value v) /* ML */
|
||||
CAMLprim value int32_neg(value v)
|
||||
{ return copy_int32(- Int32_val(v)); }
|
||||
|
||||
value int32_add(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_add(value v1, value v2)
|
||||
{ return copy_int32(Int32_val(v1) + Int32_val(v2)); }
|
||||
|
||||
value int32_sub(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_sub(value v1, value v2)
|
||||
{ return copy_int32(Int32_val(v1) - Int32_val(v2)); }
|
||||
|
||||
value int32_mul(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_mul(value v1, value v2)
|
||||
{ return copy_int32(Int32_val(v1) * Int32_val(v2)); }
|
||||
|
||||
value int32_div(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_div(value v1, value v2)
|
||||
{
|
||||
int32 divisor = Int32_val(v2);
|
||||
if (divisor == 0) raise_zero_divide();
|
||||
return copy_int32(Int32_val(v1) / divisor);
|
||||
}
|
||||
|
||||
value int32_mod(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_mod(value v1, value v2)
|
||||
{
|
||||
int32 divisor = Int32_val(v2);
|
||||
if (divisor == 0) raise_zero_divide();
|
||||
return copy_int32(Int32_val(v1) % divisor);
|
||||
}
|
||||
|
||||
value int32_and(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_and(value v1, value v2)
|
||||
{ return copy_int32(Int32_val(v1) & Int32_val(v2)); }
|
||||
|
||||
value int32_or(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_or(value v1, value v2)
|
||||
{ return copy_int32(Int32_val(v1) | Int32_val(v2)); }
|
||||
|
||||
value int32_xor(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_xor(value v1, value v2)
|
||||
{ return copy_int32(Int32_val(v1) ^ Int32_val(v2)); }
|
||||
|
||||
value int32_shift_left(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_shift_left(value v1, value v2)
|
||||
{ return copy_int32(Int32_val(v1) << Int_val(v2)); }
|
||||
|
||||
value int32_shift_right(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_shift_right(value v1, value v2)
|
||||
{ return copy_int32(Int32_val(v1) >> Int_val(v2)); }
|
||||
|
||||
value int32_shift_right_unsigned(value v1, value v2) /* ML */
|
||||
CAMLprim value int32_shift_right_unsigned(value v1, value v2)
|
||||
{ return copy_int32((uint32)Int32_val(v1) >> Int_val(v2)); }
|
||||
|
||||
value int32_of_int(value v) /* ML */
|
||||
CAMLprim value int32_of_int(value v)
|
||||
{ return copy_int32(Long_val(v)); }
|
||||
|
||||
value int32_to_int(value v) /* ML */
|
||||
CAMLprim value int32_to_int(value v)
|
||||
{ return Val_long(Int32_val(v)); }
|
||||
|
||||
value int32_of_float(value v) /* ML */
|
||||
CAMLprim value int32_of_float(value v)
|
||||
{ return copy_int32((int32)(Double_val(v))); }
|
||||
|
||||
value int32_to_float(value v) /* ML */
|
||||
CAMLprim value int32_to_float(value v)
|
||||
{ return copy_double((double)(Int32_val(v))); }
|
||||
|
||||
value int32_format(value fmt, value arg) /* ML */
|
||||
CAMLprim value int32_format(value fmt, value arg)
|
||||
{
|
||||
char format_string[FORMAT_BUFFER_SIZE];
|
||||
char default_format_buffer[FORMAT_BUFFER_SIZE];
|
||||
|
@ -244,7 +244,7 @@ value int32_format(value fmt, value arg) /* ML */
|
|||
return res;
|
||||
}
|
||||
|
||||
value int32_of_string(value s) /* ML */
|
||||
CAMLprim value int32_of_string(value s)
|
||||
{
|
||||
return copy_int32(parse_long(String_val(s)));
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ value int32_of_string(value s) /* ML */
|
|||
|
||||
#ifdef ARCH_ALIGN_INT64
|
||||
|
||||
int64 Int64_val(value v)
|
||||
CAMLexport int64 Int64_val(value v)
|
||||
{
|
||||
union { int32 i[2]; int64 j; } buffer;
|
||||
buffer.i[0] = ((int32 *) Data_custom_val(v))[0];
|
||||
|
@ -290,7 +290,7 @@ static unsigned long int64_deserialize(void * dst)
|
|||
return 8;
|
||||
}
|
||||
|
||||
struct custom_operations int64_ops = {
|
||||
CAMLexport struct custom_operations int64_ops = {
|
||||
"_j",
|
||||
custom_finalize_default,
|
||||
int64_compare,
|
||||
|
@ -299,7 +299,7 @@ struct custom_operations int64_ops = {
|
|||
int64_deserialize
|
||||
};
|
||||
|
||||
value copy_int64(int64 i)
|
||||
CAMLexport value copy_int64(int64 i)
|
||||
{
|
||||
value res = alloc_custom(&int64_ops, 8, 0, 1);
|
||||
#ifndef ARCH_ALIGN_INT64
|
||||
|
@ -313,75 +313,75 @@ value copy_int64(int64 i)
|
|||
return res;
|
||||
}
|
||||
|
||||
value int64_neg(value v) /* ML */
|
||||
CAMLprim value int64_neg(value v)
|
||||
{ return copy_int64(- Int64_val(v)); }
|
||||
|
||||
value int64_add(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_add(value v1, value v2)
|
||||
{ return copy_int64(Int64_val(v1) + Int64_val(v2)); }
|
||||
|
||||
value int64_sub(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_sub(value v1, value v2)
|
||||
{ return copy_int64(Int64_val(v1) - Int64_val(v2)); }
|
||||
|
||||
value int64_mul(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_mul(value v1, value v2)
|
||||
{ return copy_int64(Int64_val(v1) * Int64_val(v2)); }
|
||||
|
||||
value int64_div(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_div(value v1, value v2)
|
||||
{
|
||||
int64 divisor = Int64_val(v2);
|
||||
if (divisor == 0) raise_zero_divide();
|
||||
return copy_int64(Int64_val(v1) / divisor);
|
||||
}
|
||||
|
||||
value int64_mod(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_mod(value v1, value v2)
|
||||
{
|
||||
int64 divisor = Int64_val(v2);
|
||||
if (divisor == 0) raise_zero_divide();
|
||||
return copy_int64(Int64_val(v1) % divisor);
|
||||
}
|
||||
|
||||
value int64_and(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_and(value v1, value v2)
|
||||
{ return copy_int64(Int64_val(v1) & Int64_val(v2)); }
|
||||
|
||||
value int64_or(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_or(value v1, value v2)
|
||||
{ return copy_int64(Int64_val(v1) | Int64_val(v2)); }
|
||||
|
||||
value int64_xor(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_xor(value v1, value v2)
|
||||
{ return copy_int64(Int64_val(v1) ^ Int64_val(v2)); }
|
||||
|
||||
value int64_shift_left(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_shift_left(value v1, value v2)
|
||||
{ return copy_int64(Int64_val(v1) << Int_val(v2)); }
|
||||
|
||||
value int64_shift_right(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_shift_right(value v1, value v2)
|
||||
{ return copy_int64(Int64_val(v1) >> Int_val(v2)); }
|
||||
|
||||
value int64_shift_right_unsigned(value v1, value v2) /* ML */
|
||||
CAMLprim value int64_shift_right_unsigned(value v1, value v2)
|
||||
{ return copy_int64((uint64)Int64_val(v1) >> Int_val(v2)); }
|
||||
|
||||
value int64_of_int(value v) /* ML */
|
||||
CAMLprim value int64_of_int(value v)
|
||||
{ return copy_int64(Long_val(v)); }
|
||||
|
||||
value int64_to_int(value v) /* ML */
|
||||
CAMLprim value int64_to_int(value v)
|
||||
{ return Val_long((long) Int64_val(v)); }
|
||||
|
||||
value int64_of_float(value v) /* ML */
|
||||
CAMLprim value int64_of_float(value v)
|
||||
{ return copy_int64((int64)(Double_val(v))); }
|
||||
|
||||
value int64_to_float(value v) /* ML */
|
||||
CAMLprim value int64_to_float(value v)
|
||||
{ return copy_double((double)(Int64_val(v))); }
|
||||
|
||||
value int64_of_int32(value v) /* ML */
|
||||
CAMLprim value int64_of_int32(value v)
|
||||
{ return copy_int64(Int32_val(v)); }
|
||||
|
||||
value int64_to_int32(value v) /* ML */
|
||||
CAMLprim value int64_to_int32(value v)
|
||||
{ return copy_int32((int32) Int64_val(v)); }
|
||||
|
||||
value int64_of_nativeint(value v) /* ML */
|
||||
CAMLprim value int64_of_nativeint(value v)
|
||||
{ return copy_int64(Nativeint_val(v)); }
|
||||
|
||||
value int64_to_nativeint(value v) /* ML */
|
||||
CAMLprim value int64_to_nativeint(value v)
|
||||
{ return copy_nativeint((long) Int64_val(v)); }
|
||||
|
||||
value int64_format(value fmt, value arg) /* ML */
|
||||
CAMLprim value int64_format(value fmt, value arg)
|
||||
#ifdef ARCH_INT64_PRINTF_FORMAT
|
||||
{
|
||||
char format_string[FORMAT_BUFFER_SIZE];
|
||||
|
@ -400,7 +400,7 @@ value int64_format(value fmt, value arg) /* ML */
|
|||
{ invalid_argument ("Int64.format is not implemented on this platform"); }
|
||||
#endif
|
||||
|
||||
value int64_of_string(value s) /* ML */
|
||||
CAMLprim value int64_of_string(value s)
|
||||
{
|
||||
char * p;
|
||||
uint64 res;
|
||||
|
@ -418,14 +418,14 @@ value int64_of_string(value s) /* ML */
|
|||
return copy_int64(sign < 0 ? -((int64) res) : (int64) res);
|
||||
}
|
||||
|
||||
value int64_bits_of_float(value vd) /* ML */
|
||||
CAMLprim value int64_bits_of_float(value vd)
|
||||
{
|
||||
union { double d; int64 i; } u;
|
||||
u.d = Double_val(vd);
|
||||
return copy_int64(u.i);
|
||||
}
|
||||
|
||||
value int64_float_of_bits(value vi) /* ML */
|
||||
CAMLprim value int64_float_of_bits(value vi)
|
||||
{
|
||||
union { double d; int64 i; } u;
|
||||
u.i = Int64_val(vi);
|
||||
|
@ -567,7 +567,7 @@ static unsigned long nativeint_deserialize(void * dst)
|
|||
return sizeof(long);
|
||||
}
|
||||
|
||||
struct custom_operations nativeint_ops = {
|
||||
CAMLexport struct custom_operations nativeint_ops = {
|
||||
"_n",
|
||||
custom_finalize_default,
|
||||
nativeint_compare,
|
||||
|
@ -576,76 +576,76 @@ struct custom_operations nativeint_ops = {
|
|||
nativeint_deserialize
|
||||
};
|
||||
|
||||
value copy_nativeint(long i)
|
||||
CAMLexport value copy_nativeint(long i)
|
||||
{
|
||||
value res = alloc_custom(&nativeint_ops, sizeof(long), 0, 1);
|
||||
Nativeint_val(res) = i;
|
||||
return res;
|
||||
}
|
||||
|
||||
value nativeint_neg(value v) /* ML */
|
||||
CAMLprim value nativeint_neg(value v)
|
||||
{ return copy_nativeint(- Nativeint_val(v)); }
|
||||
|
||||
value nativeint_add(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_add(value v1, value v2)
|
||||
{ return copy_nativeint(Nativeint_val(v1) + Nativeint_val(v2)); }
|
||||
|
||||
value nativeint_sub(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_sub(value v1, value v2)
|
||||
{ return copy_nativeint(Nativeint_val(v1) - Nativeint_val(v2)); }
|
||||
|
||||
value nativeint_mul(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_mul(value v1, value v2)
|
||||
{ return copy_nativeint(Nativeint_val(v1) * Nativeint_val(v2)); }
|
||||
|
||||
value nativeint_div(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_div(value v1, value v2)
|
||||
{
|
||||
long divisor = Nativeint_val(v2);
|
||||
if (divisor == 0) raise_zero_divide();
|
||||
return copy_nativeint(Nativeint_val(v1) / divisor);
|
||||
}
|
||||
|
||||
value nativeint_mod(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_mod(value v1, value v2)
|
||||
{
|
||||
long divisor = Nativeint_val(v2);
|
||||
if (divisor == 0) raise_zero_divide();
|
||||
return copy_nativeint(Nativeint_val(v1) % divisor);
|
||||
}
|
||||
|
||||
value nativeint_and(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_and(value v1, value v2)
|
||||
{ return copy_nativeint(Nativeint_val(v1) & Nativeint_val(v2)); }
|
||||
|
||||
value nativeint_or(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_or(value v1, value v2)
|
||||
{ return copy_nativeint(Nativeint_val(v1) | Nativeint_val(v2)); }
|
||||
|
||||
value nativeint_xor(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_xor(value v1, value v2)
|
||||
{ return copy_nativeint(Nativeint_val(v1) ^ Nativeint_val(v2)); }
|
||||
|
||||
value nativeint_shift_left(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_shift_left(value v1, value v2)
|
||||
{ return copy_nativeint(Nativeint_val(v1) << Int_val(v2)); }
|
||||
|
||||
value nativeint_shift_right(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_shift_right(value v1, value v2)
|
||||
{ return copy_nativeint(Nativeint_val(v1) >> Int_val(v2)); }
|
||||
|
||||
value nativeint_shift_right_unsigned(value v1, value v2) /* ML */
|
||||
CAMLprim value nativeint_shift_right_unsigned(value v1, value v2)
|
||||
{ return copy_nativeint((unsigned long)Nativeint_val(v1) >> Int_val(v2)); }
|
||||
|
||||
value nativeint_of_int(value v) /* ML */
|
||||
CAMLprim value nativeint_of_int(value v)
|
||||
{ return copy_nativeint(Long_val(v)); }
|
||||
|
||||
value nativeint_to_int(value v) /* ML */
|
||||
CAMLprim value nativeint_to_int(value v)
|
||||
{ return Val_long(Nativeint_val(v)); }
|
||||
|
||||
value nativeint_of_float(value v) /* ML */
|
||||
CAMLprim value nativeint_of_float(value v)
|
||||
{ return copy_nativeint((long)(Double_val(v))); }
|
||||
|
||||
value nativeint_to_float(value v) /* ML */
|
||||
CAMLprim value nativeint_to_float(value v)
|
||||
{ return copy_double((double)(Nativeint_val(v))); }
|
||||
|
||||
value nativeint_of_int32(value v) /* ML */
|
||||
CAMLprim value nativeint_of_int32(value v)
|
||||
{ return copy_nativeint(Int32_val(v)); }
|
||||
|
||||
value nativeint_to_int32(value v) /* ML */
|
||||
CAMLprim value nativeint_to_int32(value v)
|
||||
{ return copy_int32(Nativeint_val(v)); }
|
||||
|
||||
value nativeint_format(value fmt, value arg) /* ML */
|
||||
CAMLprim value nativeint_format(value fmt, value arg)
|
||||
{
|
||||
char format_string[FORMAT_BUFFER_SIZE];
|
||||
char default_format_buffer[FORMAT_BUFFER_SIZE];
|
||||
|
@ -659,7 +659,7 @@ value nativeint_format(value fmt, value arg) /* ML */
|
|||
return res;
|
||||
}
|
||||
|
||||
value nativeint_of_string(value s) /* ML */
|
||||
CAMLprim value nativeint_of_string(value s)
|
||||
{
|
||||
return copy_nativeint(parse_long(String_val(s)));
|
||||
}
|
||||
|
|
82
byterun/io.c
82
byterun/io.c
|
@ -43,10 +43,10 @@
|
|||
|
||||
/* Hooks for locking channels */
|
||||
|
||||
void (*channel_mutex_free) (struct channel *) = NULL;
|
||||
void (*channel_mutex_lock) (struct channel *) = NULL;
|
||||
void (*channel_mutex_unlock) (struct channel *) = NULL;
|
||||
void (*channel_mutex_unlock_exn) (void) = NULL;
|
||||
CAMLexport void (*channel_mutex_free) (struct channel *) = NULL;
|
||||
CAMLexport void (*channel_mutex_lock) (struct channel *) = NULL;
|
||||
CAMLexport void (*channel_mutex_unlock) (struct channel *) = NULL;
|
||||
CAMLexport void (*channel_mutex_unlock_exn) (void) = NULL;
|
||||
|
||||
/* Basic functions over type struct channel *.
|
||||
These functions can be called directly from C.
|
||||
|
@ -54,7 +54,7 @@ void (*channel_mutex_unlock_exn) (void) = NULL;
|
|||
|
||||
/* Functions shared between input and output */
|
||||
|
||||
struct channel * open_descriptor(int fd)
|
||||
CAMLexport struct channel * open_descriptor(int fd)
|
||||
{
|
||||
struct channel * channel;
|
||||
|
||||
|
@ -67,14 +67,14 @@ struct channel * open_descriptor(int fd)
|
|||
return channel;
|
||||
}
|
||||
|
||||
void close_channel(struct channel *channel)
|
||||
CAMLexport void close_channel(struct channel *channel)
|
||||
{
|
||||
close(channel->fd);
|
||||
if (channel_mutex_free != NULL) (*channel_mutex_free)(channel);
|
||||
stat_free(channel);
|
||||
}
|
||||
|
||||
long channel_size(struct channel *channel)
|
||||
CAMLexport long channel_size(struct channel *channel)
|
||||
{
|
||||
long end;
|
||||
|
||||
|
@ -86,7 +86,7 @@ long channel_size(struct channel *channel)
|
|||
return end;
|
||||
}
|
||||
|
||||
int channel_binary_mode(struct channel *channel)
|
||||
CAMLexport int channel_binary_mode(struct channel *channel)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int oldmode = setmode(channel->fd, O_BINARY);
|
||||
|
@ -141,7 +141,7 @@ again:
|
|||
at least one character. Returns true if the buffer is empty at the
|
||||
end of the flush, or false if some data remains in the buffer. */
|
||||
|
||||
int flush_partial(struct channel *channel)
|
||||
CAMLexport int flush_partial(struct channel *channel)
|
||||
{
|
||||
int towrite, written;
|
||||
|
||||
|
@ -158,14 +158,14 @@ int flush_partial(struct channel *channel)
|
|||
|
||||
/* Flush completely the buffer. */
|
||||
|
||||
void flush(struct channel *channel)
|
||||
CAMLexport void flush(struct channel *channel)
|
||||
{
|
||||
while (! flush_partial(channel)) /*nothing*/;
|
||||
}
|
||||
|
||||
/* Output data */
|
||||
|
||||
void putword(struct channel *channel, uint32 w)
|
||||
CAMLexport void putword(struct channel *channel, uint32 w)
|
||||
{
|
||||
if (! channel_binary_mode(channel))
|
||||
failwith("output_binary_int: not a binary channel");
|
||||
|
@ -175,7 +175,7 @@ void putword(struct channel *channel, uint32 w)
|
|||
putch(channel, w);
|
||||
}
|
||||
|
||||
int putblock(struct channel *channel, char *p, long int len)
|
||||
CAMLexport int putblock(struct channel *channel, char *p, long int len)
|
||||
{
|
||||
int n, free, towrite, written;
|
||||
|
||||
|
@ -201,7 +201,7 @@ int putblock(struct channel *channel, char *p, long int len)
|
|||
}
|
||||
}
|
||||
|
||||
void really_putblock(struct channel *channel, char *p, long int len)
|
||||
CAMLexport void really_putblock(struct channel *channel, char *p, long int len)
|
||||
{
|
||||
int written;
|
||||
while (len > 0) {
|
||||
|
@ -211,14 +211,14 @@ void really_putblock(struct channel *channel, char *p, long int len)
|
|||
}
|
||||
}
|
||||
|
||||
void seek_out(struct channel *channel, long int dest)
|
||||
CAMLexport void seek_out(struct channel *channel, long int dest)
|
||||
{
|
||||
flush(channel);
|
||||
if (lseek(channel->fd, dest, 0) != dest) sys_error(NO_ARG);
|
||||
channel->offset = dest;
|
||||
}
|
||||
|
||||
long pos_out(struct channel *channel)
|
||||
CAMLexport long pos_out(struct channel *channel)
|
||||
{
|
||||
return channel->offset + channel->curr - channel->buff;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ static int do_read(int fd, char *p, unsigned int n)
|
|||
return retcode;
|
||||
}
|
||||
|
||||
unsigned char refill(struct channel *channel)
|
||||
CAMLexport unsigned char refill(struct channel *channel)
|
||||
{
|
||||
int n;
|
||||
|
||||
|
@ -257,7 +257,7 @@ unsigned char refill(struct channel *channel)
|
|||
return (unsigned char)(channel->buff[0]);
|
||||
}
|
||||
|
||||
uint32 getword(struct channel *channel)
|
||||
CAMLexport uint32 getword(struct channel *channel)
|
||||
{
|
||||
int i;
|
||||
uint32 res;
|
||||
|
@ -271,7 +271,7 @@ uint32 getword(struct channel *channel)
|
|||
return res;
|
||||
}
|
||||
|
||||
int getblock(struct channel *channel, char *p, long int len)
|
||||
CAMLexport int getblock(struct channel *channel, char *p, long int len)
|
||||
{
|
||||
int n, avail, nread;
|
||||
|
||||
|
@ -296,7 +296,7 @@ int getblock(struct channel *channel, char *p, long int len)
|
|||
}
|
||||
}
|
||||
|
||||
int really_getblock(struct channel *chan, char *p, long int n)
|
||||
CAMLexport int really_getblock(struct channel *chan, char *p, long int n)
|
||||
{
|
||||
int r;
|
||||
while (n > 0) {
|
||||
|
@ -308,7 +308,7 @@ int really_getblock(struct channel *chan, char *p, long int n)
|
|||
return (n == 0);
|
||||
}
|
||||
|
||||
void seek_in(struct channel *channel, long int dest)
|
||||
CAMLexport void seek_in(struct channel *channel, long int dest)
|
||||
{
|
||||
if (dest >= channel->offset - (channel->max - channel->buff) &&
|
||||
dest <= channel->offset) {
|
||||
|
@ -320,12 +320,12 @@ void seek_in(struct channel *channel, long int dest)
|
|||
}
|
||||
}
|
||||
|
||||
long pos_in(struct channel *channel)
|
||||
CAMLexport long pos_in(struct channel *channel)
|
||||
{
|
||||
return channel->offset - (channel->max - channel->curr);
|
||||
}
|
||||
|
||||
long input_scan_line(struct channel *channel)
|
||||
CAMLexport long input_scan_line(struct channel *channel)
|
||||
{
|
||||
char * p;
|
||||
int n;
|
||||
|
@ -400,19 +400,19 @@ static value alloc_channel(struct channel *chan)
|
|||
return res;
|
||||
}
|
||||
|
||||
value caml_open_descriptor(value fd) /* ML */
|
||||
CAMLprim value caml_open_descriptor(value fd)
|
||||
{
|
||||
return alloc_channel(open_descriptor(Int_val(fd)));
|
||||
}
|
||||
|
||||
value channel_descriptor(value vchannel) /* ML */
|
||||
CAMLprim value channel_descriptor(value vchannel)
|
||||
{
|
||||
int fd = Channel(vchannel)->fd;
|
||||
if (fd == -1) { errno = EBADF; sys_error(NO_ARG); }
|
||||
return Val_int(fd);
|
||||
}
|
||||
|
||||
value caml_close_channel(value vchannel) /* ML */
|
||||
CAMLprim value caml_close_channel(value vchannel)
|
||||
{
|
||||
/* For output channels, must have flushed before */
|
||||
struct channel * channel = Channel(vchannel);
|
||||
|
@ -425,12 +425,12 @@ value caml_close_channel(value vchannel) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value caml_channel_size(value vchannel) /* ML */
|
||||
CAMLprim value caml_channel_size(value vchannel)
|
||||
{
|
||||
return Val_long(channel_size(Channel(vchannel)));
|
||||
}
|
||||
|
||||
value caml_set_binary_mode(value vchannel, value mode) /* ML */
|
||||
CAMLprim value caml_set_binary_mode(value vchannel, value mode)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
struct channel * channel = Channel(vchannel);
|
||||
|
@ -440,7 +440,7 @@ value caml_set_binary_mode(value vchannel, value mode) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value caml_flush_partial(value vchannel) /* ML */
|
||||
CAMLprim value caml_flush_partial(value vchannel)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
int res;
|
||||
|
@ -453,7 +453,7 @@ value caml_flush_partial(value vchannel) /* ML */
|
|||
return Val_bool(res);
|
||||
}
|
||||
|
||||
value caml_flush(value vchannel) /* ML */
|
||||
CAMLprim value caml_flush(value vchannel)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
/* Don't fail if channel is closed, this causes problem with flush on
|
||||
|
@ -465,7 +465,7 @@ value caml_flush(value vchannel) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value caml_output_char(value vchannel, value ch) /* ML */
|
||||
CAMLprim value caml_output_char(value vchannel, value ch)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
Lock(channel);
|
||||
|
@ -474,7 +474,7 @@ value caml_output_char(value vchannel, value ch) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value caml_output_int(value vchannel, value w) /* ML */
|
||||
CAMLprim value caml_output_int(value vchannel, value w)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
Lock(channel);
|
||||
|
@ -483,7 +483,7 @@ value caml_output_int(value vchannel, value w) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value caml_output_partial(value vchannel, value buff, value start, value length) /* ML */
|
||||
CAMLprim value caml_output_partial(value vchannel, value buff, value start, value length)
|
||||
{
|
||||
CAMLparam4 (vchannel, buff, start, length);
|
||||
struct channel * channel = Channel(vchannel);
|
||||
|
@ -495,7 +495,7 @@ value caml_output_partial(value vchannel, value buff, value start, value length)
|
|||
CAMLreturn (Val_int(res));
|
||||
}
|
||||
|
||||
value caml_output(value vchannel, value buff, value start, value length) /* ML */
|
||||
CAMLprim value caml_output(value vchannel, value buff, value start, value length)
|
||||
{
|
||||
CAMLparam4 (vchannel, buff, start, length);
|
||||
struct channel * channel = Channel(vchannel);
|
||||
|
@ -512,7 +512,7 @@ value caml_output(value vchannel, value buff, value start, value length) /* ML *
|
|||
CAMLreturn (Val_unit);
|
||||
}
|
||||
|
||||
value caml_seek_out(value vchannel, value pos) /* ML */
|
||||
CAMLprim value caml_seek_out(value vchannel, value pos)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
Lock(channel);
|
||||
|
@ -521,12 +521,12 @@ value caml_seek_out(value vchannel, value pos) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value caml_pos_out(value vchannel) /* ML */
|
||||
CAMLprim value caml_pos_out(value vchannel)
|
||||
{
|
||||
return Val_long(pos_out(Channel(vchannel)));
|
||||
}
|
||||
|
||||
value caml_input_char(value vchannel) /* ML */
|
||||
CAMLprim value caml_input_char(value vchannel)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
unsigned char c;
|
||||
|
@ -537,7 +537,7 @@ value caml_input_char(value vchannel) /* ML */
|
|||
return Val_long(c);
|
||||
}
|
||||
|
||||
value caml_input_int(value vchannel) /* ML */
|
||||
CAMLprim value caml_input_int(value vchannel)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
long i;
|
||||
|
@ -551,7 +551,7 @@ value caml_input_int(value vchannel) /* ML */
|
|||
return Val_long(i);
|
||||
}
|
||||
|
||||
value caml_input(value vchannel,value buff,value vstart,value vlength) /* ML */
|
||||
CAMLprim value caml_input(value vchannel,value buff,value vstart,value vlength)
|
||||
{
|
||||
CAMLparam4 (vchannel, buff, vstart, vlength);
|
||||
struct channel * channel = Channel(vchannel);
|
||||
|
@ -583,7 +583,7 @@ value caml_input(value vchannel,value buff,value vstart,value vlength) /* ML */
|
|||
CAMLreturn (Val_long(n));
|
||||
}
|
||||
|
||||
value caml_seek_in(value vchannel, value pos) /* ML */
|
||||
CAMLprim value caml_seek_in(value vchannel, value pos)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
Lock(channel);
|
||||
|
@ -592,12 +592,12 @@ value caml_seek_in(value vchannel, value pos) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value caml_pos_in(value vchannel) /* ML */
|
||||
CAMLprim value caml_pos_in(value vchannel)
|
||||
{
|
||||
return Val_long(pos_in(Channel(vchannel)));
|
||||
}
|
||||
|
||||
value caml_input_scan_line(value vchannel) /* ML */
|
||||
CAMLprim value caml_input_scan_line(value vchannel)
|
||||
{
|
||||
struct channel * channel = Channel(vchannel);
|
||||
long res;
|
||||
|
|
32
byterun/io.h
32
byterun/io.h
|
@ -54,20 +54,20 @@ struct channel {
|
|||
? refill(channel) \
|
||||
: (unsigned char) *((channel))->curr++)
|
||||
|
||||
struct channel * open_descriptor (int);
|
||||
void close_channel (struct channel *);
|
||||
int channel_binary_mode (struct channel *);
|
||||
CAMLextern struct channel * open_descriptor (int);
|
||||
CAMLextern void close_channel (struct channel *);
|
||||
CAMLextern int channel_binary_mode (struct channel *);
|
||||
|
||||
int flush_partial (struct channel *);
|
||||
void flush (struct channel *);
|
||||
void putword (struct channel *, uint32);
|
||||
int putblock (struct channel *, char *, long);
|
||||
void really_putblock (struct channel *, char *, long);
|
||||
CAMLextern int flush_partial (struct channel *);
|
||||
CAMLextern void flush (struct channel *);
|
||||
CAMLextern void putword (struct channel *, uint32);
|
||||
CAMLextern int putblock (struct channel *, char *, long);
|
||||
CAMLextern void really_putblock (struct channel *, char *, long);
|
||||
|
||||
unsigned char refill (struct channel *);
|
||||
uint32 getword (struct channel *);
|
||||
int getblock (struct channel *, char *, long);
|
||||
int really_getblock (struct channel *, char *, long);
|
||||
CAMLextern unsigned char refill (struct channel *);
|
||||
CAMLextern uint32 getword (struct channel *);
|
||||
CAMLextern int getblock (struct channel *, char *, long);
|
||||
CAMLextern int really_getblock (struct channel *, char *, long);
|
||||
|
||||
/* Extract a struct channel * from the heap object representing it */
|
||||
|
||||
|
@ -75,10 +75,10 @@ int really_getblock (struct channel *, char *, long);
|
|||
|
||||
/* The locking machinery */
|
||||
|
||||
extern void (*channel_mutex_free) (struct channel *);
|
||||
extern void (*channel_mutex_lock) (struct channel *);
|
||||
extern void (*channel_mutex_unlock) (struct channel *);
|
||||
extern void (*channel_mutex_unlock_exn) (void);
|
||||
CAMLextern void (*channel_mutex_free) (struct channel *);
|
||||
CAMLextern void (*channel_mutex_lock) (struct channel *);
|
||||
CAMLextern void (*channel_mutex_unlock) (struct channel *);
|
||||
CAMLextern void (*channel_mutex_unlock_exn) (void);
|
||||
|
||||
#define Lock(channel) \
|
||||
if (channel_mutex_lock != NULL) (*channel_mutex_lock)(channel)
|
||||
|
|
|
@ -46,7 +46,8 @@ struct lexing_table {
|
|||
#define Short(tbl,n) (((short *)(tbl))[(n)])
|
||||
#endif
|
||||
|
||||
value lex_engine(struct lexing_table *tbl, value start_state, struct lexer_buffer *lexbuf) /* ML */
|
||||
CAMLprim value lex_engine(struct lexing_table *tbl, value start_state,
|
||||
struct lexer_buffer *lexbuf)
|
||||
{
|
||||
int state, base, backtrk, c;
|
||||
|
||||
|
|
|
@ -46,10 +46,10 @@ typedef int page_table_entry;
|
|||
typedef char page_table_entry;
|
||||
#endif
|
||||
|
||||
extern char *heap_start;
|
||||
extern char *heap_end;
|
||||
CAMLextern char *heap_start;
|
||||
CAMLextern char *heap_end;
|
||||
extern unsigned long total_heap_size;
|
||||
extern page_table_entry *page_table;
|
||||
CAMLextern page_table_entry *page_table;
|
||||
extern asize_t page_low, page_high;
|
||||
extern char *gc_sweep_hp;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
/* MD5 message digest */
|
||||
|
||||
value md5_string(value str, value ofs, value len) /* ML */
|
||||
CAMLprim value md5_string(value str, value ofs, value len)
|
||||
{
|
||||
struct MD5Context ctx;
|
||||
value res;
|
||||
|
@ -33,7 +33,7 @@ value md5_string(value str, value ofs, value len) /* ML */
|
|||
return res;
|
||||
}
|
||||
|
||||
value md5_chan(value vchan, value len) /* ML */
|
||||
CAMLprim value md5_chan(value vchan, value len)
|
||||
{
|
||||
struct channel * chan = Channel(vchan);
|
||||
struct MD5Context ctx;
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include "mlvalues.h"
|
||||
#include "io.h"
|
||||
|
||||
value md5_string (value str, value ofs, value len);
|
||||
value md5_chan (value vchan, value len);
|
||||
CAMLextern value md5_string (value str, value ofs, value len);
|
||||
CAMLextern value md5_chan (value vchan, value len);
|
||||
|
||||
struct MD5Context {
|
||||
uint32 buf[4];
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
#include "misc.h"
|
||||
#include "mlvalues.h"
|
||||
|
||||
value alloc_shr (mlsize_t, tag_t);
|
||||
CAMLextern value alloc_shr (mlsize_t, tag_t);
|
||||
void adjust_gc_speed (mlsize_t, mlsize_t);
|
||||
void modify (value *, value);
|
||||
void initialize (value *, value);
|
||||
value check_urgent_gc (value);
|
||||
void * stat_alloc (asize_t); /* Size in bytes. */
|
||||
void stat_free (void *);
|
||||
void * stat_resize (void *, asize_t); /* Size in bytes. */
|
||||
CAMLextern void modify (value *, value);
|
||||
CAMLextern void initialize (value *, value);
|
||||
CAMLextern value check_urgent_gc (value);
|
||||
CAMLextern void * stat_alloc (asize_t); /* Size in bytes. */
|
||||
CAMLextern void stat_free (void *);
|
||||
CAMLextern void * stat_resize (void *, asize_t); /* Size in bytes. */
|
||||
header_t *alloc_for_heap (asize_t request); /* Size in bytes. */
|
||||
void free_for_heap (header_t *mem);
|
||||
int add_to_heap (header_t *mem);
|
||||
|
@ -94,7 +94,7 @@ struct caml__roots_block {
|
|||
value *tables [5];
|
||||
};
|
||||
|
||||
extern struct caml__roots_block *local_roots; /* defined in roots.c */
|
||||
CAMLextern struct caml__roots_block *local_roots; /* defined in roots.c */
|
||||
|
||||
/* The following macros are used to declare C local variables and
|
||||
function parameters of type [value].
|
||||
|
@ -351,12 +351,12 @@ extern struct caml__roots_block *local_roots; /* defined in roots.c */
|
|||
for the duration of the program, or until [remove_global_root] is
|
||||
called. */
|
||||
|
||||
void register_global_root (value *);
|
||||
CAMLextern void register_global_root (value *);
|
||||
|
||||
/* [remove_global_root] removes a memory root registered on a global C
|
||||
variable with [register_global_root]. */
|
||||
|
||||
void remove_global_root (value *);
|
||||
CAMLextern void remove_global_root (value *);
|
||||
|
||||
|
||||
#endif /* _memory_ */
|
||||
|
|
|
@ -29,12 +29,12 @@
|
|||
|
||||
#ifndef NATIVE_CODE
|
||||
|
||||
value get_global_data(value unit) /* ML */
|
||||
CAMLprim value get_global_data(value unit)
|
||||
{
|
||||
return global_data;
|
||||
}
|
||||
|
||||
value reify_bytecode(value prog, value len) /* ML */
|
||||
CAMLprim value reify_bytecode(value prog, value len)
|
||||
{
|
||||
value clos;
|
||||
#ifdef ARCH_BIG_ENDIAN
|
||||
|
@ -48,7 +48,7 @@ value reify_bytecode(value prog, value len) /* ML */
|
|||
return clos;
|
||||
}
|
||||
|
||||
value realloc_global(value size) /* ML */
|
||||
CAMLprim value realloc_global(value size)
|
||||
{
|
||||
mlsize_t requested_size, actual_size, i;
|
||||
value new_global_data;
|
||||
|
@ -69,17 +69,12 @@ value realloc_global(value size) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value available_primitives(value unit) /* ML */
|
||||
{
|
||||
return copy_string_array((char const **) names_of_cprim);
|
||||
}
|
||||
|
||||
value get_current_environment(value unit) /* ML */
|
||||
CAMLprim value get_current_environment(value unit)
|
||||
{
|
||||
return *extern_sp;
|
||||
}
|
||||
|
||||
value invoke_traced_function(value codeptr, value env, value arg) /* ML */
|
||||
CAMLprim value invoke_traced_function(value codeptr, value env, value arg)
|
||||
{
|
||||
/* Stack layout on entry:
|
||||
return frame into instrument_closure function
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
#include "misc.h"
|
||||
|
||||
extern char *young_start, *young_ptr, *young_end, *young_limit;
|
||||
extern value **ref_table_ptr, **ref_table_limit;
|
||||
CAMLextern char *young_start, *young_ptr, *young_end, *young_limit;
|
||||
CAMLextern value **ref_table_ptr, **ref_table_limit;
|
||||
extern asize_t minor_heap_size;
|
||||
extern int in_minor_collection;
|
||||
|
||||
|
@ -28,8 +28,8 @@ extern int in_minor_collection;
|
|||
|
||||
extern void set_minor_heap_size (asize_t);
|
||||
extern void empty_minor_heap (void);
|
||||
extern void minor_collection (void);
|
||||
extern void garbage_collection (void); /* for the native-code system */
|
||||
CAMLextern void minor_collection (void);
|
||||
CAMLextern void garbage_collection (void); /* for the native-code system */
|
||||
extern void realloc_ref_table (void);
|
||||
extern void oldify (value, value *);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "misc.h"
|
||||
#include "memory.h"
|
||||
#ifdef HAS_UI
|
||||
#include "ui.h"
|
||||
#endif
|
||||
|
@ -67,6 +68,19 @@ void fatal_error_arg (char *fmt, char *arg)
|
|||
#endif
|
||||
}
|
||||
|
||||
void fatal_error_arg2 (char *fmt1, char *arg1, char *fmt2, char *arg2)
|
||||
{
|
||||
#ifdef HAS_UI
|
||||
ui_print_stderr(fmt1, arg1);
|
||||
ui_print_stderr(fmt2, arg2);
|
||||
ui_exit (2);
|
||||
#else
|
||||
fprintf (stderr, fmt1, arg1);
|
||||
fprintf (stderr, fmt2, arg2);
|
||||
exit(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
char *aligned_malloc (asize_t size, int modulo, void **block)
|
||||
{
|
||||
char *raw_mem;
|
||||
|
@ -92,3 +106,32 @@ char *aligned_malloc (asize_t size, int modulo, void **block)
|
|||
#endif
|
||||
return (char *) (aligned_mem - modulo);
|
||||
}
|
||||
|
||||
void ext_table_init(struct ext_table * tbl, int init_capa)
|
||||
{
|
||||
tbl->size = 0;
|
||||
tbl->capacity = init_capa;
|
||||
tbl->contents = stat_alloc(sizeof(void *) * init_capa);
|
||||
}
|
||||
|
||||
int ext_table_add(struct ext_table * tbl, void * data)
|
||||
{
|
||||
int res;
|
||||
if (tbl->size >= tbl->capacity) {
|
||||
tbl->capacity *= 2;
|
||||
tbl->contents =
|
||||
stat_resize(tbl->contents, sizeof(void *) * tbl->capacity);
|
||||
}
|
||||
res = tbl->size;
|
||||
tbl->contents[res] = data;
|
||||
tbl->size++;
|
||||
return res;
|
||||
}
|
||||
|
||||
void ext_table_free(struct ext_table * tbl, int free_entries)
|
||||
{
|
||||
int i;
|
||||
if (free_entries)
|
||||
for (i = 0; i < tbl->size; i++) stat_free(tbl->contents[i]);
|
||||
stat_free(tbl->contents);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,22 @@ typedef char * addr;
|
|||
#define Noreturn
|
||||
#endif
|
||||
|
||||
/* Export control (to mark primitives and to handle Windows DLL) */
|
||||
|
||||
#if defined(_WIN32) && defined(_DLL)
|
||||
# define CAMLexport __declspec(dllexport)
|
||||
# define CAMLprim __declspec(dllexport)
|
||||
# if defined(IN_OCAMLRUN)
|
||||
# define CAMLextern __declspec(dllexport) extern
|
||||
# else
|
||||
# define CAMLextern __declspec(dllimport) extern
|
||||
# endif
|
||||
#else
|
||||
# define CAMLexport
|
||||
# define CAMLprim
|
||||
# define CAMLextern extern
|
||||
#endif
|
||||
|
||||
/* Assertions */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -51,8 +67,22 @@ void caml_failed_assert (char *, char *, int) Noreturn;
|
|||
#define CAMLassert(x)
|
||||
#endif
|
||||
|
||||
void fatal_error (char *) Noreturn;
|
||||
void fatal_error_arg (char *, char *) Noreturn;
|
||||
void fatal_error (char *msg) Noreturn;
|
||||
void fatal_error_arg (char *fmt, char *arg) Noreturn;
|
||||
void fatal_error_arg2 (char *fmt1, char *arg1,
|
||||
char *fmt2, char *arg2) Noreturn;
|
||||
|
||||
/* Data structures */
|
||||
|
||||
struct ext_table {
|
||||
int size;
|
||||
int capacity;
|
||||
void ** contents;
|
||||
};
|
||||
|
||||
extern void ext_table_init(struct ext_table * tbl, int init_capa);
|
||||
extern int ext_table_add(struct ext_table * tbl, void * data);
|
||||
extern void ext_table_free(struct ext_table * tbl, int free_entries);
|
||||
|
||||
/* GC flags and messages */
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ typedef opcode_t * code_t;
|
|||
#define Oid_val(val) Long_val(Field((val), 1))
|
||||
|
||||
/* Another special case: variants */
|
||||
extern value hash_variant(char * tag);
|
||||
CAMLextern value hash_variant(char * tag);
|
||||
|
||||
/* 2- If tag >= No_scan_tag : a sequence of bytes. */
|
||||
|
||||
|
@ -196,7 +196,7 @@ extern value hash_variant(char * tag);
|
|||
/* Strings. */
|
||||
#define String_tag 252
|
||||
#define String_val(x) ((char *) Bp_val(x))
|
||||
mlsize_t string_length (value);
|
||||
CAMLextern mlsize_t string_length (value);
|
||||
|
||||
/* Floating-point numbers. */
|
||||
#define Double_tag 253
|
||||
|
@ -205,8 +205,8 @@ mlsize_t string_length (value);
|
|||
#define Double_val(v) (* (double *)(v))
|
||||
#define Store_double_val(v,d) (* (double *)(v) = (d))
|
||||
#else
|
||||
double Double_val (value);
|
||||
void Store_double_val (value,double);
|
||||
CAMLextern double Double_val (value);
|
||||
CAMLextern void Store_double_val (value,double);
|
||||
#endif
|
||||
|
||||
/* Arrays of floating-point numbers. */
|
||||
|
@ -234,12 +234,12 @@ struct custom_operations; /* defined in [custom.h] */
|
|||
#ifndef ARCH_ALIGN_INT64
|
||||
#define Int64_val(v) (*((int64 *) Data_custom_val(v)))
|
||||
#else
|
||||
extern int64 Int64_val(value v);
|
||||
CAMLextern int64 Int64_val(value v);
|
||||
#endif
|
||||
|
||||
/* 3- Atoms are 0-tuples. They are statically allocated once and for all. */
|
||||
|
||||
extern header_t atom_table[];
|
||||
CAMLextern header_t atom_table[];
|
||||
#define Atom(tag) (Val_hp (&(atom_table [(tag)])))
|
||||
|
||||
/* Is_atom tests whether a well-formed block is statically allocated
|
||||
|
@ -251,7 +251,7 @@ extern header_t atom_table[];
|
|||
#ifndef NATIVE_CODE
|
||||
#define Is_atom(v) ((v) >= Atom(0) && (v) <= Atom(255))
|
||||
#else
|
||||
extern char * static_data_start, * static_data_end;
|
||||
CAMLextern char * static_data_start, * static_data_end;
|
||||
#define Is_atom(v) \
|
||||
((((char *)(v) >= static_data_start && (char *)(v) < static_data_end) || \
|
||||
((v) >= Atom(0) && (v) <= Atom(255))))
|
||||
|
|
|
@ -24,33 +24,33 @@
|
|||
#include "mlvalues.h"
|
||||
#include "prims.h"
|
||||
|
||||
value static_alloc(value size) /* ML */
|
||||
CAMLprim value static_alloc(value size)
|
||||
{
|
||||
return (value) stat_alloc((asize_t) Long_val(size));
|
||||
}
|
||||
|
||||
value static_free(value blk) /* ML */
|
||||
CAMLprim value static_free(value blk)
|
||||
{
|
||||
stat_free((void *) blk);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value static_resize(value blk, value new_size) /* ML */
|
||||
CAMLprim value static_resize(value blk, value new_size)
|
||||
{
|
||||
return (value) stat_resize((char *) blk, (asize_t) Long_val(new_size));
|
||||
}
|
||||
|
||||
value obj_is_block(value arg) /* ML */
|
||||
CAMLprim value obj_is_block(value arg)
|
||||
{
|
||||
return Val_bool(Is_block(arg));
|
||||
}
|
||||
|
||||
value obj_tag(value arg) /* ML */
|
||||
CAMLprim value obj_tag(value arg)
|
||||
{
|
||||
return Val_int(Tag_val(arg));
|
||||
}
|
||||
|
||||
value obj_block(value tag, value size) /* ML */
|
||||
CAMLprim value obj_block(value tag, value size)
|
||||
{
|
||||
value res;
|
||||
mlsize_t sz, i;
|
||||
|
@ -66,7 +66,7 @@ value obj_block(value tag, value size) /* ML */
|
|||
return res;
|
||||
}
|
||||
|
||||
value obj_dup(value arg) /* ML */
|
||||
CAMLprim value obj_dup(value arg)
|
||||
{
|
||||
CAMLparam1 (arg);
|
||||
CAMLlocal1 (res);
|
||||
|
@ -93,7 +93,7 @@ value obj_dup(value arg) /* ML */
|
|||
with the leftover part of the object: this is needed in the major
|
||||
heap and harmless in the minor heap.
|
||||
*/
|
||||
value obj_truncate (value v, value newsize) /* ML */
|
||||
CAMLprim value obj_truncate (value v, value newsize)
|
||||
{
|
||||
mlsize_t new_wosize = Long_val (newsize);
|
||||
header_t hd = Hd_val (v);
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* Objective Caml */
|
||||
/* */
|
||||
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
||||
/* */
|
||||
/* Copyright 2001 Institut National de Recherche en Informatique et */
|
||||
/* en Automatique. All rights reserved. This file is distributed */
|
||||
/* under the terms of the GNU Library General Public License. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* Operating system - specific stuff */
|
||||
|
||||
#ifndef _osdeps_
|
||||
|
||||
#define _osdeps_
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
/* Decompose the given path into a list of directories, and add them
|
||||
to the given table. Return the block to be freed later. */
|
||||
extern char * decompose_path(struct ext_table * tbl, char * path);
|
||||
|
||||
/* Search the given file in the given list of directories.
|
||||
If not found, return a copy of [name]. Result is allocated with
|
||||
[stat_alloc]. */
|
||||
extern char * search_in_path(struct ext_table * path, char * name);
|
||||
|
||||
/* Same, but search an executable name in the system path for executables. */
|
||||
CAMLextern char * search_exe_in_path(char * name);
|
||||
|
||||
/* Same, but search a shared library in the given path. */
|
||||
extern char * search_dll_in_path(struct ext_table * path, char * name);
|
||||
|
||||
/* Open a shared library and return a handle on it.
|
||||
Return [NULL] on error. */
|
||||
extern void * caml_dlopen(char * libname);
|
||||
|
||||
/* Close a shared library handle */
|
||||
extern void caml_dlclose(void * handle);
|
||||
|
||||
/* Look up the given symbol in the given shared library.
|
||||
Return [NULL] if not found, or symbol value if found. */
|
||||
extern void * caml_dlsym(void * handle, char * name);
|
||||
|
||||
/* Return an error message describing the most recent dynlink failure. */
|
||||
extern char * caml_dlerror(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -105,7 +105,8 @@ int parser_trace = 0;
|
|||
|
||||
/* The pushdown automata */
|
||||
|
||||
value parse_engine(struct parser_tables *tables, struct parser_env *env, value cmd, value arg) /* ML */
|
||||
CAMLprim value parse_engine(struct parser_tables *tables,
|
||||
struct parser_env *env, value cmd, value arg)
|
||||
{
|
||||
int state;
|
||||
mlsize_t sp, asp;
|
||||
|
|
|
@ -19,7 +19,11 @@
|
|||
|
||||
typedef value (*c_primitive)();
|
||||
|
||||
extern c_primitive cprim[];
|
||||
extern char * names_of_cprim[];
|
||||
extern c_primitive builtin_cprim[];
|
||||
extern char * names_of_builtin_cprim[];
|
||||
|
||||
extern struct ext_table prim_table;
|
||||
|
||||
#define Primitive(n) ((c_primitive)(prim_table.contents[n]))
|
||||
|
||||
#endif /* _prims_ */
|
||||
|
|
|
@ -46,7 +46,7 @@ static void add_string(struct stringbuf *buf, char *s)
|
|||
buf->ptr += len;
|
||||
}
|
||||
|
||||
char * format_caml_exception(value exn)
|
||||
CAMLexport char * format_caml_exception(value exn)
|
||||
{
|
||||
mlsize_t start, i;
|
||||
value bucket, v;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "misc.h"
|
||||
#include "mlvalues.h"
|
||||
|
||||
char * format_caml_exception (value);
|
||||
CAMLextern char * format_caml_exception (value);
|
||||
void fatal_uncaught_exception (value) Noreturn;
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "roots.h"
|
||||
#include "stacks.h"
|
||||
|
||||
struct caml__roots_block *local_roots = NULL;
|
||||
CAMLexport struct caml__roots_block *local_roots = NULL;
|
||||
|
||||
void (*scan_roots_hook) (scanning_action f) = NULL;
|
||||
|
||||
|
|
|
@ -24,14 +24,14 @@ void oldify_local_roots (void);
|
|||
void darken_all_roots (void);
|
||||
void do_roots (scanning_action);
|
||||
#ifndef NATIVE_CODE
|
||||
void do_local_roots (scanning_action, value *, value *,
|
||||
struct caml__roots_block *);
|
||||
CAMLextern void do_local_roots (scanning_action, value *, value *,
|
||||
struct caml__roots_block *);
|
||||
#else
|
||||
void do_local_roots(scanning_action f, char * bottom_of_stack,
|
||||
unsigned long last_retaddr, value * gc_regs,
|
||||
struct caml__roots_block * local_roots);
|
||||
CAMLextern void do_local_roots(scanning_action f, char * bottom_of_stack,
|
||||
unsigned long last_retaddr, value * gc_regs,
|
||||
struct caml__roots_block * local_roots);
|
||||
#endif
|
||||
|
||||
extern void (*scan_roots_hook) (scanning_action);
|
||||
CAMLextern void (*scan_roots_hook) (scanning_action);
|
||||
|
||||
#endif /* _roots_ */
|
||||
|
|
|
@ -107,7 +107,7 @@ void urge_major_slice (void)
|
|||
something_to_do = 1;
|
||||
}
|
||||
|
||||
void enter_blocking_section(void)
|
||||
CAMLexport void enter_blocking_section(void)
|
||||
{
|
||||
int temp;
|
||||
|
||||
|
@ -124,7 +124,7 @@ void enter_blocking_section(void)
|
|||
if (enter_blocking_section_hook != NULL) enter_blocking_section_hook();
|
||||
}
|
||||
|
||||
void leave_blocking_section(void)
|
||||
CAMLexport void leave_blocking_section(void)
|
||||
{
|
||||
if (leave_blocking_section_hook != NULL) leave_blocking_section_hook();
|
||||
Assert(async_signal_mode);
|
||||
|
@ -201,7 +201,7 @@ static int posix_signals[] = {
|
|||
SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGVTALRM, SIGPROF
|
||||
};
|
||||
|
||||
int convert_signal_number(int signo)
|
||||
CAMLexport int convert_signal_number(int signo)
|
||||
{
|
||||
if (signo < 0 && signo >= -(sizeof(posix_signals) / sizeof(int)))
|
||||
return posix_signals[-signo-1];
|
||||
|
@ -221,7 +221,7 @@ static int rev_convert_signal_number(int signo)
|
|||
#define NSIG 64
|
||||
#endif
|
||||
|
||||
value install_signal_handler(value signal_number, value action) /* ML */
|
||||
CAMLprim value install_signal_handler(value signal_number, value action)
|
||||
{
|
||||
CAMLparam2 (signal_number, action);
|
||||
int sig;
|
||||
|
|
|
@ -19,21 +19,21 @@
|
|||
#include "mlvalues.h"
|
||||
|
||||
extern value signal_handlers;
|
||||
extern int volatile pending_signal;
|
||||
extern int volatile something_to_do;
|
||||
CAMLextern int volatile pending_signal;
|
||||
CAMLextern int volatile something_to_do;
|
||||
extern int volatile force_major_slice;
|
||||
extern int volatile async_signal_mode;
|
||||
CAMLextern int volatile async_signal_mode;
|
||||
|
||||
void enter_blocking_section (void);
|
||||
void leave_blocking_section (void);
|
||||
CAMLextern void enter_blocking_section (void);
|
||||
CAMLextern void leave_blocking_section (void);
|
||||
void urge_major_slice (void);
|
||||
int convert_signal_number (int);
|
||||
CAMLextern int convert_signal_number (int);
|
||||
void execute_signal(int signal_number, int in_signal_handler);
|
||||
void process_event(void);
|
||||
|
||||
extern void (*enter_blocking_section_hook)(void);
|
||||
extern void (*leave_blocking_section_hook)(void);
|
||||
extern void (* volatile async_action_hook)(void);
|
||||
CAMLextern void (*enter_blocking_section_hook)(void);
|
||||
CAMLextern void (*leave_blocking_section_hook)(void);
|
||||
CAMLextern void (* volatile async_action_hook)(void);
|
||||
|
||||
#endif /* _signals_ */
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
#include "mlvalues.h"
|
||||
#include "stacks.h"
|
||||
|
||||
value * stack_low;
|
||||
value * stack_high;
|
||||
value * stack_threshold;
|
||||
value * extern_sp;
|
||||
value * trapsp;
|
||||
value * trap_barrier;
|
||||
CAMLexport value * stack_low;
|
||||
CAMLexport value * stack_high;
|
||||
CAMLexport value * stack_threshold;
|
||||
CAMLexport value * extern_sp;
|
||||
CAMLexport value * trapsp;
|
||||
CAMLexport value * trap_barrier;
|
||||
value global_data;
|
||||
|
||||
unsigned long max_stack_size; /* also used in gc_ctrl.c */
|
||||
|
@ -81,7 +81,7 @@ void realloc_stack(asize_t required_space)
|
|||
#undef shift
|
||||
}
|
||||
|
||||
value ensure_stack_capacity(value required_space) /* ML */
|
||||
CAMLprim value ensure_stack_capacity(value required_space)
|
||||
{
|
||||
asize_t req = Long_val(required_space);
|
||||
if (extern_sp - req < stack_low) realloc_stack(req);
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
#include "mlvalues.h"
|
||||
#include "memory.h"
|
||||
|
||||
extern value * stack_low;
|
||||
extern value * stack_high;
|
||||
extern value * stack_threshold;
|
||||
extern value * extern_sp;
|
||||
extern value * trapsp;
|
||||
extern value * trap_barrier;
|
||||
CAMLextern value * stack_low;
|
||||
CAMLextern value * stack_high;
|
||||
CAMLextern value * stack_threshold;
|
||||
CAMLextern value * extern_sp;
|
||||
CAMLextern value * trapsp;
|
||||
CAMLextern value * trap_barrier;
|
||||
|
||||
#define Trap_pc(tp) (((code_t *)(tp))[0])
|
||||
#define Trap_link(tp) (((value **)(tp))[1])
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "callback.h"
|
||||
#include "custom.h"
|
||||
#include "debugger.h"
|
||||
#include "dynlink.h"
|
||||
#include "exec.h"
|
||||
#include "fail.h"
|
||||
#include "fix_code.h"
|
||||
|
@ -42,6 +43,7 @@
|
|||
#include "minor_gc.h"
|
||||
#include "misc.h"
|
||||
#include "mlvalues.h"
|
||||
#include "osdeps.h"
|
||||
#include "prims.h"
|
||||
#include "printexc.h"
|
||||
#include "reverse.h"
|
||||
|
@ -58,7 +60,7 @@
|
|||
#define SEEK_END 2
|
||||
#endif
|
||||
|
||||
header_t atom_table[256];
|
||||
CAMLexport header_t atom_table[256];
|
||||
|
||||
/* Initialize the atom table */
|
||||
|
||||
|
@ -97,8 +99,8 @@ int attempt_open(char **name, struct exec_trailer *trail,
|
|||
int err;
|
||||
char buf [2];
|
||||
|
||||
truename = searchpath(*name);
|
||||
if (truename == 0) truename = *name; else *name = truename;
|
||||
truename = search_exe_in_path(*name);
|
||||
*name = truename;
|
||||
gc_message(0x100, "Opening bytecode executable %s\n",
|
||||
(unsigned long) truename);
|
||||
fd = open(truename, O_RDONLY | O_BINARY);
|
||||
|
@ -170,28 +172,21 @@ int32 seek_section(int fd, struct exec_trailer *trail, char *name)
|
|||
return len;
|
||||
}
|
||||
|
||||
/* Check the primitives used by the bytecode file against the table of
|
||||
primitives linked in this interpreter */
|
||||
/* Read and return the contents of the section having the given name.
|
||||
Add a terminating 0. Return NULL if no such section. */
|
||||
|
||||
static void check_primitives(int fd, int prim_size)
|
||||
static char * read_section(int fd, struct exec_trailer *trail, char *name)
|
||||
{
|
||||
char * prims = stat_alloc(prim_size);
|
||||
char * p;
|
||||
int idx;
|
||||
int32 len;
|
||||
char * data;
|
||||
|
||||
if (read(fd, prims, prim_size) != prim_size)
|
||||
fatal_error("Fatal error: cannot read primitive table\n");
|
||||
/* prims contains 0-terminated strings, concatenated. */
|
||||
for (p = prims, idx = 0;
|
||||
p < prims + prim_size;
|
||||
p = p + strlen(p) + 1, idx++) {
|
||||
if (names_of_cprim[idx] == NULL ||
|
||||
strcmp(p, names_of_cprim[idx]) != 0)
|
||||
fatal_error_arg("Fatal error: this bytecode file cannot run "
|
||||
"on this bytecode interpreter\n"
|
||||
"Mismatch on primitive `%s'\n", p);
|
||||
}
|
||||
stat_free(prims);
|
||||
len = seek_optional_section(fd, trail, name);
|
||||
if (len == -1) return NULL;
|
||||
data = stat_alloc(len + 1);
|
||||
if (read(fd, data, len) != len)
|
||||
fatal_error_arg("Fatal error: error reading section %s\n", name);
|
||||
data[len] = 0;
|
||||
return data;
|
||||
}
|
||||
|
||||
/* Invocation of ocamlrun: 4 cases.
|
||||
|
@ -249,13 +244,19 @@ static int parse_command_line(char **argv)
|
|||
verb_gc = 1+4+8+16+32;
|
||||
break;
|
||||
case 'p':
|
||||
for (j = 0; names_of_cprim[j] != NULL; j++)
|
||||
printf("%s\n", names_of_cprim[j]);
|
||||
for (j = 0; names_of_builtin_cprim[j] != NULL; j++)
|
||||
printf("%s\n", names_of_builtin_cprim[j]);
|
||||
exit(0);
|
||||
break;
|
||||
case 'b':
|
||||
backtrace_active = 1;
|
||||
break;
|
||||
case 'I':
|
||||
if (argv[i + 1] != NULL) {
|
||||
ext_table_add(&shared_libs_path, argv[i + 1]);
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fatal_error_arg("Unknown option %s.\n", argv[i]);
|
||||
}
|
||||
|
@ -308,18 +309,20 @@ extern void caml_signal_thread(void * lpParam);
|
|||
|
||||
/* Main entry point when loading code from a file */
|
||||
|
||||
void caml_main(char **argv)
|
||||
CAMLexport void caml_main(char **argv)
|
||||
{
|
||||
int fd, pos;
|
||||
struct exec_trailer trail;
|
||||
asize_t prog_size;
|
||||
struct channel * chan;
|
||||
value res;
|
||||
char * shared_lib_path, * shared_libs, * req_prims;
|
||||
|
||||
/* Machine-dependent initialization of the floating-point hardware
|
||||
so that it behaves as much as possible as specified in IEEE */
|
||||
init_ieee_floats();
|
||||
init_custom_operations();
|
||||
ext_table_init(&shared_libs_path, 8);
|
||||
external_raise = NULL;
|
||||
/* Determine options and position of bytecode file */
|
||||
#ifdef DEBUG
|
||||
|
@ -358,8 +361,15 @@ void caml_main(char **argv)
|
|||
/* Load the code */
|
||||
code_size = seek_section(fd, &trail, "CODE");
|
||||
load_code(fd, code_size);
|
||||
/* Check the primitives */
|
||||
check_primitives(fd, seek_section(fd, &trail, "PRIM"));
|
||||
/* Build the table of primitives */
|
||||
shared_lib_path = read_section(fd, &trail, "DLPT");
|
||||
shared_libs = read_section(fd, &trail, "DLLS");
|
||||
req_prims = read_section(fd, &trail, "PRIM");
|
||||
if (req_prims == NULL) fatal_error("Fatal error: no PRIM section\n");
|
||||
build_primitive_table(shared_lib_path, shared_libs, req_prims);
|
||||
stat_free(shared_lib_path);
|
||||
stat_free(shared_libs);
|
||||
stat_free(req_prims);
|
||||
/* Load the globals */
|
||||
seek_section(fd, &trail, "DATA");
|
||||
chan = open_descriptor(fd);
|
||||
|
@ -391,7 +401,8 @@ void caml_main(char **argv)
|
|||
|
||||
/* Main entry point when code is linked in as initialized data */
|
||||
|
||||
void caml_startup_code(code_t code, asize_t code_size, char *data, char **argv)
|
||||
CAMLexport void caml_startup_code(code_t code, asize_t code_size,
|
||||
char *data, char **argv)
|
||||
{
|
||||
value res;
|
||||
|
||||
|
@ -413,6 +424,9 @@ void caml_startup_code(code_t code, asize_t code_size, char *data, char **argv)
|
|||
#ifdef THREADED_CODE
|
||||
thread_code(start_code, code_size);
|
||||
#endif
|
||||
/* Use the builtin table of primitives */
|
||||
prim_table.size = prim_table.capacity = -1;
|
||||
prim_table.contents = (void **) builtin_cprim;
|
||||
/* Load the globals */
|
||||
global_data = input_val_from_string((value)data, 0);
|
||||
/* Ensure that the globals are in the major heap. */
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include "misc.h"
|
||||
#include "exec.h"
|
||||
|
||||
extern void caml_main(char **argv);
|
||||
extern void caml_startup_code(code_t code, asize_t code_size,
|
||||
char *data, char **argv);
|
||||
CAMLextern void caml_main(char **argv);
|
||||
CAMLextern void caml_startup_code(code_t code, asize_t code_size,
|
||||
char *data, char **argv);
|
||||
|
||||
enum { FILE_NOT_FOUND = -1, BAD_BYTECODE = -2 };
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
mlsize_t string_length(value s)
|
||||
CAMLexport mlsize_t string_length(value s)
|
||||
{
|
||||
mlsize_t temp;
|
||||
temp = Bosize_val(s) - 1;
|
||||
|
@ -32,7 +32,7 @@ mlsize_t string_length(value s)
|
|||
return temp - Byte (s, temp);
|
||||
}
|
||||
|
||||
value ml_string_length(value s) /* ML */
|
||||
CAMLprim value ml_string_length(value s)
|
||||
{
|
||||
mlsize_t temp;
|
||||
temp = Bosize_val(s) - 1;
|
||||
|
@ -40,21 +40,21 @@ value ml_string_length(value s) /* ML */
|
|||
return Val_long(temp - Byte (s, temp));
|
||||
}
|
||||
|
||||
value create_string(value len) /* ML */
|
||||
CAMLprim value create_string(value len)
|
||||
{
|
||||
mlsize_t size = Long_val(len);
|
||||
if (size > Bsize_wsize (Max_wosize) - 1) invalid_argument("String.create");
|
||||
return alloc_string(size);
|
||||
}
|
||||
|
||||
value string_get(value str, value index) /* ML */
|
||||
CAMLprim value string_get(value str, value index)
|
||||
{
|
||||
long idx = Long_val(index);
|
||||
if (idx < 0 || idx >= string_length(str)) invalid_argument("String.get");
|
||||
return Val_int(Byte_u(str, idx));
|
||||
}
|
||||
|
||||
value string_set(value str, value index, value newval) /* ML */
|
||||
CAMLprim value string_set(value str, value index, value newval)
|
||||
{
|
||||
long idx = Long_val(index);
|
||||
if (idx < 0 || idx >= string_length(str)) invalid_argument("String.set");
|
||||
|
@ -62,7 +62,7 @@ value string_set(value str, value index, value newval) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value string_equal(value s1, value s2) /* ML */
|
||||
CAMLprim value string_equal(value s1, value s2)
|
||||
{
|
||||
mlsize_t sz1 = Wosize_val(s1);
|
||||
mlsize_t sz2 = Wosize_val(s2);
|
||||
|
@ -73,18 +73,18 @@ value string_equal(value s1, value s2) /* ML */
|
|||
return Val_true;
|
||||
}
|
||||
|
||||
value string_notequal(value s1, value s2) /* ML */
|
||||
CAMLprim value string_notequal(value s1, value s2)
|
||||
{
|
||||
return Val_not(string_equal(s1, s2));
|
||||
}
|
||||
|
||||
value blit_string(value s1, value ofs1, value s2, value ofs2, value n) /* ML */
|
||||
CAMLprim value blit_string(value s1, value ofs1, value s2, value ofs2, value n)
|
||||
{
|
||||
memmove(&Byte(s2, Long_val(ofs2)), &Byte(s1, Long_val(ofs1)), Int_val(n));
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value fill_string(value s, value offset, value len, value init) /* ML */
|
||||
CAMLprim value fill_string(value s, value offset, value len, value init)
|
||||
{
|
||||
register char * p;
|
||||
register mlsize_t n;
|
||||
|
@ -97,7 +97,7 @@ value fill_string(value s, value offset, value len, value init) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value is_printable(value chr) /* ML */
|
||||
CAMLprim value is_printable(value chr)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@ -124,7 +124,7 @@ value is_printable(value chr) /* ML */
|
|||
#endif
|
||||
}
|
||||
|
||||
value bitvect_test(value bv, value n) /* ML */
|
||||
CAMLprim value bitvect_test(value bv, value n)
|
||||
{
|
||||
int pos = Int_val(n);
|
||||
return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7)));
|
||||
|
|
124
byterun/sys.c
124
byterun/sys.c
|
@ -53,11 +53,15 @@
|
|||
#include "ui.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_STRERROR
|
||||
|
||||
#ifndef _WIN32
|
||||
extern char * strerror(int);
|
||||
#endif
|
||||
|
||||
char * error_message(void)
|
||||
{
|
||||
|
@ -86,7 +90,7 @@ char * error_message(void)
|
|||
#define EWOULDBLOCK (-1)
|
||||
#endif
|
||||
|
||||
void sys_error(value arg)
|
||||
CAMLexport void sys_error(value arg)
|
||||
{
|
||||
CAMLparam1 (arg);
|
||||
char * err;
|
||||
|
@ -110,7 +114,7 @@ void sys_error(value arg)
|
|||
}
|
||||
}
|
||||
|
||||
value sys_exit(value retcode) /* ML */
|
||||
CAMLprim value sys_exit(value retcode)
|
||||
{
|
||||
#ifndef NATIVE_CODE
|
||||
debugger(PROGRAM_EXIT);
|
||||
|
@ -142,7 +146,7 @@ static int sys_open_flags[] = {
|
|||
O_BINARY, O_TEXT, O_NONBLOCK
|
||||
};
|
||||
|
||||
value sys_open(value path, value flags, value perm) /* ML */
|
||||
CAMLprim value sys_open(value path, value flags, value perm)
|
||||
{
|
||||
int ret;
|
||||
ret = open(String_val(path), convert_flag_list(flags, sys_open_flags)
|
||||
|
@ -154,13 +158,13 @@ value sys_open(value path, value flags, value perm) /* ML */
|
|||
return Val_long(ret);
|
||||
}
|
||||
|
||||
value sys_close(value fd) /* ML */
|
||||
CAMLprim value sys_close(value fd)
|
||||
{
|
||||
close(Int_val(fd));
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value sys_file_exists(value name) /* ML */
|
||||
CAMLprim value sys_file_exists(value name)
|
||||
{
|
||||
#if macintosh
|
||||
int f;
|
||||
|
@ -174,7 +178,7 @@ value sys_file_exists(value name) /* ML */
|
|||
#endif
|
||||
}
|
||||
|
||||
value sys_remove(value name) /* ML */
|
||||
CAMLprim value sys_remove(value name)
|
||||
{
|
||||
int ret;
|
||||
ret = unlink(String_val(name));
|
||||
|
@ -182,20 +186,20 @@ value sys_remove(value name) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value sys_rename(value oldname, value newname) /* ML */
|
||||
CAMLprim value sys_rename(value oldname, value newname)
|
||||
{
|
||||
if (rename(String_val(oldname), String_val(newname)) != 0)
|
||||
sys_error(oldname);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value sys_chdir(value dirname) /* ML */
|
||||
CAMLprim value sys_chdir(value dirname)
|
||||
{
|
||||
if (chdir(String_val(dirname)) != 0) sys_error(dirname);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value sys_getcwd(value unit) /* ML */
|
||||
CAMLprim value sys_getcwd(value unit)
|
||||
{
|
||||
char buff[4096];
|
||||
#ifdef HAS_GETCWD
|
||||
|
@ -206,7 +210,7 @@ value sys_getcwd(value unit) /* ML */
|
|||
return copy_string(buff);
|
||||
}
|
||||
|
||||
value sys_getenv(value var) /* ML */
|
||||
CAMLprim value sys_getenv(value var)
|
||||
{
|
||||
char * res;
|
||||
|
||||
|
@ -217,7 +221,7 @@ value sys_getenv(value var) /* ML */
|
|||
|
||||
char ** caml_main_argv;
|
||||
|
||||
value sys_get_argv(value unit) /* ML */
|
||||
CAMLprim value sys_get_argv(value unit)
|
||||
{
|
||||
return copy_string_array((char const **) caml_main_argv);
|
||||
}
|
||||
|
@ -237,7 +241,7 @@ void sys_init(char **argv)
|
|||
extern int win32_system(char * command);
|
||||
#endif
|
||||
|
||||
value sys_system_command(value command) /* ML */
|
||||
CAMLprim value sys_system_command(value command)
|
||||
{
|
||||
int status, retcode;
|
||||
|
||||
|
@ -256,7 +260,7 @@ value sys_system_command(value command) /* ML */
|
|||
return Val_int(retcode);
|
||||
}
|
||||
|
||||
value sys_time(value unit) /* ML */
|
||||
CAMLprim value sys_time(value unit)
|
||||
{
|
||||
#ifdef HAS_TIMES
|
||||
#ifndef CLK_TCK
|
||||
|
@ -275,7 +279,7 @@ value sys_time(value unit) /* ML */
|
|||
#endif
|
||||
}
|
||||
|
||||
value sys_random_seed (value unit) /* ML */
|
||||
CAMLprim value sys_random_seed (value unit)
|
||||
{
|
||||
#ifdef HAS_GETTIMEOFDAY
|
||||
struct timeval tv;
|
||||
|
@ -286,7 +290,7 @@ value sys_random_seed (value unit) /* ML */
|
|||
#endif
|
||||
}
|
||||
|
||||
value sys_get_config(value unit) /* ML */
|
||||
CAMLprim value sys_get_config(value unit)
|
||||
{
|
||||
CAMLparam0 (); /* unit is unused */
|
||||
CAMLlocal2 (result, ostype);
|
||||
|
@ -298,93 +302,3 @@ value sys_get_config(value unit) /* ML */
|
|||
CAMLreturn (result);
|
||||
}
|
||||
|
||||
/* Search path function */
|
||||
/* For Win32: defined in win32.c */
|
||||
/* For MacOS: defined in macintosh.c */
|
||||
|
||||
#if !defined(_WIN32) && !defined(macintosh)
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
#ifndef __CYGWIN32__
|
||||
|
||||
char * searchpath(char * name)
|
||||
{
|
||||
char * fullname;
|
||||
char * path;
|
||||
char * p;
|
||||
char * q;
|
||||
struct stat st;
|
||||
|
||||
for (p = name; *p != 0; p++) {
|
||||
if (*p == '/') return name;
|
||||
}
|
||||
path = getenv("PATH");
|
||||
if (path == NULL) return 0;
|
||||
fullname = stat_alloc(strlen(name) + strlen(path) + 2);
|
||||
while(1) {
|
||||
for (p = fullname; *path != 0 && *path != ':'; p++, path++) *p = *path;
|
||||
if (p != fullname) *p++ = '/';
|
||||
for (q = name; *q != 0; p++, q++) *p = *q;
|
||||
*p = 0;
|
||||
if (stat(fullname, &st) == 0 && S_ISREG(st.st_mode)) break;
|
||||
if (*path == 0) return 0;
|
||||
path++;
|
||||
}
|
||||
return fullname;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Cygwin needs special treatment because of the implicit ".exe" at the
|
||||
end of executable file names */
|
||||
|
||||
static int searchpath_file_ok(char * name)
|
||||
{
|
||||
int fd;
|
||||
/* Cannot use stat() here because it adds ".exe" implicitly */
|
||||
fd = open(name, O_RDONLY);
|
||||
if (fd == -1) return 0;
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char * searchpath(char * name)
|
||||
{
|
||||
char * path, * fullname, * p;
|
||||
|
||||
path = getenv("PATH");
|
||||
fullname = malloc(strlen(name) + (path == NULL ? 0 : strlen(path)) + 6);
|
||||
/* 6 = "/" plus ".exe" plus final "\0" */
|
||||
if (fullname == NULL) return name;
|
||||
/* Check for absolute path name */
|
||||
for (p = name; *p != 0; p++) {
|
||||
if (*p == '/' || *p == '\\') {
|
||||
if (searchpath_file_ok(name)) return name;
|
||||
strcpy(fullname, name);
|
||||
strcat(fullname, ".exe");
|
||||
if (searchpath_file_ok(name)) return fullname;
|
||||
return name;
|
||||
}
|
||||
}
|
||||
/* Search in path */
|
||||
if (path == NULL) return 0;
|
||||
while(1) {
|
||||
for (p = fullname; *path != 0 && *path != ':'; p++, path++) *p = *path;
|
||||
if (p != fullname) *p++ = '/';
|
||||
strcpy(p, name);
|
||||
if (searchpath_file_ok(fullname)) return fullname;
|
||||
strcat(fullname, ".exe");
|
||||
if (searchpath_file_ok(fullname)) return fullname;
|
||||
if (*path == 0) break;
|
||||
path++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __CYGWIN32__ */
|
||||
|
||||
#endif /* _WIN32, macintosh, ... */
|
||||
|
||||
|
|
|
@ -19,10 +19,9 @@
|
|||
|
||||
#define NO_ARG Val_int(0)
|
||||
|
||||
extern void sys_error (value);
|
||||
CAMLextern void sys_error (value);
|
||||
extern void sys_init (char **);
|
||||
extern value sys_exit (value);
|
||||
extern char * searchpath (char * name);
|
||||
CAMLextern value sys_exit (value);
|
||||
|
||||
extern char ** caml_main_argv;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ static char *down = NULL;
|
|||
static char *standout = NULL;
|
||||
static char *standend = NULL;
|
||||
|
||||
value terminfo_setup (value vchan) /* ML */
|
||||
CAMLprim value terminfo_setup (value vchan)
|
||||
{
|
||||
value result;
|
||||
static char buffer[1024];
|
||||
|
@ -74,7 +74,7 @@ static int terminfo_putc (int c)
|
|||
return c;
|
||||
}
|
||||
|
||||
value terminfo_backup (value lines) /* ML */
|
||||
CAMLprim value terminfo_backup (value lines)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -84,13 +84,13 @@ value terminfo_backup (value lines) /* ML */
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value terminfo_standout (value start) /* ML */
|
||||
CAMLprim value terminfo_standout (value start)
|
||||
{
|
||||
tputs (Bool_val (start) ? standout : standend, 1, terminfo_putc);
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value terminfo_resume (value lines) /* ML */
|
||||
CAMLprim value terminfo_resume (value lines)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -102,24 +102,24 @@ value terminfo_resume (value lines) /* ML */
|
|||
|
||||
#else /* defined (HAS_TERMCAP) && !defined (NATIVE_CODE) */
|
||||
|
||||
value terminfo_setup (value vchan)
|
||||
CAMLexport value terminfo_setup (value vchan)
|
||||
{
|
||||
return Bad_term;
|
||||
}
|
||||
|
||||
value terminfo_backup (value lines)
|
||||
CAMLexport value terminfo_backup (value lines)
|
||||
{
|
||||
invalid_argument("Terminfo.backup");
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value terminfo_standout (value start)
|
||||
CAMLexport value terminfo_standout (value start)
|
||||
{
|
||||
invalid_argument("Terminfo.standout");
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
value terminfo_resume (value lines)
|
||||
CAMLexport value terminfo_resume (value lines)
|
||||
{
|
||||
invalid_argument("Terminfo.resume");
|
||||
return Val_unit;
|
||||
|
|
|
@ -0,0 +1,198 @@
|
|||
/***********************************************************************/
|
||||
/* */
|
||||
/* Objective Caml */
|
||||
/* */
|
||||
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
||||
/* */
|
||||
/* Copyright 2001 Institut National de Recherche en Informatique et */
|
||||
/* en Automatique. All rights reserved. This file is distributed */
|
||||
/* under the terms of the GNU Library General Public License. */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* Unix-specific stuff */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "config.h"
|
||||
#ifdef SUPPORT_DYNAMIC_LINKING
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#include "memory.h"
|
||||
#include "misc.h"
|
||||
#include "osdeps.h"
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
char * decompose_path(struct ext_table * tbl, char * path)
|
||||
{
|
||||
char * p, * q;
|
||||
int n;
|
||||
|
||||
if (path == NULL) return NULL;
|
||||
p = stat_alloc(strlen(path) + 1);
|
||||
strcpy(p, path);
|
||||
q = p;
|
||||
while (1) {
|
||||
for (n = 0; q[n] != 0 && q[n] != ':'; n++) /*nothing*/;
|
||||
ext_table_add(tbl, q);
|
||||
q = q + n;
|
||||
if (*q == 0) break;
|
||||
*q = 0;
|
||||
q += 1;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
char * search_in_path(struct ext_table * path, char * name)
|
||||
{
|
||||
char * p, * fullname;
|
||||
int i;
|
||||
struct stat st;
|
||||
|
||||
for (p = name; *p != 0; p++) {
|
||||
if (*p == '/') goto not_found;
|
||||
}
|
||||
for (i = 0; i < path->size; i++) {
|
||||
fullname = stat_alloc(strlen((char *)(path->contents[i])) +
|
||||
strlen(name) + 2);
|
||||
strcpy(fullname, (char *)(path->contents[i]));
|
||||
if (fullname[0] != 0) strcat(fullname, "/");
|
||||
strcat(fullname, name);
|
||||
if (stat(fullname, &st) == 0 && S_ISREG(st.st_mode)) return fullname;
|
||||
stat_free(fullname);
|
||||
}
|
||||
not_found:
|
||||
fullname = stat_alloc(strlen(name) + 1);
|
||||
strcpy(fullname, name);
|
||||
return fullname;
|
||||
}
|
||||
|
||||
#ifdef __CYGWIN32__
|
||||
|
||||
/* Cygwin needs special treatment because of the implicit ".exe" at the
|
||||
end of executable file names */
|
||||
|
||||
static int cygwin_file_exists(char * name)
|
||||
{
|
||||
int fd;
|
||||
/* Cannot use stat() here because it adds ".exe" implicitly */
|
||||
fd = open(name, O_RDONLY);
|
||||
if (fd == -1) return 0;
|
||||
close(fd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char * cygwin_search_exe_in_path(struct ext_table * path, char * name)
|
||||
{
|
||||
char * p, * fullname;
|
||||
int i;
|
||||
|
||||
for (p = name; *p != 0; p++) {
|
||||
if (*p == '/' || *p == '\\') goto not_found;
|
||||
}
|
||||
for (i = 0; i < path->size; i++) {
|
||||
fullname = stat_alloc(strlen((char *)(path->contents[i])) +
|
||||
strlen(name) + 6);
|
||||
strcpy(fullname, (char *)(path->contents[i]));
|
||||
strcat(fullname, "/");
|
||||
strcat(fullname, name);
|
||||
if (cygwin_file_exists(fullname)) return fullname;
|
||||
strcat(fullname, ".exe");
|
||||
if (cygwin_file_exists(fullname)) return fullname;
|
||||
stat_free(fullname);
|
||||
}
|
||||
not_found:
|
||||
fullname = stat_alloc(strlen(name) + 5);
|
||||
strcpy(fullname, name);
|
||||
if (cygwin_file_exists(fullname)) return fullname;
|
||||
strcat(fullname, ".exe");
|
||||
if (cygwin_file_exists(fullname)) return fullname;
|
||||
strcpy(fullname, name);
|
||||
return fullname;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
char * search_exe_in_path(char * name)
|
||||
{
|
||||
struct ext_table path;
|
||||
char * tofree;
|
||||
char * res;
|
||||
|
||||
ext_table_init(&path, 8);
|
||||
tofree = decompose_path(&path, getenv("PATH"));
|
||||
#ifndef __CYGWIN32__
|
||||
res = search_in_path(&path, name);
|
||||
#else
|
||||
res = cygwin_search_exe_in_path(&path, name);
|
||||
#endif
|
||||
stat_free(tofree);
|
||||
ext_table_free(&path, 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
char * search_dll_in_path(struct ext_table * path, char * name)
|
||||
{
|
||||
char * dllname = stat_alloc(strlen(name) + 4);
|
||||
char * res;
|
||||
strcpy(dllname, name);
|
||||
strcat(dllname, ".so");
|
||||
res = search_in_path(path, dllname);
|
||||
stat_free(dllname);
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_DYNAMIC_LINKING
|
||||
|
||||
void * caml_dlopen(char * libname)
|
||||
{
|
||||
return dlopen(libname, RTLD_NOW);
|
||||
}
|
||||
|
||||
void caml_dlclose(void * handle)
|
||||
{
|
||||
dlclose(handle);
|
||||
}
|
||||
|
||||
void * caml_dlsym(void * handle, char * name)
|
||||
{
|
||||
return dlsym(handle, name);
|
||||
}
|
||||
|
||||
char * caml_dlerror(void)
|
||||
{
|
||||
return dlerror();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void * caml_dlopen(char * libname)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void caml_dlclose(void * handle)
|
||||
{
|
||||
}
|
||||
|
||||
void * caml_dlsym(void * handle, char * name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char * caml_dlerror(void)
|
||||
{
|
||||
return "dynamic loading not supported on this platform";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
value weak_list_head = 0;
|
||||
|
||||
value weak_create (value len) /* ML */
|
||||
CAMLprim value weak_create (value len)
|
||||
{
|
||||
mlsize_t size, i;
|
||||
value res;
|
||||
|
@ -40,7 +40,7 @@ value weak_create (value len) /* ML */
|
|||
#define None_val (Val_int(0))
|
||||
#define Some_tag 0
|
||||
|
||||
value weak_set (value ar, value n, value el) /* ML */
|
||||
CAMLprim value weak_set (value ar, value n, value el)
|
||||
{
|
||||
mlsize_t offset = Long_val (n) + 1;
|
||||
Assert (Is_in_heap (ar));
|
||||
|
@ -55,7 +55,7 @@ value weak_set (value ar, value n, value el) /* ML */
|
|||
#define Setup_for_gc
|
||||
#define Restore_after_gc
|
||||
|
||||
value weak_get (value ar, value n) /* ML */
|
||||
CAMLprim value weak_get (value ar, value n)
|
||||
{
|
||||
CAMLparam2 (ar, n);
|
||||
mlsize_t offset = Long_val (n) + 1;
|
||||
|
@ -76,7 +76,7 @@ value weak_get (value ar, value n) /* ML */
|
|||
#undef Setup_for_gc
|
||||
#undef Restore_after_gc
|
||||
|
||||
value weak_get_copy (value ar, value n) /* ML */
|
||||
CAMLprim value weak_get_copy (value ar, value n)
|
||||
{
|
||||
CAMLparam2 (ar, n);
|
||||
mlsize_t offset = Long_val (n) + 1;
|
||||
|
@ -104,7 +104,7 @@ value weak_get_copy (value ar, value n) /* ML */
|
|||
CAMLreturn (res);
|
||||
}
|
||||
|
||||
value weak_check (value ar, value n) /* ML */
|
||||
CAMLprim value weak_check (value ar, value n)
|
||||
{
|
||||
mlsize_t offset = Long_val (n) + 1;
|
||||
Assert (Is_in_heap (ar));
|
||||
|
|
121
byterun/win32.c
121
byterun/win32.c
|
@ -26,25 +26,118 @@
|
|||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include "memory.h"
|
||||
#include "misc.h"
|
||||
#include "osdeps.h"
|
||||
#include "signals.h"
|
||||
|
||||
/* Path searching function */
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
char * searchpath(char * name)
|
||||
char * decompose_path(struct ext_table * tbl, char * path)
|
||||
{
|
||||
#define MAX_PATH_LENGTH 1024
|
||||
static char fullname[MAX_PATH_LENGTH];
|
||||
char * p, * q;
|
||||
int n;
|
||||
|
||||
if (path == NULL) return NULL;
|
||||
p = stat_alloc(strlen(path) + 1);
|
||||
strcpy(p, path);
|
||||
q = p;
|
||||
while (1) {
|
||||
for (n = 0; q[n] != 0 && q[n] != ';'; n++) /*nothing*/;
|
||||
ext_table_add(tbl, q);
|
||||
q = q + n;
|
||||
if (*q == 0) break;
|
||||
*q = 0;
|
||||
q += 1;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
char * search_in_path(struct ext_table * path, char * name)
|
||||
{
|
||||
char * p, * fullname;
|
||||
int i;
|
||||
struct stat st;
|
||||
|
||||
for (p = name; *p != 0; p++) {
|
||||
if (*p == '/' || *p == '\\') goto not_found;
|
||||
}
|
||||
for (i = 0; i < path->size; i++) {
|
||||
fullname = stat_alloc(strlen((char *)(path->contents[i])) +
|
||||
strlen(name) + 2);
|
||||
strcpy(fullname, (char *)(path->contents[i]));
|
||||
strcat(fullname, "\\");
|
||||
strcat(fullname, name);
|
||||
gc_message(0x100, "Searching %s\n", (unsigned long) fullname);
|
||||
if (stat(fullname, &st) == 0 && S_ISREG(st.st_mode)) return fullname;
|
||||
stat_free(fullname);
|
||||
}
|
||||
not_found:
|
||||
gc_message(0x100, "%s not found in search path\n", (unsigned long) name);
|
||||
fullname = stat_alloc(strlen(name) + 1);
|
||||
strcpy(fullname, name);
|
||||
return fullname;
|
||||
}
|
||||
|
||||
CAMLexport char * search_exe_in_path(char * name)
|
||||
{
|
||||
#define MAX_PATH_LENGTH 512
|
||||
char * fullname = stat_alloc(512);
|
||||
char * filepart;
|
||||
|
||||
if (SearchPath(NULL, /* use system search path */
|
||||
name,
|
||||
".exe", /* add .exe extension if needed */
|
||||
MAX_PATH_LENGTH, /* size of buffer */
|
||||
fullname,
|
||||
&filepart))
|
||||
return fullname;
|
||||
if (! SearchPath(NULL, /* use system search path */
|
||||
name,
|
||||
".exe", /* add .exe extension if needed */
|
||||
MAX_PATH_LENGTH, /* size of buffer */
|
||||
fullname,
|
||||
&filepart))
|
||||
strcpy(fullname, name);
|
||||
return fullname;
|
||||
}
|
||||
|
||||
char * search_dll_in_path(struct ext_table * path, char * name)
|
||||
{
|
||||
char * dllname = stat_alloc(strlen(name) + 5);
|
||||
char * res;
|
||||
strcpy(dllname, name);
|
||||
strcat(dllname, ".dll");
|
||||
res = search_in_path(path, dllname);
|
||||
stat_free(dllname);
|
||||
return res;
|
||||
}
|
||||
|
||||
void * caml_dlopen(char * libname)
|
||||
{
|
||||
return (void *) LoadLibrary(libname);
|
||||
}
|
||||
|
||||
void caml_dlclose(void * handle)
|
||||
{
|
||||
FreeLibrary((HMODULE) handle);
|
||||
}
|
||||
|
||||
void * caml_dlsym(void * handle, char * name)
|
||||
{
|
||||
return (void *) GetProcAddress((HMODULE) handle, name);
|
||||
}
|
||||
|
||||
char * caml_dlerror(void)
|
||||
{
|
||||
static char dlerror_buffer[256];
|
||||
DWORD msglen =
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, /* message source */
|
||||
GetLastError(), /* error number */
|
||||
0, /* default language */
|
||||
dlerror_buffer, /* destination */
|
||||
sizeof(dlerror_buffer), /* size of destination */
|
||||
NULL); /* no inserts */
|
||||
if (msglen == 0)
|
||||
return "unknown error";
|
||||
else
|
||||
return name;
|
||||
return dlerror_buffer;
|
||||
}
|
||||
|
||||
/* Expansion of @responsefile and *? file patterns in the command line */
|
||||
|
@ -138,7 +231,7 @@ static void expand_diversion(char * filename)
|
|||
}
|
||||
}
|
||||
|
||||
void expand_command_line(int * argcp, char *** argvp)
|
||||
CAMLexport void expand_command_line(int * argcp, char *** argvp)
|
||||
{
|
||||
int i;
|
||||
argc = 0;
|
||||
|
@ -156,8 +249,6 @@ void expand_command_line(int * argcp, char *** argvp)
|
|||
/* Wrapper around "system" for Win32. Create a diversion file if
|
||||
command line is too long. */
|
||||
|
||||
extern char * mktemp(char *);
|
||||
|
||||
int win32_system(char * cmdline)
|
||||
{
|
||||
#define MAX_CMD_LENGTH 256
|
||||
|
|
|
@ -54,7 +54,10 @@ SHARPBANGSCRIPTS=true
|
|||
|
||||
### Additional link-time options for $(BYTECC)
|
||||
### If using GCC on a Dec Alpha under OSF1:
|
||||
#BYTECCLINKOPTS=-Xlinker -taso
|
||||
#BYTECCLINKOPTS=-Wl,-T,12000000 -Wl,-D,14000000
|
||||
# To support dynamic loading of shared libraries (they need to look at
|
||||
# our own symbols):
|
||||
#BYTECCLINKOPTS=-Wl,-E
|
||||
# Otherwise:
|
||||
#BYTECCLINKOPTS=
|
||||
|
||||
|
@ -79,6 +82,22 @@ SHARPBANGSCRIPTS=true
|
|||
#RANLIB=ar rs
|
||||
#RANLIBCMD=
|
||||
|
||||
### Shared library support
|
||||
# Extension for shared libraries: so if supported, a if not supported
|
||||
#SO=so
|
||||
#SO=a
|
||||
# Set to nothing if shared libraries supported, and to -custom if not supported
|
||||
#CUSTOM_IF_NOT_SHARED=
|
||||
#CUSTOM_IF_NOT_SHARED=-custom
|
||||
# Options to $(BYTECC) to produce shared objects (e.g. PIC)
|
||||
#SHAREDCCCOMPOPTS=-fPIC
|
||||
# How to build a shared library, invoked with output .so as first arg
|
||||
# and object files as remaining args
|
||||
#MKSHAREDLIB=gcc -shared -o
|
||||
# Compile-time option to $(BYTECC) to add a directory to be searched
|
||||
# at run-time for shared libraries
|
||||
#BYTECCRPATH=-Wl,-rpath
|
||||
|
||||
############# Configuration for the native-code compiler
|
||||
|
||||
### Name of architecture for the native-code compiler
|
||||
|
@ -159,6 +178,10 @@ SHARPBANGSCRIPTS=true
|
|||
### Additional link-time options for $(NATIVECC)
|
||||
#NATIVECCLINKOPTS=
|
||||
|
||||
# Compile-time option to $(NATIVECC) to add a directory to be searched
|
||||
# at run-time for shared libraries
|
||||
#NATIVECCRPATH=-Wl,-rpath
|
||||
|
||||
### Flags for the assembler
|
||||
# For the Alpha or the Mips:
|
||||
#ASFLAGS=-O2
|
||||
|
@ -234,9 +257,9 @@ BIGNUM_ARCH=alpha
|
|||
### Link-time options to ocamlc or ocamlopt for linking with X11 libraries
|
||||
# Needed for the "graph" and "labltk" packages
|
||||
# Usually:
|
||||
#X11_LINK=-cclib -lX11
|
||||
#X11_LINK=-lX11
|
||||
# For SunOS with OpenLook:
|
||||
#X11_LINK=-cclib -L$(X11_LIB) -cclib -lX11
|
||||
#X11_LINK=-L$(X11_LIB) -lX11
|
||||
|
||||
### -I options for finding the include file ndbm.h
|
||||
# Needed for the "dbm" package
|
||||
|
|
|
@ -35,12 +35,15 @@ SYSTEM_INCLUDES=c:\Msdev\VC98\Include
|
|||
### Which C compiler to use for the bytecode interpreter.
|
||||
BYTECC=cl /nologo
|
||||
|
||||
### Additional compile-time options for $(BYTECC).
|
||||
### Additional compile-time options for $(BYTECC). (For static linking.)
|
||||
BYTECCCOMPOPTS=/Ox /MT
|
||||
|
||||
### Additional link-time options for $(BYTECC)
|
||||
### Additional link-time options for $(BYTECC). (For static linking.)
|
||||
BYTECCLINKOPTS=/MT
|
||||
|
||||
### Additional compile-time options for $(BYTECC). (For building a DLL.)
|
||||
DLLCCCOMPOPTS=/Ox /MD
|
||||
|
||||
### Libraries needed
|
||||
BYTECCLIBS=wsock32.lib
|
||||
NATIVECCLIBS=wsock32.lib
|
||||
|
@ -50,6 +53,7 @@ CPP=cl /nologo /EP
|
|||
|
||||
### How to invoke the librarian
|
||||
MKLIB=lib /nologo /debugtype:CV /out:
|
||||
MKDLL=cl /nologo /MD /LD
|
||||
|
||||
############# Configuration for the native-code compiler
|
||||
|
||||
|
@ -77,7 +81,7 @@ AFLAGS=/coff /Cp
|
|||
|
||||
############# Configuration for the contributed libraries
|
||||
|
||||
OTHERLIBRARIES=win32unix systhreads str num graph dynlink labltk bigarray
|
||||
OTHERLIBRARIES=win32unix systhreads str num graph dynlink bigarray #labltk
|
||||
|
||||
### Name of the target architecture for the "num" library
|
||||
BIGNUM_ARCH=C
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
# Determine if gcc calls the Solaris ld or the GNU ld
|
||||
# Exit code is 0 for Solaris ld, 1 for GNU ld
|
||||
|
||||
echo "int main() { return 0; }" > hasgot.c
|
||||
$cc -v -o tst hasgot.c 2>&1 | grep -s '^ld:' > /dev/null
|
||||
exit $?
|
|
@ -50,6 +50,11 @@
|
|||
|
||||
/* Define HAS_STRERROR if you have strerror(). */
|
||||
|
||||
#define SUPPORT_DYNAMIC_LINKING
|
||||
|
||||
/* Define SUPPORT_DYNAMIC_LINKING if dynamic loading of C stub code
|
||||
via dlopen() is available. */
|
||||
|
||||
/* 2. For the Unix library. */
|
||||
|
||||
#define HAS_SOCKETS
|
||||
|
|
|
@ -25,6 +25,7 @@ ccoption=''
|
|||
cclibs=''
|
||||
curseslibs=''
|
||||
mathlib='-lm'
|
||||
dllib=''
|
||||
x11_include_dir=''
|
||||
x11_lib_dir=''
|
||||
tk_defs=''
|
||||
|
@ -32,6 +33,7 @@ tk_libs=''
|
|||
posix_threads=no
|
||||
verbose=no
|
||||
withcurses=yes
|
||||
withsharedlibs=yes
|
||||
|
||||
gcc_warnings="-Wall -Wno-unused"
|
||||
|
||||
|
@ -56,7 +58,10 @@ while : ; do
|
|||
ccoption="$2"; shift;;
|
||||
-lib*)
|
||||
cclibs="$2 $cclibs"; shift;;
|
||||
-no-curses) withcurses=no;;
|
||||
-no-curses)
|
||||
withcurses=no;;
|
||||
-no-shared-libs)
|
||||
withsharedlibs=no;;
|
||||
-x11include*|--x11include*)
|
||||
x11_include_dir=$2; shift;;
|
||||
-x11lib*|--x11lib*)
|
||||
|
@ -354,6 +359,61 @@ if $int64_supported; then
|
|||
esac
|
||||
fi
|
||||
|
||||
# Shared library support
|
||||
|
||||
shared_libraries_supported=false
|
||||
sharedcccompopts=''
|
||||
mksharedlib=''
|
||||
byteccrpath=''
|
||||
|
||||
if test $withsharedlibs = "yes"; then
|
||||
case "$host" in
|
||||
*-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*)
|
||||
sharedcccompopts="-fPIC"
|
||||
mksharedlib="gcc -shared -o"
|
||||
bytecclinkopts="$bytecclinkopts -Wl,-E"
|
||||
byteccrpath="-Wl,-rpath,"
|
||||
shared_libraries_supported=true;;
|
||||
alpha*-*-osf*)
|
||||
case "$bytecc" in
|
||||
cc*) sharedcccompopts="";;
|
||||
gcc*) sharedcccompopts="-fPIC";;
|
||||
esac
|
||||
mksharedlib="ld -shared -expect_unresolved '*' -o"
|
||||
byteccrpath="-Wl,-rpath,"
|
||||
shared_libraries_supported=true;;
|
||||
sparc-sun-solaris2*)
|
||||
case "$bytecc" in
|
||||
gcc*)
|
||||
if sh ./solaris-ld; then :; else
|
||||
sharedcccompopts="-fPIC"
|
||||
mksharedlib="$bytecc -shared -o"
|
||||
bytecclinkopts="$bytecclinkopts -Wl,-E"
|
||||
byteccrpath="-Wl,-rpath,";
|
||||
shared_libraries_supported=true
|
||||
fi;;
|
||||
*)
|
||||
sharedcccompopts="-KPIC"
|
||||
byteccrpath="-Wl,-R,"
|
||||
mksharedlib="/usr/ccs/bin/ld -G -o"
|
||||
shared_libraries_supported=true;;
|
||||
esac;;
|
||||
mips-sgi-irix[56]*)
|
||||
case "$bytecc" in
|
||||
cc*) sharedcccompopts="";;
|
||||
gcc*) sharedcccompopts="-fPIC";;
|
||||
esac
|
||||
mksharedlib="ld -shared -rdata_shared -o"
|
||||
byteccrpath="-Wl,-rpath,"
|
||||
shared_libraries_supported=true;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if $shared_libraries_supported; then
|
||||
echo "Dynamic loading of shared libraries is supported."
|
||||
echo "#define SUPPORT_DYNAMIC_LINKING" >> s.h
|
||||
fi
|
||||
|
||||
# Configure the native-code compiler
|
||||
|
||||
arch=none
|
||||
|
@ -400,6 +460,7 @@ fi
|
|||
|
||||
nativecccompopts=''
|
||||
nativecclinkopts=''
|
||||
nativeccrpath="$byteccrpath"
|
||||
|
||||
case "$arch,$nativecc,$system,$host_type" in
|
||||
alpha,cc*,digital,*) nativecccompopts=-std1;;
|
||||
|
@ -493,6 +554,7 @@ fi
|
|||
# Write the OS type (Unix or Cygwin)
|
||||
|
||||
echo "#define OCAML_OS_TYPE \"$ostype\"" >> s.h
|
||||
echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h
|
||||
|
||||
# Check the semantics of signal handlers
|
||||
|
||||
|
@ -804,18 +866,18 @@ if test "$posix_threads" = "yes"; then
|
|||
nativecccompopts="$nativecccompopts -D_REENTRANT"
|
||||
case "$host" in
|
||||
*-*-solaris*)
|
||||
pthread_link="-cclib -lpthread -cclib -lposix4";;
|
||||
pthread_link="-lpthread -lposix4";;
|
||||
*-*-freebsd*)
|
||||
pthread_link="-ccopt -pthread"
|
||||
pthread_link="-pthread"
|
||||
bytecccompopts="$bytecccompopts -D_THREAD_SAFE"
|
||||
nativecccompopts="$nativecccompopts -D_THREAD_SAFE";;
|
||||
*-*-openbsd*)
|
||||
pthread_link="-ccopt -pthread"
|
||||
pthread_link="-pthread"
|
||||
bytecccompopts="$bytecccompopts -pthread"
|
||||
asppflags="$asppflags -pthread"
|
||||
nativecccompopts="$nativecccompopts -pthread";;
|
||||
*)
|
||||
pthread_link="-cclib -lpthread";;
|
||||
pthread_link="-lpthread";;
|
||||
esac
|
||||
echo "Options for linking with POSIX threads: $pthread_link"
|
||||
echo "PTHREAD_LINK=$pthread_link" >> Makefile
|
||||
|
@ -868,9 +930,9 @@ do
|
|||
test -f $dir/libX11.so || \
|
||||
test -f $dir/libX11.sa; then
|
||||
if test $dir = /usr/lib; then
|
||||
x11_link="-cclib -lX11"
|
||||
x11_link="-lX11"
|
||||
else
|
||||
x11_link="-ccopt -L$dir -cclib -lX11"
|
||||
x11_link="-L$dir -lX11"
|
||||
x11_libs="-L$dir"
|
||||
fi
|
||||
break
|
||||
|
@ -905,9 +967,9 @@ for dir in /usr/include /usr/include/gdbm /usr/include/db1; do
|
|||
if sh ./hasgot dbm_open; then
|
||||
dbm_link=""
|
||||
elif sh ./hasgot -lndbm dbm_open; then
|
||||
dbm_link="-cclib -lndbm"
|
||||
dbm_link="-lndbm"
|
||||
elif sh ./hasgot -ldb1 dbm_open; then
|
||||
dbm_link="-cclib -ldb1"
|
||||
dbm_link="-ldb1"
|
||||
else
|
||||
dbm_include="not found"
|
||||
fi
|
||||
|
@ -1020,7 +1082,6 @@ if test $has_tk = true; then
|
|||
fi
|
||||
|
||||
if test $has_tk = true; then
|
||||
tk_libs=`echo $tk_libs | sed -e 's/-l/-cclib &/g' -e 's/-[LW]/-ccopt &/g' `
|
||||
echo "TK_DEFS=$tk_defs" >> Makefile
|
||||
echo "TK_LINK=$tk_libs" >> Makefile
|
||||
otherlibraries="$otherlibraries labltk"
|
||||
|
@ -1035,8 +1096,12 @@ cclibs="$cclibs $mathlib"
|
|||
echo "BYTECC=$bytecc" >> Makefile
|
||||
echo "BYTECCCOMPOPTS=$bytecccompopts" >> Makefile
|
||||
echo "BYTECCLINKOPTS=$bytecclinkopts" >> Makefile
|
||||
echo "BYTECCLIBS=$cclibs $curseslibs" >> Makefile
|
||||
echo "BYTECCLIBS=$cclibs $dllib $curseslibs" >> Makefile
|
||||
echo "BYTECCRPATH=$byteccrpath" >> Makefile
|
||||
echo "EXE=$exe" >> Makefile
|
||||
echo "SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported" >> Makefile
|
||||
echo "SHAREDCCCOMPOPTS=$sharedcccompopts" >> Makefile
|
||||
echo "MKSHAREDLIB=$mksharedlib" >> Makefile
|
||||
|
||||
echo "ARCH=$arch" >> Makefile
|
||||
echo "MODEL=$model" >> Makefile
|
||||
|
@ -1044,6 +1109,7 @@ echo "SYSTEM=$system" >> Makefile
|
|||
echo "NATIVECC=$nativecc" >> Makefile
|
||||
echo "NATIVECCCOMPOPTS=$nativecccompopts" >> Makefile
|
||||
echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile
|
||||
echo "NATIVECCRPATH=$nativeccrpath" >> Makefile
|
||||
echo "NATIVECCLIBS=$cclibs" >> Makefile
|
||||
echo "ASFLAGS=$asflags" >> Makefile
|
||||
echo "ASPP=$aspp" >> Makefile
|
||||
|
@ -1072,7 +1138,14 @@ echo " manual pages.............. $mandir (with extension .$manext)"
|
|||
echo "Configuration for the bytecode compiler:"
|
||||
echo " C compiler used........... $bytecc"
|
||||
echo " options for compiling..... $bytecccompopts"
|
||||
echo " options for linking....... $bytecclinkopts $cclibs $curseslibs"
|
||||
echo " options for linking....... $bytecclinkopts $cclibs $dllib $curseslibs"
|
||||
if $shared_libraries_supported; then
|
||||
echo " shared libraries are supported"
|
||||
echo " options for compiling..... $sharedcccompopts $bytecccompopts"
|
||||
echo " command for building...... $mksharedlib <target>.so <objects>"
|
||||
else
|
||||
echo " shared libraries not supported"
|
||||
fi
|
||||
|
||||
echo "Configuration for the native-code compiler:"
|
||||
if test "$arch" = "none"; then
|
||||
|
|
|
@ -9,8 +9,8 @@ events.cmi: ../bytecomp/instruct.cmi
|
|||
frames.cmi: ../bytecomp/instruct.cmi primitives.cmi
|
||||
input_handling.cmi: primitives.cmi
|
||||
loadprinter.cmi: ../otherlibs/dynlink/dynlink.cmi ../parsing/longident.cmi
|
||||
parser.cmi: ../parsing/longident.cmi parser_aux.cmi
|
||||
parser_aux.cmi: ../parsing/longident.cmi primitives.cmi
|
||||
parser.cmi: ../parsing/longident.cmi parser_aux.cmi
|
||||
pattern_matching.cmi: debugcom.cmi parser_aux.cmi ../typing/typedtree.cmi
|
||||
primitives.cmi: ../otherlibs/unix/unix.cmi
|
||||
printval.cmi: debugcom.cmi ../typing/env.cmi parser_aux.cmi \
|
||||
|
|
|
@ -38,7 +38,8 @@ OTHEROBJS=\
|
|||
../typing/datarepr.cmo ../typing/env.cmo \
|
||||
../typing/ctype.cmo ../typing/printtyp.cmo ../typing/mtype.cmo \
|
||||
../bytecomp/runtimedef.cmo ../bytecomp/bytesections.cmo \
|
||||
../bytecomp/symtable.cmo ../bytecomp/opcodes.cmo ../bytecomp/meta.cmo \
|
||||
../bytecomp/dll.cmo ../bytecomp/symtable.cmo \
|
||||
../bytecomp/opcodes.cmo ../bytecomp/meta.cmo \
|
||||
../toplevel/genprintval.cmo \
|
||||
../otherlibs/dynlink/dynlink.cmo
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ let process_file ppf name =
|
|||
|| Filename.check_suffix name ".cma" then
|
||||
objfiles := name :: !objfiles
|
||||
else if Filename.check_suffix name ext_obj
|
||||
|| Filename.check_suffix name ext_lib then
|
||||
|| Filename.check_suffix name ext_lib
|
||||
|| Filename.check_suffix name ext_dll then
|
||||
ccobjs := name :: !ccobjs
|
||||
else if Filename.check_suffix name ".c" then begin
|
||||
Compile.c_file name;
|
||||
|
@ -73,6 +74,7 @@ module Options = Main_args.Make_options (struct
|
|||
let _cclib s = ccobjs := s :: !ccobjs
|
||||
let _ccopt s = ccopts := s :: !ccopts
|
||||
let _custom = set custom_runtime
|
||||
let _dllpath s = dllpaths := !dllpaths @ [s]
|
||||
let _g = set debug
|
||||
let _i = set print_types
|
||||
let _I s = include_dirs := s :: !include_dirs
|
||||
|
|
|
@ -20,6 +20,7 @@ module Make_options (F :
|
|||
val _cclib : string -> unit
|
||||
val _ccopt : string -> unit
|
||||
val _custom : unit -> unit
|
||||
val _dllpath : string -> unit
|
||||
val _g : unit -> unit
|
||||
val _i : unit -> unit
|
||||
val _I : string -> unit
|
||||
|
@ -62,6 +63,7 @@ struct
|
|||
"-ccopt", Arg.String F._ccopt,
|
||||
"<opt> Pass option <opt> to the C compiler and linker";
|
||||
"-custom", Arg.Unit F._custom, " Link in custom mode";
|
||||
"-dllpath", Arg.String F._dllpath, "<dir> Add <dir> to the run-time search path for shared libraries";
|
||||
"-g", Arg.Unit F._g, " Save debugging information";
|
||||
"-i", Arg.Unit F._i, " Print the types";
|
||||
"-I", Arg.String F._I,
|
||||
|
|
|
@ -20,6 +20,7 @@ module Make_options (F :
|
|||
val _cclib : string -> unit
|
||||
val _ccopt : string -> unit
|
||||
val _custom : unit -> unit
|
||||
val _dllpath : string -> unit
|
||||
val _g : unit -> unit
|
||||
val _i : unit -> unit
|
||||
val _I : string -> unit
|
||||
|
|
|
@ -73,6 +73,8 @@ let main () =
|
|||
"<opt> Pass option <opt> to the C compiler and linker";
|
||||
"-compact", Arg.Clear optimize_for_speed,
|
||||
" Optimize code size rather than speed";
|
||||
"-dllpath", Arg.String (fun s -> dllpaths := !dllpaths @ [s]),
|
||||
"<dir> Add <dir> to the run-time search path for shared libraries";
|
||||
"-i", Arg.Set print_types, " Print the types";
|
||||
"-I", Arg.String(fun dir -> include_dirs := dir :: !include_dirs),
|
||||
"<dir> Add <dir> to the list of include directories";
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
include ../../config/Makefile
|
||||
|
||||
CC=$(BYTECC)
|
||||
CFLAGS=-I../../byterun -g -O $(BYTECCCOMPOPTS)
|
||||
CFLAGS=-I../../byterun -g -O $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS)
|
||||
CAMLC=../../boot/ocamlrun ../../ocamlc -I ../../stdlib -I ../unix
|
||||
CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -I ../unix
|
||||
MKLIB=../../tools/ocamlmklib
|
||||
|
||||
C_OBJS=bigarray_stubs.o mmap_unix.o
|
||||
|
||||
|
@ -28,19 +29,17 @@ all: libbigarray.a bigarray.cma
|
|||
allopt: libbigarray.a bigarray.cmxa
|
||||
|
||||
libbigarray.a: $(C_OBJS)
|
||||
rm -f libbigarray.a
|
||||
ar rc libbigarray.a $(C_OBJS)
|
||||
$(RANLIB) libbigarray.a
|
||||
$(MKLIB) -o bigarray $(C_OBJS)
|
||||
|
||||
bigarray.cma: $(CAML_OBJS)
|
||||
$(CAMLC) -a -linkall -custom -o bigarray.cma \
|
||||
$(CAML_OBJS) -cclib -lbigarray
|
||||
$(MKLIB) -ocamlc '$(CAMLC)' -linkall -o bigarray $(CAML_OBJS)
|
||||
|
||||
bigarray.cmxa: $(CAML_OBJS:.cmo=.cmx)
|
||||
$(CAMLOPT) -a -linkall -o bigarray.cmxa \
|
||||
$(CAML_OBJS:.cmo=.cmx) -cclib -lbigarray
|
||||
$(MKLIB) -ocamlopt '$(CAMLOPT)' -linkall -o bigarray \
|
||||
$(CAML_OBJS:.cmo=.cmx)
|
||||
|
||||
install:
|
||||
test -f libbigarray.so && cp libbigarray.so $(LIBDIR)
|
||||
cp bigarray.cmi bigarray.mli libbigarray.a bigarray.cma $(LIBDIR)
|
||||
cd $(LIBDIR); $(RANLIB) libbigarray.a
|
||||
cp bigarray.h $(LIBDIR)/caml/bigarray.h
|
||||
|
@ -53,7 +52,7 @@ partialclean:
|
|||
rm -f *.cm*
|
||||
|
||||
clean: partialclean
|
||||
rm -f libbigarray.a *.o bigarray.a
|
||||
rm -f libbigarray.* *.o bigarray.a
|
||||
|
||||
.SUFFIXES: .ml .mli .cmo .cmi .cmx
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
include ..\..\config\Makefile.nt
|
||||
|
||||
CC=$(BYTECC)
|
||||
CFLAGS=-I..\..\byterun -I..\win32unix $(BYTECCCOMPOPTS)
|
||||
CFLAGS=-I..\..\byterun -I..\win32unix
|
||||
CAMLC=..\..\boot\ocamlrun ..\..\ocamlc -I ..\..\stdlib -I ..\win32unix
|
||||
CAMLOPT=..\..\boot\ocamlrun ..\..\ocamlopt -I ..\..\stdlib -I ..\win32unix
|
||||
|
||||
|
@ -23,24 +23,29 @@ C_OBJS=bigarray_stubs.obj mmap_win32.obj
|
|||
|
||||
CAML_OBJS=bigarray.cmo
|
||||
|
||||
all: libbigarray.lib bigarray.cma
|
||||
all: libbigarray.dll libbigarray.lib bigarray.cma
|
||||
|
||||
allopt: libbigarray.lib bigarray.cmxa
|
||||
|
||||
libbigarray.lib: $(C_OBJS)
|
||||
rm -f libbigarray.lib
|
||||
$(MKLIB)libbigarray.lib $(C_OBJS)
|
||||
libbigarray.dll: $(C_OBJS:.obj=.dobj)
|
||||
link /nologo /dll /out:libbigarray.dll /implib:tmp.lib \
|
||||
$(C_OBJS:.obj=.dobj) ..\..\byterun\ocamlrun.lib
|
||||
rm tmp.*
|
||||
|
||||
libbigarray.lib: $(C_OBJS:.obj=.sobj)
|
||||
rm -f libunix.lib
|
||||
$(MKLIB)libbigarray.lib $(C_OBJS:.obj=.sobj)
|
||||
|
||||
bigarray.cma: $(CAML_OBJS)
|
||||
$(CAMLC) -a -linkall -custom -o bigarray.cma \
|
||||
$(CAML_OBJS) -cclib -lbigarray
|
||||
$(CAMLC) -a -linkall -o bigarray.cma $(CAML_OBJS) -cclib -lbigarray
|
||||
|
||||
bigarray.cmxa: $(CAML_OBJS:.cmo=.cmx)
|
||||
$(CAMLOPT) -a -linkall -o bigarray.cmxa \
|
||||
$(CAML_OBJS:.cmo=.cmx) -cclib -lbigarray
|
||||
|
||||
install:
|
||||
cp bigarray.cmi bigarray.mli libbigarray.lib bigarray.cma $(LIBDIR)
|
||||
cp libbigarray.dll libbigarray.lib $(LIBDIR)
|
||||
cp bigarray.cmi bigarray.mli bigarray.cma $(LIBDIR)
|
||||
cp bigarray.h $(LIBDIR)/caml/bigarray.h
|
||||
|
||||
installopt:
|
||||
|
@ -50,9 +55,9 @@ partialclean:
|
|||
rm -f *.cm*
|
||||
|
||||
clean: partialclean
|
||||
rm -f libbigarray.lib *.obj
|
||||
rm -f *.dll *.lib *.dobj *.sobj
|
||||
|
||||
.SUFFIXES: .ml .mli .cmo .cmi .cmx
|
||||
.SUFFIXES: .ml .mli .cmo .cmi .cmx .dobj .sobj
|
||||
|
||||
.mli.cmi:
|
||||
$(CAMLC) -c $(COMPFLAGS) $<
|
||||
|
@ -63,6 +68,14 @@ clean: partialclean
|
|||
.ml.cmx:
|
||||
$(CAMLOPT) -c $(COMPFLAGS) $<
|
||||
|
||||
.c.dobj:
|
||||
$(BYTECC) $(DLLCCCOMPOPTS) $(CFLAGS) -c $<
|
||||
mv $*.obj $*.dobj
|
||||
|
||||
.c.sobj:
|
||||
$(BYTECC) $(BYTECCCOMPOPTS) $(CFLAGS) -c $<
|
||||
mv $*.obj $*.sobj
|
||||
|
||||
depend:
|
||||
gcc -MM $(CFLAGS) *.c > .depend
|
||||
..\..\boot\ocamlrun ..\..\tools\ocamldep *.mli *.ml >> .depend
|
||||
|
|
|
@ -126,7 +126,7 @@ value alloc_bigarray_dims(int flags, int num_dims, void * data, ...)
|
|||
|
||||
/* Allocate a bigarray from Caml */
|
||||
|
||||
value bigarray_create(value vkind, value vlayout, value vdim)
|
||||
CAMLprim value bigarray_create(value vkind, value vlayout, value vdim)
|
||||
{
|
||||
long dim[MAX_NUM_DIMS];
|
||||
mlsize_t num_dims;
|
||||
|
@ -215,19 +215,19 @@ value bigarray_get_N(value vb, value * vind, int nind)
|
|||
}
|
||||
}
|
||||
|
||||
value bigarray_get_1(value vb, value vind1)
|
||||
CAMLprim value bigarray_get_1(value vb, value vind1)
|
||||
{
|
||||
return bigarray_get_N(vb, &vind1, 1);
|
||||
}
|
||||
|
||||
value bigarray_get_2(value vb, value vind1, value vind2)
|
||||
CAMLprim value bigarray_get_2(value vb, value vind1, value vind2)
|
||||
{
|
||||
value vind[2];
|
||||
vind[0] = vind1; vind[1] = vind2;
|
||||
return bigarray_get_N(vb, vind, 2);
|
||||
}
|
||||
|
||||
value bigarray_get_3(value vb, value vind1, value vind2, value vind3)
|
||||
CAMLprim value bigarray_get_3(value vb, value vind1, value vind2, value vind3)
|
||||
{
|
||||
value vind[3];
|
||||
vind[0] = vind1; vind[1] = vind2; vind[2] = vind3;
|
||||
|
@ -235,7 +235,7 @@ value bigarray_get_3(value vb, value vind1, value vind2, value vind3)
|
|||
}
|
||||
|
||||
#if 0
|
||||
value bigarray_get_4(value vb, value vind1, value vind2,
|
||||
CAMLprim value bigarray_get_4(value vb, value vind1, value vind2,
|
||||
value vind3, value vind4)
|
||||
{
|
||||
value vind[4];
|
||||
|
@ -243,7 +243,7 @@ value bigarray_get_4(value vb, value vind1, value vind2,
|
|||
return bigarray_get_N(vb, vind, 4);
|
||||
}
|
||||
|
||||
value bigarray_get_5(value vb, value vind1, value vind2,
|
||||
CAMLprim value bigarray_get_5(value vb, value vind1, value vind2,
|
||||
value vind3, value vind4, value vind5)
|
||||
{
|
||||
value vind[5];
|
||||
|
@ -252,7 +252,7 @@ value bigarray_get_5(value vb, value vind1, value vind2,
|
|||
return bigarray_get_N(vb, vind, 5);
|
||||
}
|
||||
|
||||
value bigarray_get_6(value vb, value vind1, value vind2,
|
||||
CAMLprim value bigarray_get_6(value vb, value vind1, value vind2,
|
||||
value vind3, value vind4, value vind5, value vind6)
|
||||
{
|
||||
value vind[6];
|
||||
|
@ -262,7 +262,7 @@ value bigarray_get_6(value vb, value vind1, value vind2,
|
|||
}
|
||||
#endif
|
||||
|
||||
value bigarray_get_generic(value vb, value vind)
|
||||
CAMLprim value bigarray_get_generic(value vb, value vind)
|
||||
{
|
||||
return bigarray_get_N(vb, &Field(vind, 0), Wosize_val(vind));
|
||||
}
|
||||
|
@ -309,19 +309,19 @@ static value bigarray_set_aux(value vb, value * vind, long nind, value newval)
|
|||
return Val_unit;
|
||||
}
|
||||
|
||||
value bigarray_set_1(value vb, value vind1, value newval)
|
||||
CAMLprim value bigarray_set_1(value vb, value vind1, value newval)
|
||||
{
|
||||
return bigarray_set_aux(vb, &vind1, 1, newval);
|
||||
}
|
||||
|
||||
value bigarray_set_2(value vb, value vind1, value vind2, value newval)
|
||||
CAMLprim value bigarray_set_2(value vb, value vind1, value vind2, value newval)
|
||||
{
|
||||
value vind[2];
|
||||
vind[0] = vind1; vind[1] = vind2;
|
||||
return bigarray_set_aux(vb, vind, 2, newval);
|
||||
}
|
||||
|
||||
value bigarray_set_3(value vb, value vind1, value vind2, value vind3,
|
||||
CAMLprim value bigarray_set_3(value vb, value vind1, value vind2, value vind3,
|
||||
value newval)
|
||||
{
|
||||
value vind[3];
|
||||
|
@ -330,7 +330,7 @@ value bigarray_set_3(value vb, value vind1, value vind2, value vind3,
|
|||
}
|
||||
|
||||
#if 0
|
||||
value bigarray_set_4(value vb, value vind1, value vind2,
|
||||
CAMLprim value bigarray_set_4(value vb, value vind1, value vind2,
|
||||
value vind3, value vind4, value newval)
|
||||
{
|
||||
value vind[4];
|
||||
|
@ -338,7 +338,7 @@ value bigarray_set_4(value vb, value vind1, value vind2,
|
|||
return bigarray_set_aux(vb, vind, 4, newval);
|
||||
}
|
||||
|
||||
value bigarray_set_5(value vb, value vind1, value vind2,
|
||||
CAMLprim value bigarray_set_5(value vb, value vind1, value vind2,
|
||||
value vind3, value vind4, value vind5, value newval)
|
||||
{
|
||||
value vind[5];
|
||||
|
@ -347,7 +347,7 @@ value bigarray_set_5(value vb, value vind1, value vind2,
|
|||
return bigarray_set_aux(vb, vind, 5, newval);
|
||||
}
|
||||
|
||||
value bigarray_set_6(value vb, value vind1, value vind2,
|
||||
CAMLprim value bigarray_set_6(value vb, value vind1, value vind2,
|
||||
value vind3, value vind4, value vind5,
|
||||
value vind6, value newval)
|
||||
{
|
||||
|
@ -363,14 +363,14 @@ value bigarray_set_N(value vb, value * vind, int nargs)
|
|||
}
|
||||
#endif
|
||||
|
||||
value bigarray_set_generic(value vb, value vind, value newval)
|
||||
CAMLprim value bigarray_set_generic(value vb, value vind, value newval)
|
||||
{
|
||||
return bigarray_set_aux(vb, &Field(vind, 0), Wosize_val(vind), newval);
|
||||
}
|
||||
|
||||
/* Return the number of dimensions of a big array */
|
||||
|
||||
value bigarray_num_dims(value vb)
|
||||
CAMLprim value bigarray_num_dims(value vb)
|
||||
{
|
||||
struct caml_bigarray * b = Bigarray_val(vb);
|
||||
return Val_long(b->num_dims);
|
||||
|
@ -378,7 +378,7 @@ value bigarray_num_dims(value vb)
|
|||
|
||||
/* Return the n-th dimension of a big array */
|
||||
|
||||
value bigarray_dim(value vb, value vn)
|
||||
CAMLprim value bigarray_dim(value vb, value vn)
|
||||
{
|
||||
struct caml_bigarray * b = Bigarray_val(vb);
|
||||
long n = Long_val(vn);
|
||||
|
@ -700,7 +700,7 @@ static void bigarray_update_proxy(struct caml_bigarray * b1,
|
|||
|
||||
/* Slicing */
|
||||
|
||||
value bigarray_slice(value vb, value vind)
|
||||
CAMLprim value bigarray_slice(value vb, value vind)
|
||||
{
|
||||
struct caml_bigarray * b = Bigarray_val(vb);
|
||||
long index[MAX_NUM_DIMS];
|
||||
|
@ -742,7 +742,7 @@ value bigarray_slice(value vb, value vind)
|
|||
|
||||
/* Extracting a sub-array of same number of dimensions */
|
||||
|
||||
value bigarray_sub(value vb, value vofs, value vlen)
|
||||
CAMLprim value bigarray_sub(value vb, value vofs, value vlen)
|
||||
{
|
||||
struct caml_bigarray * b = Bigarray_val(vb);
|
||||
long ofs = Long_val(vofs);
|
||||
|
@ -782,7 +782,7 @@ value bigarray_sub(value vb, value vofs, value vlen)
|
|||
|
||||
/* Copying a big array into another one */
|
||||
|
||||
value bigarray_blit(value vsrc, value vdst)
|
||||
CAMLprim value bigarray_blit(value vsrc, value vdst)
|
||||
{
|
||||
struct caml_bigarray * src = Bigarray_val(vsrc);
|
||||
struct caml_bigarray * dst = Bigarray_val(vdst);
|
||||
|
@ -807,7 +807,7 @@ value bigarray_blit(value vsrc, value vdst)
|
|||
|
||||
/* Filling a big array with a given value */
|
||||
|
||||
value bigarray_fill(value vb, value vinit)
|
||||
CAMLprim value bigarray_fill(value vb, value vinit)
|
||||
{
|
||||
struct caml_bigarray * b = Bigarray_val(vb);
|
||||
long num_elts = bigarray_num_elts(b);
|
||||
|
@ -872,7 +872,7 @@ value bigarray_fill(value vb, value vinit)
|
|||
/* Reshape an array: change dimensions and number of dimensions, preserving
|
||||
array contents */
|
||||
|
||||
value bigarray_reshape(value vb, value vdim)
|
||||
CAMLprim value bigarray_reshape(value vb, value vdim)
|
||||
{
|
||||
struct caml_bigarray * b = Bigarray_val(vb);
|
||||
long dim[MAX_NUM_DIMS];
|
||||
|
@ -904,7 +904,7 @@ value bigarray_reshape(value vb, value vdim)
|
|||
|
||||
/* Initialization */
|
||||
|
||||
value bigarray_init(value unit)
|
||||
CAMLprim value bigarray_init(value unit)
|
||||
{
|
||||
register_custom_operations(&bigarray_ops);
|
||||
return Val_unit;
|
||||
|
|
|
@ -36,8 +36,8 @@ extern int bigarray_element_size[]; /* from bigarray_stubs.c */
|
|||
#define MAP_FAILED ((void *) -1)
|
||||
#endif
|
||||
|
||||
value bigarray_map_file(value vfd, value vkind, value vlayout,
|
||||
value vshared, value vdim)
|
||||
CAMLprim value bigarray_map_file(value vfd, value vkind, value vlayout,
|
||||
value vshared, value vdim)
|
||||
{
|
||||
int fd, flags, major_dim, shared;
|
||||
long num_dims, i;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
/* $Id$ */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "bigarray.h"
|
||||
#include "custom.h"
|
||||
|
@ -23,8 +24,10 @@
|
|||
|
||||
extern int bigarray_element_size[]; /* from bigarray_stubs.c */
|
||||
|
||||
value bigarray_map_file(value vfd, value vkind, value vlayout,
|
||||
value vshared, value vdim)
|
||||
static void bigarray_sys_error(void);
|
||||
|
||||
CAMLprim value bigarray_map_file(value vfd, value vkind, value vlayout,
|
||||
value vshared, value vdim)
|
||||
{
|
||||
HANDLE fd, fmap;
|
||||
int flags, major_dim, mode, perm;
|
||||
|
@ -51,9 +54,9 @@ value bigarray_map_file(value vfd, value vkind, value vlayout,
|
|||
}
|
||||
/* Determine file size */
|
||||
currpos = SetFilePointer(fd, 0, NULL, FILE_CURRENT);
|
||||
if (currpos == -1) { _dosmaperr(GetLastError()); sys_error(NO_ARG); }
|
||||
if (currpos == -1) bigarray_sys_error();
|
||||
file_size = SetFilePointer(fd, 0, NULL, FILE_END);
|
||||
if (file_size == -1) { _dosmaperr(GetLastError()); sys_error(NO_ARG); }
|
||||
if (file_size == -1) bigarray_sys_error();
|
||||
/* Determine array size in bytes (or size of array without the major
|
||||
dimension if that dimension wasn't specified) */
|
||||
array_size = bigarray_element_size[flags & BIGARRAY_KIND_MASK];
|
||||
|
@ -78,14 +81,10 @@ value bigarray_map_file(value vfd, value vkind, value vlayout,
|
|||
mode = FILE_MAP_COPY;
|
||||
}
|
||||
fmap = CreateFileMapping(fd, NULL, perm, 0, array_size, NULL);
|
||||
if (fmap == NULL) {
|
||||
printf("CreateFileMapping failed, err %d\n", GetLastError());
|
||||
_dosmaperr(GetLastError()); sys_error(NO_ARG); }
|
||||
if (fmap == NULL) bigarray_sys_error();
|
||||
/* Map the mapping in memory */
|
||||
addr = MapViewOfFile(fmap, mode, 0, 0, array_size);
|
||||
if (addr == NULL) {
|
||||
printf("MapViewOfFile failed, err %d\n", GetLastError());
|
||||
_dosmaperr(GetLastError()); sys_error(NO_ARG); }
|
||||
if (addr == NULL) bigarray_sys_error();
|
||||
/* Close the file mapping */
|
||||
CloseHandle(fmap);
|
||||
/* Build and return the Caml bigarray */
|
||||
|
@ -97,6 +96,19 @@ void bigarray_unmap_file(void * addr, unsigned long len)
|
|||
UnmapViewOfFile(addr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void bigarray_sys_error(void)
|
||||
{
|
||||
char buffer[512];
|
||||
unsigned long errnum;
|
||||
|
||||
errnum = GetLastError();
|
||||
if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
errnum,
|
||||
0,
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
NULL))
|
||||
sprintf(buffer, "Unknown error %d\n", errnum);
|
||||
raise_sys_error(copy_string(buffer));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,9 @@ include ../../config/Makefile
|
|||
CC=$(BYTECC) -g
|
||||
CAMLC=../../boot/ocamlrun ../../ocamlc -I ../../stdlib
|
||||
CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib
|
||||
CFLAGS=$(DBM_INCLUDES) -I../../byterun -O $(BYTECCCOMPOPTS)
|
||||
MKLIB=../../tools/ocamlmklib
|
||||
|
||||
CFLAGS=$(DBM_INCLUDES) -I../../byterun -O $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS)
|
||||
COBJS=cldbm.o
|
||||
|
||||
all: libmldbm.a dbm.cmi dbm.cma
|
||||
|
@ -28,15 +30,13 @@ all: libmldbm.a dbm.cmi dbm.cma
|
|||
allopt: libmldbm.a dbm.cmi dbm.cmxa
|
||||
|
||||
libmldbm.a: $(COBJS)
|
||||
rm -rf libmldbm.a
|
||||
ar rc libmldbm.a $(COBJS)
|
||||
$(RANLIB) libmldbm.a
|
||||
$(MKLIB) -oc mldbm $(COBJS) $(DBM_LINK)
|
||||
|
||||
dbm.cma: dbm.cmo
|
||||
$(CAMLC) -a -o dbm.cma -custom dbm.cmo -cclib -lmldbm $(DBM_LINK)
|
||||
$(MKLIB) -ocamlc '$(CAMLC)' -o dbm -oc mldbm dbm.cmo $(DBM_LINK)
|
||||
|
||||
dbm.cmxa: dbm.cmx
|
||||
$(CAMLOPT) -a -o dbm.cmxa dbm.cmx -cclib -lmldbm $(DBM_LINK)
|
||||
$(MKLIB) -ocamlopt '$(CAMLOPT)' -o dbm dbm.cmx $(DBM_LINK)
|
||||
|
||||
partialclean:
|
||||
rm -f *.cm*
|
||||
|
@ -45,6 +45,7 @@ clean: partialclean
|
|||
rm -f *.a *.o
|
||||
|
||||
install:
|
||||
test -f libmldbm.so && cp libmldbm.so $(LIBDIR)/libmldbm.so
|
||||
cp libmldbm.a $(LIBDIR)/libmldbm.a
|
||||
cd $(LIBDIR); $(RANLIB) libmldbm.a
|
||||
cp dbm.cma dbm.cmi dbm.mli $(LIBDIR)
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
dynlink.cmo: ../../utils/config.cmi ../../bytecomp/emitcode.cmi \
|
||||
../../typing/ident.cmi ../../bytecomp/meta.cmi ../../utils/misc.cmi \
|
||||
../../bytecomp/opcodes.cmo ../../bytecomp/symtable.cmi dynlink.cmi
|
||||
dynlink.cmx: ../../utils/config.cmx ../../bytecomp/emitcode.cmx \
|
||||
../../typing/ident.cmx ../../bytecomp/meta.cmx ../../utils/misc.cmx \
|
||||
../../bytecomp/opcodes.cmx ../../bytecomp/symtable.cmx dynlink.cmi
|
||||
dynlink.cmo: ../../utils/config.cmi ../../bytecomp/dll.cmi \
|
||||
../../bytecomp/emitcode.cmi ../../typing/ident.cmi \
|
||||
../../bytecomp/meta.cmi ../../utils/misc.cmi ../../bytecomp/opcodes.cmo \
|
||||
../../bytecomp/symtable.cmi dynlink.cmi
|
||||
dynlink.cmx: ../../utils/config.cmx ../../bytecomp/dll.cmx \
|
||||
../../bytecomp/emitcode.cmx ../../typing/ident.cmx \
|
||||
../../bytecomp/meta.cmx ../../utils/misc.cmx ../../bytecomp/opcodes.cmx \
|
||||
../../bytecomp/symtable.cmx dynlink.cmi
|
||||
extract_crc.cmo: dynlink.cmi
|
||||
extract_crc.cmx: dynlink.cmx
|
||||
|
|
|
@ -24,7 +24,7 @@ OBJS=dynlink.cmo
|
|||
COMPILEROBJS=misc.cmo config.cmo tbl.cmo clflags.cmo \
|
||||
ident.cmo path.cmo \
|
||||
types.cmo btype.cmo predef.cmo runtimedef.cmo \
|
||||
bytesections.cmo symtable.cmo opcodes.cmo meta.cmo
|
||||
bytesections.cmo dll.cmo symtable.cmo opcodes.cmo meta.cmo
|
||||
|
||||
all: dynlink.cma extract_crc
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue