pike.git / lib / modules / Tools.pmod / sed.pmod

version» Context lines:

pike.git/lib/modules/Tools.pmod/sed.pmod:1:   #pike __REAL_VERSION__    - // edit commands supported: - // <firstline>,<lastline><edit command> - // ^^ numeral (17) ^^ - // or relative (+17, -17) - // or a search regexp (/regexp/) - // or multiple (17/regexp//regexp/+2) - // - // D - delete first line in space - // G - insert hold space - // H - append current space to hold space - // P - print current data - // a<string> - insert - // c<string> - change current space - // d - delete current space - // h - copy current space to hold space - // i<string> - print string - // l - print current space - // p - print first line in data - // q - quit evaluating - // s/regexp/with/x - replace - // y/chars/chars/ - replace chars - // - // where line is numeral, first 'line'==0 + //! edit commands supported: + //! @pre{ + //! <firstline>,<lastline><edit command> + //! ^^ numeral (17) ^^ + //! or relative (+17, -17) + //! or a search regexp (/regexp/) + //! or multiple (17/regexp//regexp/+2) + //! @} + //! + //! @xml{ + //! <matrix> + //! <r><c><b>Command</b></c><c><b>Action</b></c></r> + //! <r><c>D</c><c>Delete first line in space</c></r> + //! <r><c>G</c><c>Insert hold space</c></r> + //! <r><c>H</c><c>Append current space to hold space</c></r> + //! <r><c>P</c><c>Print current data</c></r> + //! <r><c>a&lt;string&gt;</c><c>Insert</c></r> + //! <r><c>c&lt;string&gt;</c><c>Change current space</c></r> + //! <r><c>d</c><c>Delete current space</c></r> + //! <r><c>h</c><c>Copy current space to hold space</c></r> + //! <r><c>i&lt;string&gt;</c><c>Print string</c></r> + //! <r><c>l</c><c>Print current space</c></r> + //! <r><c>p</c><c>Print first line in data</c></r> + //! <r><c>q</c><c>Quit evaluating</c></r> + //! <r><c>s/regexp/with/x</c><c>Replace</c></r> + //! <r><c>y/chars/chars/</c><c>Replace chars</c></r> + //! </matrix> + //! @} + //! + //! where line is numeral, first 'line'==0      static array sedreplace(string s,object re,string with,    array whatin,int first,int lastmod,    multiset flags)   {    array a;    string w=0;    array pr=({});       if (!(a=re->split(s)))
pike.git/lib/modules/Tools.pmod/sed.pmod:110:    if (re->match(in[n])) break;    n++;    }    }    else break;    }    if (n<0) n=0; else if (n>=sizeof(in)) n=sizeof(in)-1;    return ({n,cmd});   }    + //!   string|array `()(string|array(string) commands,    string|array(string) data,    void|int suppress)   {    int start,stop;    string div,what,with,inflags;    multiset flags;    array whatin=({"\\1","\\2","\\3","\\4","\\5","\\6","\\7","\\8","\\9"});    array print=({});    array hold=({});
pike.git/lib/modules/Tools.pmod/sed.pmod:272:    return (arrayp(data)?(print):(print*"\n"));       default:    // error? just ignore for now    }    }    if (!suppress)    return (arrayp(data)?(print+in):(print+in)*"\n");    return (arrayp(data)?(print):(print*"\n"));   } -  -  -  +