Branch: Tag:


1995-10-11 11:40:40 by Fredrik Hübinette (Hubbe) <>


Rev: doc/builtin/getpid:1.1
Rev: doc/builtin/kill:1.1
Rev: doc/builtin/signal:1.1
Rev: doc/builtin/signame:1.1
Rev: doc/builtin/signum:1.1
Rev: doc/builtin/sleep:1.1
Rev: doc/files/file:1.2
Rev: doc/files/port:1.2
Rev: doc/lpc/control_structures:1.2
Rev: doc/lpc/hilfe.hilfe:1.2
Rev: doc/lpc/preprocessor:1.1
Rev: doc/lpc/reserved:1.1
Rev: doc/regexp/regexp:1.2
Rev: doc/types/int:1.2

763:   </tt></text></group>      <group><seealso/><text> - <p><ref resolved='predef::fork' to='predef::fork'>files/fork</ref> and <ref to='file-&gt;pipe'>file-&gt;pipe</ref></p> + <p><ref resolved='predef::fork' to='predef::fork'>files/fork</ref> and <ref resolved='predef::/precompiled/file.pipe' to='file-&gt;pipe'>file-&gt;pipe</ref></p>   </text></group>      </doc>
1041:   </text></group>      <group><seealso/><text> - <p><ref resolved='predef::exec' to='predef::exec'>files/exec</ref> and <ref to='file-&gt;pipe'>file-&gt;pipe</ref></p> + <p><ref resolved='predef::exec' to='predef::exec'>files/exec</ref> and <ref resolved='predef::/precompiled/file.pipe' to='file-&gt;pipe'>file-&gt;pipe</ref></p>   </text></group>      </doc>
1191:      </doc>   </docgroup> + <docgroup homogen-name='getpid' homogen-type='method'> + <method name='getpid'/><doc placeholder='true'> + <text> + <p><tt>getpid</tt> - get the process id of this process</p> +  + <tt><p>int getpid();<br/> + </p> + </tt> + <p>This returns the pid of this process. Useful for sending + signals to yourself.</p> + </text> +  + <group><seealso/><text> + <p><ref resolved='predef::kill' to='kill'>kill</ref>, <ref resolved='predef::fork' to='fork'>fork</ref> and <ref resolved='predef::signal' to='signal'>signal</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='hash' homogen-type='method'>   <method name='hash'/><doc placeholder='true'>   <text>
1268:      <tt><p>9797 /* decimal number */<br/>   0x20 /* hexadecimal number */<br/> + 020 /* octal number */<br/>   </p>   </tt>   <p>This type stores an integer, normally it is 32 bits and use 4 bytes
1319:      </doc>   </docgroup> + <docgroup homogen-name='kill' homogen-type='method'> + <method name='kill'/><doc placeholder='true'> + <text> + <p><tt>kill</tt> - send signal to other process</p> +  + <tt><p>int kill(int pid, int signal)<br/> + </p> + </tt> + <p>Kill sends a signal to another process. If something goes wrong + -1 is returned, 0 otherwise. + </p> + <p>Some signals and their supposed purpose: + </p> + <p><matrix> + <r><c> SIGHUP </c><c> Hangup, sent to process when user logs out </c></r> + <r><c> SIGINT </c><c> Interrupt, normally sent by ctrl-c </c></r> + <r><c> SIGQUIT </c><c> Quit, sent by ctrl-\ </c></r> + <r><c> SIGILL </c><c> Illegal instruction </c></r> + <r><c> SIGTRAP </c><c> Trap, mostly used by debuggers </c></r> + <r><c> SIGABRT </c><c> Aborts process, can be caught, used by uLPC whenever something goes seriously wrong. </c></r> + <r><c> SIGBUS </c><c> Bus error </c></r> + <r><c> SIGFPE </c><c> Floating point error (such as division by zero) </c></r> + <r><c> SIGKILL </c><c> Really kill a process, cannot be caught </c></r> + <r><c> SIGUSR1 </c><c> Signal reserved for whatever you want to use it for. </c></r> + <r><c> SIGSEGV </c><c> Segmentation fault, caused by accessing memory where you shouldn't. Should never happen to uLPC. </c></r> + <r><c> SIGUSR2 </c><c> Signal reserved for whatever you want to use it for. </c></r> + <r><c> SIGALRM </c><c> Signal used for timer interrupts. </c></r> + <r><c> SIGTERM </c><c> Termination signal </c></r> + <r><c> SIGSTKFLT Stack fault </c></r> + <r><c> SIGCHLD </c><c> Child process died </c></r> + <r><c> SIGCONT </c><c> Continue suspended </c></r> + <r><c> SIGSTOP </c><c> Stop process </c></r> + <r><c> SIGSTP </c><c> Suspend process </c></r> + <r><c> SIGTTIN </c><c> tty input for background process </c></r> + <r><c> SIGTTOU </c><c> tty output for background process </c></r> + <r><c> SIGXCPU </c><c> Out of cpu </c></r> + <r><c> SIGXFSZ </c><c> File size limit exceeded </c></r> + <r><c> SIGPROF </c><c> Profile trap </c></r> + <r><c> SIGWINCH Window change signal </c></r> + <r><c> Note that you have to use signame to translate the name of a signal </c></r> + <r><c> to it's number. </c></r> + </matrix> + </p> + </text> +  + <group><seealso/><text> + <p><ref resolved='predef::signal' to='signal'>signal</ref>, <ref resolved='predef::signum' to='signum'>signum</ref>, <ref resolved='predef::signame' to='signame'>signame</ref> and <ref resolved='predef::fork' to='predef::fork'>files/fork</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='l_sizeof' homogen-type='method'>   <method name='l_sizeof'/><doc placeholder='true'>   <text>
2198:      </doc>   </docgroup> + <docgroup homogen-name='signal' homogen-type='method'> + <method name='signal'/><doc placeholder='true'> + <text> + <p><tt>signal</tt> - trap signals</p> +  + <tt><p>void signal(int <i>sig</i>, function(int:void) <i>callback</i>);<br/> + or<br/> + void signal(int <i>sig</i>);<br/> + </p> + </tt> + <p>This function allows you to trap a signal and have a function called + when the process receives a signal. Although it IS possible to trap + SIGBUS, SIGSEGV etc. I advice you not to. uLPC should not receive any + such signals and if it does it is because of bugs in the uLPC + interperter. And all bugs should be reported, no matter how trifle. + </p> + <p>The callback will receive the signal number as the only argument. + See the document for the function 'kill' for a list of signals. + </p> + <p>If no second argument is given, the signal handler for that signal + is restored to the default handler.</p> + </text> +  + <group><seealso/><text> + <p><ref resolved='predef::kill' to='kill'>kill</ref>, <ref resolved='predef::signame' to='signame'>signame</ref> and <ref resolved='predef::signum' to='signum'>signum</ref></p> + </text></group> +  + </doc> + </docgroup> + <docgroup homogen-name='signame' homogen-type='method'> + <method name='signame'/><doc placeholder='true'> + <text> + <p><tt>signame</tt> - get the name of a signal</p> +  + <tt><p>string signame(int <i>sig</i>);<br/> + </p> + </tt> + <p>Return a string describing the signal.</p> + </text> +  + <group><example/><text> + <tt><p>&gt; signame(9);<br/> + Result: SIGKILL<br/> + </p> + </tt></text></group> +  + <group><seealso/><text> + <p><ref resolved='predef::kill' to='kill'>kill</ref>, <ref resolved='predef::signum' to='signum'>signum</ref> and <ref resolved='predef::signal' to='signal'>signal</ref></p> + </text></group> +  + </doc> + </docgroup> + <docgroup homogen-name='signum' homogen-type='method'> + <method name='signum'/><doc placeholder='true'> + <text> + <p><tt>signum</tt> - get a signal number given a desctiptive string</p> +  + <tt><p>int signum(string <i>sig</i>);<br/> + </p> + </tt> + <p>This function is the opposite of signame.</p> + </text> +  + <group><example/><text> + <tt><p>&gt; signum("SIGKILL");<br/> + Result: 9<br/> + </p> + </tt></text></group> +  + <group><seealso/><text> + <p><ref resolved='predef::signame' to='signame'>signame</ref>, <ref resolved='predef::kill' to='kill'>kill</ref> and <ref resolved='predef::signal' to='signal'>signal</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='sin' homogen-type='method'>   <method name='sin'/><doc placeholder='true'>   <text>
2231:      </doc>   </docgroup> + <docgroup homogen-name='sleep' homogen-type='method'> + <method name='sleep'/><doc placeholder='true'> + <text> + <p><tt>sleep</tt> - let interpreter doze of for a while</p> +  + <tt><p>void sleep(int <i>s</i>);<br/> + </p> + </tt> + <p>This function makes the program stop for s seconds. Only signal + handlers can interrupt the sleep. Other callbacks are not called + during sleep.</p> + </text> +  + <group><seealso/><text> + <p><ref resolved='predef::signal' to='signal'>signal</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='sort_array' homogen-type='method'>   <method name='sort_array'/><doc placeholder='true'>   <text>
2953:   </p>   </tt>   <p>This funcion connects a socket previously created with - file-&gt;open_socket to a remote socket. The argument is the ip number - for the remote machine on the form x.x.x.x where x is a number. - This function returns 1 for success, 0 otherwise. Note that if the + file-&gt;open_socket to a remote socket. The argument is the ip name + or number fot he remote machine. + </p> + <p>This function returns 1 for success, 0 otherwise. Note that if the   socket is in nonblocking mode, you have to wait for a write or close   callback before you know if the connection failed or not.</p>   </text>
3108:      </doc>   </docgroup> + <docgroup homogen-name='pipe' homogen-type='method'> + <method name='pipe'> + </method> + <doc placeholder='true'> + <text> + <p><tt>pipe</tt> - create a two-way pipe</p> +  + <tt><p>object file-&gt;pipe();<br/> + </p> + </tt> + <p>This function creates a pipe between the object it was called in + and an object that is returned. The two ends of the pipe are + indistinguishable. If the object is this function is called in + was open to begin with, it is closed before the pipe is created.</p> + </text> +  + <group><seealso/><text> + <p><ref resolved='predef::fork' to='predef::fork'>builtin/fork</ref></p> + </text></group> +  + </doc> + </docgroup>   <docgroup homogen-name='query_address' homogen-type='method'>   <method name='query_address'>   </method>
3455:   <tt><p>int port-&gt;bind(int <i>port</i>);<br/>   or<br/>   int port-&gt;bind(int <i>port</i>,function <i>accept_callback</i>);<br/> + or<br/> + int port-&gt;bind(int <i>port</i>,function <i>accept_callback</i>, string <i>ip</i>);<br/>   </p>   </tt>   <p>Bind opens a sockets and binds it to port number on the local machine.   If the second argument is present, the socket is set to nonblocking   and the callback funcition is called whenever something connects to   the socket. The callback will receive the id for this port as argument. - Bind returns 1 on success, and zero on failiure.</p> + Bind returns 1 on success, and zero on failiure. + </p> + <p>If the optional argument 'ip' is given, bind will try to bind to + this ip name (or number).</p>   </text>      <group><seealso/><text>
3481:   or<br/>   void port-&gt;create("stdin",function accept_callback)<br/>   or<br/> + void port-&gt;create("stdin",function accept_callback)<br/> + or<br/>   void port-&gt;create(int port)<br/>   or<br/>   void port-&gt;create(int port,function accept_callback)<br/> -  + or<br/> + void port-&gt;create(int port,function accept_callback, string ip)<br/>   </p>   </tt>   <p>When create is called with 'stdin' as argument, a socket is created
3595:      <p>/precompiled/regexp is a precompiled LPC program that interfaces a   regexp package written in C. It contains a few simple functions to - handle regexps. For more documentation about regexps, consult your - unix manual for 'ed' or 'sed'. + handle regexps. A short description of regexp follows:   </p> -  + <p>. Matches any character<br/> + [abc] Matches a, b or c<br/> + [a-z] Matches any character a to z inclusive<br/> + [^ac] Matches any character except a and c<br/> + (x) Matches x (x might be any regexp)<br/> + x* Matches zero or more occurances of 'x' (x may be anything)<br/> + x|y Matches x or y. (x or y may be any regexp)<br/> + xy Matches xy (x and y may be any regexp)<br/> + ^ Matches beginning of string (but no characters)<br/> + $ Matches end of string (but no characters)<br/> + &lt;x&gt; Used with split() to put the string matching x into the<br/> + <dl><group><text>result array.<br/> + </text></group></dl> + </p> + <p>Note that \ can be used to quote these characters in which case + they match themselves, nothing else. Also note that when quoting + these something in uLPC you need two \ because uLPC also uses + this character for quoting. + </p> + <p>For more information about regexps, refer to your unix manuals such + as sed or ed. + </p>   <p>Descriptions of all functions in /precompiled/file follows:   </p>   <p/>
3665:   </p>   </tt>   <p>Works as regexp-&gt;match, but returns an array of the strings that - matched the subregexps.</p> + matched the subregexps. Subregexps are those contained in &lt; &gt; in + the regexp. Subregexps that were not matched will contain zero. + If the total regexp didn't match, zero is returned.</p>   </text>    -  + <group><bugs/><text> + <p>You can only have 40 subregexps.</p> + </text></group> +    <group><seealso/><text>   <p><ref to='regexp-&gt;create'>regexp-&gt;create</ref> and <ref to='regexp-&gt;split'>regexp-&gt;split</ref></p>   </text></group>