libutils.c File Reference

#include <stdio.h>
#include <string.h>
#include <pwd.h>
#include <stdarg.h>
#include <stdlib.h>
#include "libutils.h"
#include "filetermreader.h"

Go to the source code of this file.

Defines

#define EXPORT_BORLAND
#define EXPORT_MSCPP
#define SETUP_FILE_NAME   "setup.pl"
#define SETUP_FILE_BUFSIZ   1024

Functions

char * expand_filename (char *nm, char *startDir)
 Convert a filename to absolute, and canonicalize it.
EXPORT_MSCPP int EXPORT_BORLAND oaa_ResolveVariable (char *inVarName, ICLTerm **resolvedVar)
EXTERN void printDebug (int level, char *str,...)
 Prints out debug messages.
EXTERN void printWarning (int level, char *str,...)
 Prints out warning messages.
void print_dictionary (DICTIONARY *d)
 Prints a dictionary's contents as ICLTerms.
hthash_tablehtconstruct_table (hthash_table *table, size_t size)
 Initialize the hash_table to the size asked for.
void * htinsert (char *key, void *data, hthash_table *table)
 Insert key into hash table.
void * htlookup (char *key, hthash_table *table)
 Look up a key and return the associated data.
void * htdel (char *key, hthash_table *table)
 Delete a key from the hash table and return associated data, or NULL if not present.
void htfree_node (char *key, void *data, void *otherData)
 Function htfree_table() iterates the table, calling this repeatedly to free each individual node.
void htfree_table (hthash_table *table, void(*func)(void *))
 Frees a complete table by iterating over it and freeing each node.
void htenumerate (hthash_table *table, void(*func)(char *, void *, void *), void *otherData)
 Simply invokes the function given as the second parameter for each node in the table, passing it the key and the associated data.
void printer (char *key, void *data, void *otherData)
void htprint (hthash_table *table)
char * get64BitFormatWrapped (char *pre, char *post)
char * get64BitFormat ()

Variables

int oaa_argc
char ** oaa_argv


Detailed Description

Definition in file libutils.c.


Define Documentation

#define EXPORT_BORLAND

Definition at line 39 of file libutils.c.

#define EXPORT_MSCPP

Definition at line 44 of file libutils.c.

#define SETUP_FILE_BUFSIZ   1024

Definition at line 52 of file libutils.c.

#define SETUP_FILE_NAME   "setup.pl"

Definition at line 50 of file libutils.c.


Function Documentation

char * expand_filename ( char *  nm,
char *  startDir 
)

Convert a filename to absolute, and canonicalize it.

Accepts "~", "~username", and all relative paths. Filenames containing . or .. as components are simplified.

Parameters:
filename the filename to expand
startdir the directory to start with if filename is relative. If startdir is NULL or missing, the current working directory is used.
Returns:
The expanded filename in a structure created by malloc.

Definition at line 224 of file libutils.c.

char* get64BitFormat (  ) 

Definition at line 731 of file libutils.c.

char* get64BitFormatWrapped ( char *  pre,
char *  post 
)

Definition at line 691 of file libutils.c.

hthash_table* htconstruct_table ( hthash_table table,
size_t  size 
)

Initialize the hash_table to the size asked for.

Allocates space for the correct number of pointers and sets them to NULL. If it can't allocate sufficient memory, signals error by setting the size of the table to 0.

Definition at line 426 of file libutils.c.

void* htdel ( char *  key,
hthash_table table 
)

Delete a key from the hash table and return associated data, or NULL if not present.

Definition at line 554 of file libutils.c.

void htenumerate ( hthash_table table,
void(*)(char *, void *, void *)  func,
void *  otherData 
)

Simply invokes the function given as the second parameter for each node in the table, passing it the key and the associated data.

Definition at line 657 of file libutils.c.

void htfree_node ( char *  key,
void *  data,
void *  otherData 
)

Function htfree_table() iterates the table, calling this repeatedly to free each individual node.

This, in turn, calls one or two other functions - one to free the storage used for the key, the other passes a pointer to the data back to a function defined by the user, process the data as needed.

Definition at line 620 of file libutils.c.

void htfree_table ( hthash_table table,
void(*)(void *)  func 
)

Frees a complete table by iterating over it and freeing each node.

the second parameter is the address of a function it will call with a pointer to the data associated with each node. This function is responsible for freeing the data, or doing whatever is needed with it.

Definition at line 642 of file libutils.c.

void* htinsert ( char *  key,
void *  data,
hthash_table table 
)

Insert key into hash table.

Returns pointer to old data associated with the key, if any, or NULL if the key wasn't in the table previously.

Definition at line 471 of file libutils.c.

void* htlookup ( char *  key,
hthash_table table 
)

Look up a key and return the associated data.

Returns NULL if the key is not in the table.

Definition at line 533 of file libutils.c.

void htprint ( hthash_table table  ) 

Definition at line 685 of file libutils.c.

EXPORT_MSCPP int EXPORT_BORLAND oaa_ResolveVariable ( char *  inVarName,
ICLTerm **  resolvedVar 
)

Definition at line 64 of file libutils.c.

void print_dictionary ( DICTIONARY d  ) 

Prints a dictionary's contents as ICLTerms.

Definition at line 410 of file libutils.c.

EXTERN void printDebug ( int  level,
char *  str,
  ... 
)

Prints out debug messages.

Definition at line 382 of file libutils.c.

void printer ( char *  key,
void *  data,
void *  otherData 
)

Definition at line 679 of file libutils.c.

EXTERN void printWarning ( int  level,
char *  str,
  ... 
)

Prints out warning messages.

Definition at line 396 of file libutils.c.


Variable Documentation

int oaa_argc

Definition at line 115 of file liboaa.c.

char** oaa_argv

Definition at line 116 of file liboaa.c.


Generated on Wed May 23 17:20:16 2007 using doxygen 1.5.2