Graeme Burnett's C Programming Examples

Common Header Files
File NameDescription
c.class.h Abstract type definitions
c.defs.h Global constant definitions
c.incl.h Global include files
c.proto.h Function prototypes
error.class.h ESQL/C error handling routines global definitions
hash.h hash algorithm parameters

Generic Utility Modules
File NameDescription
IUEnv.c set/unset environment variables
IULog.c direct messages to a log file
IUMD5file.c Perform an MD5 hash of a file or input stream
ReadSQL.c Parse an SQL statement from a file


Generic Linked List Implementation

This code was adapted from Data Structures - an Advanced Approach Using C.

File NameLinked Lists - can handle generic structures
ListAllocNode.c Allocate a new node;
ListAppend.c Append node
ListDelete.c Find node and delete it.
ListDeleteNode.c Delete node and free memory.
ListDestroy.c C Linked List Utility routine.
ListEmpty.c empty list checking
ListFreeNode.c Free up memory for a node.
ListInitialise.c Create a new linked list.
ListInsert.c Insert a node.
list.c Test harness for the List


Generic Stack Implementation

This code was adapted from Data Structures - an Advanced Approach Using C.

File NameStack - can handle generic structures
StackEmpty.c Is a stack object empty
StackInit.c Initialise a stack object
StackPop.c Pop an object off the top of a Stack
StackPush.c Push an object onto a Stack
StackTop.c Get the object at the top of the Stack


Unix Multithreading Utility Modules

File NameDescription
rwlockInit.c Initialise a read/write lock object
rwlockLockRead.c Lock resource before reading
rwlockLockWrite.c Lock resource before writing
rwlockUnlockWrite.c Release a write lock resource on a mutex object
rwlockUnlockRead.c Release a a read lock resource on a mutex object
rwlockWaitingReaderCleanup.c Clean up mutex in the event of a waiting reader condition being cancelled
rwlockWaitingWriterCleanup.c Clean up mutex in the event of a waiting writer condition being cancelled


General Utility Modules

File NameDescription
CstripComment.c Routine to strip comments from C Source - useful when you need to count the actual number of lines of code. Taken from C Programming in the Berkeley Unix Environment.
StripNewLine.c Strips new lines from the end of a string
hash.c Return a hash value for a string
match.c Pattern match using a regular expression
makefile Unix makefile for the above library


Last Updated