Ok, this may seem totaly crazy :)

I was having a look at the issue of the php compiler (really 
distributing a single executable) of php code. - we are starting to 
develop php-gtk apps and it seemed usefull.... - it appears that the 
previous effort at doing this has dissappeared of the face of the web...

rather than get into the hard chore of actually building it against the 
bytecode, the idea was just to merge php code (either zipped) or just 
appended to the php binary, and making it execute code from the end of 
it'self..

eg.
--------------------
| php binary     |
--------------------
| php raw code |
--------------------

taking a bit of code from all over the place, I created a 'embedded 
extension' the core bit being below..


Now, it currently would assume creating a big 'XXXXXXXX' area (where the 
echo'test' stuff is) which would replaced by php code by  a post 
processing on the binary..

It would be nice if the application could some how work out the memory 
address at the end of the php binary - where some kind of lookup table 
of all attached php files would be located...
other than that, an easy way to do an array rather than this hacked 
embedded_1 variable stuff... would be usefull...

--ideas would be appreciated..

anyway have a happy new year everybody..

regards
alan



PHP_FUNCTION(embedded_run)
{
    char *arg = NULL;
    int arg_len=0 , len;
    char *string = NULL;
        char *tmp = "embedded_run";
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, 
&arg_len) == FAILURE) {
        return;
    }
        if (arg) {
           string  =   embedded_get_data(arg);
           tmp=arg;
        } else {  
           string  =   embedded_get_data(tmp);
        }  
       
        if (string)
          embedded_eval_string(string, return_value, tmp CLS_CC ELS_CC);
    
}


/* auto generated bit */

char *embedded_1 = "embedded_run";
char *embedded_2 = "START_EMBEDDED_2_XXXXXXXXXXXXXXXXXXXXXXXXXX.......";
char *embedded_r1 = "echo \"hello there\n\";";
char *embedded_r2 = "START_EMBEDDED_R2_XXXXXXXXXXXXXXXXXXXXXXXXXX.......";";


char *embedded_get_data(char *str) {

   if (!strcmp(str,embedded_1))
      return   embedded_r1;
   if (!strcmp(str,embedded_2))
      return  embedded_r2;     
   return NULL;
}


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to