Announcement

Collapse
No announcement yet.

DecodeCgi Function

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

  • Steve Bouffe
    replied
    Thanks Michael

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

    Leave a comment:


  • Michael Mattias
    replied
    Code:
    FUNCTION DecodeCGI( BYVAL t AS STRING ) AS STRING
      DIM b_in AS BYTE PTR, b_out AS BYTE PTR, h AS STRING PTR * 2
      LOCAL A AS STRING, c AS INTEGER
     
      IF LEN( t ) THEN
        b_in = STRPTR( t )
        a      = t 
        b_out  = STRPTR(a)
        c     = 0
        DO
          IF @b_in = 43 THEN          
            @b_out = 32
          ELSEIF @b_in = 37 THEN       
            h = b_in + 1
            @b_out = VAL( "&H" & @h )
            b_in = b_in + 2
          ELSE
            @b_out = @b_in
          END IF
          INCR b_in
          INCR b_out
          INCR c
        LOOP UNTIL @b_in = 0
        FUNCTION  = LEFT$(a, C)
      END IF
    END FUNCTION
    Self-documenting.

    Leave a comment:


  • Steve Bouffe
    started a topic DecodeCgi Function

    DecodeCgi Function

    Bit of a strange one but I need to use the DecodeCgi in my Dos program and I'm having trouble converting the PBCC version.

    Code:
    FUNCTION DecodeCGI( BYVAL t AS STRING ) AS STRING
      DIM b_in AS BYTE PTR, b_out AS BYTE PTR, h AS STRING PTR * 2, a AS ASCIIZ PTR
      IF LEN( t ) THEN
        b_in = STRPTR( t )
        b_out = b_in
        DO
          IF @b_in = 43 THEN
            @b_out = 32
          ELSEIF @b_in = 37 THEN
            h = b_in + 1
            @b_out = VAL( "&H" & @h )
            b_in = b_in + 2
          ELSE
            @b_out = @b_in
          END IF
          INCR b_in
          INCR b_out
        LOOP UNTIL @b_in = 0
        @b_out = 0
        a = STRPTR( t )
        FUNCTION = @a
      END IF
    END FUNCTION
    ------------------
Working...
X