QUESTION

Mr Background daemon at bloom-beacon.MIT.EDU
Fri Apr 8 18:19:01 AEST 1988


From: penguin at athena.mit.edu (Ricky A Cardenas)
Path: athena.mit.edu!penguin

Hi all you C wizards.  I don't usually read this newsgroup, but I happen
to have a problem I hope you guys will be able to help me out with.

I am part of a team implementing this expert system.  It is written in C
and consists of thousands of functions linked together in the
executable.  The problem is, to control the flow from one place to the
next, we must use a central dispatcher function.  This function takes a
string and calls a C function with the same name (it does this by
looking up the string in an array of function names/function pointers,
and then using the corresponding function pointer to execute the
function).

This, however, requires a massive dispatch.c program, simply because it
must have a LONG declaration list of functions it COULD call, e.g.:

extern FI

	dummy,

	stage0, stage10,

	stage1000, stage1010, stage1020, stage1100, stage1150, stage1200, 
	stage1300, stage1400,
	stage2000, stage2003, stage2005, stage2010, stage2015, stage2020, 
	stage2025, stage2030, stage2035,
	stage2050, stage2070, stage2080, stage2090, stage2095,
	stage2100, stage2110, stage2120, stage2195,
	...

So basically, as you probably guessed, I'd like to know if there's any
(clean) way to get a program to call functions that haven't been
declared within its scope.  (I hope I'm using the right terminology
here.)  

Any help would be appreciated... (as I said, please email)
If you're interested in the possible responses/solutions send me mail...

--
Ricky Cardenas, MIT '88
ARPA:    penguin at athena.mit.edu
BITNET:  penguin%athena.mit.edu at MITVMA.BITNET
UUCP:    ...!mit-eddie!athena.mit.edu!penguin



More information about the Comp.lang.c mailing list