Branch: Tag:

1996-10-15

1996-10-15 03:58:07 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

/precompiled/FILE added

Rev: lib/include/stdio.pre.pike:1.2

265:      </doc>   </docgroup> + <docgroup homogen-name='IS_ZERO' homogen-type='method'> + <method name='IS_ZERO'/><doc placeholder='true'> + <text> + <p><tt>IS_ZERO</tt> - is this svalue considered 'false'</p> +  + <tt><p>#include &lt;simulate.h&gt;<br/> +  + </p> + <p>int IS_ZERO(struct svalue *<i>s</i>);<br/> + </p> + </tt> + <p>IS_ZERO returns true if the svalue 's' is a zero. (or an object with + `! operator that returned true..)</p> + </text> +  + <group><note/><text> + <p>IS_ZERO is actually a macro</p> +  + svalue</text></group> +  + <group><seealso/><text> + <p><ref resolved='predef::is_eq' to='is_eq'>is_eq</ref>, <ref resolved='predef::is_equal' to='is_equal'>is_equal</ref> and <ref resolved='predef::is_lt' to='is_lt'>is_lt</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='PI' homogen-type='constant'>   <constant name='PI'/><doc placeholder='true'>   <text>
1164:      </doc>   </docgroup> + <docgroup homogen-name='assign_svalue' homogen-type='method'> + <method name='assign_svalue'/><doc placeholder='true'> + <text> + <p><tt>assign_svalue</tt> - copy svalues from one place to another</p> +  + <tt><p>#include &lt;svalue.h&gt;<br/> +  + </p> + <p>void assign_svalue(struct svale *<i>to</i>, struct svalue *<i>from</i>);<br/> + </p> + </tt> + <p>This function copies an svalue from one struct svalue to another. + It frees the contents of 'to' first and updates the involved + refcounts.</p> +  + svalue</text> +  + <group><seealso/><text> + <p><ref resolved='predef::free_svalue' to='free_svalue'>free_svalue</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='atan' homogen-type='method'>   <method name='atan'/><doc placeholder='true'>   <text>
2206:      </doc>   </docgroup> + <docgroup homogen-name='find_option' homogen-type='method'> + <method name='find_option'/><doc placeholder='true'> + <text> + <p><tt>find_option</tt> - find command line options</p> +  + <tt><p>#include &lt;getopt.h&gt;<br/> +  + </p> + <p>mixed find_option(string *argv,<br/> + <dl><group><text>string shortform,<br/> + string longform,<br/> + string envvar,<br/> + mixed def);<br/> + </text></group></dl></p> + </tt> + <p>This is a generic function to parse command line options of the + type '-f', '--foo' or '--foo=bar'. The first argument should be + the array of strings that is sent as second argument to your + main() function, the second is a string with the short form of + your option. The short form must be only one character long. + The 'longform' is an alternative and maybe more readable way to + give the same option. If you give "foo" as longform your program + will accept --foo as argument. The envvar argument specifies what + environment variable can be used to specify the same option. The + envvar option exists to make it easier to custimizer program usage. + The 'def' has two functions: It specifies that the option takes an + argument and it tells find_option what to return if the option is + not present. If 'def' is given and the option does not have an + argument find_option will print an error message and exit the program. + </p> + <p>Also, as an extra bonus: shortform, longform and envvar can all be + arrays, in which case either of the options in the array will be + accpted.</p> + </text> +  + <group><note/><text> + <p>find_option modifies argv.</p> + </text></group> +  + <group><example/><text> + <tt><p>int main(int argc, string *argv)<br/> + {<br/> + <dl><group><text>if(find_option(argv,"f","foo"))<br/> + <dl><group><text>werror("The FOO option was given.\n");<br/> + </text></group></dl></text></group></dl> + </p> + <p><dl><group><text>werror("The BAR option got the "+<br/> + find_option(argv,"b","bar","BAR_OPTION","default")+<br/> + " argument.\n");<br/> + </text></group></dl>}<br/> + </p> + </tt></text></group> +  + <group><seealso/><text> + <p><ref resolved='predef::get_args' to='get_args'>get_args</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='findstring' homogen-type='method'>   <method name='findstring'/><doc placeholder='true'>   <text>
2416:      </doc>   </docgroup> + <docgroup homogen-name='free_svalue' homogen-type='method'> + <method name='free_svalue'/><doc placeholder='true'> + <text> + <p><tt>free_svalue</tt> - free the contents of an svalue</p> +  + <tt><p>#include &lt;svalue.h&gt;<br/> +  + </p> + <p>void free_svalue(struct svalue *<i>s</i>);<br/> + </p> + </tt> + <p>This function frees the contents of an svalue with respect to + ref counts. It does not however free the storage for svalue itself. + That is up to the caller to do.</p> +  + svalue</text> +  + <group><seealso/><text> + <p><ref resolved='predef::assign_svalue' to='assign_svalue'>assign_svalue</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='function' homogen-type='method'>   <method name='function'/><doc placeholder='true'>   <text>
2632:      </doc>   </docgroup> + <docgroup homogen-name='get_args' homogen-type='method'> + <method name='get_args'/><doc placeholder='true'> + <text> + <p><tt>get_args</tt> - get the non-option arguments</p> +  + <tt><p>#include &lt;getopt.h&gt;<br/> +  + </p> + <p>string *get_args(string *<i>argv</i>);<br/> + </p> + </tt> + <p>This function returns the remaining command line arguments after + you have run find_options to find all the options in the + argument list. If there are any options left not handled by + find_options an error message will be written and the program will + exit. Otherwise a new 'argv' array without the parsed options is + returned.</p> + </text> +  + <group><example/><text> + <tt><p>int main(int argc, string *argv)<br/> + {<br/> + <dl><group><text>if(find_option(argv,"f","foo"))<br/> + <dl><group><text>werror("The FOO option was given.\n");<br/> + </text></group></dl></text></group></dl> + </p> + <p><dl><group><text>argv=get_args(argv);<br/> + werror("The arguments are: "+(argv*" ")+".\n");<br/> + </text></group></dl>}<br/> + </p> + </tt></text></group> +  + <group><seealso/><text> + <p><ref resolved='predef::find_option' to='find_option'>find_option</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='get_dir' homogen-type='method'>   <method name='get_dir'/><doc placeholder='true'>   <text>
3079:      </doc>   </docgroup> + <docgroup homogen-name='is_eq' homogen-type='method'> + <method name='is_eq'/><doc placeholder='true'> + <text> + <p><tt>is_eq</tt> - compare two svalues</p> +  + <tt><p>#include &lt;svalue.h&gt;<br/> +  + </p> + <p>int is_eq(struct svalue *<i>a</i>, struct svalue *<i>b</i>);<br/> + </p> + </tt> + <p>This is the equivialent of the Pike operator `==. It compares two + svalues and returns one if they are the same. Otherwise zero.</p> +  + svalue</text> +  + <group><seealso/><text> + <p><ref resolved='predef::is_equal' to='is_equal'>is_equal</ref>, <ref resolved='predef::is_lt' to='is_lt'>is_lt</ref> and <ref resolved='predef::IS_ZERO' to='IS_ZERO'>IS_ZERO</ref></p> + </text></group> +  + </doc> + </docgroup> + <docgroup homogen-name='is_equal' homogen-type='method'> + <method name='is_equal'/><doc placeholder='true'> + <text> + <p><tt>is_equal</tt> - compare two svalues recursively</p> +  + <tt><p>#include &lt;svalue.h&gt;<br/> +  + </p> + <p>int is_equal(struct svalue *<i>a</i>, struct svalue *<i>b</i>);<br/> + </p> + </tt> + <p>This is the equivialent of the Pike function equal(), it compares + two svalues recursively and returns 1 if their contents are equal, + zero otherwise.</p> +  + svalue</text> +  + <group><seealso/><text> + <p><ref resolved='predef::is_eq' to='is_eq'>is_eq</ref>, <ref resolved='predef::is_lt' to='is_lt'>is_lt</ref> and <ref resolved='predef::IS_ZERO' to='IS_ZERO'>IS_ZERO</ref></p> + </text></group> +  + </doc> + </docgroup> + <docgroup homogen-name='is_lt' homogen-type='method'> + <method name='is_lt'/><doc placeholder='true'> + <text> + <p><tt>is_lt</tt> - compare two svalues</p> +  + <tt><p>#include &lt;svalue.h&gt;<br/> +  + </p> + <p>int is_lt(struct svalue *<i>a</i>, struct svalue *<i>b</i>);<br/> + </p> + </tt> + <p>This is the equivialent of the Pike operator `&lt;. It compares the + contents of two svalues and returns true if the 'a' is lesser than + 'b'. It will give an error if the types are not comparable.</p> + </text> +  + <group><note/><text> + <p>is_gt, is_ge and is_le are also available. They are all macros that + call this function.</p> +  + svalue</text></group> +  + <group><seealso/><text> + <p><ref resolved='predef::is_eq' to='is_eq'>is_eq</ref> and <ref resolved='predef::is_equal' to='is_equal'>is_equal</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='kill' homogen-type='method'>   <method name='kill'/><doc placeholder='true'>   <text>
5317:      </doc>   </docgroup> + <docgroup homogen-name='strmult' homogen-type='method'> + <method name='strmult'/><doc placeholder='true'> + <text> + <p><tt>strmult</tt> - multiply strings</p> +  + <tt><p>#include &lt;string.h&gt;<br/> +  + </p> + <p>string strmult(string <i>s</i>, int <i>num</i>);<br/> + </p> + </tt> + <p>This function multplies 's' by 'num'. The return value is the same + as appending 's' to an empty string 'num' times. + </p> + </text> +  + </doc> + </docgroup>   <docgroup homogen-name='strstr' homogen-type='method'>   <method name='strstr'/><doc placeholder='true'>   <text>
5403:      </doc>   </docgroup> + <docgroup homogen-name='svalue' homogen-type='method'> + <method name='svalue'/><doc placeholder='true'> + <text> + <p><tt>svalue</tt> - internal type for storing Pike values</p> +  + <p>The 'struct svalue' contains one Pike 'value', variables, arrays + and the evaluator are all svalues. An svalue consists of three + elements: type, subtype and a union containing the actual value. + The type is a short which tells you what type the svalue is. The + value is one of the following: + </p> + <p><matrix> + <r><c> T_ARRAY </c><c> When type is T_ARRAY, the array is stored in </c></r> + <r><c> </c></r> + </matrix> + <dl><group><text><matrix> + <r><c> </c><c> the 'array' member of the union. So if sval is </c></r> + <r><c> </c></r> + </matrix> + <matrix> + <r><c> </c><c> the pointer to the svalue, you would use sval-&gt;u.array </c></r> + <r><c> </c></r> + </matrix> + <matrix> + <r><c> </c><c> to access the actual array. </c></r> + <r><c> </c></r> + </matrix> + </text></group></dl><matrix> + <r><c> T_MAPPING </c><c> In this case, you use sval-&gt;u.mapping. </c></r> + <r><c> T_MULTISET </c><c> sval-&gt;u.multiset </c></r> + <r><c> T_OBJECT </c><c> sval-&gt;u.object </c></r> + <r><c> T_FUNCTION </c><c> Functions are a bit more difficult, sval-&gt;u.object </c></r> + </matrix> + <dl><group><text><matrix> + <r><c> </c><c> is the object the function is in, and sval-&gt;subtype </c></r> + <r><c> </c></r> + </matrix> + <matrix> + <r><c> </c><c> is the number of the function in that object. </c></r> + <r><c> </c></r> + </matrix> + </text></group></dl><matrix> + <r><c> T_PROGRAM </c><c> sval-&gt;u.program is the struct program you want. </c></r> + <r><c> T_STRING </c><c> sval-&gt;u.string </c></r> + <r><c> T_FLOAT </c><c> sval-&gt;u.float_number </c></r> + <r><c> T_INT </c><c> sval-&gt;u.integer, a special case is that sval-&gt;subtype </c></r> + </matrix> + <dl><group><text><matrix> + <r><c> </c><c> is used in some cases to represent the value </c></r> + <r><c> </c><c> 'undefined'. This is what zero_type detects. </c></r> + </matrix> + </text></group></dl> + </p> + <p>There are lots of functions operating on svalues, so you shouldn't + have to do all that much stuff with them yourself. However, for now + you do need to check the type and extract the proper member of the + union yourself when writing your own C functions for Pike.</p> +  + internals</text> +  + </doc> + </docgroup>   <docgroup homogen-name='switch' homogen-type='method'>   <method name='switch'/><doc placeholder='true'>   <text>
5918:      </doc>   </docgroup> + <class name='/precompiled/FILE'> + <doc placeholder='true'> + <text> + <p><tt>/precompiled/FILE</tt> - buffered IO</p> +  + <p>/precompiled/FILE implements buffered IO and some nice functions + not available in /precompiled/file such as gets(). Almost all the + functions of /precompiled/file are present. The extra functions + are listed below:</p> + </text> +  + <group><seealso/><text> + <p><ref resolved='predef::/precompiled/FILE' to='/precompiled/file'>/precompiled/file</ref></p> + </text></group> +  + </doc> + <docgroup homogen-name='getchar' homogen-type='method'> + <method name='getchar'> + </method> + <doc placeholder='true'> + <text> + <p><tt>getchar</tt> - get one character from the input stream</p> +  + <tt><p>#include &lt;stdio.h&gt;<br/> +  + </p> + <p>int FILE-&gt;getchar();<br/> + </p> + </tt> + <p>This function returns one character from the input stream. Note + that the return value is the ascii value of the character, not + a string containing one character. +  + </p> + </text> +  + </doc> + </docgroup> + <docgroup homogen-name='gets' homogen-type='method'> + <method name='gets'> + </method> + <doc placeholder='true'> + <text> + <p><tt>gets</tt> - get one line</p> +  + <tt><p>#include &lt;stdio.h&gt;<br/> +  + </p> + <p>string FILE-&gt;gets();<br/> + </p> + </tt> + <p>This function returns one line from the FILE, it returns zero if + no more lines are available. + </p> + <p/> + </text> +  + </doc> + </docgroup> + <docgroup homogen-name='printf' homogen-type='method'> + <method name='printf'> + </method> + <doc placeholder='true'> + <text> + <p><tt>printf</tt> - formatted print</p> +  + <tt><p>#include &lt;stdio.h&gt;<br/> +  + </p> + <p>string FILE-&gt;printf(string <i>format</i>, mixed ... <i>data</i>);<br/> + </p> + </tt> + <p>This function does aproximately the same as: + FILE-&gt;write(sprintf(format,@data))</p> + </text> +  + <group><seealso/><text> + <p><ref resolved='predef::sprintf' to='sprintf'>sprintf</ref></p> + </text></group> +  + </doc> + </docgroup> + <docgroup homogen-name='ungets' homogen-type='method'> + <method name='ungets'> + </method> + <doc placeholder='true'> + <text> + <p><tt>ungets</tt> - put a character back in the buffer</p> +  + <tt><p>#include &lt;stdio.h&gt;<br/> +  + </p> + <p>string FILE-&gt;ungets(string <i>s</i>);<br/> + </p> + </tt> + <p>This function puts a string back in the input buffer. The string + can then be read with read or gets. + </p> + <p/> + </text> +  + </doc> + </docgroup> + </class>   <class name='/precompiled/condition'>   <doc placeholder='true'>   <text>