MEMORY LIBRARY
A Programming Language Manual




memalloc
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
ptr memalloc( size )

IN
int size buffer size
OUT
ptr memory buffer

Allocates a memory buffer and returns the pointer.

 C/C++ source code


memrealloc
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
ptr memrealloc( addr, size )

IN
ptr addr memory buffer
int size buffer size
OUT
ptr new memory buffer

Resizes a memory buffer. Content is preserved with respect to the new size.

 C/C++ source code


memfree
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
memfree( addr )

IN
ptr addr memory buffer

Frees a memory buffer.

 C/C++ source code


memcpy
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
memcpy( src_addr, src_pos, dst_addr, dst_pos, size )

IN
ptr src_addr source memory buffer
int src_pos source position
ptr dst_addr destination memory buffer
int dst_pos destination position
int size number of bytes to copy

Copy from a memory buffer to another.
The copy is safe for copy inside the same buffer, even for overlapping zones.


 C/C++ source code


memcmp
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
int memcmp( addr1, pos1, addr2, pos2, size )

IN
ptr addr1 memory buffer 1
int pos1 position 1
ptr addr2 memory buffer 2
int pos2 position 2
int size number of bytes to compare
OUT
int -1=less, 0=equal, 1=greater

Compares two memory buffers.
Safe for same buffer (untested for overlapping zones).


 C/C++ source code


memget
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
int memget( addr, pos )

IN
ptr addr memory buffer
int pos position
OUT
int byte value

Returns the byte content from given position in memory buffer (1 byte).

 C/C++ source code


memgetw
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
int memgetw( addr, pos )

IN
ptr addr memory buffer
int pos position
OUT
int word value

Returns the word content from given position in memory buffer (2 bytes).

 C/C++ source code


memgeti
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
int memgeti( addr, pos )

IN
ptr addr memory buffer
int pos position
OUT
int integer value

Returns the integer content from given position in memory buffer (4 bytes).

 C/C++ source code


memgetf
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
flt memgetf( addr, pos )

IN
ptr addr memory buffer
int pos position
OUT
flt float value

Returns the float content from given position in memory buffer (4 bytes).

 C/C++ source code


memgets
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
str memgets( addr, pos )

IN
ptr addr memory buffer
int pos position
OUT
str string value

Returns the text content from given position in memory buffer, based on EOS (0 value) (n+1 bytes)

 C/C++ source code


memset
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
memset( addr, pos, value )

IN
ptr addr memory buffer
int pos position
int value byte value

Writes the byte content at given position in memory buffer (1 byte).

 C/C++ source code


memsetw
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
memsetw( addr, pos, value )

IN
ptr addr memory buffer
int pos position
int value word value

Writes the word content at given position in memory buffer (2 bytes).

 C/C++ source code


memseti
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
memseti( addr, pos, value )

IN
ptr addr memory buffer
int pos position
int value integer value

Writes the integer content at given position in memory buffer (4 bytes).

 C/C++ source code


memsetf
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
memsetf( addr, pos, value )

IN
ptr addr memory buffer
int pos position
flt value float value

Writes the float content at given position in memory buffer (4 bytes).

 C/C++ source code


memsets
( lib: Memory, file: ../src/gs/gslib_memory.cpp )
memsets( addr, pos, value )

IN
ptr addr memory buffer
int pos position
str value string value

Writes the text content at given position in memory buffer, adding EOS (0 value) (n+1 bytes)

 C/C++ source code