Galaxy Communicator Documentation:

Core Library

License / Documentation home / Help and feedback


 

This documentation briefly describes functions in the directory src/libGalaxy/galaxy which are present but probably will not be used by the developer. The signatures of these functions may change from release to release.



 

String Utility Functions

int Gal_DigitStringp(const char *word)
Returns 1 if the string, word, represents an integer.

int Gal_FloatStringp(const char *word)
Returns 1 if the string word represents a float.

void Gal_StringRightTrim(char *str, const char *trim)
Removes characters in trim from the right edge of str, inserting a null character at the appropriate place.

void Gal_StringLeftTrim(char *str, const char *trim)
Removes characters in trim from the left edge of str, updating the underlying pointer.

void Gal_StringTrim(char *str, const char *trim)
Removes characters in trim from both edges of str using Gal_StringLeftTrim and Gal_StringRightTrim.

int Gal_StringEq(const char *str1, const char *str2);
Returns 1 if the strings, str1 and str2, are equivalent (using strcmp).  Otherwise, 0 is returned.

int Gal_StringCaseEq(const char *str1, const char *str2);
Returns 1 if the strings, str1 and str2, are of the same case.  Otherwise, 0 is returned.


Print Utility Functions

char *Gal_ObjectString(Gal_Object to, Gal_StringBuffer **buf)
A static version of Gal_ObjectToString. Also returns strings corresponding to keyword, symbol and tag objects.

void Gal_ObjectStringToBuffer(Gal_Object to, Gal_StringBuffer *buf)
An alternative for working with an existing string buffer.


Program File Parsing Functions

Part of program files which is new in 1.3 is the notion of a "tag", which is a distinguished symbol such as RULE: or destroy!. Tags can be used for errors, directives in Hub programs, or other uses.

char *Gal_SplitOperationName(const char *op_name, char **server_name)

char *Gal_SplitLocation(const char *location_string, int *port)

Gal_DispatchFnSignature *Gal_FindNamedSignature(Gal_DispatchFnSignature *sigs, const char *name)

void Gal_SetTagObjectHash(Gal_HashTable ht)
Internal function to establish the hash table for tag objects.

Gal_HashTable Gal_GetTagObjectHash(void )
Internal function to retrieve the tag object hash table.

Gal_Object Gal_GetTagObject(const char *str)
Internal function to retrieve a tag object for str. Depends on Gal_SetTagObject having been called on the string str, so it is not yet really used.

void Gal_SetTagObject(const char *key, Gal_Object value)
Internal function to store the tag object for a given string. Not yet used.

Gal_HashTable Gal_InitializeTagTable(Gal_TagMap *map, int size)
Initializes the hash table mapping from tag names to tag integers.

void Gal_AddToTagTable(Gal_TagMap *map, Gal_HashTable ht)
Adds a set of pairs to the hash table.

Gal_TagArray Gal_InitializeTagArray(Gal_TagMap *map)
Initializes the mapping from tag integers to tag names.

void Gal_AddToTagArray(Gal_TagMap *map, Gal_TagArray tag_array)
Adds a set of pairs to the tag array mapping.

char *Gal_GetTagArrayTag(int tag, Gal_TagArray tag_array)
Retrievs the tag name corresponding to a given tag integer.

void Gal_FreeTagArray(Gal_TagArray tag_array)

void Gal_AddErrorTags(Gal_TagMap *map)

char *Gal_ErrorTagString(int tag)

void Gal_FreeErrorTags()

void Gal_AddProgramTags(Gal_TagMap *map)

char *Gal_ProgramTagString(int tag)

int Gal_GetProgramTag(const char *tag_name)

Gal_HashTable Gal_GetProgramTagHash(void )

void Gal_FreeProgramTags()

Gal_FileStruct *Gal_PushProgramFile(const char *filename, FILE *fp, Gal_FileStruct *current_files)

Gal_FileStruct *Gal_PopProgramFile(Gal_FileStruct *current_files)

