libugrad.h
Index
/*
libugrad: library of useful functions for UGRAD's.
Copyright 1996, Ali Rahimi (ali@XCF.Berkeley.EDU).
Special thanks to Gene Kan (genehkan@xcf) and Tracy Scott (tracs@xcf)
for the good ideas.
This library has been tested under Ultrix, HP-UX and Linux.
Test with:
gmake CC=gcc CFLAGS=-DTEST_UGRAD libugrad
./libugrad
*/
#define DONT_ASSERT(x) if(!(x)) ; /* Do nothing if assertion failed. Who
would want a coredump in their directory
anyway?? */
/* A UGRAD object. */
typedef struct ugrad {
struct ugrad *next;
} ugrad;
typedef enum {true, false} ubool; /* A ugrad boolean type. */
typedef long gnumber; /* The Goedel number of a function. */
/* Init the UGRAD package. */
void ugrad_init();
/* Is the user a ugrad? */
ubool is_ugrad();
/* */
ubool is_computer_on();
ubool is_computer_off();
/* Computer Science theory type functions. */
ubool is_algorithm_terminating(void (*algorithm)());
gnumber get_goedel_number(void (*program)());
/* Flushes ugrad buffers. Forcefully. */
void ugrad_flush();
/* Ugrad object ops. */
ugrad *new_ugrad();
ugrad *ugrad_cdr(ugrad *l);
void ugrad_set_cdr(ugrad *l, ugrad *n);
/* Helps you avoid a common problem. See main() for example. */
void ugrad_swap_stdio();
/* Makes sure sysadmin does not kill your process just because it take up CPU.
*/
void ugrad_dont_die();
/* Useful when you are stuck and don't know what to do. */
void ugrad_call_random_function();
/* Calls function f(). On return of f(), checks to see if it blew the stack
top away due to infinite recursion (this function is highly architecture
dependent). */
ubool ugrad_makes_stack_overflow(void (*f)(), size_t maxssz);