-
Notifications
You must be signed in to change notification settings - Fork 3
/
MemFile.bi
40 lines (37 loc) · 2.64 KB
/
MemFile.bi
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
'-----------------------------------------------------------------------------------------------------------------------
' File I/O like routines for memory loaded files
' Copyright (c) 2024 Samuel Gomes
'-----------------------------------------------------------------------------------------------------------------------
$INCLUDEONCE
'$INCLUDE:'Common.bi'
'$INCLUDE:'Types.bi'
DECLARE LIBRARY "MemFile"
FUNCTION MemFile_Create~%& (BYVAL src AS _UNSIGNED _OFFSET, BYVAL size AS _UNSIGNED _OFFSET)
SUB MemFile_Destroy (BYVAL memFile AS _UNSIGNED _OFFSET)
FUNCTION MemFile_IsEOF%% (BYVAL memFile AS _UNSIGNED _OFFSET)
$IF 32BIT THEN
FUNCTION MemFile_GetSize~& (BYVAL memFile AS _UNSIGNED _OFFSET)
FUNCTION MemFile_GetPosition~& (BYVAL memFile AS _UNSIGNED _OFFSET)
FUNCTION MemFile_Read~& (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL dst AS _UNSIGNED _OFFSET, BYVAL size AS _UNSIGNED _OFFSET)
FUNCTION MemFile_Write~& (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL src AS _UNSIGNED _OFFSET, BYVAL size AS _UNSIGNED _OFFSET)
$ELSE
FUNCTION MemFile_GetSize~&& (BYVAL memFile AS _UNSIGNED _OFFSET)
FUNCTION MemFile_GetPosition~&& (BYVAL memFile AS _UNSIGNED _OFFSET)
FUNCTION MemFile_Read~&& (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL dst AS _UNSIGNED _OFFSET, BYVAL size AS _UNSIGNED _OFFSET)
FUNCTION MemFile_Write~&& (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL src AS _UNSIGNED _OFFSET, BYVAL size AS _UNSIGNED _OFFSET)
$END IF
SUB MemFile_Seek (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL position AS _UNSIGNED _OFFSET)
SUB MemFile_Resize (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL newSize AS _UNSIGNED _OFFSET)
FUNCTION MemFile_ReadByte~%% (BYVAL memFile AS _UNSIGNED _OFFSET)
SUB MemFile_WriteByte (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL src AS _UNSIGNED _BYTE)
FUNCTION MemFile_ReadInteger~% (BYVAL memFile AS _UNSIGNED _OFFSET)
SUB MemFile_WriteInteger (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL src AS _UNSIGNED INTEGER)
FUNCTION MemFile_ReadLong~& (BYVAL memFile AS _UNSIGNED _OFFSET)
SUB MemFile_WriteLong (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL src AS _UNSIGNED LONG)
FUNCTION MemFile_ReadSingle! (BYVAL memFile AS _UNSIGNED _OFFSET)
SUB MemFile_WriteSingle (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL src AS SINGLE)
FUNCTION MemFile_ReadInteger64~&& (BYVAL memFile AS _UNSIGNED _OFFSET)
SUB MemFile_WriteInteger64 (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL src AS _UNSIGNED _INTEGER64)
FUNCTION MemFile_ReadDouble# (BYVAL memFile AS _UNSIGNED _OFFSET)
SUB MemFile_WriteDouble (BYVAL memFile AS _UNSIGNED _OFFSET, BYVAL src AS DOUBLE)
END DECLARE