char *Gal_ProgramStringValue(Gal_Object obj)

int Gal_ProgramStringp(Gal_Object o)

Gal_Object Gal_GetProgramEntity(Gal_ProgramEntity *e, Gal_Frame *namespace_array, int *newly_created)

void Gal_SetProgramEntityLocation(Gal_ProgramEntity *e, Gal_Object o, Gal_Frame *namespace_array, int newly_created)

void Gal_DeleteProgramEntityLocation(Gal_ProgramEntity *e, Gal_Frame *namespace_array)

void Gal_InitializeProgramParser(Gal_ProgramParser *pp, Gal_InputStream gs, Gal_FileStruct *fs, int default_tag, int control_flags)

Gal_Boolean Gal_TestConditionInNamespaces(Gal_TestClause *tests, Gal_Frame *frame_array, int default_namespace)

Gal_Object _Gal_ReadObjectWithTags(Gal_InputStream gs, Gal_SpecialTokenizer special_tokenizer)

int Gal_IsFullPath(const char *path)

Gal_ConditionStruct *Gal_NewCondition(ProgramObject *values, Gal_ProgramParser *pp, int *error_ptr)

ProgramObject *Gal_ReadProgramLine(Gal_ProgramParser *pp, int *count_ptr)

void Gal_PrintProgramWarning(Gal_FileStruct *fs, int error)

void Gal_PrintProgramError(Gal_FileStruct *fs, int error)

void Gal_PrintProgramObject(ProgramObject *obj)

Gal_FileStruct *Gal_OpenControlFile(const char *filename, char *directory)

void Gal_CloseControlFile(Gal_FileStruct *fs)

void Gal_PrintTests(FILE *fp, Gal_TestClause *tests, int pedantic)

void Gal_PrintCondition(FILE *fp, Gal_ConditionStruct *condition, char *tag, int pedantic)

Gal_Boolean Gal_TestCondition(Gal_Frame frame, Gal_TestClause *tests)

The types GAL_PTR, GAL_KEYWORD, GAL_TAG and GAL_TOKEN are used in the program file parser.

Gal_Object Gal_PointerObject(void *val);
Converts the value, val, into a GAL_PTR object. This object is used internally in hash tables to deal with objects in program file parsing.

Memory management

void *Gal_PointerValue(Gal_Object to)
Extracts a void * from the object to.  If the object is not of type GAL_PTR, a warning is printed and NULL is returned.

int Gal_Pointerp(Gal_Object to)
Returns 1 if the object, obj, is a void *, of type GAL_PTR.

Gal_Object Gal_KeywordObject(const char *value)
char *Gal_KeywordValue(Gal_Object to)
int Gal_Keywordp(Gal_Object to)
Returns 1 if the object, obj, is a symbol, of type GAL_KEYWORD.

Gal_Object Gal_TagObject(const char *value)
int Gal_Tagp(Gal_Object to)
Returns 1 if the object, obj, is a symbol, of type GAL_TAG.

To access the value of this object use, Gal_KeywordValue.

Gal_Object Gal_TokenObject(const char *val)
Gal_Object Gal_CreateTokenObject(char *cp, int manage_memory)
int Gal_Tokenp(Gal_Object to)
Returns 1 if the object, obj, is a symbol, of type GAL_TOKEN.

to access the value of this object, use Gal_StringValue.

Gal_Object Gal_SymbolObject(const char *value)
int Gal_Symbolp(Gal_Object to);
Returns 1 if the object, obj, is a symbol, of type GAL_SYMBOL.

To access the value of this object use, Gal_KeywordValue.

Gal_TestClause *Gal_NewTest(ProgramObject *values, int *error_ptr, int in_group, Gal_ProgramParser *pp)

Gal_ProgramEntity *Gal_CreateProgramEntity(ProgramObject *p, Gal_ProgramParser *pp, int allow_complex, int allow_literal, int allow_key)

