home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / srev13h.zip / tstdigit.cmd < prev    next >
OS/2 REXX Batch file  |  1999-03-17  |  5KB  |  133 lines

  1. /* 15 Oct 1998 -- Demo of the SREF_DIGITS and SREF_XBITMAP
  2.    procedures.
  3.  
  4.   This will print a message, and also display the current request number
  5.   (the reqnum argument below).
  6.  
  7. You can invoke this with:
  8.         /TSTDIGIT?1+message
  9. or with
  10.      /TSTDIGIT?option_list
  11.  
  12. Where option list has the form:
  13.    var1=val1&var2=val2&..
  14. and Varn can be (with valn = ... ):
  15.    MESS = a message (with + used for spaces)
  16.    FONT = font to display message with 
  17.    FONT2 = font to display request number with
  18.    XBITMAP = create an xbitmap file (FONT and FONT2 are ignored)
  19.              of the current request number. valn is 0 (plain) or
  20.              1 (reversed)
  21.   For example:
  22.          mess=hello+world&font=Goldblok&font2=goldodo
  23.  
  24.  
  25. Note: This procecurde  assumes that "digit/character" sets are installed 
  26.      in the DIGITS subdirectory of the GoServe data directory (this is where
  27.      SRE-http installs them).
  28.  
  29. */
  30.  
  31. /* First, get arguments sent to this addon by SRE-http */
  32. /* See STATUS.CMD (or srehttp.htm) for a description what these do */
  33.  
  34. parse arg  ddir, tempfile, reqstrg,list,verb ,uri,user, ,
  35.           basedir ,workdir,privset,enmadd,transaction,verbose, ,
  36.          servername,host_nickname,homedir,aparam,semqueue,prog_file,reqnum
  37.  
  38. if ddir='' then do
  39.    say 'Sorry, this SRE-http addon is not meant to be run in stand alone mode'
  40.    say ' (see COUNTER.DOC for examples of how to use this addon).'
  41.    exit
  42. end /* do */
  43.  
  44. /* LIST contains the arguments sent to the server by the browser */
  45. list=packur(translate(list,' ','+'))
  46.  
  47. /* Extract  options */
  48.  
  49. amess='Test' ; doxbm=''  /* initialize */
  50.  
  51. /* defaults */
  52. dname='GOLDBLOK' ; dname2='GOLDODO'
  53. do forever
  54.    if list='' then leave
  55.    parse var list a1 '&' list
  56.    parse var a1 a1a '=' a1b ; a1a=upper(a1a)
  57.    if a1b='' then do
  58.        a1b=a1a
  59.       a1a="MESS" 
  60.    end 
  61.   select
  62.          when  abbrev(translate(a1a),"MESS")=1 then amess=a1b    /* the message */
  63.          when  a1a="XBITMAP" then   doxbm=strip(a1b)
  64.          when  a1a='FONT2' then dname2=strip(upper(a1b))
  65.          when  a1a="FONT"  then dname=strip(upper(a1b))
  66.          otherwise nop
  67.    end
  68. end /* do */
  69.  
  70. /* if XBITMAP in list, then return an xbitmap of amess */
  71. if doxbm<>'' then do
  72.   foo=sref_xbitmap(amess,5,doxbm)  /* sref_gos is called from sref_xbitmap */
  73.   return ' '
  74. end /* do */
  75.  
  76. /* else, create and html document that contains the <IMG elements */
  77.  
  78. /* if no fonts specified ... */
  79. if dname='' then dname='GOLDBLOK'
  80. if dname2='' then dname2=dname
  81.  
  82.  
  83.  
  84. /* Write <head> of response */
  85. call lineout tempfile,'<html><head><title>Demo of SREF_DIGITS and SREF_XBITMAP</title>'
  86. call lineout tempfile, '</head>'
  87.  
  88. sq="'"
  89.  
  90. call lineout tempfile,' <h2>Demo of the SREF_DIGITS and SREF_XBITMAP procedures</h2>'
  91. call lineout tempfile,'<h3>Examples:</h3><ol> '
  92. call lineout tempfile,' <li><code> txt=sref_digits("'amess'","'dname'",,,,'sq'VALIGN="MIDDLE"'sq') </code> :'
  93.  
  94.  
  95. /* create the "list" message, using the dname font (aligned in the middle) */
  96.  
  97. fooo=sref_digits(amess,dname,,,,' VALIGN="MIDDLE"')
  98.  
  99. call lineout tempfile,fooo
  100. call lineout tempfile,' <p>'
  101. call lineout tempfile,'<li><code> txt=sref_digits('reqnum',"'dname2'",4,1,0,'sq'VALIGN="MIDDLE"'sq') </code>:'
  102.  
  103. /* write digit message (the current request #), with min of 4 digits and use a frame. */
  104.  
  105. txt=sref_digits(reqnum,dname2,4,1,0,' VALIGN="MIDDLE" ')
  106.  
  107. /* this section will invoke XBITMAP calls back to this addon ! */
  108.  
  109. call lineout tempfile,txt'<p><li>'
  110. call lineout tempfile,' <code>  xbm=sref_xbitmap('reqnum',5,0 and 1): </code>'
  111. call lineout tempfile,'<img src="/tstdigit?mess='reqnum'&XBITMAP=0&nm=a.xbm">'
  112. call lineout tempfile,'  and  '
  113. call lineout tempfile,'<img src="/tstdigit?mess='reqnum'&XBITMAP=1&nm=a.xbm"> </ol>'
  114.  
  115. /* and some notes ... */
  116.  
  117. call lineout tempfile,' '
  118. call lineout tempfile,'<p><b>Notes</b><menu> '
  119. call lineout tempfile,'<li> The calling syntax for SREF_DIGITS is: <p><code>'
  120. call lineout tempfile,' txt=sref_digits(list,dname,ndig,useframe,nobr,opts,imgsel,imgdir)><p></code>'
  121. call lineout tempfile,' '
  122. call lineout tempfile,' <li>and for SREF_XBITMAP: <p><code>'
  123. call lineout tempfile,'     img=SREF_XBITMAP(anumber,ndigits,doreverse) </code><p> </menu>'
  124.  
  125. call lineout tempfile,' </body></html> '
  126. call lineout tempfile
  127.  
  128. /* tell sre-http to send this document to the client */
  129. return 'file type text/html name ' tempfile
  130.  
  131.  
  132.                                                                         
  133.