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.9 2000/08/09 03:05:15 per Exp $"; + constant cvs_version = "$Id: piketag.pike,v 2.10 2000/08/09 05:15:43 per Exp $";   constant thread_safe=1;      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>
Roxen.git/server/modules/scripting/piketag.pike:90:    data += args[0];    }       string flush()    {    string r = data;    data ="";    return r;    }    +  string rxml( string what, object id ) +  { +  return parse_rxml( what, id ); +  } +  +     constant seteuid=0;    constant setegid=0;    constant setuid=0;    constant setgid=0;    constant call_out=0;    constant all_constants=0;    constant Privs=0;   }      string functions(string page, int line)
Roxen.git/server/modules/scripting/piketag.pike:149:    mixed err;       request_id->misc->cacheable=0;       array flat=Parser.C.hide_whitespaces(Parser.C.tokenize(Parser.C.split(s)));       object e = ErrorContainer();    master()->set_inhibit_compile_errors(e);    if(err=catch    { +  object cip, cipup; +  + #define OCIP( ) \ +  if( cip ) \ +  { \ +  cip->text=sprintf("write(rxml(%O,id));",cip->text); \ +  cip = 0; \ +  } +  + #define OCIPUP( ) \ +  if( cipup ) \ +  { \ +  cipup->text=sprintf("write(%O);",cipup->text); \ +  cipup = 0; \ +  } +  + #define CIP(X) if( X ) \ +  { \ +  flat[i]->text=flat[i]->trailing_whitespaces=""; \ +  X->text += flat[i]->text[3..]+"\n"; \ +  } \ +  else \ +  { \ +  X = flat[i]; \ +  flat[i]->text = flat[i]->text[3..]+"\n"; \ +  } +  +     for( int i = 0; i<sizeof( flat ); i++ ) -  if( flat[i] == "." && flat[++i] != "." ) -  flat[i-1]->text = "->"; +  { +  if( flat[i] == "." && flat[++i] != "." ) // Parser.C in 7.0 does not +  flat[i-1]->text = "->"; // recognize .. as a single token. +  else if( flat[i]->text[..2] == "//#" ) +  { +  OCIPUP(); +  CIP( cip ); +  } +  else if( flat[i]->text[..2] == "//@" ) +  { +  OCIP(); +  CIP( cipup ); +  } +  else +  { +  OCIP(); +  OCIPUP(); +  } +  } +  OCIP(); +  OCIPUP();    -  s = pre(flat,request_id)+Parser.C.simple_reconstitute( flat )+post(flat); +  s = pre(flat,request_id)+"\n"+ +  Parser.C.simple_reconstitute( flat )+ +  post(flat);    p = program_cache[s];       if (!p)    {    // Not in the program cache.    object key = Roxen.add_scope_constants();       p = compile_string(s, "Pike-tag("+request_id->not_query+":"+    request_id->misc->line+")");    destruct( key );