Announcement

Collapse
No announcement yet.

CGI in PB/DOS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CGI in PB/DOS

    I was converting the PB/CC PBCGI.INC file over so it can be used in PB/DOS. While doing this, I came across a few things that I can't figure out what they do. PARSE$, and PARSECOUNT. It looks like PARSECOUNT has the same function as TALLY.

    would the following code give me something equivalent to PARSE$ ?

    'inSt$ is the main string.
    ' spChar$ is the splitter character

    FUNCTION PARSE$(inSt$,spChar$)
    pstr$=extract$(inSt$,spChar$)
    inSt$=right$(inSt$,(LEN(inSt$)-LEN(pstr$+"&")))
    PARSE$=pstr$
    END FUNCTION

    This is mr blindly walking into this. I don't know what the actual PARSE$ function does, so if I'm wrong, please correct me.

    Thanks,

    Amos

    ------------------

    Amos

  • #2
    PARSE$ and PARSECOUNT are native PB/CC and PB/DLL functions, they are not (yet?) implemented in PB/DOS.

    PARSE$(instring$, delimiter$, n&) returns the n'th section of instring$ delimited by delimiter$.

    For example, if instring$ = "a&b&c&d&e&f&g" and delimter$ = "&", then

    PARSE$(instring$, delimiter$, 4) would return "d"
    PARSE$(instring$, delimiter$, 7) would return "g"
    etc.

    PARSECOUNT returns the maximum number of parameters that can be extracted with PARSE$().
    In the above example, PARSECOUNT(instring$, "&") would return 7.

    Note that PARSECOUNT("",delimiter$) will return 1. This means that there is only one section and it happens to be an empty string. If this seems strange, think of how PARSECOUNT would work if we tested PARSECOUNT("abc","&").

    The ARGC and ARGV functions in DOSUNIT.BAS work in a "similar" fashion to these function.


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Perhaps I will just check those out and modify them appropriately. While working on modifying the file last night, I decided to make two "spawnings" of it. First, a version of PBCGI.INC that can be used by PB/DOS users. That will be done really quick. Second, a full fledged CGI library. (OpenSource of course) I will also be trying to make a function called txt2img, which (as I understand) will solve the UniSys GIF patent problem by using a PNG unit. The library will take a little longer to complete.

      ------------------

      Amos

      Comment

      Working...
      X