<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 20, 2010, at 6:00 AM, <a href="mailto:openbios-request@openbios.org">openbios-request@openbios.org</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">On Thu, Aug 19, 2010 at 4:52 PM, Programmingkid<br><<a href="mailto:programmingkidx@gmail.com">programmingkidx@gmail.com</a>> wrote:<br><blockquote type="cite">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:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">#include "libopenbios/bindings.h"<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">For some reason, I still see these errors:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Building OpenBIOS for x86<br></blockquote><blockquote type="cite">Building...error:<br></blockquote><blockquote type="cite">?HOSTCC host/kernel/bootstrap.o<br></blockquote><blockquote type="cite">?HOSTCC host/kernel/dict.o<br></blockquote><blockquote type="cite">?HOSTCC host/kernel/primitives.o<br></blockquote><blockquote type="cite">?HOSTCC host/kernel/stack.o<br></blockquote><blockquote type="cite">?HOSTCC forthstrap<br></blockquote><blockquote type="cite">host/kernel/primitives.o: In function `setupLocalDictionary':<br></blockquote><blockquote type="cite">/home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1035: undefined reference to `_fword'<br></blockquote><blockquote type="cite">/home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1037: undefined reference to `_fword'<br></blockquote><blockquote type="cite">/home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1044: undefined reference to `feval'<br></blockquote><blockquote type="cite">/home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1045: undefined reference to `feval'<br></blockquote><blockquote type="cite">host/kernel/primitives.o: In function `loadLocalVariable':<br></blockquote><blockquote type="cite">/home/user/Development/openbios-devel/obj-x86/../kernel/forth.c:1072: undefined reference to `feval'<br></blockquote><blockquote type="cite">collect2: ld returned 1 exit status<br></blockquote><blockquote type="cite">make[1]: *** [forthstrap] Error 1<br></blockquote><blockquote type="cite">make[1]: Leaving directory `/home/user/Development/openbios-devel/obj-x86'<br></blockquote><blockquote type="cite">make: *** [build] Error 1<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">This is a simple function someone could use as an example to be used in the file forth.c<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">static void test(void)<br></blockquote><blockquote type="cite">{<br></blockquote><blockquote type="cite">? ? ? ?feval("banner");<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Anyone know what I am doing wrong or how to solve this problem?<br></blockquote><br>You are using the bootstrap compiler, which has only very limited set<br>of basic Forth words defined and actually even some of those will not<br>work during bootstrap time.<br><br>Full set of words like 'feval' is available when the library compiled<br>by bootstrap compiler is loaded into non-bootstrap kernel. Your<br>example should compile in arch/x86/openbios.c or arch/unix/unix.c.</span></blockquote><br></div><div><br></div><div>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. </div><br><div>Here are the functions I am trying to make available to the interpreter:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">static void setupLocalDictionary(void)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">{</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">    </span>int localWordListID, standardDictionaryID;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>#define NUMBER_OF_DICTIONARIES 2</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">  </span>char commandString[100];</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">     </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">       </span>fword("wordlist");</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">      </span>localWordListID = POP();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">  </span>fword("get-order");</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">     </span>POP(); // removes the number of dictionaries</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">      </span>standardDictionaryID = POP();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">     </span>sprintf(commandString, "%d %d %d", standardDictionaryID, localWordListID, NUMBER_OF_DICTIONARIES);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">      </span>feval(commandString);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">     </span>feval("set-order");</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">} </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">// (addr len -- )<span class="Apple-tab-span" style="white-space:pre">       </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">//<span class="Apple-tab-span" style="white-space:pre">        </span> variable   </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">static void loadLocalVariable(void)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">{</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">    </span>int lengthOfVariableString, addressOfVariableString;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">      </span>char variableString[WIDTH], defineVariableCommandString[WIDTH];</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">   </span>int stackSize;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">    </span>#define NUMBER_OF_NEEDED_STACK_ITEMS 2</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">       </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">       </span>depth();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">  </span>stackSize = POP();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>if(stackSize < NUMBER_OF_NEEDED_STACK_ITEMS)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">   </span>{</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">         </span>printk("\nSorry but loadLocalVarable needs stack in this format: (addr len -- )\n");</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">            </span>return;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">   </span>}</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">    </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">       </span>lengthOfVariableString = POP();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">   </span>addressOfVariableString = POP();</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">     </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">       </span>strncpy(variableString, (char *) addressOfVariableString, lengthOfVariableString);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>variableString[lengthOfVariableString] = '\0';</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">       </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">       </span>sprintf(defineVariableCommandString, "variable %s", variableString);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">    </span>feval(defineVariableCommandString);</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">  </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">       </span>//printk("variable = %s\t", variableString);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">}<span class="Apple-tab-span" style="white-space:pre">   </span></div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">A</span>ny ideas as to where I can place them?</div></body></html>