~ubuntu-branches/ubuntu/lucid/mtasc/lucid

« back to all changes in this revision

Viewing changes to ocaml/extc/extc_stubs.c

  • Committer: Bazaar Package Importer
  • Author(s): Paul Wise
  • Date: 2007-05-23 19:17:16 UTC
  • mto: (2.1.1 gutsy)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20070523191716-lpvac307yorewp3g
Tags: upstream-1.13
ImportĀ upstreamĀ versionĀ 1.13

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#ifdef _WIN32
25
25
#       include <windows.h>
26
26
#else
 
27
#       include <limits.h>
27
28
#       include <unistd.h>
28
29
#endif
29
30
#ifdef __APPLE__
30
31
#       include <sys/param.h>
 
32
#       include <sys/syslimits.h>
31
33
#       include <mach-o/dyld.h>
32
34
#endif
33
35
 
56
58
        value res;
57
59
        int r;
58
60
 
59
 
        z->next_in = String_val(src) + Int_val(spos);
60
 
        z->next_out = String_val(dst) + Int_val(dpos);
 
61
        z->next_in = (Bytef*)(String_val(src) + Int_val(spos));
 
62
        z->next_out = (Bytef*)(String_val(dst) + Int_val(dpos));
61
63
        z->avail_in = Int_val(slen);
62
64
        z->avail_out = Int_val(dlen);
63
65
        if( (r = deflate(z,Int_val(flush))) < 0 )
95
97
        value res;
96
98
        int r;
97
99
 
98
 
        z->next_in = String_val(src) + Int_val(spos);
99
 
        z->next_out = String_val(dst) + Int_val(dpos);
 
100
        z->next_in = (Bytef*)(String_val(src) + Int_val(spos));
 
101
        z->next_out = (Bytef*)(String_val(dst) + Int_val(dpos));
100
102
        z->avail_in = Int_val(slen);
101
103
        z->avail_out = Int_val(dlen);
102
104
        if( (r = inflate(z,Int_val(flush))) < 0 )
130
132
        return caml_copy_string(path);
131
133
#elif __APPLE__
132
134
        char path[MAXPATHLEN+1];
133
 
        unsigned long path_len = MAXPATHLEN;
 
135
        uint32_t path_len = MAXPATHLEN;
134
136
        if ( _NSGetExecutablePath(path, &path_len) )
135
137
                failwith("executable_path");
136
138
        return caml_copy_string(path);
148
150
        }
149
151
#endif
150
152
}
 
153
 
 
154
CAMLprim value get_full_path( value f ) {
 
155
#ifdef _WIN32
 
156
        char path[MAX_PATH];
 
157
        if( GetFullPathName(String_val(f),MAX_PATH,path,NULL) == 0 )
 
158
                failwith("get_full_path");
 
159
        return caml_copy_string(path);
 
160
#else
 
161
        char path[PATH_MAX];
 
162
        if( realpath(String_val(f),path) == NULL )
 
163
                failwith("get_full_path");
 
164
        return caml_copy_string(path);
 
165
#endif
 
166
}