RetroForum Welcome, Guest. Please login or register.
September 09, 2010, 11:00:33 PM
Home Help Search Calendar Login Register

RetroForth Discussion  |  Older Boards  |  Development  |  Topic: Introducing libretro « previous next »
Pages: 1 Go Down Print
Author Topic: Introducing libretro  (Read 1838 times)
Charles Childers
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 745


View Profile WWW
Introducing libretro
« on: September 11, 2005, 07:25:53 PM »

Today I finally got around to restarting work on a version of RetroForth for use with C. This is the outgrowth of the retroforth.dll that existed in RetroForth/Windows 7.x.

The new libretro is superior to the old dll since it provides more access to the forth language. When I revive the dll in the near future, this will be helpful since it allows richer integration between the languages. Here's an example:

Code:
#include "retro.h"

int main() {
  init_forth();
  spush(100);
  spush(200);
  evaluate("2dup . '+ emit space . '= emit space + . cr");
  bye();
}

My next goal for this is to write a function that allows me to map C functions into RetroForth, allowing the forth side to call C seamlessly. This will be helpful for many of my projects, and hopefully be useful to others as well. The code for this is in the repo and nightly build tree now, so check it out.
Logged
Charles Childers
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 745


View Profile WWW
Re: Introducing libretro
« Reply #1 on: September 12, 2005, 02:09:50 AM »

Update: define() has been added! The syntax is:

Code:
define("forthname", &function, #args);
Logged
Charles Childers
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 745


View Profile WWW
Re: Introducing libretro
« Reply #2 on: September 14, 2005, 12:31:44 AM »

I added getxt() and rfcall() today:

Code:
int words = getxt("words");
rfcall(words);
Logged
Pages: 1 Go Up Print 
RetroForth Discussion  |  Older Boards  |  Development  |  Topic: Introducing libretro « previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC2 | SMF © 2001-2005, Lewis Media Valid XHTML 1.0! Valid CSS!