8.15. File tom/C

class tom.C

The C class provides low-level memory manipulation functionality. With it, a lot of collection and string methods can be written in TOM instead of needing to be written in C.


Behaviour supers: All


  free pointer address;

Release the memory at address.

  malloc int length;

Return a pointer to a newly allocated memory region of length bytes.

  calloc (int, int) (num, bytes);

Return a pointer to newly allocated and zeroed memory region of num elements of each bytes size.

  realloc (pointer, int) (address, length);

Return a pointer to the resized memory region at address which must hold length bytes. The address returned can differ from the previous address.

  memcmp (pointer, pointer, int) (one, other, length);

Return 0 iff the length bytes at one equal the bytes at other.

  memchr (pointer, int, int) (p, c, length);

Search the first length bytes from s for character c. Return the index into s at which c first occurs. If c is not present, return the value -1.

  memcpy (pointer, pointer, int) (to, from, length);

Copy the length bytes from from to to. Return to.

  memmove (pointer, pointer, int) (to, from, length);

Copy the length bytes from from to to, safely. Return to.

  bzero (pointer, int) (p, num);

Set the num bytes at p to 0.

instance tom.C

The C instance can be and is totally empty.