See CurlLanguage

From
 The Curl Programming Environment
 Dr. Dobb's Journal September 2001
 http://www.ddj.com/documents/s=1485/ddj0109f/0109f.htm

----

 || File: start2.curl
 || Contents:
 ||     This applet allows to enter a value to a Text''''''Field
 ||     The prompt and result will be shown with funny, jumping letters
 || Author: Friedger Mueffke
 || Version: 1.2 

 {curl 1.5 applet}

 {import * from MUEFFKE.COMPONENTS.LETTERBOX,
    location="letterbox.curl"}

 || Create a document without margins and scrollbars
 || that it can neatly integrated in a HTML document
 {document-style Plain''''''Document}


 || Define function that fetches a string from a web site
 {define-proc {get-web-string}:String
    {let nr: int = {value
                         {let rand:Linear''''''Random={Linear''''''Random}}
                         {rand.next-in-range 0, 6}
                     },
        result: String ="Welcome"
    }

    {try
        let intext: Text''''''Input''''''Stream =
            {read-open{url "txt.php3?nr=" & nr}}
        {set result={{intext.read-one-line}.to-String}}
         {intext.close}
     catch err: Missing''''''File''''''Exception do
        {error "Cannot find that file. Sorry!"}
    }
    {return result}

 }

 || Declare a global variable without instanziation
 {let c:#Letter''''''Box}

 || The output of this environement is its last line
 {value
    {set
        || Define Canvas containing the letters
         c={Letter''''''Box
                        "Enter your Name",
                        width=10cm,
                        height=5cm,
                        background="black"
                     }
    }
    {let
        || Define Text''''''Field to enter a value
        tf:Text''''''Field={Text''''''Field
                         {on Value''''''Finished do
                             {if (tf.value != null ) then
                                 {do
                                     {c.set-string ({get-web-string} & " " & tf.value)}
                                     {c.move-string-to-center}
                                 }
                             }
                         }
                     }
    }

    {c.add tf,
        x=1cm,
        y=1cm
    }

    c
 }

 || This environment doesn't produce any output!
 || Resize the Letter Box to a size of 500 x 400 pixel
 {do
    {set c.height=c.points-per-pixel*400}
    {set c.width=c.points-per-pixel*500}

 }
 || File: start2.curl
 || Contents:
 ||     This applet allows to enter a value to a Text''''''Field
 ||     The prompt and result will be shown with funny, jumping letters
 || Author: Friedger Mueffke
 || Version: 1.2 

 {curl 1.5 applet}

 {import * from MUEFFKE.COMPONENTS.LETTERBOX,
    location="letterbox.curl"}

 || Create a document without margins and scrollbars
 || that it can neatly integrated in a HTML document
 {document-style Plain''''''Document}


 || Define function that fetches a string from a web site
 {define-proc {get-web-string}:String
    {let nr: int = {value
                         {let rand:Linear''''''Random={Linear''''''Random}}
                         {rand.next-in-range 0, 6}
                     },
        result: String ="Welcome"
    }

    {try
        let intext: Text''''''Input''''''Stream =
            {read-open{url "txt.php3?nr=" & nr}}
        {set result={{intext.read-one-line}.to-String}}
         {intext.close}
     catch err: Missing''''''File''''''Exception do
        {error "Cannot find that file. Sorry!"}
    }
    {return result}

 }

 || Declare a global variable without instanziation
 {let c:#Letter''''''Box}

 || The output of this environement is its last line
 {value
    {set
        || Define Canvas containing the letters
         c={Letter''''''Box
                        "Enter your Name",
                        width=10cm,
                        height=5cm,
                        background="black"
                     }
    }
    {let
        || Define Text''''''Field to enter a value
        tf:Text''''''Field={Text''''''Field
                         {on Value''''''Finished do
                             {if (tf.value != null ) then
                                 {do
                                     {c.set-string ({get-web-string} & " " & tf.value)}
                                     {c.move-string-to-center}
                                 }
                             }
                         }
                     }
    }

    {c.add tf,
        x=1cm,
        y=1cm
    }

    c
 }

 || This environment doesn't produce any output!
 || Resize the Letter Box to a size of 500 x 400 pixel
 {do
    {set c.height=c.points-per-pixel*400}
    {set c.width=c.points-per-pixel*500}

 }