Index: install.ml --- install.ml.orig 2006-08-02 17:59:19 +0200 +++ install.ml 2010-01-26 09:32:41 +0100 @@ -104,10 +104,10 @@ in let startdir = Sys.getcwd() in try - download(); + (* download(); *) compile(); Sys.chdir startdir; with Failure msg -> Sys.chdir startdir; - prerr_endline msg; exit 1 \ No newline at end of file + prerr_endline msg; exit 1 Index: ocaml/extc/extc_stubs.c --- ocaml/extc/extc_stubs.c.orig 2007-03-05 12:09:37 +0100 +++ ocaml/extc/extc_stubs.c 2010-01-26 09:32:41 +0100 @@ -32,6 +32,11 @@ # include # include #endif +#ifdef __FreeBSD__ +# include +# include +# include +#endif #define zval(z) ((z_streamp)(z)) @@ -125,7 +130,26 @@ } CAMLprim value executable_path(value u) { -#ifdef _WIN32 +#if defined(__FreeBSD__) + char pathname[PATH_MAX]; + int error, name[4]; + size_t len; + pid_t pid; + + pid = getpid(); + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_PATHNAME; + name[3] = pid; + + len = sizeof(pathname); + error = sysctl(name, 4, pathname, &len, NULL, 0); + if (error < 0 && errno != ESRCH) + warn("sysctl: kern.proc.pathname: %d", pid); + if (error < 0) + return caml_copy_string("-"); + return caml_copy_string(pathname); +#elif defined(_WIN32) char path[MAX_PATH]; if( GetModuleFileName(NULL,path,MAX_PATH) == 0 ) failwith("executable_path"); Index: ocaml/mtasc/main.ml --- ocaml/mtasc/main.ml.orig 2008-09-01 07:53:38 +0200 +++ ocaml/mtasc/main.ml 2010-01-26 09:32:41 +0100 @@ -112,8 +112,8 @@ if do_exit then exit 1 ;; try - let usage = "Motion-Twin ActionScript2 Compiler 1.14 - (c)2004-2008 Motion-Twin\n Usage : mtasc.exe [options] \n Options :" in - let base_path = normalize_path (try Extc.executable_path() with _ -> ".") in + let usage = "Motion-Twin ActionScript2 Compiler 1.14 - (c)2004-2008 Motion-Twin\n Usage : mtasc [options] \n Options :" in + let base_path = normalize_path (try Extc.executable_path() ^ "/.." with _ -> "..") in let files = ref [] in let time = Sys.time() in Plugin.class_path := [base_path;"";"/"]; @@ -132,8 +132,8 @@ ),": use precompiled mx package"); ] @ !Plugin.options in Arg.parse args_spec (fun file -> files := file :: !files) usage; - Plugin.class_path := (base_path ^ "std/") :: !Plugin.class_path; - if (match !GenSwf.version with Some x -> x >= 8 | None -> false) then Plugin.class_path := (base_path ^ "std8/") :: !Plugin.class_path; + Plugin.class_path := (base_path ^ "share/mtasc/std/") :: !Plugin.class_path; + if (match !GenSwf.version with Some x -> x >= 8 | None -> false) then Plugin.class_path := (base_path ^ "share/mtasc/std8/") :: !Plugin.class_path; Hashtbl.remove Lexer.keywords "add"; Parser.warning := (fun msg pos -> report ~do_exit:false (msg,pos) "Warning" (fun msg -> msg)); if !files = [] then begin Index: ocaml/mtasc/parser.ml --- ocaml/mtasc/parser.ml.orig 2007-02-04 14:56:04 +0100 +++ ocaml/mtasc/parser.ml 2010-01-26 09:32:41 +0100 @@ -166,8 +166,8 @@ | [< '(Kwd For,p); '(POpen,_); c = parse_expr_opt; e = parse_for p c >] -> e | [< '(Kwd If,p); cond = parse_eval; e = parse_expr_opt; e2 , p2 = parse_else (pos e) >] -> EIf (cond,wrap_var e,e2), punion p p2 | [< '(Kwd Return,p); v , p2 = parse_eval_option p; >] -> EReturn v , punion p p2 - | [< '(Kwd Break,p); >] -> EBreak , p - | [< '(Kwd Continue,p); >] -> EContinue , p + | [< '(Kwd Break,p) >] -> EBreak , p + | [< '(Kwd Continue,p) >] -> EContinue , p | [< '(Kwd While,p1); v = parse_eval; e = parse_expr_opt >] -> EWhile (v,wrap_var e,NormalWhile) , punion p1 (pos e) | [< '(Kwd Do,p1); e = parse_expr; '(Kwd While,_); v = parse_eval; >] -> EWhile (v,wrap_var e,DoWhile) , punion p1 (pos v) | [< '(Kwd Switch,p1); v = parse_eval; '(BrOpen,_); el, p2 = parse_switch false >] -> ESwitch (v,el) , punion p1 p2 @@ -278,7 +278,7 @@ and parse_expr_opt = parser | [< e = parse_expr >] -> e - | [< '(Next,p); >] -> EBlock [] , p + | [< '(Next,p) >] -> EBlock [] , p and parse_for p c = parser | [< '(Kwd In,_); v = parse_eval; '(PClose,p2); e = parse_expr_opt >] -> EForIn(c,v,wrap_var e) , punion p p2 @@ -324,7 +324,7 @@ and parse_block callb sp = parser | [< e = callb; el,p = parse_block callb sp >] -> e :: el , p | [< '(Next,_); el = parse_block callb sp >] -> el - | [< '(BrClose,p); >] -> [] , p + | [< '(BrClose,p) >] -> [] , p | [< '(Eof,_) >] -> error Unclosed_parenthesis sp and parse_expr_list p = parser @@ -351,7 +351,7 @@ and parse_import = parser | [< '(Const (Ident name),_); p = parse_import2 name >] -> p - | [< '(Binop OpMult,_); >] -> [] , None + | [< '(Binop OpMult,_) >] -> [] , None and parse_import2 name = parser | [< '(Dot,_); p , n = parse_import >] -> name :: p , n