You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by "David N. Welton" <da...@dedasys.com> on 2002/12/14 20:56:12 UTC

specifying source

Thanks to David Brancato's hard work, Rivet should now be able to
specify the source (query string or POST) to fetch variables from.

There are a few things left to do:

* Add some test cases!

* Update the documentation.

I'll see about doing this.

There are a few other things I thought about:

This is repeated a lot.  Maybe we should put it in a macro?

    /* determine which part of table to traverse */
    if (source == VAR_SRC_QUERYSTRING) {
	i = 0; j = req->apachereq->nargs;
    } else if (source == VAR_SRC_POST) {
	i = req->apachereq->nargs; j = parmsarray->nelts;
    } else {
	i = 0; j = parmsarray->nelts;
    }

Maybe these

        for (; i < j; ++i)

are better as while loops at this point?  Doesn't really matter, I
guess, but at least you don't have to think about ++i vs i++ :-)

We also need to make sure the apreq stuff gets added upstream, but
that's another day, another list.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: specifying source

Posted by "David N. Welton" <da...@dedasys.com>.
Ok, I have added a few tests (more would be better), and updated the
docs in CVS.  I also added the macro we discussed:

#define PARMSARRAY_COORDINATES i = 0; j = parmsarray->nelts; \
if (source == VAR_SRC_QUERYSTRING) { j = req->apachereq->nargs; } \
else if (source == VAR_SRC_POST) { i = req->apachereq->nargs; }

and did while loops instead of for loops.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org


Re: specifying source

Posted by David Brancato <Da...@Brancato.com>.
----- Original Message -----
From: David N. Welton <da...@dedasys.com>
>
> This is repeated a lot.  Maybe we should put it in a macro?
>
>     /* determine which part of table to traverse */
>     if (source == VAR_SRC_QUERYSTRING) {
> i = 0; j = req->apachereq->nargs;
>     } else if (source == VAR_SRC_POST) {
> i = req->apachereq->nargs; j = parmsarray->nelts;
>     } else {
> i = 0; j = parmsarray->nelts;
>     }
>
> Maybe these
>
>         for (; i < j; ++i)
>
> are better as while loops at this point?  Doesn't really matter, I
> guess, but at least you don't have to think about ++i vs i++ :-)

Both of these suggstions make the code that much cleaner and should
therefore be implemented.

>
> We also need to make sure the apreq stuff gets added upstream, but
> that's another day, another list.
>

Once it's in Rivet for a bit and we tell Joe Shaefer about it, no doubt
he'll want to include it in apreq.

-- David Brancato




---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org