[Coco] The Coco's first webserver, written in Basic09

Wayne Campbell asa.rand at gmail.com
Thu Dec 31 00:54:07 EST 2009


Starting with the last paragraph, it isn't a byte variable that can't be 
passed as a byte. It is a byte value that can't be. Byte variables are 
handled correctly, as I have used them many times.

The converter would be easy to write, yes. But Basic09 is not a script 
language like javascript. That code would have to be loaded into Basic09 to 
be run, and that is a waste of memory, and is slower than running packed 
procedures from the command line with RunB. It would be the same as running 
Visual Studio every time you created a c++ source file.

Wayne

----- Original Message ----- 
From: "Christian Lesage" <hyperfrog at gmail.com>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Wednesday, December 30, 2009 9:11 PM
Subject: Re: [Coco] The Coco's first webserver, written in Basic09


> Wayne Campbell wrote:
>> I was beginning with simply parsing an expression. I felt that if I could 
>> accomplish this, the rest would be easier to figure out. The problem with 
>> RUN is that it specifically launches a subroutine module (Basic09 I-Code 
>> or 6809 object code), passing to it whatever parameters are required. 
>> This means that the eval() function , in the statement RUN 
>> eval(<string>), is a subroutine that does whatever parsing is necessary 
>> to evaluate the "expression". The parameter, in this case, would be the 
>> string to parse.
> Forget about eval(). Let's say you authored the following web page:
>
> <HTML>
> <BODY BGCOLOR=#33FF33>
> <P><CENTER><H1>coco!</h1><P>
> <H4>This page is served by a Color Computer 3<BR>
> running <A HREF=http://www.nitros9.org/>NitrOS-9</A>
> and <A 
> HREF=http://www.frontiernet.net/%7Emmarlette/Cloud-9/Software/DriveWire3.html>DriveWire</A>
>  <P>For more information on this project, <A 
> HREF=http://aaronwolfe.com/coco>click here</A><P>
> This server has processed <% PRINT #port_path,hits \ hits = hits + 1 %> 
> requests since it last crashed.</H4>
> </BODY>
> </HTML>
>
>
> And you have a program that converts that HTML code into this:
>
> PROCEDURE SomeWebPage
> PARAM port_path:BYTE
> PARAM hits:INTEGER
>
>  PRINT #port_path,"<HTML>"
>  PRINT #port_path,"<BODY BGCOLOR=#33FF33>"
>  PRINT #port_path,"<P><CENTER><H1>coco!</h1><P>"
>  PRINT #port_path,"<H4>This page is served by a Color Computer 3<BR>"
>  PRINT #port_path,"running <A HREF=http://www.nitros9.org/>NitrOS-9</A>"
>  PRINT #port_path,"and <A 
> HREF=http://www.frontiernet.net/%7Emmarlette/Cloud-9/Software/DriveWire3.html>DriveWire</A>"
>  PRINT #port_path," <P>For more information on this project, <A 
> HREF=http://aaronwolfe.com/coco>click here</A><P>"
>  PRINT #port_path,"This server has processed "
>  PRINT #port_path,hits \ hits = hits + 1
>  PRINT #port_path," requests since it last crashed.</H4>"
>  PRINT #port_path,"</BODY>"
>  PRINT #port_path,"</HTML>"
>  END
>
>
> Such a converter would be easy to write. It merely wraps the HTML code 
> inside quotation marks and adds PRINT statements. It leaves untouched 
> anything between <% and %>.
>
> Now, you compile the resulting PROCEDURE into bytecode, and it becomes the 
> active page that the server RUNs whenever it needs to display it.
>
> Yes, I know, for some reason, a BYTE cannot be passed as a parameter. This 
> is just an example to illustrate what I'm thinking about. I guess one 
> would define in the main program a structure to be passed as a parameter 
> to every page.
>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco 




More information about the Coco mailing list