int Gal_ProgramEntitiesEqual(Gal_ProgramEntity *e1, Gal_ProgramEntity *e2)

Gal_NamespaceEntry *Gal_FindNamespaceEntry(const char *name, Gal_NamespaceEntry *ne)

Gal_ProgramEntity *Gal_CreateNamespaceProgramEntity(const char *key, Gal_ProgramParser *pp)

char *Gal_FormatEntity(Gal_ProgramEntity *e, int pedantic, Gal_StringBuffer **bufptr)

void Gal_PrintEntity(Gal_ProgramEntity *e, int pedantic)

void Gal_FreeConditionStruct(Gal_ConditionStruct *cond)

void Gal_FreeTests(Gal_TestClause *c)

void Gal_FreeProgramEntity(Gal_ProgramEntity *e)

void Gal_FreeProgramLine(ProgramObject *p)

void Gal_ClearProgramParser(Gal_ProgramParser *pp)

char *Gal_SplitServiceTypeName(const char *type_name, int *provider_int, char **provider_name)

int Gal_GetProgramObjectTag(ProgramObject *p, int i)

void Gal_FreeProgramObject(ProgramObject *p, int starting_from)

void Gal_InstantiateProgramObjectFromList(Gal_Object list_obj, ProgramObject *p, int do_tags)

Gal_ProgramEntity *Gal_CopyProgramEntity(Gal_ProgramEntity *old_entity)

Gal_NamespaceEntry *Gal_FindProgramNamespace(Gal_Object o, Gal_ProgramParser *pp)


Stream Functions

Gal_InputStream Gal_MakeStringInputStream(const char *s)
Creates a stream from a string.
Memory management

The string is not copied.

int Gal_InputStreamNextChar(Gal_InputStream gs)
Returns the next char from an input stream.

void Gal_InputStreamRewind(Gal_InputStream gs, int i)
Rewinds the input stream by count.

char *Gal_StringInputStreamString(Gal_InputStream gs)
Returns a pointer into the string used to create the string stream.

Gal_InputStream Gal_MakeFileInputStream(FILE *fp)
Creates a stream from a file pointer.

char *Gal_FileNextLine(Gal_InputStream gs, char *line, int max)
Returns the next line from a file stream, or NULL if the stream is not a file stream.

char *Gal_FileCurrentLine(Gal_InputStream gs, char *line, int max)
Returns the current line from a file stream, or NULL if the stream is not a file stream.

Gal_OutputStream Gal_MakeStringOutputStream(char *buf, int bufsize)
Creates an output stream with a string as its target. It uses Gal_MakeStringBuffer to construct its internal store.

void Gal_FreeStringOutputStream(Gal_OutputStream gs)
Frees the output stream if the stream is a string stream. Calls Gal_FreeStringBuffer.

char *Gal_StringOutputStreamString(Gal_OutputStream gs)
Returns a pointer to the current contents of the string buffer, or NULL if the stream is not a string stream.

int Gal_StringStreamWriteString(Gal_OutputStream gs, int increment, const char *s, ... )
Formats s with its arguments to the output stream. It attempts to ensure that there is at least increment bytes open in the internal buffer. If increment is -1, the length of s is used. If the stream is not a string stream, or the string buffer does not have the requested room available and can't be expanded, 0 is returned; otherwise, 1 is returned.


Buffer Functions

Gal_StringBuffer *Gal_MakeStringBuffer(char *buf, int bufsize)
Returns a string buffer suitable for writing to. If buf is NULL, a dynamically extendable string buffer is allocated from an internal store of such buffers. If buf is not NULL, buf is used as a buffer of immutable size bufsize.

void Gal_FreeStringBuffer(Gal_StringBuffer *buf)
Frees the string buffer. If the buffer is immutable, the structure is freed; if it is dynamic, the buffer is zeroed and returned to the internal store of string buffers.

char *Gal_StringBufferString(Gal_StringBuffer *buf)
Returns the string associated with the string buffer. The internal buffer is not copied.

