Passing URL in VARIABLE function call

Discussion to talk about software related topics only.
Post Reply
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Passing URL in VARIABLE function call

Post by greengene »

i was using FUNCTIONCALL with different functions for each case
but i would like to use a single function and pass an index but i also need to
know/see the URL of the page, e.g.,
<!--VARIABLE MYFUNC(fd,val,url) -->

is there a global defined that has the URL so i could put it in place of url above?
User avatar
pbreed
Posts: 1091
Joined: Thu Apr 24, 2008 3:58 pm

Re: Passing URL in VARIABLE function call

Post by pbreed »

That is the normal functioncall...

From the tictactoe example...

The HTML code:
<!--FUNCTIONCALL DoTickTacToe -->


The function...
void DoTickTacToe( int sock, PCSTR url );
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: Passing URL in VARIABLE function call

Post by greengene »

yes, but that is what i'm trying to get away from.
i would like to reduce my number of distinct functions.

right now i have:
<!--FUNCTIONCALL DoTickTacToe1 -->
<!--FUNCTIONCALL DoTickTacToe2 -->
<!--FUNCTIONCALL DoTickTacToe3 -->

which has the associated:
void DoTickTacToe1( int sock, PCSTR url );
void DoTickTacToe2( int sock, PCSTR url );
void DoTickTacToe3( int sock, PCSTR url );

what i would like to do is:
<!--VARIABLE DoTickTacToe(fd,1,url) -->
<!--VARIABLE DoTickTacToe(fd,2,url) -->
<!--VARIABLE DoTickTacToe(fd,3,url) -->
with its
const char * DoTickTacToe( int sock, int index, PCSTR url);

but i need something to replace "url" in the VARIABLE statement
in my html than can be resolved by the comphtml process.
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: Passing URL in VARIABLE function call

Post by greengene »

why do i need the url?
i pass info with it, e.g.,
index.htm?arg=sumpin
and DoTickTacToe() needs to process sumpin
but differently for 1,2, and 3.
greengene
Posts: 164
Joined: Wed May 14, 2008 11:20 am
Location: Lakeside, CA

Re: Passing URL in VARIABLE function call

Post by greengene »

i don't need a system global for the url, i alreay have MyDoGet() function,
so i'll just define a application global to point at the system url and just use that.

<!--VARIABLE DoTickTacToe(fd,1) -->
<!--VARIABLE DoTickTacToe(fd,2) -->
<!--VARIABLE DoTickTacToe(fd,3) -->
with its
const char * DoTickTacToe( int sock, int index);

that closes that one - thanks.
User avatar
pbreed
Posts: 1091
Joined: Thu Apr 24, 2008 3:58 pm

Re: Passing URL in VARIABLE function call

Post by pbreed »

Another way to do this is to define small individual functions...

DoPage1, DoPage2, etc....
and have them call another function

IE
BigBrotherDoPage(int sock, int page, cosnt char * url)..


The Body of DoPage 1 could be:

void DoPage1(int sock, const char * url)
{
BigBrotherDoPage(socke,1,url);
}


etc....

If you look at the docs on variable there are some hacks that abuse the system to do what you want.
Specifically look at section 10.2.2 of the programmers guide...

Then realize that any variables actually get compiled into code in htmldata.cpp

Look at how this code is generated and you can play games with all of it....

Paul
Post Reply