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 - 2000, Roxen IS.   //   // Adds support for inline pike in documents.   //   // Example:   // <pike>   // return "Hello world!\n";   // </pike>    - constant cvs_version = "$Id: piketag.pike,v 2.12 2000/08/09 07:35:28 per Exp $"; + constant cvs_version = "$Id: piketag.pike,v 2.13 2000/08/09 11:12:42 per Exp $";   constant thread_safe=1;    -  +  + #if constant(Parser.C) + #define PARSER_C Parser.C + #else + #define PARSER_C Roxen.Parser.C + #endif +  +    inherit "module";   #include <module.h>      constant module_type = MODULE_PARSER;   constant module_name = "Pike tag";   constant module_doc =   #"This module adds a new tag, &lt;pike&gt;&lt;/pike&gt;. It makes it   possible to insert some pike code directly in the document. <br>   <img src=\"internal-roxen-err_2\" align=\"left\" alt=\"Warning\"> <br>NOTE: Enabling this   module is the same thing as letting your users run programs with the
Roxen.git/server/modules/scripting/piketag.pike:142:      string read_roxen_file( string what, object id )   {    // let there be magic    return id->conf->open_file(Roxen.fix_relative(what,id),"rR",id,1)    ->read()[0];   }         #define PS(X) (compile_string( "mixed foo(){ return "+(X)+";}")()->foo()) - #define SPLIT(X) Parser.C.hide_whitespaces(Parser.C.tokenize(Parser.C.split(X))) + #define SPLIT(X) PARSER_C.hide_whitespaces(PARSER_C.tokenize(PARSER_C.split(X)))   #define OCIP( ) \    if( cip ) \    { \    cip->text=sprintf("write(rxml(%O));",cip->text); \    cip = 0; \    }      #define OCIPUP( ) \    if( cipup ) \    { \
Roxen.git/server/modules/scripting/piketag.pike:168:    { \    X->text += flat[i]->text[3..]+"\n"; \    flat[i]->text=flat[i]->trailing_whitespaces=""; \    } \    else \    { \    X = flat[i]; \    flat[i]->text = flat[i]->text[3..]+"\n"; \    }    - #define R(X) Parser.C.simple_reconstitute(X) + #define R(X) PARSER_C.simple_reconstitute(X)      program my_compile_string(string s, object id, int dom, string fn)   {    if( program_cache[ s ] )    return program_cache[ s ];       object key = Roxen.add_scope_constants();    [array ip, array data] = parse_magic(s,id,dom);       if( !fn )fn = "pike-tag("+id->not_query+")";
Roxen.git/server/modules/scripting/piketag.pike:196:    }    else    pre = helper_prototypes();       foreach( ip, program ipc )    {    add_constant( "____ih_"+cnt, ipc );    pre += "inherit ____ih_"+cnt++ + ";\n";    }    + // werror("parsed to\n%s\n", pre+R(data));    program p = compile_string(pre+R(data), fn);    program_cache[ s ] = p;       cnt=0;    foreach( ip, program ipc ) add_constant( "____ih_"+cnt++, 0 );    destruct( key );    return p;   }      program handle_inherit( string what, RequestID id )
Roxen.git/server/modules/scripting/piketag.pike:236:    int start = ++i;    while( flat[++i] != ";" ) ;    inherits += ({ handle_inherit( PS(R(flat[start..i])), id ) });    flat = flat[..start-1] + flat[i+1..];    i = start;    }    break;       case 'p':    OCIP(); OCIPUP(); -  if( flat[i] == "parse" && flat[i+1] == "(") +  if( flat[i] == "parse" )    add_md = 0;    break;       case '.':    OCIP(); OCIPUP(); -  if( flat[i] == "." && flat[++i] != "." ) // Parser.C in 7.0 does not -  flat[i-1]->text = "->"; // recognize .. as a single token. +  if( flat[i] == "." ) +  flat[i]->text = "->";    break;       case '/':    if( flat[i]->text[..2] == "//#" )    {    OCIPUP();    CIP( cip );    }    else if( flat[i]->text[..2] == "//@" )    {