int Gal_StringBufferWrite(Gal_StringBuffer *b, int increment, const char *s, ... )
Formats s with its arguments to the string buffer. It attempts to ensure that there is at least increment bytes open in the internal buffer. If increment is -1, the length of s is used. If the string buffer does not have the requested room available and can't be expanded, 0 is returned; otherwise, 1 is returned.

int Gal_StringBufferWriteString(Gal_StringBuffer *b, const char *s)
"Safe" version of Gal_StringBufferWrite, where characters which appear to be format directives but aren't (say, stray % characters) aren't interpreted incorrectly.

Gal_StringBuffer *Gal_MakeByteBuffer(char *buf, int bufpos, int bufsize, int manage_memory, int dynamic, int increment, int padding)

void Gal_FreeByteBuffer(Gal_StringBuffer *buf)

char *Gal_ByteBufferBytes(Gal_StringBuffer *buf)

int Gal_ByteBufferSize(Gal_StringBuffer *buf)

int Gal_ByteBufferAppend(Gal_StringBuffer *b, const char *s, int size)

int Gal_ByteBufferDynamic(Gal_StringBuffer *b)

Gal_StringBuffer *Gal_MakeDataBuffer(char *buf, int bufpos, int bufsize, int manage_memory, int dynamic, int increment, int padding, int chunk_size)

char *Gal_DataBufferData(Gal_StringBuffer *buf)

int Gal_DataBufferSize(Gal_StringBuffer *buf)

int Gal_DataBufferByteCount(Gal_StringBuffer *buf)

int Gal_DataBufferAppend(Gal_StringBuffer *b, const char *s, int size)

Gal_PointerBuffer *Gal_MakePointerBuffer(void **buf, int pointer_type, int bufpos, int bufsize, int manage_memory, int dynamic, void (*free_fn)(void *), int increment, int padding)

void Gal_FreePointerBuffer(Gal_PointerBuffer *buf)

void **Gal_PointerBufferPointers(Gal_PointerBuffer *buf)

int Gal_PointerBufferSize(Gal_PointerBuffer *buf)

int Gal_PointerBufferAddMultiple(Gal_PointerBuffer *b, void **s, int size)

int Gal_PointerBufferAdd(Gal_PointerBuffer *b, void *s)

Gal_PointerBuffer *Gal_PointerBufferCopy(Gal_PointerBuffer *b, void *(*copy_fn)(void *), void (*free_fn)(void *))

void *_gal_copy_object(void *obj)

void *Gal_PointerBufferNthElement(Gal_PointerBuffer *b, int i)

void Gal_PointerBufferRemove(Gal_PointerBuffer *b, void *s)

