[OpenBIOS] fword and feval

Programmingkid programmingkidx at gmail.com
Mon Aug 23 01:22:49 CEST 2010

On Aug 20, 2010, at 6:00 AM, openbios-request at openbios.org wrote:

> On Thu, Aug 19, 2010 at 4:52 PM, Programmingkid
> <programmingkidx at gmail.com> wrote:
>> I am trying to use the fword and feval functions in the file "kernel/forth.c". I know the header file for these functions are located in "include/libopenbios/bindings.h". I used this code to include the bindings.h file:
>> #include "libopenbios/bindings.h"
>> For some reason, I still see these errors:
>> Building OpenBIOS for x86
>> Building...error:
>> ?HOSTCC host/kernel/bootstrap.o
>> ?HOSTCC host/kernel/dict.o
>> ?HOSTCC host/kernel/primitives.o
>> ?HOSTCC host/kernel/stack.o
>> ?HOSTCC forthstrap
>> host/kernel/primitives.o: In function `setupLocalDictionary':
>> /home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1035: undefined reference to `_fword'
>> /home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1037: undefined reference to `_fword'
>> /home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1044: undefined reference to `feval'
>> /home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1045: undefined reference to `feval'
>> host/kernel/primitives.o: In function `loadLocalVariable':
>> /home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1072: undefined reference to `feval'
>> collect2: ld returned 1 exit status
>> make[1]: *** [forthstrap] Error 1
>> make[1]: Leaving directory `/home/user/Development/openbios-devel/obj-x86'
>> make: *** [build] Error 1
>> This is a simple function someone could use as an example to be used in the file forth.c
>> static void test(void)
>> {
>> ? ? ? ?feval("banner");
>> }
>> Anyone know what I am doing wrong or how to solve this problem?
> You are using the bootstrap compiler, which has only very limited set
> of basic Forth words defined and actually even some of those will not
> work during bootstrap time.
> Full set of words like 'feval' is available when the library compiled
> by bootstrap compiler is loaded into non-bootstrap kernel. Your
> example should compile in arch/x86/openbios.c or arch/unix/unix.c.

Thanks for the help, but I still run into problems. I want to be able to use the functions from the forth interpreter. I tried adding my functions to primitives.c and bootstrap.c, but openbios won't compile. 

Here are the functions I am trying to make available to the interpreter:

static void setupLocalDictionary(void)
	int localWordListID, standardDictionaryID;
	char commandString[100];
	localWordListID = POP();
	POP(); // removes the number of dictionaries
	standardDictionaryID = POP();
	sprintf(commandString, "%d %d %d", standardDictionaryID, localWordListID, NUMBER_OF_DICTIONARIES);

// (addr len -- )	
//	 variable   
static void loadLocalVariable(void)
	int lengthOfVariableString, addressOfVariableString;
	char variableString[WIDTH], defineVariableCommandString[WIDTH];
	int stackSize;
	stackSize = POP();
		printk("\nSorry but loadLocalVarable needs stack in this format: (addr len -- )\n");
	lengthOfVariableString = POP();
	addressOfVariableString = POP();
	strncpy(variableString, (char *) addressOfVariableString, lengthOfVariableString);
	variableString[lengthOfVariableString] = '\0';
	sprintf(defineVariableCommandString, "variable %s", variableString);
	//printk("variable = %s\t", variableString);

Any ideas as to where I can place them?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20100822/3f5cff8b/attachment-0001.html>

More information about the OpenBIOS mailing list