For anyone interested:
Enjoy, Wilfred
For anyone interested:
Enjoy, Wilfred
Wilfred Nilsen wrote in message news:...
Hi Wilfred, That's a very interesting approach. Are you actually embedding the C compiler on the device, or it is all precompiled? What is the footprint? What are the intended target platforms? Is this a new company? Is this product for sale yet? How much?
Z-World also has a new scripting language for rapid web interface development (for sale now for $149). It's called RabbitWeb. It runs on Z-World/Rabbit Semiconductor platforms. It operates on program variables and structures to eliminate complex CGI programming. Here's the hangman program source code and HTML ported to RabbitWeb:
// #define TCPCONFIG 1 #define USE_RABBITWEB 1
#use "dcrtcp.lib" #use "http.lib" #use "rand.lib"
#ximport "/hang.zhtml" index_html #ximport "/hang0.gif" hang0gif #ximport "/hang1.gif" hang1gif #ximport "/hang2.gif" hang2gif #ximport "/hang3.gif" hang3gif #ximport "/hang4.gif" hang4gif #ximport "/hang5.gif" hang5gif #ximport "/hang6.gif" hang6gif #ximport "/hang.c" csource
SSPEC_RESOURCETABLE_START SSPEC_RESOURCE_XMEMFILE("/", index_html), SSPEC_RESOURCE_XMEMFILE("/index.zhtml", index_html), SSPEC_RESOURCE_XMEMFILE("/hang.c", csource), SSPEC_RESOURCE_XMEMFILE("/hang0.gif", hang0gif), SSPEC_RESOURCE_XMEMFILE("/hang1.gif", hang1gif), SSPEC_RESOURCE_XMEMFILE("/hang2.gif", hang2gif), SSPEC_RESOURCE_XMEMFILE("/hang3.gif", hang3gif), SSPEC_RESOURCE_XMEMFILE("/hang4.gif", hang4gif), SSPEC_RESOURCE_XMEMFILE("/hang5.gif", hang5gif), SSPEC_RESOURCE_XMEMFILE("/hang6.gif", hang6gif) SSPEC_RESOURCETABLE_END
SSPEC_MIMETABLE_START SSPEC_MIME_FUNC(".zhtml", "text/html", zhtml_handler), SSPEC_MIME(".html", "text/html"), SSPEC_MIME(".gif", "image/gif"), SSPEC_MIME(".c", "text") SSPEC_MIMETABLE_END
struct Word { char* clue; char* answer; };
struct Word * wrd; char guess[20], newGuess[40], prompt[80], hint[20]; int noOfUsedGues, mode, currentgif, chr;
#web chr; #web prompt #web newGuess #web noOfUsedGues #web hint #web currentgif #web mode
const struct Word wordDB[] = { {"action", "drool"}, {"action", "forecast"}, {"action", "forget"}, {"action", "jump"}, {"action", "panic"}, {"action", "quash"}, {"action", "snore"}, {"action", "talk"}, {"action", "walk"}, {"activity", "boating"}, {"activity", "repair"}, {"activity", "ruffle"}, {"activity", "sleep"},{"activity", "surfing"}, {"animal", "aardvark"}, {"animal", "adder"}, {"animal", "beaver"}, {"animal", "bison"}, {"animal", "cardinal"}, {"animal", "cariboo"}, {"animal", "cat"}, {"animal", "donkey"}, {"animal", "elephant"}, {"animal", "koala"}, {"animal", "otter"}, {"animal", "rabbit"}, {"animal", "raccoon"}, {"animal", "rodent"}, {"animal", "shark"}, {"animal", "sheep"}, {"animal", "squirrel"}, {"animal", "tiger"}, {"antique", "china"}, {"band", "nirvana"}, {"band", "rush"}, {"band", "ventures"}, {"creature", "elf"}, {"creature", "hobbit"}, {"creature", "mummy"}, {"creature", "troll"}, {"creature", "unicorn"}, {"creature", "vampire"}, {"creature", "warewolf"}, {"drink", "cola"}, {"drink", "juice"}, {"event", "drama"}, {"event", "mirage"}, {"event", "siesta"}, {"event", "stampede"}, {"food", "apple"}, {"food", "butter"}, {"food", "caesar salad"}, {"food", "cashew"}, {"food", "celery"}, {"food", "cheese"}, {"food", "chestnut"}, {"food", "cream"}, {"food", "donut"}, {"food", "grape"}, {"food", "honey"}, {"food", "icecream"}, {"food", "limburger"}, {"food", "milk"}, {"food", "noodle"}, {"food", "orange"}, {"food", "pasta"}, {"food", "pizza"}, {"food", "potato"}, {"food", "spice"}, {"food", "sugar"}, {"food", "tomatoes"}, {"food", "turnip"}, {"game", "cards"}, {"game", "golf"}, {"game", "pacman"}, {"icon", "barbie"}, {"icon", "frosty"}, {"icon", "grinch"}, {"icon", "gumby"}, {"icon", "lucy"}, {"icon", "popeye"}, {"icon", "snoopy"}, {"icon", "waldo"}, {"invention", "velcro"}, {"person", "enemy"}, {"person", "giant"}, {"person", "hero"}, {"person", "husband"}, {"person", "kennedy"}, {"person", "nixon"}, {"person", "youngster"}, {"place", "amsterdam"}, {"place", "athens"}, {"place", "beach"}, {"place", "bob"}, {"place", "buffalo"}, {"place", "calgary"}, {"place", "canada"}, {"place", "detroit"}, {"place", "downtown"}, {"place", "england"}, {"place", "gorge"}, {"place", "graceland"}, {"place", "hotel"}, {"place", "hotel"}, {"place", "india"}, {"place", "japan"}, {"place", "land"}, {"place", "library"}, {"place", "london"}, {"place", "norway"}, {"place", "oslo"}, {"place", "ottawa"}, {"place", "quadrant"}, {"place", "restaurant"}, {"place", "rink"}, {"place", "toronto"}, {"place", "victoria"}, {"place", "village"}, {"place", "zoo"}, {"plant", "daffodil"}, {"plant", "eggplant"}, {"plant", "ivy"}, {"plant", "spinach"}, {"plant", "tulip"}, {"profession","astronaut"}, {"profession", "bard"},{"profession", "hermit"}, {"profession", "lawyer"}, {"profession", "sorcerer"}, {"state", "alaska"}, {"subject", "geography"}, {"taste","bitter"}, {"taste", "salty"}, {"taste","sour"},{"taste","sweet"}, {"tool", "anvil"}, {"tool", "buffer"}, {"tool", "hook"}, {"tool", "knife"}, {"tool", "lasso"}, {"tool", "pickaxe"}, {"tool", "pliers"}, {"tool", "plow"}, {"tool", "screwdriver"}, {"tool", "wrench"}, {"toy", "kite"},{"toy", "slinky"}, {"trouble", "tribble"} };
main(){ int chCorrect, i;
mode = -1; sock_init(); http_init(); http_set_path("/", "index.zhtml"); tcp_reserveport(80);
while(1){ if(mode== -1){ InitGame(); mode = 0; }
http_handler();
if(noOfUsedGues == 6){ mode = 1; noOfUsedGues = 0; strcpy(hint,wrd->answer); }
if(chr) { chCorrect = 0; for(i = 0 ; i < strlen(wrd->answer) ; i++) { if(wrd->answer[i] == (char)chr) { guess[i] = newGuess[2*i] = (char)chr; chCorrect = 1; } } if( !strcmpi(guess, wrd->answer) ) noOfUsedGues = 7; /* 7 signals "You Won!!!" */ else if(chCorrect == 0) { noOfUsedGues++; currentgif++; } sprintf(prompt,"You have %d guesses left!", 6-noOfUsedGues); chr = 0; } } }
InitGame(){ int wordDbIndex, i;
rand16_init(MS_TIMER); wordDbIndex = rand16() % (sizeof(wordDB) / sizeof(wordDB[0])); wrd = &wordDB[wordDbIndex]; for(i=0; ianswer); i++){ newGuess[2*i] = '_'; newGuess[2*i+1] = ' '; } newGuess[2*i] = 0; guess[strlen(wrd->answer)] = 0; strcpy(hint,wrd->clue); currentgif = 0; chr = 0; noOfUsedGues = 0; strcpy(prompt,"Guess your first letter of the above unknown word."); } //
************************************ ********* HTML SOURCE ************ ***********************************hangman
H a n g m a n
The CSP and the C code generated by the CSP compiler is precompiled and embedded into the executable. Read the white papers.
The link
More info:
or:
Wilfred, enjoy!
Cool stuff (except for the $10,000 price tag - ouch!). I'd have to limit the RabbitWeb version to one player at a time because users change program variables. Does a single Coldfire board handle mutliple instances of the game for your demo or is there a bank of them?.
Well, yes, that should be obvious. How do you manage to mix up multiple instances of the game and the hardware? Maybe you need to read up on web-development. You can start of by reading this:
The Old Saying Goes, RTFM
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.