Roxen.git / server / modules / scripting / piketag.pike

version» Context lines:

Roxen.git/server/modules/scripting/piketag.pike:1:   // This is a roxen module. Copyright © 1996 - 2001, Roxen IS.   //   // Adds support for inline pike in documents.   //   // Example:   // <pike>   // return "Hello world!\n";   // </pike>    - constant cvs_version = "$Id: piketag.pike,v 2.38 2004/05/27 18:28:44 _cvs_stephen Exp $"; + constant cvs_version = "$Id: piketag.pike,v 2.39 2004/06/04 08:29:25 _cvs_stephen Exp $";   constant thread_safe=1;      inherit "module";   #include <module.h>      constant module_type = MODULE_TAG;   constant module_name = "Scripting: Pike tag";   constant module_doc = #"   <p>This module adds a processing instruction tag, <code>&lt;?pike ...   ?&gt;</code>, for evaluating Pike code directly in the document.</p>
Roxen.git/server/modules/scripting/piketag.pike:223:    array a = indices(program_cache);    int i;       // Zap somewhere between 25 & 50% of the cache.    for(i = query("program_cache_limit")/2; i > 0; i--)    m_delete(program_cache, a[random(sizeof(a))]);    }    })    {    master()->set_inhibit_compile_errors(0); -  if (e->get() && strlen(e->get())) +  if (e->get() && sizeof(e->get()))    RXML.parse_error ("Error while compiling Pike code:\n%s", e->get());    else throw (err);    }    master()->set_inhibit_compile_errors(0);       if(err = catch{    (o=p())->parse(id);    }) {    catch {    err = ({err[0], err[1][sizeof (backtrace())..]});
Roxen.git/server/modules/scripting/piketag.pike:333:   }      array parse_magic( string data, RequestID id, int add_md, string filename,    ErrorContainer e )   {    array flat=SPLIT(data,filename);    object cip, cipup;    array inherits = ({});    for( int i = 0; i<sizeof( flat ); i++ )    { -  switch( strlen(flat[i]->text) && flat[i]->text[0] ) +  switch( sizeof(flat[i]->text) && flat[i]->text[0] )    {    case '.':    OCIP(); OCIPUP();    if( flat[i] == "." )    {    flat[i]->text = "[";    flat[i+1]->text = "\"" + flat[++i]->text + "\"]";    }    break;       case '/': -  if( strlen(flat[i]->text)>2 && +  if( sizeof(flat[i]->text)>2 &&    (flat[i]->text[1]=='/' || flat[i]->text[1]=='*') )    {    if( flat[i]->text[2] == 'X' )    {    if (flat[i]->text[1] == '*')    flat[i]->text = flat[i]->text[..sizeof (flat[i]->text) - 3];    OCIPUP();    CIP( cip );    }    else if( flat[i]->text[2] == 'O' )
Roxen.git/server/modules/scripting/piketag.pike:464:    else    return functions(id->not_query, id->misc->line) +    "string|int parse(RequestID id, mapping defines, object file, mapping args) { return ";   }      // Will be added at the end...   string post(string what)   {    if(has_value(what, "parse("))    return ""; -  if (!strlen(what) || what[-1] != ';') +  if (!sizeof(what) || what[-1] != ';')    return ";}";    else    return "}";   }      // Compile and run the contents of the tag (in s) as a pike   // program.   string container_pike(string tag, mapping m, string s, RequestID request_id,    object file, mapping defs)   {
Roxen.git/server/modules/scripting/piketag.pike:511:    // Zap somewhere between 25 & 50% of the cache.    for(i = query("program_cache_limit")/2; i > 0; i--)    m_delete(program_cache, a[random(sizeof(a))]);    }    if (query ("program_cache_limit") > 0)    program_cache[s] = p;    }    })    {    master()->set_inhibit_compile_errors(0); -  if (e->get() && strlen(e->get())) +  if (e->get() && sizeof(e->get()))    {    RXML.parse_error ("Error while compiling Pike code:\n%s",    Roxen.html_encode_string( e->get()) );    }    else    throw (err);    }    master()->set_inhibit_compile_errors(0);       if(err = catch{