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, dst_addr, size )

IN
ptr src_addr source memory buffer
ptr dst_addr destination memory buffer
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, addr2, size )

IN
ptr addr1 memory buffer 1
ptr addr2 memory buffer 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 )

IN
ptr addr memory buffer
OUT
int byte value

Returns the byte content from given address (1 byte).

 C/C++ source code


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

IN
ptr addr memory buffer
OUT
int word value

Returns the word content from given address (2 bytes).

 C/C++ source code


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

IN
ptr addr memory buffer
OUT
int integer value

Returns the integer content from given address (4 bytes).

 C/C++ source code


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

IN
ptr addr memory buffer
OUT
flt float value

Returns the float content from given address (4 bytes).

 C/C++ source code


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

IN
ptr addr memory buffer
OUT
str string value

Returns the text content from given address, based on EOS (0 value) (n+1 bytes)

 C/C++ source code


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

IN
ptr addr memory buffer
int value byte value

Writes the byte content at given address (1 byte).

 C/C++ source code


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

IN
ptr addr memory buffer
int value word value

Writes the word content at given address (2 bytes).

 C/C++ source code


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

IN
ptr addr memory buffer
int value integer value

Writes the integer content at given address (4 bytes).

 C/C++ source code


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

IN
ptr addr memory buffer
flt value float value

Writes the float content at given address (4 bytes).

 C/C++ source code


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

IN
ptr addr memory buffer
str value string value

Writes the text content at given address, adding EOS (0 value) (n+1 bytes)

 C/C++ source code