[-]
[+]
|
Changed |
mtasc-cvs.tar.bz2/extc/extc_stubs.c
|
@@ -32,6 +32,12 @@
# include <sys/syslimits.h>
# include <mach-o/dyld.h>
#endif
+#ifdef __FreeBSD__
+# include <sys/param.h>
+# include <sys/sysctl.h>
+# include <sys/user.h>
+#endif
+
#define zval(z) ((z_streamp)(z))
@@ -136,6 +142,19 @@
if ( _NSGetExecutablePath(path, &path_len) )
failwith("executable_path");
return caml_copy_string(path);
+#elif __FreeBSD__
+ char path[PATH_MAX];
+ int error, name[4];
+ size_t len;
+ name[0] = CTL_KERN;
+ name[1] = KERN_PROC;
+ name[2] = KERN_PROC_PATHNAME;
+ name[3] = (int)getpid();
+ len = sizeof(path);
+ error = sysctl(name, 4, path, &len, NULL, 0);
+ if( error < 0 )
+ failwith("executable_path");
+ return caml_copy_string(path);
#else
const char *p = getenv("_");
if( p != NULL )
|
[-]
[+]
|
Changed |
mtasc-cvs.tar.bz2/extlib-dev/dynArray.ml
^
|
@@ -161,7 +161,7 @@
if idx < 0 || idx > d.len then invalid_arg idx "insert" "index";
if d.len = ilen d.arr then changelen d (d.len + 1) else d.len <- d.len + 1;
if idx < d.len - 1 then begin
- for i = d.len - 1 downto idx do
+ for i = d.len - 2 downto idx do
iset d.arr (i+1) (iget d.arr i)
done;
end;
|
[-]
[+]
|
Changed |
mtasc-cvs.tar.bz2/swflib/as3hlparse.ml
^
|
@@ -28,6 +28,8 @@
mutable classes : hl_class array;
mutable jumps : (int * int) list;
mutable pos : int;
+ delta_mt : int;
+ delta_cl : int;
}
let get = As3parse.iget
@@ -412,7 +414,7 @@
let parse_method_type ctx idx f =
let m = ctx.as3.as3_method_types.(idx) in
{
- hlmt_index = idx;
+ hlmt_index = idx + ctx.delta_mt;
hlmt_ret = opt name ctx m.mt3_ret;
hlmt_args = List.map (opt name ctx) m.mt3_args;
hlmt_native = m.mt3_native;
@@ -429,7 +431,7 @@
let parse_class ctx c s index =
{
- hlc_index = index;
+ hlc_index = index + ctx.delta_cl;
hlc_name = name ctx c.cl3_name;
hlc_super = opt name ctx c.cl3_super;
hlc_sealed = c.cl3_sealed;
@@ -449,7 +451,7 @@
hls_fields = Array.map (parse_field ctx) s.st3_fields;
}
-let parse t =
+let parse ?(delta_mt=0) ?(delta_cl=0) t =
let ctx = {
as3 = t;
namespaces = [||];
@@ -459,6 +461,8 @@
classes = [||];
jumps = [];
pos = 0;
+ delta_mt = delta_mt;
+ delta_cl = delta_cl;
} in
ctx.namespaces <- Array.map (parse_namespace ctx) t.as3_namespaces;
ctx.nsets <- Array.map (parse_nset ctx) t.as3_nsets;
|
[-]
[+]
|
Changed |
mtasc-cvs.tar.bz2/swflib/swf.ml
^
|
@@ -380,17 +380,11 @@
jpg_data : string;
}
-type bitmap_jpg2 = {
- mutable jp2_id : int;
- jp2_table : string;
- jp2_data : string;
-}
-
-type bitmap_jpg3 = {
- mutable jp3_id : int;
- jp3_table : string;
- jp3_data : string;
- jp3_alpha_data : string;
+type bitmap_data = {
+ mutable bd_id : int;
+ bd_table : string option;
+ bd_data : string;
+ bd_alpha : string option;
}
type bitmap_lossless = {
@@ -522,7 +516,7 @@
| TSound of sound
| TStartSound of start_sound
| TBitsLossless of bitmap_lossless
- | TBitsJPEG2 of bitmap_jpg2
+ | TBitsJPEG2 of bitmap_data
| TShape2 of shape
| TProtect
| TPlaceObject2 of place_object
@@ -530,7 +524,7 @@
| TShape3 of shape
| TText2 of text
| TButton2 of button2
- | TBitsJPEG3 of bitmap_jpg3
+ | TBitsJPEG3 of bitmap_data
| TBitsLossless2 of bitmap_lossless
| TEditText of edit_text
| TClip of clip
|
[-]
[+]
|
Changed |
mtasc-cvs.tar.bz2/swflib/swfParser.ml
^
|
@@ -322,7 +322,7 @@
| TBitsLossless b ->
bitmap_lossless_length b
| TBitsJPEG2 b ->
- 2 + String.length b.jp2_table + String.length b.jp2_data
+ 2 + opt_len String.length b.bd_table + String.length b.bd_data
| TShape2 s ->
shape_length s
| TProtect ->
@@ -338,7 +338,7 @@
| TButton2 b ->
button2_length b
| TBitsJPEG3 b ->
- 2 + 4 + String.length b.jp3_alpha_data + String.length b.jp3_data + String.length b.jp3_table
+ 2 + 4 + opt_len String.length b.bd_table + String.length b.bd_data + opt_len String.length b.bd_alpha
| TBitsLossless2 b ->
bitmap_lossless_length b
| TEditText t ->
@@ -858,18 +858,25 @@
sh_style = style;
}
-let parse_jpg_table ch =
- let b = Buffer.create 0 in
- let rec loop flag =
- let c = IO.read ch in
- Buffer.add_char b c;
- match int_of_char c with
- | 0xFF -> loop true
- | 0xD9 when flag -> ()
- | _ -> loop false
- in
- loop false;
- Buffer.contents b
+let extract_jpg_table data =
+ match data.[0], data.[1] with
+ | '\xFF', '\xD8' ->
+ let ch = IO.input_string data in
+ let b = Buffer.create 0 in
+ let rec loop flag =
+ let c = IO.read ch in
+ Buffer.add_char b c;
+ match int_of_char c with
+ | 0xFF -> loop true
+ | 0xD9 when flag -> ()
+ | _ -> loop false
+ in
+ loop false;
+ let t = Buffer.contents b in
+ let l = String.length t in
+ String.sub data l (String.length data - l), Some t
+ | _ ->
+ data, None
let parse_bitmap_lossless ch len =
let id = read_ui16 ch in
@@ -1184,12 +1191,13 @@
TBitsLossless (parse_bitmap_lossless ch len)
| 0x15 ->
let id = read_ui16 ch in
- let table = parse_jpg_table ch in
- let data = nread ch (len - 2 - String.length table) in
+ let data = nread ch (len - 2) in
+ let data, table = extract_jpg_table data in
TBitsJPEG2 {
- jp2_id = id;
- jp2_table = table;
- jp2_data = data;
+ bd_id = id;
+ bd_table = table;
+ bd_data = data;
+ bd_alpha = None;
}
| 0x16 when !full_parsing ->
TShape2 (parse_shape ch len 2)
@@ -1210,14 +1218,14 @@
| 0x23 ->
let id = read_ui16 ch in
let size = read_i32 ch in
- let table = parse_jpg_table ch in
- let data = nread ch (size - String.length table) in
- let alpha_data = nread ch (len - 6 - size) in
+ let data = nread ch size in
+ let data, table = extract_jpg_table data in
+ let alpha = nread ch (len - 6 - size) in
TBitsJPEG3 {
- jp3_id = id;
- jp3_table = table;
- jp3_data = data;
- jp3_alpha_data = alpha_data;
+ bd_id = id;
+ bd_table = table;
+ bd_data = data;
+ bd_alpha = Some alpha;
}
| 0x24 ->
TBitsLossless2 (parse_bitmap_lossless ch len)
@@ -1752,9 +1760,9 @@
| TBitsLossless b ->
write_bitmap_lossless ch b
| TBitsJPEG2 b ->
- write_ui16 ch b.jp2_id;
- nwrite ch b.jp2_table;
- nwrite ch b.jp2_data;
+ write_ui16 ch b.bd_id;
+ opt (nwrite ch) b.bd_table;
+ nwrite ch b.bd_data;
| TShape2 s ->
write_shape ch s
| TProtect ->
@@ -1770,11 +1778,11 @@
| TButton2 b ->
write_button2 ch b
| TBitsJPEG3 b ->
- write_ui16 ch b.jp3_id;
- write_i32 ch (String.length b.jp3_data + String.length b.jp3_table);
- nwrite ch b.jp3_table;
- nwrite ch b.jp3_data;
- nwrite ch b.jp3_alpha_data;
+ write_ui16 ch b.bd_id;
+ write_i32 ch (String.length b.bd_data + opt_len String.length b.bd_table);
+ opt (nwrite ch) b.bd_table;
+ nwrite ch b.bd_data;
+ opt (nwrite ch) b.bd_alpha;
| TBitsLossless2 b ->
write_bitmap_lossless ch b
| TEditText t ->
|
[-]
[+]
|
Changed |
mtasc-cvs.tar.bz2/swflib/swfPic.ml
^
|
@@ -36,6 +36,7 @@
pheight : int;
pid : int;
pdata : tag_data;
+ pframe : string option;
}
let error_msg = function
@@ -76,6 +77,7 @@
pwidth = w;
pheight = h;
pid = id;
+ pframe = None;
pdata = (match header.png_color with
| ClTrueColor (TBits8,NoAlpha) ->
(* set alpha to 0 *)
|