Online embedded web-server demo

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
For anyone interested:


Re: Online embedded web-server demo

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:

// <pre>
#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_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_MIME_FUNC(".zhtml", "text/html", zhtml_handler),
   SSPEC_MIME(".html", "text/html"),
   SSPEC_MIME(".gif", "image/gif"),
   SSPEC_MIME(".c", "text")

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",
   {"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",
   {"creature", "troll"},  {"creature", "unicorn"},  {"creature",
   {"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",
   {"place", "rink"}, {"place", "toronto"}, {"place", "victoria"},
   {"place", "village"}, {"place", "zoo"}, {"plant", "daffodil"},
   {"plant", "eggplant"}, {"plant", "ivy"}, {"plant", "spinach"},
   {"plant", "tulip"},
   , {"profession", "bard"},{"profession",
   {"profession", "lawyer"}, {"profession", "sorcerer"},
   {"state", "alaska"},
   {"subject", "geography"},
   , {"taste", "salty"},
   {"tool", "anvil"}, {"tool", "buffer"}, {"tool", "hook"}, {"tool",
   {"tool", "lasso"}, {"tool", "pickaxe"}, {"tool", "pliers"},
{"tool", "plow"},
   {"tool", "screwdriver"}, {"tool", "wrench"},
   {"toy", "kite"},{"toy", "slinky"},
   {"trouble", "tribble"}

   int chCorrect, i;

   mode = -1;
   http_set_path("/", "index.zhtml");

     if(mode== -1){
         mode = 0;


     if(noOfUsedGues == 6){
         mode = 1;
         noOfUsedGues = 0;

     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) {
        sprintf(prompt,"You have %d guesses left!", 6-noOfUsedGues);
        chr = 0;

    int wordDbIndex, i;

    wordDbIndex = rand16() % (sizeof(wordDB) / sizeof(wordDB[0]));
    wrd = &wordDB[wordDbIndex];
    for(i=0; i<strlen(wrd->answer); i++){
        newGuess[2*i] = '_';
        newGuess[2*i+1] = ' ';
    newGuess[2*i] = 0;
    guess[strlen(wrd->answer)] = 0;
    currentgif = 0;
    chr = 0;
    noOfUsedGues = 0;
    strcpy(prompt,"Guess your first letter of the above unknown
// </pre>

********* HTML SOURCE ************

  <head><title> hangman </title></head>
  <body bgcolor="white" text="#000010" link="blue" vlink="#ff00ff"

    <div align=center>
      <font color="#ff3333" size=+5>H</font>
      <font color="#cc6633" size=+5>a</font>
      <font color="#999900" size=+5>n</font>
      <font color="#33cc33" size=+5>g</font>
      <font color="#339999" size=+5>m</font>
      <font color="#3366cc" size=+5>a</font>
      <font color="#0033ff" size=+5>n</font>

 <?z if($mode <= 0) { ?>
    <div align=center>
      <font size=+3 color="#336699">
      <?z if($mode == 0) { ?>
            <?z  echo($newGuess)) ?>
      <?z } ?>
      <?z if($noOfUsedGues == 7) { ?>
          <p>Game Over - You Win!</p>
      <?z } ?>
    <div align=center>
      <img src="./hang<?z echo($currentgif) ?>.gif" height="150"
            <p><?z echo($prompt) ?></p>
          <font color="#0033ff">hint : <B><?z echo($hint)
          <?z for($A97%; $A<123; $A++) { ?>
            <form action="./index.zhtml" method="post" >
            <input type="hidden" NAME="chr" VALUE="<?z echo($A) ?>">
            <input type="submit" value="<?z printf("%c",$A) ?>">
        <?z } ?>
<?z } ?>

<?z if($mode==1) { ?>
    <div align=center>
      <font size=+3 color="#336699">
      <p><?z echo($newGuess) ?></p>
    <div align=center>
      <img src='./hang6.gif' height15%0 width15%0>
            <font size=+3 color="#ff3333">
              Game over.
            <font size=+2 color="#3333cc">
              The correct answer is <B><?z echo($hint) ?></B>.
<?z } ?>

      <form action="./index.zhtml" method="post" >
           <input type="hidden" NAME="mode" VALUE="-1">
            <input type="submit" value="Start New Game">

        <a href = "./hang.c" target="_blank">view C source code</a>
        <a href =
" "
Quoted text here. Click to load it

Re: Online embedded web-server demo
Quoted text here. Click to load it

The CSP and the C code generated by the CSP compiler is precompiled and
embedded into the executable. Read the white papers.

The link is to a Motorola Coldfire 5272
board, which is powered by MQX from ARC.

More info:

Re: Online embedded web-server demo
Quoted text here. Click to load it

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?.

Re: Online embedded web-server demo

Quoted text here. Click to load it

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

Re: Online embedded web-server demo

Quoted text here. Click to load it

Wilfred, enjoy!

Site Timeline