pike.git / refdoc / chapters / hilfe.xml

version» Context lines:

pike.git/refdoc/chapters/hilfe.xml:1: - <!-- FIXME: I'd like this file to be generated from the actual strings in Hilfe.pmod -  and all examples autogenerated in a wrapper like the one in testhilfe.pike --> + <!-- FIXME: I'd like this file to be generated from the actual strings +  in Hilfe.pmod and all examples autogenerated in a wrapper like +  the one in testhilfe.pike --> +    <chapter title="Hilfe">      <p>Hilfe stands for Hubbes Incremental LPC Front End, and is an   incremental Pike evaluator. As the name hints Hilfe has its roots back   when Pike was called LPC, but none of the code from that Hilfe   remains. Hilfe is one of the most useful tools for Pike developers,   since it enables them to try various Pike constructions and see how   they work. Even the most experienced Pike programmer can forget how   the return data structure of a function looks like or if + or | is the   best way to merge to mappings for a specific purpose.
pike.git/refdoc/chapters/hilfe.xml:161:   </subsection>      <subsection title="Exit and Quit">   <p>It is possible to end a Hilfe session by entering the command   <tt>exit</tt> or <tt>quit</tt>. It is also possible to exit by using   Control+D. Note that no history will be saved if Control+C is used to   terminate Hilfe.</p>   </subsection>      <subsection title="."> + <p>When a single dot is inputed into Hilfe on a new line, any + multiline expression currently in progress to be inputed will be + discarded.</p> + <example> + &gt; foreach(getenv(); string env; string value) + &gt;&gt; if(has_prefix(env, "LC_")) + &gt;&gt; . + &gt; + </example>   </subsection>      <subsection title="dump"> -  + <p>Dump shows certain states within Hilfe or Pike. If only + <tt>dump</tt> is given, Hilfe prints out the currently defined + constants, variables, functions and programs. It also lists all active + inherits and imports.</p> + <example> + &gt; dump +  + Constants: + pi : 3.141593 +  + Variables: + int i : 3 + float|string res : "VRkjMs28m0PCU" +  + Functions: + plot +  + Inherits: + Parser.XML.Tree +  + Imports: + GL + </example> +  + <p><tt>dump history</tt> shows all items in the result history queue.</p> + <example> + &gt; dump history +  1 (-4) : 3102 +  2 (-3) : 8.039803 +  3 (-2) : "D3Y1jk2fOYl5M" +  4 (-1) : "CsuBAXhfB9HWI" + 4 out of 10 possible entries used. + </example> +  + <p><tt>dump memory</tt> shows the current memory usage.</p> + <example> + > dump memory +  Num Bytes + array 511 67860 (66.3 kb) + callable 235 16304 (15.9 kb) + callback 3 4128 (4.0 kb) + frame 7 16296 (15.9 kb) + mapping 125 121262 (118.4 kb) + multiset 42 20064 (19.6 kb) + object 710 129024 (126.0 kb) + program 412 2070184 (2.0 Mb) + string 9522 743959 (726.5 kb) + </example> +  + <p><tt>dump state</tt> shows the current parser state. Only useful for + debugging Hilfe.</p> + <example> + > while(0) { + >> dump state + Current parser state + Parenthesis stack: { + Current pipeline: ({ /* 7 elements */ +  "while", +  "(", +  "0", +  ")", +  " ", +  "{", +  "\n\n" + }) + Last token: ")" + Current block: ")" + </example> +  + <p><tt>dump wrapper</tt> show the latest Hilfe wrapper that the last + expression was evaluated in. Useful when debugging Hilfe (i.e. + investigating why valid Pike expressions doesn't compile).</p> + <example> + > int i=5; + > i=i+5; + (1) Result: 10 + > dump wrapper + Last compiled wrapper: + 001: #pragma unpragma_strict_types + 002: mapping(string:mixed) ___hilfe = ___Hilfe->variables; + 003: # 1 + 004: mixed ___HilfeWrapper() { return (([mapping(string:int)]___hilfe)->i)=(([mapping(string:int)]___hilfe)->i)+5; ; } + 005: + </example>   </subsection>      <subsection title="new"> -  + <p>When <tt>new</tt> is given without any arguments it clears the + current Hilfe state. This includes the parser state, variables, + constants, functions, programs, inherits, imports and the history. It + does not include the currently installed commands. Note that code in + your .hilferc will not be reevaluated.</p> +  + <p><tt>new history</tt> removes all entries from the result history. + <tt>new constants</tt>, <tt>new functions</tt>, <tt>new programs</tt>, + and <tt>new variables</tt> clears all locally defined symbols of the + given type. <tt>new imports</tt> and <tt>new inherits</tt> removes all + imports and inherits respectively.</p>   </subsection>      <subsection title="set"> - </subsection> + <p>With the <tt>set</tt> commands various settings in Hilfe can be + changed. Set is used as <tt>"set &lt;setting&gt; + &lt;parameter&gt;"</tt>.</p>    - <subsection title="start and stop"> - </subsection> + <p><b>assembler_debug</b> Changes the level of assembler debug used + when evaluating expressions in Pike. Requires that Pike is compiled + with RTL debug.</p>    - </section> + <p><b>compiler_trace</b> Changes the level of compiler trace used when + evaluating expressions in Pike. Requires that Pike is compiled with + RTL debug.</p>    - <section title="Subsystems"> + <p><b>debug</b> Changes the level of debug used when evaluating + expressions in Pike. Requires that Pike is compiled with RTL debug.</p>    - <subsection title="Backend"> + <p><b>format</b> Changes the formatting of the result values from + evaluated Pike expressions. Currently the following set format + parameters are available:</p> + <matrix> + <r><c>default</c><c>The normal result formatting.</c></r> + <r><c>bench</c><c>A result formatting extended with compilation and + evaluation times.</c></r> + <r><c>sprintf</c><c>The result formatting will be decided by the succeeding + Pike string. The sprintf will be given the arguments shown in + the table below.</c></r> + </matrix> + <p></p> + <matrix> + <r><c>0</c><c>The result as a string.</c></r> + <r><c>1</c><c>The result number in the history.</c></r> + <r><c>2</c><c>The result in its native type.</c></r> + <r><c>3</c><c>The compilation time as a string.</c></r> + <r><c>4</c><c>The evaluation time as a string.</c></r> + <r><c>5</c><c>The compilation time in nanoseconds as an int.</c></r> + <r><c>6</c><c>The evaluation time in nanoseconds as an int.</c></r> + </matrix> + <example> + > 1+2/3.0; + (1) Result: 1.666667 + > set format bench + > 1+2/3.0; + Result 2: 1.666667 + Compilation: 573ns, Execution: 6ns + > set format sprintf "%s (%[2]t)\n" + > 1+2/3.0; + 1.666667 (float) + > set format sprintf "%s (%d/%[3]s/%[4]s)\n" + > 1+2/3.0; + 1.666667 (4/575ns/6ns) + </example> +  + <p><b>hedda</b> Initializes some variables for quick access, unless + they are already defined. Hilfe attempts to do the following + declarations: mixed foo, mixed bar, int i, float f=0.0, mapping + m=([]), array a=({}) and string s="".</p> +  + <p><b>history</b> Change the maximum number of entries that are kept in + the result history. Default is 10. When dealing with objects of which + there can only exist one copy you should set history to 0.</p> +  + <p><b>trace</b> Changes the level of trace used when evaluating expressions + in Pike. Possible values are:</p> + <matrix> + <r><c>0</c><c>Off</c></r> + <r><c>1</c><c>Calls to Pike functions are printed.</c></r> + <r><c>2</c><c>Calls to buitin functions are printed.</c></r> + <r><c>3</c><c>Every opcode interpreted is printed.</c></r> + <r><c>4</c><c>Arguments to these opcodes are printed as well.</c></r> + </matrix> +  + <p><b>warnings</b> Change the current level of warnings checking. + Possible values are:</p> + <matrix> + <r><c>off</c><c>No warnings are shown.</c></r> + <r><c>on</c><c>Normal warnings are shown.</c></r> + <r><c>strict</c><c>Try a little harder to show warnings.</c></r> + </matrix> +    </subsection>    - <subsection title="Logging"> + <subsection title="start and stop"> + <p>Start and stop turns various subsystems in Hilfe on and off. + Currently there are two subsystems implemented in Hilfe, backend and + logging.</p>   </subsection>      </section>      <section title="Bugs and possible improvements">      <ul>   <li>Hilfe can not handle sscanf statements like    <expr>int a = sscanf("12", "%d", int b);</expr></li>   <li>The variable scope is not correctly adjusted for sscanf