int Gal_PointerBufferDynamic(Gal_PointerBuffer *b

int Gal_PointerBufferSetNthElement(Gal_PointerBuffer *b, int i, void *elt)


Frame Reading Functions

Gal_Frame Gal_ReadNextFrameFromFile(FILE *fp, int bol)
Identical to Gal_ReadFrameFromFile, but bol controls whether the frame must start at the beginning of a line or not (so it's possible to "comment out" a frame by adding a space before the initial left curly bracket).

char *Gal_ReadToken(Gal_InputStream gs, char *tok, int toksize, const char *stop_chars, int do_rewind)
Reads a token from a stream.

char *Gal_NextToken(const char *sent, char *tok, int toksize)
Uses Gal_ReadToken to read a token from a string.
 
 
 


Hash Table Utilities

Gal_HashTable Gal_MakeHash(int size);
Allocates space for and returns a symbol hash table of size, size.  If the operation is not successful, NULL is returned.

Gal_Object Gal_GetHash(const char *str, Gal_HashTable hp);
Looks up the symbol, str, in the hash table, hp, and returns the value.  If the lookup is not successful, NULL is returned.

Gal_Object Gal_SetHash(const char *str, Gal_Object val, Gal_HashTable hp);
Inserts and returns the object, val, identified by str, into the hash table.  If the symbol already exists in the table, the function sets the new value and returns it.  If insertion is unsuccessful, NULL is returned.

void Gal_ClearHash(Gal_HashTable hp);
Clears the hash table, hp.

void Gal_FreeHash(Gal_HashTable hp)
Clears the hash table and frees it.

Gal_HashTable Gal_CopyHash(Gal_HashTable old_ht)
Copies the hash table.

void Gal_MapHash(Gal_HashTable hp, void (*fn)(char *str, Gal_Object val, Gal_HashTable hp))

void Gal_HashListRewind(Gal_HashTable hp)
Initializes a hash table for sequential search.

char *Gal_HashListNext(Gal_HashTable hp, Gal_Object *value)
Returns the current key and sets *value to the current value. Returns NULL at the end.

int Gal_HashHasKey(const char *key, Gal_HashTable ht)
Returns 1 if the hash table has the given key, 0 otherwise.


Dispatch Function Utilities

Gal_DispatchFnSignatureKeyEntry *Gal_CopyDispatchFnKeyArray(Gal_DispatchFnSignatureKeyEntry *array)

Gal_DispatchFnPkg *Gal_AddDispatchFunctionEntry(Gal_DispatchFnPkg *table, const char *name, Gal_FrameDataFnPtr fn_with_data, Gal_DispatchFnSignatureKeyEntry *in_key_array, int allow_other_in_keys, int reply_provided, Gal_DispatchFnSignatureKeyEntry *out_key_array, int allow_other_out_keys)

int Gal_FindDispatchFunctionEntry(Gal_DispatchFnInvocation *i)

void Gal_ValidateDispatchFnInput(const char *op_name, Gal_Frame frame, Gal_DispatchFnSignature *sig, char **exclusions)

void Gal_ValidateDispatchFnOutput(const char *op_name, Gal_Frame frame, Gal_DispatchFnSignature *sig, char **exclusions)

Gal_Object Gal_EncodeDispatchFnPkgSigs(Gal_DispatchFnPkg *pkg)

Gal_Object Gal_EncodeDispatchFnSignatures(Gal_DispatchFnPkg *pkg)

Gal_DispatchFnSignature *Gal_DecodeDispatchFnSignatures(Gal_Object maybe_list)

Gal_DispatchFnSignatureKeyEntry *_Gal_CreateEmptyDispatchFnKeyArray(int i)

void _Gal_PopulateDispatchFnKeyArrayCell(Gal_DispatchFnSignatureKeyEntry *array, int index, const char *key, Gal_ObjectType t, int obligatory)

void Gal_DispatchFnPkgSetClientData(Gal_DispatchFnPkg *pkg, const char *op_name, void *data)

void *Gal_DispatchFnPkgGetClientData(Gal_DispatchFnPkg *pkg, const char *op_name)

void Gal_FreeDispatchFnSignature(Gal_DispatchFnSignature *sigs)

Gal_DispatchFnSignature *Gal_CreateDispatchFnSignature(const char *name, Gal_DispatchFnSignatureKeyEntry *in_key_array, int allow_other_in_keys, int reply_provided, Gal_DispatchFnSignatureKeyEntry *out_key_array, int allow_other_out_keys)

Gal_DispatchFnPkg *_Gal_DispatchFnPkgSetAccess(Gal_DispatchFnPkg *pkg, Gal_DispatchFunctionSelector s, Gal_DispatchFnSignatureLister l, Gal_DispatchFunctionInvoker i, void *invocation_client_data)

Gal_Frame _Gal_InvokeDispatchFn(Gal_DispatchFnInvocation *i)

Gal_DispatchFnSignature *_Gal_ListDispatchFnSignatures(Gal_DispatchFnPkg *pkg)


Random utilities

void Gal_UpdateFrameProperties(Gal_Frame target_frame, Gal_Frame source_properties, char **delete_properties)
License / Documentation home / Help and feedback
Last updated July 5, 2002