/*
 * file: genlib.h
 * contains a small group of helper functions
 */

#ifndef _genlib_h
#define _genlib_h

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>

typedef char* string;

/*
 * the type UNDEFINED is a constant to use with type (void *) when NULL
 * indicates something you don't want.
 */

#define UNDEFINED ((void *) undefined_object)

extern char undefined_object[];


#define opaque struct{int dummy;}

void *GetBlock(size_t nbytes);

void Error(string msg);

/* copies the string into dynamically allocated storage */
string CopyString(string s);

/* returns length of string or -1 on error */
int getline(char s[], int n);

#endif  /* _genlib_h */