pike.git / bin / extract.pike

version» Context lines:

pike.git/bin/extract.pike:1:   #!/usr/local/bin/pike   // Copyright © 2000, Roxen IS.   // By Martin Nilsson and Andreas Lange   // - // $Id: extract.pike,v 1.10 2001/02/20 06:21:31 nilsson Exp $ + // $Id: extract.pike,v 1.11 2001/09/27 19:53:28 nilsson Exp $   //         // The arguments given to the program   mapping args = ([]);   // All the files to gather strings from   array(string) files = ({});   // All ids used, id:mapping(info)   mapping ids = ([]);   // Reversed id mapping, text:id
pike.git/bin/extract.pike:528:    }    write("\n");   }         array(string) get_tokens(string in, mapping args, string filename) {    // Picks out tokens from <locale-token>-tag in pikesource    // The order between // blocks and /* */ blocks is not important    // for our purposes.    string comments = ""; -  foreach(in/"//", string line) { +  foreach( (in/"//")[1..], string line) {    sscanf(line, "%s\n", line);    comments += line+"\n";    } -  foreach(in/"/\052", string block) { -  string c = ""; -  sscanf(block, "%s\052/", c); -  comments += c+"\n"; -  } +     -  +  // This is code is flawed. Breaks in e.g. userfs.pike in Roxen. +  // foreach(in/"/\052", string block) { +  // string c = ""; +  // sscanf(block, "%s\052/", c); +  // comments += c+"\n"; +  // } +     array(string) tokens = ({});    Parser.HTML()->    add_container("locale-token",    lambda(object foo, mapping m, string c) {    if(args->project && m->project!=args->project)    return 0;    c = String.trim_whites(c); -  if(has_value(tokens, c)) -  werror("\n* Warning: Token %O already found\n", c); +  if(has_value(tokens, c)) { +  werror("\n* Warning: Token %O already found.\n", c); +  }    tokens += ({c});    if (m->project)    args->project = m->project;    else    args->project = "";    return 0;    })    ->feed( comments )->finish();    if(!sizeof(tokens)) {    if(args->project)
pike.git/bin/extract.pike:1031:    configname = args->project+".xml";    string filename = parse_config(configname);    if(!xml_name || xml_name=="")    if(filename!="")    xml_name = filename;    else if(args->xmlpath && args->baselang)    xml_name = replace(args->xmlpath, "%L", args->baselang);       if( (!(xml_name && args->sync && args->xmlpath && args->baselang)) &&    (!sizeof(files) || args->help) ) { -  sscanf("$Revision: 1.10 $", "$"+"Revision: %s $", string v); +  sscanf("$Revision: 1.11 $", "$"+"Revision: %s $", string v);    werror("\n Locale Extractor Utility "+v+"\n\n");    werror(" Syntax: extract.pike [arguments] infile(s)\n\n");    werror(" Arguments: --project=name default: first found in infile\n");    werror(" --config=file default: [project].xml\n");    werror(" --out=file default: [project]_eng.xml\n");    werror(" --nocopy update infile instead of infile.new\n");    werror(" --notime don't include dump time in xml files\n");    werror(" --wipe remove unused ids from xml\n");    werror(" --sync synchronize all locale projects\n");    werror(" --encoding=enc default: ISO-8859-1\n");