Utility functions of GRP parser defined in putils.h header file

char *GetErrorString(int errorcode);

This function returns the error string which describes the error specified by the errorcode.

char *NewString(char *str);

This function is used to allocate memory to store str string and it makes a copy of str in the newly allocated memory area.

void DisposeString(char *str);

This function can be used to free up and dispose strings created by NewString function. Parameter str must be a pointer to a string (return value of NewString).

int LinesInString(char *str);

This function counts number of lines in string str.

void MakeTempFileName(char *Where);

This function creates a new file name for a temporary file and places the name in Where string (note that it does not check if there is enough space to store the name in the specified area). The generated name begins with "/usr/tmp/grp2c.".

void RemoveTempFiles(void);

This function is used to remove temporary files made by tha parser.

char *GetDataTypeName(prsTDataType AType);

This function returns the name of AType data. The return value is an address of a constant strring so it must not be disposed.

void DumpHTML(char *FName);

This function prints out FName file on standard output and replaces characters that have special meaning in HTML languge to HTML representation of those characters. For example it replaces < with &lt;. It also places <PRE> tag at the beginning of the list and </PRE> at the end.

void Indent(FILE *To, int Ind);

This function writes Ind number of characters to To file.

bool fprintfile(FILE *To, char *What);

This function inserts file named What into a specified output stream (To). It returns TRUE if the specified file exists otherwise it returns FALSE.

bool fprintsrc(FILE *To, PprsSource What);

This function inserts source code stored in object What into a specified output stream (To). It returns TRUE if the operation succeeded otherwise it returns FALSE.

Back to Grapnel Compiler.