Post Reply 
Adding functions to Proxomitron
Apr. 23, 2009, 04:54 PM
Post: #1
Adding functions to Proxomitron
I'm developing a concept to adding functions to proxomitron. It works with a list called functions wich can receive arguments to run these functions.

CALLING THESE FUNCTIONS FROM THE FILTERS

The typical use will be
Code:
$TST((FunctionName;parameter1;parameter2;...parameterN;)=$LST(functions))

Another use is using global vars. You can use other names, not necesarily input or output.
Code:
$SET(input=...) $TST((FunctionName)=$LST(functions)) $GET(output)


FORMAT OF THE LIST

Function [FunctionName]:
Input: [Parameter1];[Parameter2];[Parameter3];.....[ParameterN];
Output: [truth or false and when]. [Values of other variables]
Explain: Explain here what the function does.
Author and date in database format Year, month, day YYYY MM DD
Function name (2 or 3 tabs here) Code of the function


Attached File(s)
.txt  functions.txt (Size: 2.01 KB / Downloads: 958)
Add Thank You Quote this message in a reply
Apr. 23, 2009, 05:08 PM
Post: #2
RE: Adding functions to Proxomitron
looks "complex"...
how would we see it in "action" ?
Add Thank You Quote this message in a reply
Apr. 23, 2009, 07:18 PM
Post: #3
RE: Adding functions to Proxomitron
Using the trivial function "Example2" included in the list and testing the URL code in the test window:
Code:
[HTTP headers]
In = FALSE
Out = FALSE
Key = "' : testing functions list 2"
URL = "$TST((EXAMPLE2;This Text will be logged;)=$LST(functions))"

A more complex function is ADLIST, also included. Inside a filter wich stores the url in \1 for example to call the function to know if it is an AD-URL or not, we just would use
Code:
$TST((ADLIST;\1;)=$LST(functions))
Add Thank You Quote this message in a reply
Apr. 23, 2009, 09:13 PM
Post: #4
RE: Adding functions to Proxomitron
Interesting. Would be nice if such swapped out, often used, subroutines would run in their own scope, so that we aren't stuck with 10 positional variables per filter anymore.
Add Thank You Quote this message in a reply
Apr. 23, 2009, 10:36 PM (This post was last modified: Apr. 23, 2009 10:43 PM by lnminente.)
Post: #5
RE: Adding functions to Proxomitron
Also to avoid problems with already existing positional variables we could use vars specifically named inside these functions. Time or future problems will tell us.

As always by my side, everybody feel free to post modifications to this concept Wink

Maybe we could change the ";" as a separator for parameters because maybe could be problematic if passing it cookies. Anyway it is a per function setting, and can be modified only in functions having problems. But in search of standarization we could define another char since now...
Add Thank You Quote this message in a reply
Apr. 23, 2009, 11:05 PM (This post was last modified: Apr. 23, 2009 11:12 PM by sidki3003.)
Post: #6
RE: Adding functions to Proxomitron
Well, the great thing with positional variables is that they just disappear, freeing up all used memory, once the filter is done.

I've never actually proved it, but since the invention of global Proxomitron variables i couldn't get rid of the feeling that uncontrolled use, without caring about resetting them, is messing with Proxomitron's memory handling. JavaScript geeks would call it polluting the global namespace.

(Which is why i compiled Global_Vars.txt, to keep track of used variables, and if/where they are reset. It may well be that i'm the only person frequenting this document. Smile! )

Also, working with globals is rather time intense, compared to positionals, around factor 5.
Add Thank You Quote this message in a reply
Apr. 24, 2009, 12:12 AM (This post was last modified: Apr. 24, 2009 12:14 AM by lnminente.)
Post: #7
RE: Adding functions to Proxomitron
Polluting the global namespace? hehehe it sounds like many satellites over the proxoworld Big Teeth

The help of proxomitron Wrote:Global variables have a name that can consist of alphanumeric characters (a-z and 0-9) but they must begin with a letter
Using Excel datasheet we could write easily a filter wich sets one hundred variables named from tmp00 until tmp99 to act only in a url specific and watch the memory use of proxomitron. I we add a big string to every variable we could see if proxomitron empties these vars i hope 8)


Sidki3003 Wrote:Also, working with globals is rather time intense, compared to positionals, around factor 5.
I didn't remember that, we need to have it in mind to not have noticeable slowdowns using frequent functions. By know for simply functions we could reserve the \0 for storing the input and the output. Always explaning the vars used in the "Input:" and "Output:" lines in functions list to make it easier to follow.

By other side, thinking in writing a function to add a value to the variable keyword only if that value wasn't add before. Also if it should answer truth always or only that value wasn't there...
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: