Download SICStus Prolog User`s Manual
Transcript
182 SICStus Prolog 9.3.5 Unifying and Comparing Terms int SP_unify(SP_term_ref x, SP_term_ref y) Unifies two terms, returning zero on failure and nonzero on success. int SP_compare(SP_term_ref x, SP_term_ref y) Returns -1 if x @< y, 0 if x == y and 1 if x @> y 9.3.6 Operating System Services The usual C library memory allocation functions (malloc, calloc, realloc, and free) may not work properly in foreign code. The following functions provide these services from SICStus Prolog’s memory manager: void * SP_malloc(unsigned int size) Returns a properly aligned pointer to a block of at least size bytes. void * SP_calloc(unsigned int nmemb, unsigned size) Returns a properly aligned pointer to a block of at least size * nemb. The first size * nmemb bytes are set to zero. void * SP_realloc(void *ptr, unsigned int size) Changes the size of the block referenced by ptr to size bytes and returns a pointer to the (possibly moved) block. The contents will be unchanged up to the lesser of the new and old sizes. The block referenced by ptr must have been obtained by a call to SP_malloc or SP_realloc, and must not have been released by a call to SP_free or SP_realloc. void SP_free(void *ptr) Releases the block referenced by ptr, which must have been obtained by a call to SP_malloc or SP_realloc, and must not have been released by a call to SP_free or SP_realloc. char * SP_strdup(const char *str) Returns a pointer to a new string which is a duplicate of the string pointer to by str. The memory for the new string is allocated using SP_malloc(). SICStus Prolog caches the name of the current working directory. To take advantage of the cache and to keep it consistent, foreign code should call the following interface functions instead of calling chdir() and getcwd() directly: int SP_chdir(const char *path) Cause a directory pointed to by path to become the current working directory. Returns 0 upon successful completion. Otherwise, a value of -1 is returned and errno is set to indicate the error. char *SP_getcwd(char *buf, unsigned int size); Returns a pointer to the current directory pathname. If buf is not NULL, the pathname will be stored in the space pointed to by buf. If buf is a NULL pointer, size bytes of space will be obtained using SP_malloc(). In this case,
Related documents
SICStus Prolog User`s Manual
SICStus Prolog User`s Manual
SICStus Prolog User's Manual
SICStus Prolog User`s Manual
Planning using Situation Calculus, Prolog and a - CEUR
Ciao Manual - The Ciao System
SICStus Prolog Release Notes
Sec - SICStus Prolog 3
PR Pilot 575 User Manual
Design and Applied Technology (Secondary 4 – 6)
AX50 Color Screen Digital Mobile Phone User Manual