-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathminiphysfs.nelua
218 lines (218 loc) · 13.1 KB
/
miniphysfs.nelua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
##[[
if not MINIPHYSFS_NO_IMPL then
cdefine 'PHYSFS_DECL static'
cdefine 'PHYSFS_IMPL'
cdefine 'PHYSFS_PLATFORM_IMPL'
end
cinclude 'miniphysfs.h'
]]
global PHYSFS_File: type <cimport,nodecl> = @record{
opaque: pointer
}
global PHYSFS_ArchiveInfo: type <cimport,nodecl> = @record{
extension: cstring,
description: cstring,
author: cstring,
url: cstring,
supportsSymlinks: cint
}
global PHYSFS_Version: type <cimport,nodecl> = @record{
major: uint8,
minor: uint8,
patch: uint8
}
global function PHYSFS_getLinkedVersion(ver: *PHYSFS_Version): void <cimport,nodecl> end
global function PHYSFS_init(argv0: cstring): cint <cimport,nodecl> end
global function PHYSFS_deinit(): cint <cimport,nodecl> end
global function PHYSFS_supportedArchiveTypes(): **PHYSFS_ArchiveInfo <cimport,nodecl> end
global function PHYSFS_freeList(listVar: pointer): void <cimport,nodecl> end
global function PHYSFS_getLastError(): cstring <cimport,nodecl> end
global function PHYSFS_getDirSeparator(): cstring <cimport,nodecl> end
global function PHYSFS_permitSymbolicLinks(allow: cint): void <cimport,nodecl> end
global function PHYSFS_getCdRomDirs(): *cstring <cimport,nodecl> end
global function PHYSFS_getBaseDir(): cstring <cimport,nodecl> end
global function PHYSFS_getUserDir(): cstring <cimport,nodecl> end
global function PHYSFS_getWriteDir(): cstring <cimport,nodecl> end
global function PHYSFS_setWriteDir(newDir: cstring): cint <cimport,nodecl> end
global function PHYSFS_addToSearchPath(newDir: cstring, appendToPath: cint): cint <cimport,nodecl> end
global function PHYSFS_removeFromSearchPath(oldDir: cstring): cint <cimport,nodecl> end
global function PHYSFS_getSearchPath(): *cstring <cimport,nodecl> end
global function PHYSFS_setSaneConfig(organization: cstring, appName: cstring, archiveExt: cstring, includeCdRoms: cint, archivesFirst: cint): cint <cimport,nodecl> end
global function PHYSFS_mkdir(dirName: cstring): cint <cimport,nodecl> end
global function PHYSFS_delete(filename: cstring): cint <cimport,nodecl> end
global function PHYSFS_getRealDir(filename: cstring): cstring <cimport,nodecl> end
global function PHYSFS_enumerateFiles(dir: cstring): *cstring <cimport,nodecl> end
global function PHYSFS_exists(fname: cstring): cint <cimport,nodecl> end
global function PHYSFS_isDirectory(fname: cstring): cint <cimport,nodecl> end
global function PHYSFS_isSymbolicLink(fname: cstring): cint <cimport,nodecl> end
global function PHYSFS_getLastModTime(filename: cstring): int64 <cimport,nodecl> end
global function PHYSFS_openWrite(filename: cstring): *PHYSFS_File <cimport,nodecl> end
global function PHYSFS_openAppend(filename: cstring): *PHYSFS_File <cimport,nodecl> end
global function PHYSFS_openRead(filename: cstring): *PHYSFS_File <cimport,nodecl> end
global function PHYSFS_close(handle: *PHYSFS_File): cint <cimport,nodecl> end
global function PHYSFS_read(handle: *PHYSFS_File, buffer: pointer, objSize: uint32, objCount: uint32): int64 <cimport,nodecl> end
global function PHYSFS_write(handle: *PHYSFS_File, buffer: pointer, objSize: uint32, objCount: uint32): int64 <cimport,nodecl> end
global function PHYSFS_eof(handle: *PHYSFS_File): cint <cimport,nodecl> end
global function PHYSFS_tell(handle: *PHYSFS_File): int64 <cimport,nodecl> end
global function PHYSFS_seek(handle: *PHYSFS_File, pos: uint64): cint <cimport,nodecl> end
global function PHYSFS_fileLength(handle: *PHYSFS_File): int64 <cimport,nodecl> end
global function PHYSFS_setBuffer(handle: *PHYSFS_File, bufsize: uint64): cint <cimport,nodecl> end
global function PHYSFS_flush(handle: *PHYSFS_File): cint <cimport,nodecl> end
global function PHYSFS_swapSLE16(val: int16): int16 <cimport,nodecl> end
global function PHYSFS_swapULE16(val: uint16): uint16 <cimport,nodecl> end
global function PHYSFS_swapSLE32(val: int32): int32 <cimport,nodecl> end
global function PHYSFS_swapULE32(val: uint32): uint32 <cimport,nodecl> end
global function PHYSFS_swapSLE64(val: int64): int64 <cimport,nodecl> end
global function PHYSFS_swapULE64(val: uint64): uint64 <cimport,nodecl> end
global function PHYSFS_swapSBE16(val: int16): int16 <cimport,nodecl> end
global function PHYSFS_swapUBE16(val: uint16): uint16 <cimport,nodecl> end
global function PHYSFS_swapSBE32(val: int32): int32 <cimport,nodecl> end
global function PHYSFS_swapUBE32(val: uint32): uint32 <cimport,nodecl> end
global function PHYSFS_swapSBE64(val: int64): int64 <cimport,nodecl> end
global function PHYSFS_swapUBE64(val: uint64): uint64 <cimport,nodecl> end
global function PHYSFS_readSLE16(file: *PHYSFS_File, val: *int16): cint <cimport,nodecl> end
global function PHYSFS_readULE16(file: *PHYSFS_File, val: *uint16): cint <cimport,nodecl> end
global function PHYSFS_readSBE16(file: *PHYSFS_File, val: *int16): cint <cimport,nodecl> end
global function PHYSFS_readUBE16(file: *PHYSFS_File, val: *uint16): cint <cimport,nodecl> end
global function PHYSFS_readSLE32(file: *PHYSFS_File, val: *int32): cint <cimport,nodecl> end
global function PHYSFS_readULE32(file: *PHYSFS_File, val: *uint32): cint <cimport,nodecl> end
global function PHYSFS_readSBE32(file: *PHYSFS_File, val: *int32): cint <cimport,nodecl> end
global function PHYSFS_readUBE32(file: *PHYSFS_File, val: *uint32): cint <cimport,nodecl> end
global function PHYSFS_readSLE64(file: *PHYSFS_File, val: *int64): cint <cimport,nodecl> end
global function PHYSFS_readULE64(file: *PHYSFS_File, val: *uint64): cint <cimport,nodecl> end
global function PHYSFS_readSBE64(file: *PHYSFS_File, val: *int64): cint <cimport,nodecl> end
global function PHYSFS_readUBE64(file: *PHYSFS_File, val: *uint64): cint <cimport,nodecl> end
global function PHYSFS_writeSLE16(file: *PHYSFS_File, val: int16): cint <cimport,nodecl> end
global function PHYSFS_writeULE16(file: *PHYSFS_File, val: uint16): cint <cimport,nodecl> end
global function PHYSFS_writeSBE16(file: *PHYSFS_File, val: int16): cint <cimport,nodecl> end
global function PHYSFS_writeUBE16(file: *PHYSFS_File, val: uint16): cint <cimport,nodecl> end
global function PHYSFS_writeSLE32(file: *PHYSFS_File, val: int32): cint <cimport,nodecl> end
global function PHYSFS_writeULE32(file: *PHYSFS_File, val: uint32): cint <cimport,nodecl> end
global function PHYSFS_writeSBE32(file: *PHYSFS_File, val: int32): cint <cimport,nodecl> end
global function PHYSFS_writeUBE32(file: *PHYSFS_File, val: uint32): cint <cimport,nodecl> end
global function PHYSFS_writeSLE64(file: *PHYSFS_File, val: int64): cint <cimport,nodecl> end
global function PHYSFS_writeULE64(file: *PHYSFS_File, val: uint64): cint <cimport,nodecl> end
global function PHYSFS_writeSBE64(file: *PHYSFS_File, val: int64): cint <cimport,nodecl> end
global function PHYSFS_writeUBE64(file: *PHYSFS_File, val: uint64): cint <cimport,nodecl> end
global function PHYSFS_isInit(): cint <cimport,nodecl> end
global function PHYSFS_symbolicLinksPermitted(): cint <cimport,nodecl> end
global PHYSFS_Allocator: type <cimport,nodecl> = @record{
Init: function(): cint,
Deinit: function(): void,
Malloc: function(uint64): pointer,
Realloc: function(pointer, uint64): pointer,
Free: function(pointer): void
}
global function PHYSFS_setAllocator(allocator: *PHYSFS_Allocator): cint <cimport,nodecl> end
global function PHYSFS_mount(newDir: cstring, mountPoint: cstring, appendToPath: cint): cint <cimport,nodecl> end
global function PHYSFS_getMountPoint(dir: cstring): cstring <cimport,nodecl> end
global PHYSFS_StringCallback: type <cimport,nodecl> = @function(pointer, cstring): void
global PHYSFS_EnumFilesCallback: type <cimport,nodecl> = @function(pointer, cstring, cstring): void
global function PHYSFS_getCdRomDirsCallback(c: PHYSFS_StringCallback, d: pointer): void <cimport,nodecl> end
global function PHYSFS_getSearchPathCallback(c: PHYSFS_StringCallback, d: pointer): void <cimport,nodecl> end
global function PHYSFS_enumerateFilesCallback(dir: cstring, c: PHYSFS_EnumFilesCallback, d: pointer): void <cimport,nodecl> end
global function PHYSFS_utf8FromUcs4(src: *uint32, dst: cstring, len: uint64): void <cimport,nodecl> end
global function PHYSFS_utf8ToUcs4(src: cstring, dst: *uint32, len: uint64): void <cimport,nodecl> end
global function PHYSFS_utf8FromUcs2(src: *uint16, dst: cstring, len: uint64): void <cimport,nodecl> end
global function PHYSFS_utf8ToUcs2(src: cstring, dst: *uint16, len: uint64): void <cimport,nodecl> end
global function PHYSFS_utf8FromLatin1(src: cstring, dst: cstring, len: uint64): void <cimport,nodecl> end
global function PHYSFS_caseFold(from: uint32, to: *uint32): cint <cimport,nodecl> end
global function PHYSFS_utf8stricmp(str1: cstring, str2: cstring): cint <cimport,nodecl> end
global function PHYSFS_utf16stricmp(str1: *uint16, str2: *uint16): cint <cimport,nodecl> end
global function PHYSFS_ucs4stricmp(str1: *uint32, str2: *uint32): cint <cimport,nodecl> end
global PHYSFS_EnumerateCallbackResult: type <cimport,nodecl,using> = @enum(cint){
PHYSFS_ENUM_ERROR = -1,
PHYSFS_ENUM_STOP = 0,
PHYSFS_ENUM_OK = 1
}
global PHYSFS_EnumerateCallback: type <cimport,nodecl> = @function(pointer, cstring, cstring): PHYSFS_EnumerateCallbackResult
global function PHYSFS_enumerate(dir: cstring, c: PHYSFS_EnumerateCallback, d: pointer): cint <cimport,nodecl> end
global function PHYSFS_unmount(oldDir: cstring): cint <cimport,nodecl> end
global function PHYSFS_getAllocator(): *PHYSFS_Allocator <cimport,nodecl> end
global PHYSFS_FileType: type <cimport,nodecl,using> = @enum(cint){
PHYSFS_FILETYPE_REGULAR = 0,
PHYSFS_FILETYPE_DIRECTORY = 1,
PHYSFS_FILETYPE_SYMLINK = 2,
PHYSFS_FILETYPE_OTHER = 3
}
global PHYSFS_Stat: type <cimport,nodecl> = @record{
filesize: int64,
modtime: int64,
createtime: int64,
accesstime: int64,
filetype: PHYSFS_FileType,
readonly: cint
}
global function PHYSFS_stat(fname: cstring, stat: *PHYSFS_Stat): cint <cimport,nodecl> end
global function PHYSFS_utf8FromUtf16(src: *uint16, dst: cstring, len: uint64): void <cimport,nodecl> end
global function PHYSFS_utf8ToUtf16(src: cstring, dst: *uint16, len: uint64): void <cimport,nodecl> end
global function PHYSFS_readBytes(handle: *PHYSFS_File, buffer: pointer, len: uint64): int64 <cimport,nodecl> end
global function PHYSFS_writeBytes(handle: *PHYSFS_File, buffer: pointer, len: uint64): int64 <cimport,nodecl> end
global PHYSFS_Io: type <cimport,nodecl,forwarddecl> = @record{}
PHYSFS_Io = @record{
version: uint32,
opaque: pointer,
read: function(*PHYSFS_Io, pointer, uint64): int64,
write: function(*PHYSFS_Io, pointer, uint64): int64,
seek: function(*PHYSFS_Io, uint64): cint,
tell: function(*PHYSFS_Io): int64,
length: function(*PHYSFS_Io): int64,
duplicate: function(*PHYSFS_Io): *PHYSFS_Io,
flush: function(*PHYSFS_Io): cint,
destroy: function(*PHYSFS_Io): void
}
global function PHYSFS_mountIo(io: *PHYSFS_Io, newDir: cstring, mountPoint: cstring, appendToPath: cint): cint <cimport,nodecl> end
global function PHYSFS_mountMemory(buf: pointer, len: uint64, del: function(pointer): void, newDir: cstring, mountPoint: cstring, appendToPath: cint): cint <cimport,nodecl> end
global function PHYSFS_mountHandle(file: *PHYSFS_File, newDir: cstring, mountPoint: cstring, appendToPath: cint): cint <cimport,nodecl> end
global PHYSFS_ErrorCode: type <cimport,nodecl,using> = @enum(cint){
PHYSFS_ERR_OK = 0,
PHYSFS_ERR_OTHER_ERROR = 1,
PHYSFS_ERR_OUT_OF_MEMORY = 2,
PHYSFS_ERR_NOT_INITIALIZED = 3,
PHYSFS_ERR_IS_INITIALIZED = 4,
PHYSFS_ERR_ARGV0_IS_NULL = 5,
PHYSFS_ERR_UNSUPPORTED = 6,
PHYSFS_ERR_PAST_EOF = 7,
PHYSFS_ERR_FILES_STILL_OPEN = 8,
PHYSFS_ERR_INVALID_ARGUMENT = 9,
PHYSFS_ERR_NOT_MOUNTED = 10,
PHYSFS_ERR_NOT_FOUND = 11,
PHYSFS_ERR_SYMLINK_FORBIDDEN = 12,
PHYSFS_ERR_NO_WRITE_DIR = 13,
PHYSFS_ERR_OPEN_FOR_READING = 14,
PHYSFS_ERR_OPEN_FOR_WRITING = 15,
PHYSFS_ERR_NOT_A_FILE = 16,
PHYSFS_ERR_READ_ONLY = 17,
PHYSFS_ERR_CORRUPT = 18,
PHYSFS_ERR_SYMLINK_LOOP = 19,
PHYSFS_ERR_IO = 20,
PHYSFS_ERR_PERMISSION = 21,
PHYSFS_ERR_NO_SPACE = 22,
PHYSFS_ERR_BAD_FILENAME = 23,
PHYSFS_ERR_BUSY = 24,
PHYSFS_ERR_DIR_NOT_EMPTY = 25,
PHYSFS_ERR_OS_ERROR = 26,
PHYSFS_ERR_DUPLICATE = 27,
PHYSFS_ERR_BAD_PASSWORD = 28,
PHYSFS_ERR_APP_CALLBACK = 29
}
global function PHYSFS_getLastErrorCode(): PHYSFS_ErrorCode <cimport,nodecl> end
global function PHYSFS_getErrorByCode(code: PHYSFS_ErrorCode): cstring <cimport,nodecl> end
global function PHYSFS_setErrorCode(code: PHYSFS_ErrorCode): void <cimport,nodecl> end
global function PHYSFS_getPrefDir(org: cstring, app: cstring): cstring <cimport,nodecl> end
global PHYSFS_Archiver: type <cimport,nodecl> = @record{
version: uint32,
info: PHYSFS_ArchiveInfo,
openArchive: function(*PHYSFS_Io, cstring, cint, *cint): pointer,
enumerate: function(pointer, cstring, PHYSFS_EnumerateCallback, cstring, pointer): PHYSFS_EnumerateCallbackResult,
openRead: function(pointer, cstring): *PHYSFS_Io,
openWrite: function(pointer, cstring): *PHYSFS_Io,
openAppend: function(pointer, cstring): *PHYSFS_Io,
remove: function(pointer, cstring): cint,
mkdir: function(pointer, cstring): cint,
stat: function(pointer, cstring, *PHYSFS_Stat): cint,
closeArchive: function(pointer): void
}
global function PHYSFS_registerArchiver(archiver: *PHYSFS_Archiver): cint <cimport,nodecl> end
global function PHYSFS_deregisterArchiver(ext: cstring): cint <cimport,nodecl> end
global function PHYSFS_setRoot(archive: cstring, subdir: cstring): cint <cimport,nodecl> end