Skip to content

Instantly share code, notes, and snippets.

@tbielawa
Created February 6, 2009 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbielawa/59261 to your computer and use it in GitHub Desktop.
Save tbielawa/59261 to your computer and use it in GitHub Desktop.
// FUNC_LIB.H
// Provides:
// (STRUCT) FUNC_ITEM
// (METHOD) FIND_FUNCTION((STRING) FUNC_NAME)
//
// TDF-OS http://ducksarepeople.com/tdf/
#include <stdio.h>
#include "FUNC_LIB.H"
#include "DATE.H"
struct func_item {
char name[NAME_LENGTH];
int (*function)();
struct func_item *next; //set last item in list to NULL
} ;
void Tehfoobar() {
printf("foobar <3s you");
}
// Lets define some items we could call
struct func_item *head; //head will point at first real item
// Real items (just look at their names!)
struct func_item item_one;
item_one.function = Tehfoobar; //this could call the 'foobar' function
strncpy(&item_one.name, "foobar\0", NAME_LENGTH);
int main( int argc, char *argv[]) {
printf("\nhi2u\n");
return 0;
}
// Built in Function library
// Who wants a struct for Christmas?
#define NAME_LENGTH 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment