diff --git a/tutorial/tutorial.wmml b/tutorial/tutorial.wmml index 2ca69fefebf900a3d51c9850aa60740758a7db37..d5b1a73f79f834632e51ada2eb71eb1fceb39e8f 100644 --- a/tutorial/tutorial.wmml +++ b/tutorial/tutorial.wmml @@ -1,11 +1,14 @@ +<head> <title>Pike tutorial</title> -<body bgcolor="#A0E0C0" text="#000000" link=blue vlink=purple> +</head> + +<firstpage> <p> <center> <h1> Programming, using and understanding <p> -<img src=pike.gif alt=" "> +<img src=pike.gif> <p> <font size=+7>Pike</font> <p> @@ -13,9 +16,9 @@ Programming, using and understanding <h2>by Fredrik H�binette</h2> </center> -<HR NEWPAGE> +</firstpage> -<h2> Preface </h2> +<preface title="Preface"> This book was written with the intention to make anybody with a little programming experience able to use Pike. It should also be possible to @@ -31,23 +34,17 @@ me iron out some of the rough spots. The book assumes that you have programmed some other programming language before and that you have some experience of UNIX. -<p> - -<HR NEWPAGE> +</preface> -<h1> Table of contents </h1> +<table-of-contents title="Table of contents"> -<table-of-contents> +<introduction title="Introduction"> -<HR NEWPAGE> - -<h1> Introduction </h1> - -This chapter will give you some background about Pike and this book +This introduction will give you some background about Pike and this book and also compare Pike with other languages. If you want to start learning Pike immediately you can skip this chapter. -<h2>Overview</h2> +<section title="Overview"> This book is designed for people who want to learn Pike fast. Since Pike is a simple language to learn, especially if you have some prior programming experience, this should benefit most people. @@ -60,17 +57,16 @@ learned the basics of Pike programming. Chapter two is where the action starts. It is a crash course in Pike with examples and explanations about some of the basics. It explains the fundamenals of the pike data types and control structures -The systematic documentation of all pike capabilities starts in chapther three +The systematic documentation of all pike capabilities starts in chapter three with a description of all control structures in pike. It then continues with all the data types in chapter four and operators in chapter five. Chapter six deals with object orientation in pike, which is slightly different than what you might be used to. - <!-- FIXME (finish this overview) --> -<p> +</section> -<h2> The history of Pike </h2> -<a name=uLPC> +<anchor name=uLPC> +<section title="The history of Pike"> In the beginning, there was Zork. Then a bunch of people decided to make multiplayer adventure games. One of those people was Lars Pensj� at the Chalmers university in Gothenburg, Sweden. For his game he needed a simple, @@ -92,10 +88,10 @@ their webserver. Before then, Roxen (then called Spinner) was non-commercial and written in LPC4. Then in 1996 I started working for InformationsV�varna developing �LPC for them. We also changed the name of �LPC to Pike to get a more commercially viable name. -<p> -</a> +</section> +</anchor> -<H2> A comparison with other languages </H2> +<section title="A comparison with other languages"> <dl> <dt> Python @@ -125,8 +121,9 @@ get a more commercially viable name. On the other hand Tcl/Tk has X windows system support. <!-- The idea from the begining was similar but the implementation is very different.--> </dl> +</section> -<H2> What is Pike </H2> +<section title="What is Pike"> Pike is: <ul> @@ -150,8 +147,9 @@ Pike has: <li> Support for bignums <li> Builtin socket support </ul> -<p> -<h2>How to read this manual</h2> +</section> + +<section title="How to read this manual"> This manual uses a couple of different typefaces to describe different things: <dl> @@ -166,12 +164,14 @@ things: </dl> Also, please beware that the word <b>program</b> is also a builtin pike data type. -<HR NEWPAGE> + +</section> +</introduction> <chapter title="Getting started"> <p> -First you need to have pike installed on your computer. See <link to=install> +First you need to have pike installed on your computer. See <ref to=install> "how to install Pike" if this is not already done. It is also vital for the first of the following examples that the pike binary is in your UNIX search path. If you have problems with this, consult the manual for your shell @@ -180,13 +180,13 @@ or go buy a beginners book about UNIX. <section title="Your first Pike program"> -<pre> +<example language=pike> int main() { write("hello world\n"); return 0; } -</pre> +</example> Let's call this file hello_world.pike, and then we try to run it: <p> <pre> @@ -195,9 +195,9 @@ Let's call this file hello_world.pike, and then we try to run it: $ </pre> Pretty simple, Let's see what everything means: -<pre> +<example language=pike> int main() -</pre> +</example> This begins the function <tt>main</tt>. Before the function name the type of value it returns is declared, in this case <tt>int</tt> which is the name of the integer number type in Pike. The empty space between the @@ -206,18 +206,18 @@ A Pike program has to contain at least one function, the <tt>main</tt> function. Pike is, as many other programming languages, built upon the concept of functions, i.e. what the program does is separated into small portions, or functions, each performing one (perhaps very complex) task. A function declaration consists of certain essential components; the type of the value it will return, the <i>name</i> of the function, the <i>parameters</i>, if any, it takes and the body of the function. A function is also a part of something greater; an object. You can program in Pike without caring about objects, but the programs you write will in fact be objects themselves anyway. Now let's examine the body of <tt>main</tt>; <p> -<pre> +<example language=pike> { write("hello world\n"); return 0; } -</pre> +</example> Within the function body, programming instructions, statements, are grouped together in blocks. A block is a series of statements placed between curly brackets. Every statement has to end in a semicolon. This group of statements will be executed every time the function is called. <p> -<pre> +<example language=pike> write("hello world\n"); -</pre> +</example> The first statement is a call to the builtin function <tt>write</tt>. This will execute the code in the function <tt>write</tt> with the arguments as input data. In this case, the constant string <tt>hello world\n</tt> is sent. @@ -225,9 +225,9 @@ Well, not quite. The <tt>\n</tt> combination corresponds to the newline character. <tt>write</tt> then writes this string to stdout when executed. Stdout is the standard Unix output channel, usually the screen. <p> -<pre> +<example language=pike> return 0; -</pre> +</example> This statement exits the function and returns the value zero. Any statements following the return statements will not be executed. <p> @@ -236,23 +236,23 @@ following the return statements will not be executed. <section title="Improving hello_world.pike"> Typing <tt>pike hello_world.pike</tt> to run our program may seem a bit -unpractical, fortunately, Unix provides us with a way of automating this +unpractical. Fortunately, Unix provides us with a way of automating this somewhat. If we modify hello_world.pike to look like this: <p> -<pre> +<example language=pike> #!/usr/local/bin/pike int main() { write("hello world\n"); } -</pre> +</example> And then we tell UNIX that hello_world.pike is executable so we can run hello_world.pike without having to bother with running pike: <p> <pre> $ chmod +x hello_world.pike - $ ./hello_wold.pike + $ ./hello_world.pike hello world $ </pre> @@ -272,20 +272,20 @@ Therefore we'll add a <i>command line option</i> that will make it type the old what it should output based on the command line optino. This is what it could look like: <p> -<pre> +<example language=pike> #!/usr/local/bin/pike int main(int argc, string *argv) { if(argc > 1 && argv[1]=="--traditional") { - write("hello world\n"); // old stype + write("hello world\n"); // old style }else{ write("Hello world!\n"); // new style } return 0; } -</pre> +</example> Let's run it: <p> <pre> @@ -297,9 +297,9 @@ Let's run it: $ </pre> What is new in this version, then? -<pre> +<example language=pike> int main(int argc, string *argv) -</pre> +</example> In this version the space between the parentesis has been filled. What it means is that <tt>main</tt> now takes two arguments. One is called <tt>argc</tt>, and is of the type <tt>int</tt>. @@ -314,22 +314,22 @@ Pike program is executed. The first argument, <tt>argc</tt>, is how many words were written on the command line (including the command itself) and <tt>argv</tt> is an array formed by these words. <p> -<pre> +<example language=pike> if(argc > 1 && argv[1] == "--traditional") { - write("hello world\n"); // old stype + write("hello world\n"); // old style }else{ write("Hello world!\n"); // new style } -</pre> +</example> This is an if-else statement, it will execute what's between the first set of brackets if the expression between the parenthesis evaluate to something other than zero. Otherwise what's between the second set of brackets will be executed. Let's look at that expression: <p> -<pre> +<example language=pike> argc > 1 && argv[1] == "--traditional" -</pre> +</example> Loosely translated, this means: argc is greater than one, and the second element in the array argv is equal to the string <tt>--traditional</tt>. Since argc is the number of words on the command line the first part is true only @@ -337,12 +337,12 @@ if there was anything after the program invocaton. <p> Also note the comments: <p> -<pre> - write("hello world\n"); // old stype -</pre> +<example language=pike> + write("hello world\n"); // old style +</example> The <tt>//</tt> begins a comment which continues to the end of the line. -Comments lets you type in text in the program which will be ignored by the -computer. This is to inform whoever might read your code (like yourself) of +Comments will be ignore by the computer when it reads the code. +This allows to inform whoever might read your code (like yourself) of what the program does to make it easier to understand. Comments are also allowed to look like C-style comments, ie. <tt>/* ... */</tt>, which can extend over several lines. The <tt>//</tt> comment only extends to the end of the line. <p> @@ -363,28 +363,29 @@ We have already seen an example of the <tt>if</tt> statement: else <i>statement2 </i> ; </pre> -If simply evaluates the expression and if the result is true it executes -statement1, otherwise it executes statement2. If you have no need for -statement2 you can leave out the whole else part like this: +<!-- FIXME: should if have a capital letter or not? --> +<tt>if</tt> simply evaluates the expression and if the result is true it +executes <i>statement1</i>, otherwise it executes <i>statement2</i>. If you have no need for +statement2 you can leave out the whole else<!-- FIXME: tt/italics --> part like this: <pre> if( <i>expression </i> ) <i>statement1 </i> ; </pre> -In this case statement1 is evaluated if expression is true, otherwise +In this case <i>statement1</i> is evaluated if <i>expression</i> is true, otherwise nothing is evaluated. <p> <b>Note for beginners: go back to our first example and make sure you - understand what if does.</b> + understand what <tt>if</tt> does.</b> <p> Another very simple control structure is the <tt>while</tt> statement: <pre> while( <i>expression </i> ) <i>statement </i> ; </pre> -This statement evaluates expression and if it is found to be true it -evaluates statement. After that it starts over and evaluates expression -again. This continues until expression is no longer true. This type of -control structure is called a <i>loop </i> and is fundamental to all +This statement evaluates <i>expression</i> and if it is found to be true it +evaluates <i>statement</i>. After that it starts over and evaluates <i>expression</i> +again. This continues until <i>expression</i> is no longer true. This type of +control structure is called a <b>loop </b> and is fundamental to all interesting programming. <p> </section> @@ -399,7 +400,7 @@ A function is declared like this: <i> statements </i> } </pre> -The <i>modifiers</i> are optional. See <link to=modifiers> for more details about +The <i>modifiers</i> are optional. See <ref to=modifiers> for more details about modifiers. The <i>type </i> specifies what kind of data the function returns. For example, the word <tt>int</tt> would signify that the function returns an integer number. The <i>name </i> is used to identify the function when @@ -411,16 +412,16 @@ to a function. The <i> statements </i> between the brackets are the function body. Those statements will be executed whenever the function is called. <p> <b>Example:</b> -<pre> +<example language=pike> int sqr(int x) { return x*x; } -</pre> +</example> This line defines a function called <tt>sqr</tt> to take one argument of the type <tt>int</tt> and also return an <tt>int</tt>. The code itself returns -the argument multiplied by itself. To call this function somewhere in the code +the argument multiplied by itself. To call this function from somewhere in the code you could simply put: <tt>sqr(17)</tt> and that would return the integer value 289. <p> -As the example above shows that <tt>return</tt> is used to specify the +As the example above shows, <tt>return</tt> is used to specify the return value of a function. The value after <tt>return</tt> must be of the type specified before the function name. If the function is specified to return <tt>void</tt>, nothing at all should be written after <tt>return</tt>. @@ -445,7 +446,6 @@ As you saw in our first examples we have to indicate the type of value returned The others are <tt>mapping</tt>, <tt>mixed</tt>, <tt>void</tt>, <tt>float</tt>, <tt>multiset</tt>, <tt>function</tt>, <tt>object</tt> and <tt>program</tt>. Neither <tt>mixed</tt> nor <tt>void</tt> are really types, <tt>void</tt> signifies that no value should be returned and <tt>mixed</tt> that the return value can be of any type, or that the variable can contain any type of value. <tt>Function</tt>, <tt>object</tt> and <tt>program</tt> are all types related to object orientation. We will not discuss the last three in any great detail here, -in this short Pike overview. You can, however, read more at <a href=http://pike.infovav.se/>the pike home page</a>. There you'll also find more details on the other data types and the operations that it is possible to perform on each of them. <dl> <dt>Int @@ -453,32 +453,46 @@ in this short Pike overview. You can, however, read more at <a href=http://pike. <dt>Float <dd>This variable type stores a floating point number. <dt>Array -<dd>Arrays are basically a place to store a number of other values. Arrays in Pike are allocated blocks of values. They are dynamically allocated and do not need to be declared as in C. The values in the array can be set when creating the array like this, -<pre> +<dd>Arrays are basically a place to store a number of other values. +Arrays in Pike are allocated blocks of values. +They are dynamically allocated and do not need to be declared as in C. +The values in the array can be set when creating the array like this: +<example language=pike> arr=({1,2,3}); -</pre> -or anytime afterwards like this, -<pre> - arr[index]=data; -</pre> -where index is an integer, i.e. entry number index is set to data. The first index of an array is 0 (zero). A negative index will count from the end of the array rather than from the beginning, -1 being the last element. -To indicate an array of a certain type of value you can use the * operator, e.g. -<pre> - string *i; -</pre> -which tells us that i is an array of strings. The * binds to the variable name, not to the type, so writing -<pre> - string *i, j; -</pre> -will declare one array of strings and one string. However, it's much clearer to write -<pre> +</example> +Or, if you have already created an array, you can change the values +in the array like this: +<example language=pike> + <i>arr</i> [ <i>ind</i> ] = <i>data</i>; +</example> +This sets entry number <i>ind</i> in the array <i>arr</i> to <i>data</i>. +<i>ind</i> must be an integer. +The first index of an array is 0 (zero). A negative index will count from the end of the array rather than from the beginning, -1 being the last element. + +To declare that a variable is an array we simply type <tt>array</tt> in +front of the variable name we want: +<example language=pike> + array i; +</example> + +We can also declare several array variables on the same line: +<example language=pike> + string i, j; +</example> +If we want to specify that the variable should hold an array of strigngs, +we would write: +<example language=pike> array (string) i; -</pre> +</example> <dt>String -<dd>A string contains a sequence of characters, a text, i.e. a word, a sentence, or a book. Note that this is not simply the letters A to Z; special characters, null characters, newlines and so on can all be stored in a string. Any 8-bit character is allowed. String is a basic type in Pike, as opposed to C where strings are represented by an array of char. This means that you cannot assign new values to individual characters in a string. +<dd>A string contains a sequence of characters, a text, i.e. a word, a sentence or a book. +Note that this is not simply the letters A to Z; special characters, null characters, newlines and so on can all be stored in a string. +Any 8-bit character is allowed. +String is a basic type in Pike, it is not an array of char like it is in C. +This means that you cannot assign new values to individual characters in a string. Also, all strings are "shared", i.e. if the same string is used in several places, it will be stored in memory only once. -When writing a string in a program, you enclose it in doublequotes. To write special characters you need to use the following syntax; +When writing a string in a program, you enclose it in doublequotes. To write special characters you need to use the following syntax: <table> <tr><td><li>\n</td><td>newline</td></tr> <tr><td><li>\r</td><td>carriage return</td></tr> @@ -489,24 +503,30 @@ When writing a string in a program, you enclose it in doublequotes. To write spe </table> <dt>Mapping <dd>A mapping is basically an array that can be indexed on any type, not just integers. It can also be seen as a way of linking data (usually strings) together. It consists of a lot of index-data pairs which are linked togeter in such a way that map[index1] returns data1. -A mapping can be created in a way similar to arrays; -<pre> +A mapping can be created in a way similar to arrays: +<example language=pike> map=([five:good, ten:excellent]); -</pre> +</example> You can also set that data by writing map[five]=good. If you try to set an index in a mapping that isn't already present in the mapping it will be added as well. <dt>Multiset -<dd>A multiset is basically a mapping without data values. When referring to an index of the multiset a 1 (one) will be returned if the index is present, 0 (zero) otherwise. +<dd>A multiset is basically a mapping without data values. When referring to an index in the multiset a 1 (one) will be returned if the index is present and 0 (zero) otherwise. </dl> </section> </chapter> <chapter title="A more elaborate example"> - -To illustrate several of the fundamental points of Pike we will now introduce an example program, that will be extended as we go. We will build a database program that keeps track of a record collection and the songs on the records. -In the first version we hard-code our "database" into the program. The database is a mapping where the index is the record name and the data is an array of strings. The strings are of course the song names. The default register consists of one record. -<pre> +<!-- FIXME: explain things AFTER showing the code? --> +To illustrate several of the fundamental points of Pike we will now +introduce an example program, that will be extended as we go. +We will build a database program that keeps track of a record +collection and the songs on the records. In the first version we +hard-code our "database" into the program. The database is a mapping +where the index is the record name and the data is an array of strings. +The strings are of course the song names. The default register consists +of one record. +<example language=pike> #!/usr/local/bin/pike mapping (string:array(string)) records = @@ -528,10 +548,10 @@ In the first version we hard-code our "database" into the program. The database "Finale" }) ]); -</pre> +</example> We want to be able to get a simple list of the records in our database. The function <tt>list_records</tt> just goes through the mapping <tt>records</tt> and puts the indices, i.e. the record names, in an array of strings, record_names. By using the builtin function <tt>sort</tt> we put the record names into the array in alphabetical order which might be a nice touch. For the printout we just print a header, "Records:", followed by a newline. Then we use the loop control structure for to traverse the array and print every item in it, including the number of the record, by counting up from zero to the last item of the array. The builtin function sizeof gives the number of items in an array. The printout is formatted through the use of <tt>sprintf</tt> which works more or less like the C function of the same name. -<pre> +<example language=pike> void list_records() { int i; @@ -541,9 +561,9 @@ For the printout we just print a header, "Records:", followed by a newline. Then for(i=0;i<sizeof(record_names);i++) write(sprintf("%3d: %s\n", i+1, record_names[i])); } -</pre> +</example> If the command line contained a number our program will find the record of that number and print its name along with the songs of this record. First we create the same array of record names as in the previous function, then we find the name of the record whose number (num) we gave as an argument to this function. Next we put the songs of this record in the array <tt>songs</tt> and print the record name followed by the songs, each song on a separate line. -<pre> +<example language=pike> void show_record(int num) { int i; @@ -555,9 +575,11 @@ If the command line contained a number our program will find the record of that for(i=0;i<sizeof(songs);i++) write(sprintf("%3d: %s\n", i+1, songs[i])); } -</pre> -The main function doesn't do much; it checks whether there was anything on the command line after the invocation. If this is not the case it calls the list_records function, otherwise it sends the given argument to the show_record function. When either one of those functions is done the program just quits. -<pre> +</example> +The main function doesn't do much; it checks whether there was anything on the command line after the invocation. +If this is not the case it calls the list_records function, otherwise it sends the given argument to the show_record function. +When the called function is done the program just quits. +<example language=pike> int main(int argc, array (string) argv) { if(argc <= 1) @@ -567,7 +589,7 @@ The main function doesn't do much; it checks whether there was anything on the c show_record((int) argv[1]); } } -</pre> +</example> <section title="Taking care of input"> Now, it would be better and more general if we could enter more records into our database. Let's add such a function and modify the <tt>main()</tt> function to accept "commands". @@ -585,12 +607,12 @@ If it is a "." we return a null value that will be used in the while statement t If it is not a dot, the string will be added to the array of songs for this record, unless it's an empty string. Note the <tt>+=</tt> operator. It is the same as saying <tt>records[record_name]=records[record_name]+({song})</tt>. -<pre> +<example language=pike> void add_record() { string record_name=readline("Record name: "); records[record_name]=({}); - write("Input song names, one per line. End with '.' on its own line.\n"); + write("Input song names, one per line. End with '.' on its own line.\n"); while(1) { string song; @@ -602,18 +624,29 @@ Note the <tt>+=</tt> operator. It is the same as saying records[record_name]+=({song}); } } -</pre> +</example> </section> <section title="main()"> -The main function now does not care about any command line arguments. Instead we use <tt>readline()</tt> to prompt the user for instructions and arguments. The available instructions are "add", "list" and "quit". What you enter into the variables cmd and args is checked in the <tt>switch()</tt> block. If you enter something that is not covered in any of the case statements the program just silently ignores it and asks for a new command. +The main function now does not care about any command line arguments. +Instead we use <tt>readline()</tt> to prompt the user for instructions +and arguments. The available instructions are "add", "list" and "quit". +What you enter into the variables cmd and args is checked in the +<tt>switch()</tt> block. If you enter something that is not covered +in any of the case statements the program just silently ignores it and +asks for a new command. In a <tt>switch()</tt> the argument (in this case cmd) is checked in the case statements. The first case where the expression equals cmd (the argument) then executes the statement after the colon. If no expression is equal, we just fall through without any action. -The only command that takes an argument is "list" which works like the first version of the program; if there is an argument that record is shown along with its songs, and if there isn't the program sends a list of the records in the database. When the program returns from either of the listing functions, the break instruction tells the program to jump out of the <tt>switch()</tt> block. + +The only command that takes an argument is "list" which works like the first version of the program. +If "list" receives an argument that record is shown along with all the songs +on it. If there is no argument it shows a list of the records in the database. + + When the program returns from either of the listing functions, the break instruction tells the program to jump out of the <tt>switch()</tt> block. "Add" of course turns control over to the function described above. If the command given is "quit" the <tt>exit(0)</tt> statement stops the execution of the program and returns 0 (zero) to the operating systems, telling it that everything was ok. -<pre> - int main(int argc, string * argv) +<example language=pike> + int main(int argc, array(string) argv) { string cmd; while(cmd=readline("Command: ")) @@ -641,30 +674,32 @@ If the command given is "quit" the <tt>exit(0)</tt> statement stops the executio } } } -</pre> +</example> </section> </section> <section title="Communicating with files"> Now if we want to save the database and also be able to retrieve previously stored data we have to communicate with the environment, i.e. with files on disk. -Now we will introduce you to programming with objects. To open a file, be it for writing or for reading, we will use one of the programs which is builtin in Pike, it is called <tt>Stdio.File</tt>. -To Pike, a program is a data type which contans code, functions and variables. -A program can be <i>cloned</i>, i.e. Pike can create an data area in memory for the program, place a reference to the program in the data area, and initialize it to act on the data file in question. The methods (ie. functions in the objct) and variables in the object Stdio.File enables us to perform actions on the associated data file. -The methods we need to use are open, read, write and close. See <link to=io> +Now we will introduce you to programming with objects. +To open a file for reading or writing we will use one of the programs which is builtin in Pike called <tt>Stdio.File</tt>. +To Pike, a program is a data type which contains code, functions and variables. +A program can be <i>cloned</i> which means that Pike creates an data area + in memory for the program, place a reference to the program in the data area, and initialize it to act on the data file in question. The methods (ie. functions in the object) and variables in the object Stdio.File enables us to perform actions on the associated data file. +The methods we need to use are open, read, write and close. See <ref to=io> for more details. <p> <section title="save()"> First we clone a <tt>Stdio.File</tt> program to the object <tt>o</tt>. -Then we use it to open the file whose name is given in the string file_name for writing. +Then we use it to open the file whose<!-- FIXME: which instead of whose? --> name is given in the string file_name for writing. We use the fact that if there is an error during opening, open() will return a false value which we can detect and act upon by exiting. The arrow operator (->) is what you use to access methods and variables in an object. If there is no error we use yet another control structure, <tt>foreach</tt>, to go through the mapping <tt>records</tt> one record at a time. We precede record names with the string "Record: " and song names with "Song: ". We also put every entry, be it song or record, on its own line by adding a newline to everything we write to the file.<br> Finally, remember to close the file. -<pre> +<example language=pike> void save(string file_name) { string name, song; @@ -686,7 +721,7 @@ Finally, remember to close the file. o->close(); } -</pre> +</example> </section> @@ -696,8 +731,8 @@ The <tt>load</tt> function begins much the same, except we open the file named < When receiving data from the file we put it in the string <tt>file_contents</tt>. The abscense of arguments to the method o->read means that the reading should not end until the end of the file. After having closed the file we initialise our database, i.e. the mapping records. Then we have to put <tt>file_contents</tt> into the mapping and we do this by splitting the string on newlines (cf. the split operator in Perl) using the division operator. Yes, that's right: by dividing one string with another we can obtain an array consisting of parts from the first. And by using a <tt>foreach</tt> statement we can take the string <tt>file_contents</tt> apart piece by piece, putting each piece back in its proper place in the mapping records. -<pre> - void load(string file_nae) +<example language=pike> + void load(string file_name) { object o; string name="ERROR"; @@ -734,13 +769,13 @@ After having closed the file we initialise our database, i.e. the mapping record } } } -</pre> +</example> </section> <section title="main() revisited"> <tt>main()</tt> remains almost unchanged, except for the addition of two case statements with which we now can call the load and save functions. Note that you must provide a filename to load and save, respectively, otherwise they will return an error which will crash the program. -<pre> +<example language=pike> case "save": save(args); break; @@ -748,7 +783,7 @@ After having closed the file we initialise our database, i.e. the mapping record case "load": load(args); break; -</pre> +</example> <p> </section> </section> @@ -758,23 +793,25 @@ Now let's add the last functions we need to make this program useful: the abilit <p> <section title="delete()"> -If you sell one of your records it might be nice to able to delete that entry from the database. The delete function is quite simple; first we set up an array of record names (cf. the <tt>list_records</tt> function). Then we find the name of the record of the number num and use the builtin function <tt>m_delete()</tt> to remove that entry from <tt>records</tt>. -<pre> +If you sell one of your records it might be nice to able to delete that entry from the database. The delete function is quite simple. +First we set up an array of record names (cf. the <tt>list_records</tt> function). +Then we find the name of the record of the number <tt>num</tt> and use the builtin function <tt>m_delete()</tt> to remove that entry from <tt>records</tt>. +<example language=pike> void delete_record(int num) { - string *record_names=sort(indices(records)); + array(string) record_names=sort(indices(records)); string name=record_names[num-1]; m_delete(records,name); } -</pre> +</example> </section> <section title="search()"> Searching for songs is quite easy too. To count the number of <tt>hits</tt> we declare the variable hits. Note that it's not necessary to initialise variables, that is done automatically when the variable is declared if you do not do it explicitly. To be able to use the builtin function <tt>search()</tt>, which searches for the presence of a given string inside another, we put the search string in lowercase and compare it with the lowercase version of every song. The use of <tt>search()</tt> enables us to search for partial song titles as well. When a match is found it is immediately written to standard output with the record name followed by the name of the song where the search string was found and a newline. If there were no hits at all, the function prints out a message saying just that. -<pre> +<example language=pike> void find_song(string title) { string name, song; @@ -796,12 +833,12 @@ If there were no hits at all, the function prints out a message saying just that if(!hits) write("Not found.\n"); } -</pre> +</example> </section> <section title="main() again"> Once again <tt>main()</tt> is left unchanged, except for yet another two case statements used to call the <tt>search()</tt> and <tt>delete</tt> functions, respectively. Note that you must provide an argument to delete or it will not work properly. -<pre> +<example language=pike> case "delete": delete_record((int)args); break; @@ -809,20 +846,19 @@ Once again <tt>main()</tt> is left unchanged, except for yet another two case st case "search": find_song(args); break; -</pre> +</example> </section> </section> <section title="Then what?"> Well that's it! The example is now a complete working example of a Pike program. But of course there are plenty of details that we haven't attended to. Error checking is for example extremely sparse in our program. This is left for you -to do as you continue to reed this book. The complete listing of this example can be found in <link to=register_program>. Read it, study it and enjoy! +to do as you continue to read this book. The complete listing of this example can be found in <ref to=register_program>. Read it, study it and enjoy! <p> </section> <section title="Simple exercises"> -<table cellpadding=10 width="100%" border=1 cellspacing=0> -<tr><td> +<box> <ul> <li> Make a program which writes hello world 10 times. <li> Modify hello_world.pike to write the first argument to the program. @@ -839,8 +875,7 @@ to do as you continue to reed this book. The complete listing of this example ca available number of records. <li> Rewrite the register program and put all the code in main(). </ul> -</td></tr> -</table> +</box> </section> </chapter> @@ -975,14 +1010,14 @@ executed if the expression is true. Then the expression is evaluated again, and if it is true the statement is executed again. Then it evaluates the expression again and so forth... Here is an example of how it could be used: -<pre> +<example language=pike> int e=1; while(e<5) { show_record(e); e=e+1; } -</pre> +</example> This would call show_record with the values 1, 2, 3 and 4. </section> @@ -1008,10 +1043,10 @@ For does the following steps: <li> Starts over from 2. </ol> This means that the example in the while section can be written like this: -<pre> +<example language=pike> for(int e=1; e<5; e=e+1) show_record(e); -</pre> +</example> </section> <section title="do-while"> @@ -1032,11 +1067,11 @@ expression is <b>true</b> it executes the loop again. For instance, if you want to make a program that lets your modem dial your internet provider, it could look something like this: <!-- Can someone come up with a better example? --> -<pre> +<example language=pike> do { modem->write("ATDT441-9109\n"); // Dial 441-9109 } while(modem->gets()[..6]] != "CONNECT"); -</pre> +</example> This example assumes you have written something that can communicate with the modem by using the functions <tt>write</tt> and <tt>gets</tt>. @@ -1056,11 +1091,12 @@ We have already seen an example of <tt>foreach</tt> in the <tt>find_song</tt> function in chapter 2. What foreach does is: <ol> <li> It evaluates the <i>array expression</i> which must return an array. +<li> If the array is empty, exit the loop. <li> It then assigns the first element from the array to the <i>variable</i>. <li> Then it executes the <i>statement</i>. <li> If there are more elements in the array, the next one is assigned to the <i>variable</i>, otherwise exit the loop. -<li> Go to point 3. +<li> Go to point 4. </ol> <tt>Foreach</tt> is not really necessary, but it is faster and clearer than doing the same thing with a <tt>for</tt> loop, as shown here: @@ -1083,29 +1119,29 @@ that is still missing is the ability to exit a loop in the middle of it. There are three ways to do this: <section title="break"> -Break exits a loop or switch statement immediately and continues -executing after the loop. Break can not be used outside of a loop or +<tt>Break</tt><!-- FIXME: liten bokstav? --> exits a loop or switch statement immediately and continues +executing after the loop. <tt>Break</tt> can not be used outside of a loop or switch. It is quite useful in conjunction with <tt>while(1)</tt> to construct command parsing loops for instance: -<pre> +<example language=pike> while(1) { string command=readline("> "); if(command=="quit") break; do_command(command); } -</pre> +</example> </section> <section title="continue"> -Continue does almost the same thing as <tt>break</tt>, except instead of +<tt>Continue</tt> does almost the same thing as <tt>break</tt>, except instead of breaking out of the loop it only breaks out of the loop body. It then continues to execute the next iteration in the loop. For a <tt>while</tt> loop, this means it jumps up to the top again. For a <tt>for</tt> loop, it jumps to the incrementor expression. For a <tt>do-while</tt> loop it jumps down to the -expression at the end. To continue our example above, continue can be used +expression at the end. To continue our example above, <tt>continue</tt> can be used like this: -<pre> +<example language=pike> while(1) { string command=readline("> "); @@ -1113,30 +1149,30 @@ like this: if(command=="quit") break; do_command(command); } -</pre> +</example> This way, <tt>do_command</tt> will never be called with an empty string as argument. </section> <section title="return"> -Return doesn't just exit the loop, it exits the whole function. We have seen -several examples how how to use it chapter 2. None of the functions in chapter +<tt>Return</tt> doesn't just exit the loop, it exits the whole function. We have seen +several examples how to use it chapter 2. None of the functions in chapter two returned anything in particular however. To do that you just put the return -value right after the <tt>return</tt>. Of course the type of the return value +value right after <tt>return</tt>. Of course the type of the return value must match the type in the function declaration. If your function declaration -is <tt>int main()</tt> the value after the return must be an <b>int</b>. +is <tt>int main()</tt> the value after <tt>return</tt> must be an <b>int</b>. For instace, if we wanted to make a program that always returns an error code to the system, just like the UNIX command <tt>false</tt> this is how it would be done: -<pre> +<example language=pike> #!/usr/local/bin/pike int main() { return 1; } -</pre> +</example> This would return the error code <tt>1</tt> to the system when the program is run. </section> @@ -1144,8 +1180,7 @@ is run. <section title=Exercises> -<table cellpadding=10 width="100%" border=1 cellspacing=0> -<tr><td> +<box> <ul> <li> End all functions in the examples in chapter two with a return statement. <li> Change all <tt>foreach</tt> loops to <tt>for</tt> or <tt>while</tt> loops. @@ -1159,9 +1194,7 @@ is run. <li> Modify the program in the previous exercise to NOT write numbers dividable by 3, 7 or 17. <li> Make a program that writes all the prime numbers between 1 to 1000. </ul> -</td></tr> -</table> - +</box> </section> </chapter> @@ -1171,8 +1204,8 @@ In this chapter we will discuss all the different ways to store data in Pike in detail. We have seen examples of many of these, but we haven't really gone into how they work. In this chapter we will also see which operators and functions work with the different types. -There are two categories of data types in Pike: <b>atomic types</b>, and -<b>pointer types</b>. The difference is that atomic types are copied when +There are two categories of data types in Pike: <b>basic types</b>, and +<b>pointer types</b>. The difference is that basic types are copied when assigned to variable. With pointer types, merely the pointer is copied, that way you get two variables pointing to the same thing. <p> @@ -1223,6 +1256,8 @@ Also note these functions: </section> <section title="float"> +<!-- FIXME: Du borde skriva n�got om att float och int inte �r kompatibla och ingen +implicit casting sker som i C++ --> Although most programs only use integers, they are unpractical when doing trigonometric calculations, transformations or anything else where you need decimals. For this purpose you use <tt>float</tt>. Floats are normally @@ -1266,10 +1301,10 @@ Also, these functions operates on floats: <dd>This computes the square root of <i>x</i>. <dt><tt>float floor(float <i>x</i>)</tt> -<dd>This function computes the highest integer value lower or equal to <i>x</i>. +<dd>This function computes the highest integer value lower or equal to <i>x</i>. Note that the value is returned as a <tt>float</tt>, not an <tt>int</tt>. <dt><tt>float ceil(float <i>x</i>)</tt>, -<dd>This function computes the lowest integer value higher or equal to <i>x</i>. +<dd>This function computes the lowest integer value higher or equal to <i>x</i> and returns it as a <tt>float</tt>. </dl> </section> @@ -1307,10 +1342,10 @@ other, they will be concatenated into one string. <p> Although a string is an array, you can not change the individual characters in the string. Instead you have to construct a new string, here is an example of how: -<pre> +<example language=pike> string s = "hello torld"; s=s[..5]+"w"+s[7..]; -</pre> +</example> <p> All the comparison operators plus the operators listed here can be used on strings: <dl> @@ -1326,7 +1361,7 @@ All the comparison operators plus the operators listed here can be used on strin The first character is index zero. <dt> Range <dd> The range operator will let you copy any part of the string into a - new string. + new string. Example: <tt>"foobar"[2..4]</tt> will return <tt>"oba"</tt>. <dt> Division <dd> Divison will let you divide a string at every occurance of a word or character. For instance if you do <tt>"foobargazonk" / "o"</tt> the @@ -1396,7 +1431,7 @@ values you want in the array with <tt>({ })</tt> like this: ({ }) // Empty array ({ 1 }) // Array containing one element of type int ({ "" }) // Array containing a string - ({ "", 1, 3.0 }) // Array of three elements, each of different types + ({ "", 1, 3.0 }) // Array of three elements, each of different type </pre> As you can see, each element in the array can contain any type of value. Indexing and ranges on arrays works just like on strings, except with @@ -1496,22 +1531,24 @@ use the operators <tt>></tt>, <tt>>=</tt>, <tt><</tt> or <tt><=</tt> <dt><tt>array rows(array <i>a</i>, array <i>indexes</i>)</tt> <dd>This function is similar to <tt>column</tt>. It indexes <i>a</i> with - each element from <i>indexes</i> and returns the results in in an array. + each element from <i>indexes</i> and returns the results in an array. For example: <tt>rows( ({"a","b","c"}), ({ 2,1,2,0}) ) </tt> will return <tt>({"c","b","c","a"})</tt>. -<dt><tt>array search(array <i>haystack</i>, mixed <i>needle</i>)</tt> -<dd>This function returns the first occurance of an element equal to - <i>needle</i> in the array <i>haystack</i>. +<dt><tt>int search(array <i>haystack</i>, mixed <i>needle</i>)</tt> +<dd>This function returns the index of the first occurance of an element + equal (tested with <tt>==</tt>) to <i>needle</i> in the array + <i>haystack</i>. -<dt><tt>array sizeof(mixed <i>arr</i>)</tt> + +<dt><tt>int sizeof(mixed <i>arr</i>)</tt> <dd>This function returns the number of elements in the array <i>arr</i> <dt><tt>array sort(array <i>arr</i>, array ... <i>rest</i>)</tt> <dd>This function sorts <i>arr</i> in smaller-to-larger order. Numbers, floats and strings can be sorted. If there are any additional arguments, they will be permutated in the same manner as <i>arr</i>. See - <link to=functions> for more details. + <ref to=functions> for more details. <dt><tt>array uniq(array <i>a</i>)</tt> <dd>This function returns a copy of the array <i>a</i> with all duplicate @@ -1601,7 +1638,7 @@ The following operators and functions are important to use mappings: <dd>This function returns the index of the 'first' index-value pair which has the value <i>val</i>. <dt><tt>int sizeof(mapping <i>m</i>)</tt> -<dd><tt>Sizeof</tt> returns how many index-value pairs there is in the mapping. +<dd><tt>Sizeof</tt> returns how many index-value pairs there are in the mapping. <dt><tt>array values(mapping <i>m</i>)</tt> <dd>This function does the same as <tt>indices</tt>, but returns an array with all the values instead. If <tt>indices</tt> and <tt>values</tt> are called on the same mapping after each other, without any other mapping operations in between, the returned arrays will be in the same order. They can in turn be used as arguments to <tt>mkmapping</tt> to rebuild the mapping <i>m</i> again. @@ -1639,7 +1676,7 @@ Note that you can actually have two of the same index in a multiset. This is normally not used, but can be practical at times. </section> -<section title="program" alias=programs> +<section title="program" name=programs> Normally, when we say <b>program</b> we mean something we can execute from a shell prompt. However, Pike has another meaning for the same word. In Pike @@ -1661,13 +1698,13 @@ Writing a <tt>program</tt> is easy, in fact, every example we have tried so far has been a <tt>program</tt>. To load such a program into memory, we can use <tt>compile_file</tt> which takes a file name, compiles the file and returns the compiled program. It could look something like this: -<pre> +<example language=pike> program p = compile_file("hello_world.pike"); -</pre> +</example> You can also use the <b>cast</b> operator like this: -<pre> +<example language=pike> program p = (program) "hello_world"; -</pre> +</example> This will also load the program <tt>hello_world.pike</tt>, the only difference is that it will cache the result so that next time you do <tt>(program)"hello_world"</tt> you will receive the _same_ program. If you call <tt>compile_file("hello_world.pike")</tt> repeatedly you will get a new program @@ -1689,7 +1726,7 @@ This is very similar to how classes are written in C++ and can be used in much the same way. It can also be used to create <b>structs</b> (or records if you program Pascal). Let's look at an example: -<pre> +<example language=pike> class record { string title; string artist; @@ -1707,12 +1744,12 @@ in much the same way. It can also be used to create <b>structs</b> { write("Record name: "+rec->title+"\n"); write("Artist: "+rec->artist+"\n"); - write("Songs:\n"); - foreach(rec->songs, string song) + write("Songs:\n"); + foreach(rec->songs, string song) write(" "+song+"\n"); } -</pre> +</example> This could be a small part of a better record register program. It is not a complete executable program in itself. In this example we create a <tt>program</tt> called <tt>record</tt> which has three identifiers. @@ -1780,7 +1817,7 @@ Each object has its own set of variables, and when calling a function in that object, that function will operate on those variables. If we take a look at the short example in the section about programs, we see that it would be better to write it like this: -<pre> +<example language=pike> class record { string title; string artist; @@ -1807,7 +1844,7 @@ better to write it like this: { rec->show(); } -</pre> +</example> Here we can clearly see how the function <tt>show</tt> prints the contents of the variables in that object. In essence, instead of accessing the data in the object with the <tt>-></tt> operator, we call a function @@ -1864,7 +1901,7 @@ Functions and operators relevant to objects: <section title="function"> When indexing an object on a string, and that string is the name of a function -in the object a <tt>function</tt> is returned. Despite is name, a +in the object a <tt>function</tt> is returned. Despite iss name, a <tt>function</tt> is really a <b>function pointer</b>. <center> <image xfig=function><br> @@ -1875,12 +1912,12 @@ When the function pointer is called, the interpreter sets <tt>this_object()</tt> to the object in which the function is located and procedes to execute the function it points to. Also note that function pointers can be passed around just like any other data type: -<pre> +<example language=pike> int foo() { return 1; } function bar() { return foo; } - void gazonk() { return foo(); } - void teleledningsanka() { return bar()(); } -</pre> + int gazonk() { return foo(); } + int teleledningsanka() { return bar()(); } +</example> In this example, the function bar returns a pointer to the function <tt>foo</tt>. No indexing is necessary since the function <tt>foo</tt> is located in the same object. The function <tt>gazonk</tt> simply calls @@ -1898,9 +1935,9 @@ syntax is the same as for a normal function, except you write </pre> The major differeance is that this is an expression that can be used inside other function. Example: -<pre> +<example language=pike> function bar() { return lambda() { return 1; }; ) -</pre> +</example> This is the same as the first two lines in the previous example, the keyword <tt>lambda</tt> allows you to write the function inside <tt>bar</tt>. <p> @@ -1939,7 +1976,7 @@ Instead it just creates another reference to the memory object. In most situations this does not present a problem, and it speeds up Pikes performance. However, you must be aware of this when programming. This can be illustrated with an example: -<pre> +<example language=pike> int main(int argc, array(string) argv) { array(string) tmp; @@ -1947,7 +1984,7 @@ This can be illustrated with an example: argv[0]="Hello world.\n"; write(tmp[0]); } -</pre> +</example> This program will of course write <tt>Hello world.</tt> <p> Sometimes you want to create a copy of a mapping, array or object. To @@ -1979,7 +2016,7 @@ than that, let's look at a few examples: mapping(string:int) x; // x is a mapping mapping from int to string object(Stdio.File) x; // x is a clone of Stdio.File - // x is a function that takes two integers arguments and returns a string + // x is a function that takes two integer arguments and returns a string function(int,int:string) x; // x is a function taking any amount of integer arguments and returns nothing. @@ -2031,7 +2068,7 @@ Here is a list of what is possible: </chapter> -<chapter title="Operators" alias=operators> +<chapter title="Operators" name=operators> To make it easier to write Pike, and to make the code somewhat shorter, some functions can be called with just one or two characters in the code. @@ -2199,8 +2236,8 @@ the complete list of combinations of types you can use with these operators: <section title="Comparison operators"> The arithmetic operators would be hard to use for something interesting -without the ability to compare them to each other. For this purpose there -are six comparison operators: +without the ability to compare the results to each other. +For this purpose there are six comparison operators: <center> <p> @@ -2243,7 +2280,7 @@ can not be called as normal functions. There are four logical operators: <tr><td>And</td> <td>a && b</td> <td>If a is false, a is returned and b is not evaluated. Otherwise, b is returned.</td></tr> <tr><td>Or</td> <td>a || b</td> <td>If a is true, a is returned and b is not evaluated. Otherwise, b is returned.</td></tr> <tr><td>Not</td> <td>! a</td> <td>Returns 0 if a is true, 1 otherwise.</td></tr> -<tr><td>If-else</td> <td>a ? b : c</td> <td>If a is true, b is returned and c is not evaluated. Otherwise c is returned and a is not evaluated.</td></tr> +<tr><td>If-else</td> <td>a ? b : c</td> <td>If a is true, b is returned and c is not evaluated. Otherwise c is returned and b is not evaluated.</td></tr> </table> </center> </section> @@ -2297,11 +2334,11 @@ complex data type. <table border=1> <tr><th>Function</th> <th>Syntax</th> <th>Identifier</th> <th>Returns</th></tr> <tr><td>Index</td> <td>a [ b ]</td><td>`[]</td> <td>Returns the index b from a.</td></tr> -<tr><td>Lookup</td> <td>a -><i>identifier</i></td> <td>`-></td> <td>Looks up the identifer. Same as a["<i>identifeir</i>"].</td></tr> +<tr><td>Lookup</td> <td>a -><i>identifier</i></td> <td>`-></td> <td>Looks up the identifier. Same as a["<i>identifeir</i>"].</td></tr> <tr><td>Assign index</td> <td>a [ b ] = c</td><td>`[]=;</td><td>Sets the index b in a to c.</td></tr> <tr><td>Assign index</td> <td>a -><i>identifier</i> = c</td><td>`->=</td><td>Sets the index "<i>identifier</i>" in a to c.</td></tr> <tr><td>Range</td> <td>a [ b .. c]</td> <td>`[..]</td> <td>Returns a slice of a starting at the index b and ending at c.</td></tr> -<tr><td>Range</td> <td>a [ .. c]</td> <td>`[..]</td> <td>Returns a slice of a starting at the beginning av a and ending at b.</td></tr> +<tr><td>Range</td> <td>a [ .. c]</td> <td>`[..]</td> <td>Returns a slice of a starting at the beginning av a and ending at c.</td></tr> <tr><td>Range</td> <td>a [ b .. ]</td> <td>`[..]</td> <td>Returns a slice of a from the index b to the end of a.</td></tr> </table> <p> @@ -2310,7 +2347,9 @@ complex data type. The index operator can be written in two different ways. It can be written as <tt><i>ob</i> [ <i>index</i> ]</tt> or <tt><i>ob</i>-><i>identifier</i></tt>. However, the latter syntax is -equal to <tt><i>ob</i> [ "<i>identifier</i>" ]</tt>. You can only +equal to <tt><i>ob</i> [ "<i>identifier</i>" ]</tt>. + +You can only index strings, arrays, mapping, multisets and objects, and some of these can only be indexed on certain things as shown in this list: <p> @@ -2337,7 +2376,7 @@ can only be indexed on certain things as shown in this list: <td><tt> <i>multiset</i>[<i>mixed</i>]<br> <i>multiset</i>-><i>identifier</i> - </tt></td><td>Returns 1 if the index is present in the multiset, 0 otherwise.</td> + </tt></td><td>Returns 1 if the index (the value between the brackets) is present in the multiset, 0 otherwise.</td> </tr> @@ -2376,18 +2415,39 @@ can only be indexed on certain things as shown in this list: <td><tt> <i>object</i>[<i>string</i>]=<i>mixed</i><br> <i>object</i>-><i>identifier</i>=<i>mixed</i><br> - </tt></td><td>Set the given identifer in the object to the mixed value. Only works if the identifier references a variable on the object.</td> + </tt></td><td>Set the given identifier in the object to the mixed value. Only works if the identifier references a variable in the object.</td> </tr> <tr> -<td><tt><i>string</i>[<i>int</i>..<i>int</i>]</tt></td><td>Return a piece of the string.</td> +<td><tt><i>string</i>[<i>int</i>..<i>int</i>]</tt></td><td>Returns a piece of the string.</td> </tr> <tr> -<td><tt><i>array</i>[<i>int</i>..<i>int</i>]</tt></td><td>Return a slice of the array.</td> +<td><tt><i>array</i>[<i>int</i>..<i>int</i>]</tt></td><td>Returns a slice of the array.</td> </tr> - </table> + +<p> +When indexing an <tt>array</tt> or <tt>string</tt> it is sometimes convenient +to access index from the end instead of from the beginning. This function +can be performed by using a negative index. Thus <tt> arr[-i] </tt> is the +same as <tt>arr[sizeof(arr)-i]</tt>. Note however that this behaviour does +not apply to the range operator. Instead the range operator clamps it's +arguments to a suitable range. This means that +<tt><i>a</i>[<i>b</i>..<i>c</i>]</tt> will be treated as follows: + +<ul> +<li> If <i>b</i> i less than zero, the range will begin at the start + of the array as if <i>b</i> had been zero. +<li> If <i>b</i> is greater or equal to sizeof(<i>a</i>) an empty array/string + will be returned. +<li> If <i>c</i> is less than <i>b</i>, an empty array/string will be + returned. +<li> If <i>c</i> is greater or equal to sizeof(<i>a</i>) the range will + continue to the end of the array/string. +<li> No errors are generated in any of the above cases. +</ul> + </center> </section> @@ -2477,9 +2537,9 @@ clone an object from the program and call create() in the new object with the arguments given. In fact, the function <tt>clone</tt> is implemented like this: <p> -<pre> +<example language=pike> object clone(mixed p, mixed ... args) { ( (program)p )(@args); } -</pre> +</example> <p> On the subject of function calls, the splice operator should also be mentioned. The splice operator is an at sign in front of an expression. The expression @@ -2513,7 +2573,7 @@ possible. Here is a list of all casts that actually _do_ anything: <p> You can also use the cast operator to tell the compiler things. If <tt>a</tt> is a variable of type mixed containing an int, then the -expression <tt>(int)a</tt> can be used intead of <tt>a</tt> and that will +expression <tt>(int)a</tt> can be used instead of <tt>a</tt> and that will tell the compiler that the type of that expression is <tt>int</tt>. <p> Last, and in some respect least, is the comma operator. It doesn't do @@ -2527,8 +2587,8 @@ or to make defines that can be used in expressions. When evaluating an expression, you can always use parenthesis to tell the compiler in which order to evaluate things. Normally, the compiler will evaluate things from left to right, but it will evaluate operators -with higher priority on the below before evaluating operators of lower -priority. +with higher priority before those will lower. The following table shows +how the relative priority of all the operators in descending order: <p> <center> <table border=1 halign=center> @@ -2594,19 +2654,36 @@ look at some examples: <chapter title="Object orientation"> As mention several times, Pike is object oriented. This does not mean that it is identical to C++ in any way. Pike uses a less strict approach to -object orientation which creates a more relaxed programming style. For you -who have never come in contact with object oriented programming before, be +object orientation which creates a more relaxed programming style. If you +have never come in contact with object oriented programming before, be warned that the ideas expressed in Pike and in this chapter are my own and do not necessarily reflect what other people think about object orientated programming. +<section title="Terminology"> +As mentioned before, Pike uses a different terminology than C++ does. +This has historic reasons, but might be changed in the future. In +the meantime, you might benefit from this mini-dictionary which translates +C++-ish to Pike-ish: +<dl> +<dt> a <i>class</i> <dd> a class +<dt> a <i>clone</i> <dd> an instance of a class +<dt> to <i>clone</i> <dd> to create an instance +<dt> an <i>object</i> <dd> an instance of a class +<dt> a <i>program</i> <dd> a class +</dl> +</section> + <section title="The approach"> Think of the data type program as an executable file. Then we clone this program and create an object. The object is then a running program. The object has its own data and its own functions, however, it can work together with other programs by calling functions in those objects. The functions can be thought of as message carriers, tcp sockets or -just a way for programs to communicate. Now we have a running system with +just a way for programs to communicate. + +<!-- FIXME: do something about the following sentence? --> +Now we have a running system with many running programs, each performing only the task it was designed for. <p> This analogy has one major flaw, when running programs in UNIX they actually @@ -2617,7 +2694,7 @@ descussed in a later chapter. </section> <section title="How does this help?"> -Ok, why is it a good idea to use object oriented programming you ask? Well, +Ok, why is it a good idea to use object oriented programming? Well if you beleive what you hear, the biggest advantage is that you can re-use your code in several projects. In my experience this is not the case. <p> @@ -2647,7 +2724,7 @@ object orientation that makes them easy. </section> <section title="Pike and Object Orientation"> -In most object oriented langauges there is a way to write functions outside +In most object oriented languages there is a way to write functions outside of all classes. Some readers might think this is what we have been doing until now. However, in Pike, all functions have to reside within a program. When you write a simple script in Pike, the file is first compiled into a @@ -2683,25 +2760,25 @@ to the class. It is important to know that although the class is defined in the same file as other classes and functions it can not immediately access data in its surroundings. Only constants defined before the class in the same file can be used. Example: -<pre> +<example language=pike> constant x = 17; class foobar { int test() { return x; } }; -</pre> +</example> This works because <tt>x</tt> is a <b>constant</b>. If x had been a variable or function it would not have worked. In future versions of Pike it may be possible to do this with variables as well. To make it easier to progam, defining a class is also to define a constant with that name. Essentially, these two lines of code do the same thing: -<pre> +<example language=pike> class foo {}; constant foo = class {}; -</pre> +</example> Because classes defined as constants, it is possible to use a class defined inside classes you define later, like this: -<pre> +<example language=pike> class foo { int test() { return 17; } @@ -2711,7 +2788,7 @@ inside classes you define later, like this: { program test2() { return foo; } }; -</pre> +</example> <!-- FIXME: tell more --> </section> @@ -2720,17 +2797,17 @@ inside classes you define later, like this: A big part of writing object oriented code is the ability to add functionality to a program without changing (or even understanding) the original code. This is what <tt>inherit</tt> is all about. -Let's say I want to change the hello_world program to write a version number +Let's say I want to change the <tt>hello_world</tt> program to write a version number before it writes hello world, using <tt>inherit</tt> I could do this like this: -<pre> +<example language=pike> inherit "hello_world"; - int main(int argc, string *argv) + int main(int argc, array(string) argv) { write("Hello world version 1.0\n"); return ::main(argc,argv); } -</pre> +</example> What inherit does is that it copies all the variables and functions from the inherited program into the current one. You can then re-define any function or variable you want, and you can call the original one by using a <tt>::</tt> @@ -2767,7 +2844,7 @@ You can inherit any number of programs in one program, you can even inherit the same thing more than once. If you do this you will a separate set of functions and variables for each inherit. To access a specific function you need to name your inherits. Here is an example of named inherits: -<pre> +<example language=pike> inherit Stdio.File; // This inherit is named File inherit Stdio.FILE; // This inherit is named FILE inherit "hello_word"; // This inherit is named hello_world @@ -2783,7 +2860,7 @@ your inherits. Here is an example of named inherits: test2::main(0,({})); // Call main in fourth inherit ::read(); // Read data from all inherits } -</pre> +</example> As you can see it would be impossible to separate the different read and main functions without using inherit names. If you tried calling @@ -2796,13 +2873,13 @@ call all inherited read() functions. If there is more than one inherited read function the results will be returned in an array. <p> Let's look at another example: -<pre> +<example language=pike> #!/usr/local/bin/pike inherit Stdio.File : input; inherit Stdio.File : output; - int main(int argc, string *argv) + int main(int argc, array(string) argv) { output::create("stdout"); for(int e=1;e<sizeof(argv);e++) @@ -2811,7 +2888,7 @@ Let's look at another example: while(output::write(input::read(4096)) == 4096); } } -</pre> +</example> This short piece of code works a lot like the UNIX command <tt>cat</tt>. It reads all the files given on the command line and writes them to stdout. As an example, I have inherited Stdio.File twice to show you @@ -2826,16 +2903,16 @@ choose not to. This may confuse some programmers with previous experience in object oriented programming. </section> -<section title="Modifiers" alias=modifiers> +<section title="Modifiers" name=modifiers> Sometimes, you may wish to hide things from inheriting programs, or prevent functions from being called from other objects. To do so you use <b>modifiers</b>. A modifier is simply a word written before a variable definition, function definition, class definition or an inherit that -specifies how this identifer should interact with other objects and programs. +specifies how this identifier should interact with other objects and programs. These modifiers are available: <dl> <dt><tt>static</tt> -<dd>Static hides this identifer from the index and arrow operators, which +<dd>Static hides this identifier from the index and arrow operators, which makes it impossible for other objects to call this function unless a function pointer to it is returned from inside this program. <dt><tt>nomask</tt> @@ -2843,7 +2920,7 @@ These modifiers are available: programs that inherit this program. <dt><tt>private</tt> <dd>This prevents inheriting programs from accessing this identifier. - Note that inheriting program can still re-define the identifer. + Note that inheriting program can still re-define the identifier. Also note that <tt>private</tt> does not imply <tt>static</tt>. <dt><tt>public</tt> <dd>This is the oppsite of <tt>private</tt>. This is the default for @@ -2855,8 +2932,8 @@ These modifiers are available: When modifiers are used in conjunction with inherit, all the variabels, functions and classes copied from the inherited class will be modified with the keywords used. For instance, <tt>private inherit</tt> means that -the identifers from this inherit will not be available to program inheriting -this program. <tt>static private inherit</tt> will also hide those identifers +the identifiers from this inherit will not be available to program inheriting +this program. <tt>static private inherit</tt> will also hide those identifiers from the index and arrow operators, making the inherit available only to the code in this program. </section> @@ -2874,7 +2951,7 @@ evaluated if you use that particular operation on an object. Note that some of these operators, notably <tt>==</tt> and <tt>!</tt> have default behaviour which will be used if the corresponding method is not defined in the object. Other operators will simply fail if called with objects. Refer to -<link to=operators> for information on which operators can operate on objects +<ref to=operators> for information on which operators can operate on objects without operator overloading. <center> <table border=1> @@ -2916,7 +2993,7 @@ without operator overloading. Here is a really silly example of a program that will write 10 to stdout when executed. -<pre> +<example language=pike> #!/usr/local/bin/pike class three { int `+(int foo) { return 3+foo; } @@ -2926,7 +3003,7 @@ to stdout when executed. { write(sprintf("%d\n",three()+7)); } -</pre> +</example> It is important to know that some optimizations are still performed even when operator overloading is in effect. If you define a multiplication operator @@ -2936,14 +3013,13 @@ expect, in which case you are better off not using operator overloading. </section> <section title="Simple exercises"> -<table cellpadding=10 width="100%" border=1 cellspacing=0> -<tr><td> +<box> <ul> <li> Make a program that clones 10 hello world and then runs main() in each one of them. <li> Modify the register program to use an object for each record. <li> Modify the register program to use the following search funtion: -<pre> +<example language=pike> void find_song(string title) { string name, song; @@ -2962,16 +3038,15 @@ expect, in which case you are better off not using operator overloading. if(!hits) write("Not found.\n"); } -</pre> +</example> </ul> -</td></tr> -</table> +</box> <!-- FIXME add more examples above --> </section> </chapter> -<chapter title="Miscellaneous functions" alias=misc> +<chapter title="Miscellaneous functions" name=misc> There are some 'functions' in pike that are not really functions at all but just as builtin as operators. These special functions can do things that no @@ -2979,7 +3054,7 @@ other functions can do, but they can not be re-defined or overloaded. In this chapter I will describe these functions and why they are implemented as special functions. -<a name=sscanf> +<anchor name=sscanf> <section title="sscanf"> Sscanf may look exactly like a normal function, but normal functions can not set the variables you send to it. The purpose of sscanf is to @@ -3023,7 +3098,7 @@ returns how many % were matched. If this happens, the lvalues for % that were not matched will not be changed. <p> Let's look at a couple of examples: -<pre> +<example language=pike> // a will be assigned "oo" and 1 will be returned sscanf("foo","f%s",a); @@ -3036,15 +3111,15 @@ Let's look at a couple of examples: // Remove "the " from the beginning of a string // If 'str' does not begin with "the " it will not be changed sscanf(str,"the %s",str); -</pre> +</example> <p> -<encaps>SEE ALSO</encaps>: <a href=#sprintf>sprintf</a> +<encaps>SEE ALSO</encaps>: <link to=sprintf>sprintf</link> </section> -</a> +</anchor> -<a name=catch> -<a name=exceptions> -<section title="catch & throw"> +<anchor name=catch> +<anchor name=exceptions> +<section title="catch & throw"> Catch is used to trap errors and other exceptions in Pike. It works by making a block of code into an expression, like this: <pre> @@ -3059,19 +3134,19 @@ The description of the error has the following format: }) </pre> If no error occurs, catch will return zero. You may emulate your own errors -using the function throw, described in <link to=functions>. +using the function throw, described in <ref to=functions>. <p> Example: -<pre> +<example language=pike> int x,y; // This might generate "division by zero" mixed error=catch { x/=y; }; -</pre> +</example> </section> -</a> -</a> +</anchor> +</anchor> -<a name=gauge> +<anchor name=gauge> <section title="gauge"> The syntax for gauge is the same as the syntax for catch: <pre> @@ -3082,25 +3157,25 @@ This can be used to find out how fast your code actually is.. :) Only CPU time used by the pike process is measured. This means that if it takes two seconds to execute but only uses 50% cpu, this function will return 1000. </section> -</a> +</anchor> -<a name=typeof> +<anchor name=typeof> <section title="typeof"> This function retuns the type of an expression as a string. It does not evaluate the expression at all, which might be somewhat confusing. Example: -<pre> +<example language=pike> typeof( exit(1) ) -</pre> +</example> This will return the string <tt>"void"</tt> since exit is a function that returns void. It will not execute the function <tt>exit</tt> and exit the process as you might expect. </section> -</a> +</anchor> </chapter> -<chapter title="Modules" alias=modules> +<chapter title="Modules" name=modules> A module is a software package that plugs into the Pike programming environment. They provide you with simple interfaces to system routines @@ -3211,32 +3286,31 @@ cloned for to find the identifiers. <section title="How to write a module"> Here is an example of a simple module: -<pre> +<example language=pike> constant PI = 3.15; float cos2(float f) { return pow(cos(f),2.0); } -</pre> +</example> if we save this short file as <tt>Trig.pike.pmod</tt> we can now use this module like this: -<pre> +<example language=pike> int main() { write(sprintf("%f\n",Trig.cos2(Trig.PI)); } -</pre> +</example> or like this: -<pre> +<example language=pike> import Trig; int main() { write(sprintf("%f\n",cos2(PI)); } -</pre> +</example> </section> <section title="Simple exercises"> -<table cellpadding=10 width="100%" border=1 cellspacing=0> -<tr><td> +<box> <ul> <li> Save the hello_world.pike program as hello_world.pike.pmod, then make a program that loads this module and calls its main(). @@ -3250,20 +3324,19 @@ or like this: <li> Try putting <tt>Programs.pmod</tt> in another directory, now try to run the programs from the last two examples. </ul> -</td></tr> -</table> +</box> </section> </chapter> -<a name=Stdio> -<chapter title="File I/O" alias=io> +<anchor name=Stdio> +<chapter title="File I/O" name=io> Programming without reading and writing data from files, sockets, keyboard etc. would be quite pointless. Luckily enough, Pike provides you with an object oriented interface to files, pipes and TCP sockets. All I/O functions and classes are collected in the module <tt>Stdio</tt>. -<a name=Stdio.File> +<anchor name=Stdio.File> <section title="Stdio.File"> This is the basic I/O object, it provides socket communication as well as file access. It does not buffer reads and writes or provide line-by-line @@ -3272,7 +3345,7 @@ written in C. What follows is a description of all the functions in <tt>Stdio.File</tt>. <hr noshade size=1> -<a name=Stdio.File.create> +<anchor name=Stdio.File.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->create</tt> - init file struct @@ -3300,13 +3373,13 @@ Alternatively, you can clone a File with "stdin", "stdout" or stream. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#clone>clone</a> and <a href=#Stdio.File.open>Stdio.File->open</a> +<link to=clone>clone</link> and <link to=Stdio.File.open>Stdio.File->open</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.open> +<anchor name=Stdio.File.open> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->open</tt> - open a file @@ -3331,13 +3404,13 @@ contain one or more of the following letters: <p>Returns 1 on success, 0 otherwise. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.close>Stdio.File->close</a> +<link to=Stdio.File.close>Stdio.File->close</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.close> +<anchor name=Stdio.File.close> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->close</tt> - close file @@ -3355,13 +3428,13 @@ respectively. Note that this funciton will not call the close_callback. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.open>Stdio.File->close</a> +<link to=Stdio.File.open>Stdio.File->close</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.read> +<anchor name=Stdio.File.read> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->read</tt> - read data from a file or stream @@ -3386,13 +3459,13 @@ exactly one row or packet at a time. If no arguments are given, read will read to the end of the file/stream. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.write>Stdio.File->write</a> +<link to=Stdio.File.write>Stdio.File->write</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.write> +<anchor name=Stdio.File.write> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->write</tt> - write data to a file or stream @@ -3407,13 +3480,13 @@ actually written. -1 is returned if something went wrong and no bytes had been written. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.read>Stdio.File->read</a> +<link to=Stdio.File.read>Stdio.File->read</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.seek> +<anchor name=Stdio.File.seek> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->seek</tt> - seek to a position in a file @@ -3428,13 +3501,13 @@ position pos relative end of file. Return -1 for failiure, or the old position in the file when successful. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.tell>Stdio.File->tell</a> +<link to=Stdio.File.tell>Stdio.File->tell</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.tell> +<anchor name=Stdio.File.tell> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->tell</tt> - tell where we are in a file @@ -3447,13 +3520,13 @@ the old position in the file when successful. Return the current position in the file. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.seek>Stdio.Fileile->seek</a> +<link to=Stdio.File.seek>Stdio.Fileile->seek</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.stat> +<anchor name=Stdio.File.stat> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->stat</tt> - do file_stat on an open file @@ -3469,13 +3542,13 @@ zero will be returned. Zero is also returned if file is a pipe or socket. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#file_stat>file_stat</a> +<link to=file_stat>file_stat</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.errno> +<anchor name=Stdio.File.errno> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->errno</tt> - what was last error? @@ -3491,9 +3564,9 @@ Error code is normally cleared when a command is successful. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.set_buffer> +<anchor name=Stdio.File.set_buffer> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->set_buffer</tt> - set internal socket buffer @@ -3512,13 +3585,13 @@ actually does anything, but it certainly helps to increase data transfer speed when it does. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.open_socket>Stdio.File->open_socket</a> and <a href=#Stdio.Port.accept>Stdio.Port->accept</a> +<link to=Stdio.File.open_socket>Stdio.File->open_socket</link> and <link to=Stdio.Port.accept>Stdio.Port->accept</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.set_nonblocking> +<anchor name=Stdio.File.set_nonblocking> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->set_nonblocking</tt> - make stream nonblocking @@ -3543,13 +3616,13 @@ id of file as first argument when called. stream is just set to nonblocking mode. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_blocking>Stdio.File->set_blocking</a> +<link to=Stdio.File.set_blocking>Stdio.File->set_blocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.set_read_callback> +<anchor name=Stdio.File.set_read_callback> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->set_read_callback</tt> - set the read callback @@ -3564,13 +3637,13 @@ is called whenever there is data to read from the file. Note that this function does not set the file nonblocking. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</a> +<link to=Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.set_write_callback> +<anchor name=Stdio.File.set_write_callback> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->set_write_callback</tt> - set the write callback @@ -3585,13 +3658,13 @@ is called whenever there is buffer space available to write to for the file. Note that this function does not set the file nonblocking. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</a> +<link to=Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.set_close_callback> +<anchor name=Stdio.File.set_close_callback> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->set_close_callback</tt> - set the close callback @@ -3606,13 +3679,13 @@ is called when the remote end of a socket or pipe is closed. Note that this function does not set the file nonblocking. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</a> +<link to=Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.set_blocking> +<anchor name=Stdio.File.set_blocking> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->set_blocking</tt> - make stream blocking @@ -3626,13 +3699,13 @@ This function sets a stream to blocking mode. ie. all reads and writes will wait until data has been written before returning. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</a> +<link to=Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.set_id> +<anchor name=Stdio.File.set_id> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->set_id</tt> - set id of this file @@ -3648,13 +3721,13 @@ default id is 0. Another possible use of the id is to hold all data related to this file in a mapping or array. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.query_id>Stdio.File->query_id</a> +<link to=Stdio.File.query_id>Stdio.File->query_id</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.query_id> +<anchor name=Stdio.File.query_id> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->query_id</tt> - get id of this file @@ -3667,13 +3740,13 @@ related to this file in a mapping or array. This function returns the id of this file. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_id>Stdio.File->set_id</a> +<link to=Stdio.File.set_id>Stdio.File->set_id</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.query_read_callback> +<anchor name=Stdio.File.query_read_callback> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->query_read_callback</tt> - return the read callback function @@ -3687,13 +3760,13 @@ This function returns the read_callback, which is set with set_nonblocking. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</a> +<link to=Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.query_write_callback> +<anchor name=Stdio.File.query_write_callback> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->query_write_callback</tt> - return the write callback function @@ -3707,13 +3780,13 @@ This function returns the write_callback, which is set with set_nonblocking. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</a> +<link to=Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.query_close_callback> +<anchor name=Stdio.File.query_close_callback> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File.query_close_callback</tt> - return the close callback function @@ -3727,13 +3800,13 @@ This function returns the close_callback, which is set with set_nonblocking. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</a> +<link to=Stdio.File.set_nonblocking>Stdio.File->set_nonblocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.dup> +<anchor name=Stdio.File.dup> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->dup</tt> - duplicate a file @@ -3747,13 +3820,13 @@ This function returns a clone of Stdio.File with all variables copied from this file. Note that all variables, even id, is copied. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.assign>Stdio.File->assign</a> +<link to=Stdio.File.assign>Stdio.File->assign</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.dup2> +<anchor name=Stdio.File.dup2> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->dup2</tt> - duplicate a file over another @@ -3775,13 +3848,13 @@ o->dup2(Stdio.File("stdin"));<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.assign>Stdio.File->assign</a> and <a href=#Stdio.File.dup>Stdio.File->dup</a> +<link to=Stdio.File.assign>Stdio.File->assign</link> and <link to=Stdio.File.dup>Stdio.File->dup</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.assign> +<anchor name=Stdio.File.assign> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->assign</tt> - assign a file @@ -3796,13 +3869,13 @@ variables of this file from it. It can be used together with file->dup to move files around. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.dup>Stdio.File->dup</a> +<link to=Stdio.File.dup>Stdio.File->dup</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.open_socket> +<anchor name=Stdio.File.open_socket> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->open_socket</tt> - open a socket @@ -3823,13 +3896,13 @@ some silly protocols like FTP. You may also specify an adress to bind to if your machine has many ip numbers. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.connect>Stdio.File->connect</a> and <a href=#Stdio.File.set_nonblocking>Stdio.Fileile->set_nonblocking</a> +<link to=Stdio.File.connect>Stdio.File->connect</link> and <link to=Stdio.File.set_nonblocking>Stdio.Fileile->set_nonblocking</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.connect> +<anchor name=Stdio.File.connect> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->connect</tt> - connect a socket to something. @@ -3847,13 +3920,13 @@ 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> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.query_address>Stio.File->query_address</a> +<link to=Stdio.File.query_address>Stio.File->query_address</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.query_address> +<anchor name=Stdio.File.query_address> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->query_address</tt> - get adresses @@ -3871,13 +3944,13 @@ with argument the local address is returned. If this file is not a socket, not connected or some other error occurs, zero is returned. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File.connect>Stdio.File->connect</a> +<link to=Stdio.File.connect>Stdio.File->connect</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.pipe> +<anchor name=Stdio.File.pipe> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->pipe</tt> - create a two-way pipe @@ -3893,13 +3966,13 @@ indistinguishable. If the object is this function is called in was open to begin with, it is closed before the pipe is created. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#fork>fork</a> +<link to=fork>fork</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.File.set_close_on_exec> +<anchor name=Stdio.File.set_close_on_exec> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.File->set_close_on_exec</tt> - set / clear the close on exec flag @@ -3914,11 +3987,11 @@ calling exece. Default is that the file WILL be closed on exec except for stdin, stdout and stderr. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#exece>exece</a> +<link to=exece>exece</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> <!-- FIXME might be good to have a plain and simple example of Stdio.File here --> @@ -3930,7 +4003,7 @@ WWW server, sends a HEAD request and writes the reply to stdout. For clarity, all calls to Stdio.File use <tt>File::</tt> even if that is not strictly necessary. -<pre> +<example language=pike> import Stdio; inherit File; @@ -3958,13 +4031,13 @@ necessary. File::write(sprintf("HEAD /%s HTTP/1.0\n",path)); stdout::write(File::read()); } -</pre> +</example> </section> -</a> +</anchor> -<a name=Stdio.FILE> +<anchor name=Stdio.FILE> <section title="Stdio.FILE"> Stdio.FILE is a buffered version of Stdio.File, it inherits Stdio.File and has most of the functionalty of Stdio.File. However, it has a an input buffer @@ -3973,7 +4046,7 @@ not buffered at this moment. The added functionality of Stdio.FILE is described here: <hr noshade size=1> -<a name=Stdio.FILE.gets> +<anchor name=Stdio.FILE.gets> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.FILE->gets</tt> - get one line @@ -3989,9 +4062,9 @@ no more lines are available. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.FILE.printf> +<anchor name=Stdio.FILE.printf> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.FILE->printf</tt> - formatted print @@ -4005,13 +4078,13 @@ This function does aproximately the same as: write(sprintf(format,@data)) <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sprintf>sprintf</a> +<link to=sprintf>sprintf</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.FILE.ungets> +<anchor name=Stdio.FILE.ungets> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.FILE->ungets</tt> - put a string back in the buffer @@ -4027,9 +4100,9 @@ can then be read with read, gets or getchar. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.FILE.getchar> +<anchor name=Stdio.FILE.getchar> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.FILE->getchar</tt> - get one character from the input stream @@ -4044,16 +4117,16 @@ that the return value is the ascii value of the character, not a string containing one character. <p> </dl> -</a> +</anchor> <!-- FIXME, example of how to use Stdio.FILE here --> </section> -</a> +</anchor> -<a name=Stdio.stdin> -<a name=Stdio.stdout> -<a name=Stdio.stderr> +<anchor name=Stdio.stdin> +<anchor name=Stdio.stdout> +<anchor name=Stdio.stderr> <section title="Standard streams"> Any UNIX program has three files open from the beginning. These are called standard input, standard output and standard error stream. These streams @@ -4064,29 +4137,29 @@ oriented functions. <tt>Stdio.stdout</tt> and <tt>Stdio.stderr</tt> are simply clones of <tt>Stdio.File</tt>. <p> Example: -<pre> +<example language=pike> int main() { int line; while(string s=Stdio.stdin.gets()) write(sprintf("%5d: %s\n",line++,s)); } -</pre> +</example> This example will read lines from standard input for as long as there are more lines to read. Each line will then be written to stdout together with the line number. We could use <tt>Stdio.stdout.write</tt> instead of just <tt>write</tt> they are the same function. </section> -</a> -</a> -</a> +</anchor> +</anchor> +</anchor> <section title="Other Stdio functions"> The Stdio module also contains a collection of high level IO functions to make it easy to write short and readable Pike programs. Most of these functions are implemented using Stdio.File and Stdio.FILE. -<a name=Stdio.file_size> +<anchor name=Stdio.file_size> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.file_size</tt> - return the size of a file in bytes @@ -4104,13 +4177,13 @@ indicates that it is a directory. <a href=index.html#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.write_file>Stdio.write_file</a> and <a href=#Stdio.read_bytes>Stdio.read_bytes</a> +<link to=Stdio.write_file>Stdio.write_file</link> and <link to=Stdio.read_bytes>Stdio.read_bytes</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.perror> +<anchor name=Stdio.perror> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.perror</tt> - print error @@ -4128,15 +4201,15 @@ out what went wrong, so it is only applicable to IO errors. <a href=index.html#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.werror>Stdio.werror</a> +<link to=Stdio.werror>Stdio.werror</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.read_bytes> +<anchor name=Stdio.read_bytes> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.read_bytes</tt> - read a number of bytes into a string from a file @@ -4160,13 +4233,13 @@ be returned. <a href=index.html#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.write_file>Stdio.write_file</a> +<link to=Stdio.write_file>Stdio.write_file</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.read_file> +<anchor name=Stdio.read_file> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.read_file</tt> - read a number of lines into a string from file @@ -4187,15 +4260,15 @@ the whole file is read. <a href=index.html#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.read_bytes>Stdio.read_bytes</a> and <a href=#Stdio.write_file.html>Stdio.write_file</a> +<link to=Stdio.read_bytes>Stdio.read_bytes</link> and <link to=Stdio.write_file.html>Stdio.write_file</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.readline> +<anchor name=Stdio.readline> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.readline</tt> - read a line from stdin @@ -4211,13 +4284,13 @@ was available when Pike was compiled the user will have history and line edithing at his/her disposal when entering the line. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File>Stdio.File</a> +<link to=Stdio.File>Stdio.File</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.werror> +<anchor name=Stdio.werror> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.werror</tt> - write to stderr @@ -4231,13 +4304,13 @@ Writes a message to stderr. Stderr is normally the console, even if the process output has been redirected to a file or pipe. <p> <dt><encaps>KEYWORDS</encaps><dd> -<a href=#Stdio.File>Stdio.File</a> +<link to=Stdio.File>Stdio.File</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.write_file> +<anchor name=Stdio.write_file> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.write_file</tt> - append a string to a file @@ -4253,15 +4326,15 @@ Append the string str onto the file file. Returns number of bytes written. <a href=index.html#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.read_bytes.html>Stdio.read_bytes</a> +<link to=Stdio.read_bytes.html>Stdio.read_bytes</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> </section> -<a name=Stdio.Port> +<anchor name=Stdio.Port> <section title="Listening to sockets"> Stdio.File can handle connections to any TCP socket, but it can not listen to a local TCP port. For this purpose there is a special class called @@ -4270,7 +4343,7 @@ it can accept connections which will be returned as clones of Stdio.File. These are the methods available in <tt>Stdio.Port</tt>: <hr noshade size=1> -<a name=Stdio.Port.bind> +<anchor name=Stdio.Port.bind> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.Port->bind</tt> - open socket and bind it to a port @@ -4293,13 +4366,13 @@ Bind returns 1 on success, and zero on failiure. this ip name (or number). <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.Port.accept>Stdio.Port->accept</a> +<link to=Stdio.Port.accept>Stdio.Port->accept</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.Port.listen_fd> +<anchor name=Stdio.Port.listen_fd> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.Port->listen_fd</tt> - listen to an already open port @@ -4320,13 +4393,13 @@ This function is only for the advanced user, and is generally used when sockets are passed to Pike at exec time. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.Port.bind>Stdio.Port->bind</a> and <a href=#Stdio.Port.accept>Stdio.Port->accept</a> +<link to=Stdio.Port.bind>Stdio.Port->bind</link> and <link to=Stdio.Port.accept>Stdio.Port->accept</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.Port.create> +<anchor name=Stdio.Port.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.Port->create</tt> - create and/or setup a port @@ -4352,13 +4425,13 @@ IS a socket to begin with. When create is called with an int as first argument, it does the same as bind() would do with the same arguments. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#clone>clone</a> +<link to=clone>clone</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.Port.set_id> +<anchor name=Stdio.Port.set_id> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.Port->set_id</tt> - set the id of a port @@ -4372,13 +4445,13 @@ This function sets the id used for accept_callback by this port. The default id is this_object(). <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.Port.query_id>Stdio.Port->query_id</a> +<link to=Stdio.Port.query_id>Stdio.Port->query_id</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.Port.query_id> +<anchor name=Stdio.Port.query_id> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.Port->query_id</tt> - Return the id for this port. @@ -4392,13 +4465,13 @@ This function returns the id for this port. The id is normally the first argument to accept_callback. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.Port.set_id>Stdio.Port->set_id</a> +<link to=Stdio.Port.set_id>Stdio.Port->set_id</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.Port.errno> +<anchor name=Stdio.Port.errno> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.Port->errno</tt> - return the last error @@ -4413,13 +4486,13 @@ integer describing what went wrong. Refer to your unix manual for further information. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.Port.errno>Stdio.Port->errno</a> +<link to=Stdio.Port.errno>Stdio.Port->errno</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Stdio.Port.accept> +<anchor name=Stdio.Port.accept> <dl> <dt><encaps>NAME</encaps><dd> <tt>Stdio.Port->accept</tt> - accept a connection @@ -4434,13 +4507,13 @@ this port. It returns a two-way stream in the form of a copy of Stdio.File. The new file is by default set to blocking. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.File>Stdio.File</a> +<link to=Stdio.File>Stdio.File</link> <p> </dl> -</a> +</anchor> </section> -</a> +</anchor> <hr noshade size=1> <section title="A more complex example - a simple www server"> @@ -4456,7 +4529,7 @@ write documents with embedded pictures and links to other pages. These links are normally displayed underlined and if you click them your WWW- browser will load whatever document that link leads to. <p> -<pre> +<example language=pike> #!/usr/local/bin/pike /* A very small httpd capable of fetching files only. @@ -4464,7 +4537,7 @@ browser will load whatever document that link leads to. */ inherit Stdio.Port; -</pre> +</example> We inherit Stdio.Port into this program so we can bind a TCP socket to accept incoming connection. A socket is simply a number to separate communications to and from different programs on the same computer. @@ -4474,7 +4547,7 @@ the preprocessor directive #define. The preprocessor is the first stage in the compiling process and can make textual processing of the code before it is compiled. As an example, after the first define below, all occurances of 'BLOCK' will be replaced with 16060. -<pre> +<example language=pike> /* Amount of data moved in one operation */ #define BLOCK 16060 @@ -4487,7 +4560,7 @@ of 'BLOCK' will be replaced with 16060. /* Port to open */ #define PORT 1905 -</pre> +</example> A port is a destination for a TCP connection. It is simply a number on the local computer. 1905 is not the standard port for HTTP connections though, which means that if you want to access this WWW server from a browser you @@ -4496,18 +4569,18 @@ need to specify the port like this: http://my.host.my.domain:1905/ Next we declare a class called output_class. Later we will clone one instance of this class for each incoming HTTP connection. <p> -<pre> +<example language=pike> class output_class { inherit Stdio.File : socket; inherit Stdio.File : file; -</pre> +</example> Our new class inherits Stdio.File twice. To be able to separate them they are then named 'socket' and 'file'. <p> -<pre> +<example language=pike> int offset=0; -</pre> +</example> Then there is a global variable called offset which is initialized to zero. (each instance of this class will have its own instance of this variable, so it is not truly global, but..) @@ -4522,111 +4595,111 @@ there is buffer space available. In the following lines 'void' means that it does not return a value. Write callback will be used further down as a callback and will be called whenever there is room in the socket output buffer. -<pre> +<example language=pike> void write_callback() { int written; string data; -</pre> +</example> The following line means: call seek in the inherited program 'file'. -<pre> +<example language=pike> file::seek(offset); -</pre> +</example> Move the file pointer to the where we want to the position we want to read from. The file pointer is simply a location in the file, usually it is where the last read() ended and the next will begin. seek() can move this pointer to where we want it though. <p> -<pre> +<example language=pike> data=file::read(BLOCK); -</pre> +</example> Read BLOCK (16060) bytes from the file. If there are less that that left to read only that many bytes will be returned. <p> -<pre> +<example language=pike> if(strlen(data)) { -</pre> +</example> If we managed to read someting... <p> -<pre> +<example language=pike> written=socket::write(data); -</pre> +</example> ... we try to write it to the socket. <p> -<pre> +<example language=pike> if(written >= 0) { offset+=written; return; } -</pre> +</example> Update offset if we managed to write to the socket without errors. <p> -<pre> +<example language=pike> werror("Error: "+socket::errno()+".\n"); } -</pre> +</example> If something went wrong during writing, or there was nothing left to read we destruct this instance of this class. <p> -<pre> +<example language=pike> destruct(this_object()); } -</pre> +</example> That was the end of write_callback() <p> Next we need a variable to buffer the input received in. We initialize it to an empty string. -<pre> +<example language=pike> string input=""; -</pre> +</example> And then we define the function that will be called when there is something in the socket input buffer. The first argument 'id' is declared as mixed, which means that it can contain any type of value. The second argument is the contents of the input buffer. <p> -<pre> +<example language=pike> void read_callback(mixed id,string data) { string cmd; input+=data; -</pre> +</example> Append data to the string input. Then we check if we have received a a complete line yet. If so we parse this and start ouputting the file. <p> -<pre> +<example language=pike> if(sscanf(input,"%s %s%*[\012\015 \t]",cmd,input)>2) { -</pre> +</example> This sscanf is pretty complicated, but in essense it means: put the first word in 'input' in 'cmd' and the second in 'input' and return 2 if successful, 0 otherwise. <p> -<pre> +<example language=pike> if(cmd!="GET") { werror("Only method GET is supported.\n"); destruct(this_object()); return; } -</pre> +</example> If the first word isn't GET print an error message and terminate this instance of the program. (and thus the connection) -<pre> +<example language=pike> sscanf(input,"%*[/]%s",input); -</pre> +</example> Remove the leading slash. <p> -<pre> +<example language=pike> input=combine_path(BASE,input); -</pre> +</example> Combine the requested file with the base of the HTML tree, this gives us a full filename beginning with a slash. The HTML tree is the directory on the server in which the HTML files are located. Normally @@ -4634,140 +4707,140 @@ all files in this directory can be accessed by anybody by using a WWW browser. So if a user requests 'index.html' then that file name is first added to BASE (/home/hubbe/www/html/ in this case) and if that file exists it will be returned to the browser. -<pre> +<example language=pike> if(!file::open(input,"r")) { -</pre> +</example> Try opening the file in read-only mode. If this fails, try opening NOFILE instead. Opening the file will enable us to read it later. <p> -<pre> +<example language=pike> if(!file::open(NOFILE,"r")) { -</pre> +</example> If this fails too. Write an error message and destruct this object. <p> -<pre> +<example language=pike> werror("Couldn't find default file.\n"); destruct(this_object()); return; } } -</pre> +</example> Ok, now we set up the socket so we can write the data back. -<pre> +<example language=pike> socket::set_buffer(65536,"w"); -</pre> +</example> Set the buffer size to 64 kilobytes. <p> -<pre> +<example language=pike> socket::set_nonblocking(0,write_callback,0); -</pre> +</example> Make it so that write_callback is called when it is time to write more data to the socket. <p> -<pre> +<example language=pike> write_callback(); -</pre> +</example> Jump-start the writing. -<pre> +<example language=pike> } } -</pre> +</example> That was the end of read_callback(). <p> This function is called if the connection is closed while we are reading from the socket. -<pre> +<example language=pike> void selfdestruct() { destruct(this_object()); } -</pre> +</example> This function is called when the program is instantiated. It is used to set up data the way we want it. Extra arguments to clone() will be sent to this function. In this case it is the object representing the new connection. <p> -<pre> +<example language=pike> void create(object f) { socket::assign(f); -</pre> +</example> We insert the data from the file f into 'socket'. <p> -<pre> +<example language=pike> socket::set_nonblocking(read_callback,0,selfdestruct); -</pre> +</example> Then we set up the callback functions and sets the file nonblocking. Nonblocking mode means that read() and write() will rather return that wait for I/O to finish. Then we sit back and wait for read_callback to be called. <p> -<pre> +<example language=pike> } -</pre> +</example> End of create() <p> -<pre> +<example language=pike> }; -</pre> +</example> End of the new class. <pre> </pre> Next we define the function called when someone connects. <p> -<pre> +<example language=pike> void accept_callback() { object tmp_output; -</pre> +</example> This creates a local variable of type 'object'. An object variable can contain a clone of any program. Pike does not consider clones of different programs different types. This also means that function calls to objects have to be resolved at run time. <p> -<pre> +<example language=pike> tmp_output=accept(); -</pre> +</example> The function accept clones a Stdio.File and makes this equal to the newly connected socket. <p> -<pre> +<example language=pike> if(!tmp_output) return; -</pre> +</example> If it failed we just return. <p> -<pre> +<example language=pike> output_class(tmp_output); -</pre> +</example> Otherwise we clone an instanec of 'output_class' and let it take care of the connection. Each clone of output_class will have its own set of global variables, which will enable many connections to be active at the same time without data being mixed up. Note that the programs will not actually run simultaneously though. <p> -<pre> +<example language=pike> destruct(tmp_output); -</pre> +</example> Destruct the object returned by accept(), output_class has already copied the contents of this object. <p> -<pre> +<example language=pike> } -</pre> +</example> Then there is main, the function that gets it all started. -<pre> - int main(int argc, string *argv) +<example language=pike> + int main(int argc, array(string) argv) { werror("Starting minimal httpd\n"); -</pre> +</example> Write an encouraging message to stderr. -<pre> +<example language=pike> if(!bind(PORT, accept_callback)) { @@ -4775,20 +4848,20 @@ Write an encouraging message to stderr. return 17; } -</pre> +</example> Bind PORT and set it up to call accept_callback as soon as someone connects to it. If the bind() fails we write an error message and return the 17 to indicate failiure. -<pre> +<example language=pike> return - 17; /* Keep going */ -</pre> +</example> If everything went ok, we return -17, any negative value returned by main() means that the program WON'T exit, it will hang around waiting for events instead. (like someone connecting) -<pre> +<example language=pike> } -</pre> +</example> That's it, this simple program can be used as the basis for a simple WWW-server. Note that today most WWW servers are very complicated programs, and the above program can never replace a modern WWW server. @@ -4797,9 +4870,9 @@ a slow machine available for the server. <p> </section> </chapter> -</a> +</anchor> -<a name=Threads> +<anchor name=Threads> <chapter title="Threads"> Threads are used to run several Pike functions at the same time without having to start several Pike processes. Using threads often simplifies coding and because the @@ -4814,7 +4887,7 @@ Starting a thread is very easy. You simply call <tt>thread_create</tt> with a fu pointer and any arguments it needs and that function will be executed in a separate thread. The function <tt>thread_create</tt> will return immediately and both the calling function and the called function will execute at the same time. Example: -<pre> +<example language=pike> void foo(int x) { for(int e=0;e<5;e++) @@ -4830,13 +4903,13 @@ the calling function and the called function will execute at the same time. Exam thread_create(foo, 3); foo(1); } -</pre> +</example> This may all seem very simple, but there are a few complications to watch out for: <dl> <dt> Accessing unlocked data <dd> Look at this code: -<pre> +<example language=pike> void mapadd(mapping m, int i, int j) { if(map[i]) @@ -4844,7 +4917,7 @@ watch out for: else map[i]=({j}); } -</pre> +</example> This is quite harmless as long as it is only used from one thread at a time, but if two threads call it it at the same time, there is a slight chance that both threads will discover that <tt>map[i]</tt> is zero and both threads will @@ -4857,7 +4930,7 @@ is being performed. Conditions, or <b>condition variables</b>, are used to infor other threads that they don't have to wait any longer. Pike also provides two different kinds of pipelines to send data from one thread to another, which makes it very simple to write threaded programs. Let's look at an example: -<pre> +<example language=pike> #!/usr/local/bin/pike import Thread; // We need fifos inherit Fifo; // Fifo used to supply workers @@ -4880,7 +4953,7 @@ makes it very simple to write threaded programs. Let's look at an example: ended::write(0); } - int main(int argc, string *argv) + int main(int argc, array(string) argv) { for(int e=0;e<4;e++) // Start workers thread_create(worker,argv[1]); @@ -4892,7 +4965,7 @@ makes it very simple to write threaded programs. Let's look at an example: ended::read(); exit(0); } -</pre> +</example> This is an example of a simple grep-like program. It looks for the string given as first argument to the program in the files given as the rest @@ -4916,7 +4989,7 @@ this example again. This section describes all thread-related functions and classes. <hr noshade size=1> -<a name=Thread.thread_create> +<anchor name=Thread.thread_create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.thread_create</tt> - create a thread @@ -4938,14 +5011,14 @@ the same as the return value of this_thread() for the new thread. This function is only available on systems with POSIX or UNIX threads support. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Thread.Mutex>Thread.Mutex</a>, <a href=#Thread.Condition>Thread.Condition</a> and <a href=#Thread.this_thread>Thread.this_thread</a> +<link to=Thread.Mutex>Thread.Mutex</link>, <link to=Thread.Condition>Thread.Condition</link> and <link to=Thread.this_thread>Thread.this_thread</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.this_thread> +<anchor name=Thread.this_thread> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.this_thread</tt> - return thread id @@ -4958,13 +5031,13 @@ This function is only available on systems with POSIX or UNIX threads support. This function returns the object that identifies this thread. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Thread.thread_create>Thread.thread_create</a> +<link to=Thread.thread_create>Thread.thread_create</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Mutex> +<anchor name=Thread.Mutex> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Mutex</tt> - mutex locks @@ -4988,7 +5061,7 @@ locked them. In Pike any thread can unlock a locked mutex. This simple program can be used to exchange data between two programs. It is similar to Thread.Fifo, but can only hold one element of data. -<pre> +<example language=pike> inherit Thread.Mutex : r_mutex; inherit Thread.Mutex : w_mutex; object r_lock=r_mutex::lock(); @@ -5011,12 +5084,12 @@ mixed read() destruct(w_lock); return tmp; } -</pre> +</example> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Mutex.lock> +<anchor name=Thread.Mutex.lock> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Mutex->lock</tt> - lock the mutex @@ -5034,9 +5107,9 @@ be unlocked. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Mutex.trylock> +<anchor name=Thread.Mutex.trylock> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Mutex->trylock</tt> - try to lock the mutex @@ -5053,7 +5126,7 @@ lock is unlocked. </dl> <hr newpage noshade size=1> -<a name=Thread.Condition> +<anchor name=Thread.Condition> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Condition</tt> - condition variables @@ -5068,51 +5141,52 @@ Condition variables are only available on systems with POSIX or UNIX threads support. <p> <dt><encaps>EXAMPLE</encaps><dd> -<tt>// This program implements a fifo that can be used to send<br> -// data between two threads.<br> -inherit Thread.Condition : r_cond;<br> -inherit Thread.Condition: w_cond;<br> -inherit Thread.Mutex: lock;<br> +<example language=pike> +// This program implements a fifo that can be used to send +// data between two threads. +inherit Thread.Condition : r_cond; +inherit Thread.Condition: w_cond; +inherit Thread.Mutex: lock; -<p>mixed *buffer = allocate(128);<br> -int r_ptr, w_ptr;<br> +mixed *buffer = allocate(128); +int r_ptr, w_ptr; -<p>int query_messages() { return w_ptr - r_ptr; }<br> +int query_messages() { return w_ptr - r_ptr; } -<p>// This function reads one mixed value from the fifo.<br> -// If no values are available it blocks until a write has been done.<br> -mixed read()<br> -{<br> -<dl><dt><dd>mixed tmp;<br> -// We use this mutex lock to make sure no write() is executed<br> -// between the query_messages and the wait() call. If it did<br> -// we would wind up in a deadlock.<br> -object key=lock::lock();<br> -while(!query_messages()) r_cond::wait(key);<br> -tmp=buffer[r_ptr++ % sizeof(buffer)];<br> -w_cond::signal();<br> -return tmp;<br> -</dl>}<br> +// This function reads one mixed value from the fifo. +// If no values are available it blocks until a write has been done. +mixed read() +{ + mixed tmp; + // We use this mutex lock to make sure no write() is executed + // between the query_messages and the wait() call. If it did + // we would wind up in a deadlock. + object key=lock::lock(); + while(!query_messages()) r_cond::wait(key); + tmp=buffer[r_ptr++ % sizeof(buffer)]; + w_cond::signal(); + return tmp; +} -<p>// This function pushes one mixed value on the fifo.<br> -// If the fifo is full it blocks until a value has been read.<br> -void write(mixed v)<br> -{<br> -<dl><dt><dd>object key=lock::lock();<br> -while(query_messages() == sizeof(buffer)) w_cond::wait(key);<br> -buffer[w_ptr++ % sizeof(buffer)]=v;<br> -r_cond::signal();<br> -</dl>}<br> -</tt> +// This function pushes one mixed value on the fifo. +// If the fifo is full it blocks until a value has been read. +void write(mixed v) +{ + object key=lock::lock(); + while(query_messages() == sizeof(buffer)) w_cond::wait(key); + buffer[w_ptr++ % sizeof(buffer)]=v; + r_cond::signal(); +} +</example> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Tread.Mutex>Thread.Mutex</a> +<link to=Tread.Mutex>Thread.Mutex</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Condition.wait> +<anchor name=Thread.Condition.wait> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Condition->wait</tt> - wait for condition @@ -5131,13 +5205,13 @@ waiting for the condition in one atomical operation. After waiting for the condition the mutex referenced by mutex_key will be re-locked. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Thread.Mutex.lock>Thread.Mutex->lock</a> +<link to=Thread.Mutex.lock>Thread.Mutex->lock</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Condition.signal> +<anchor name=Thread.Condition.signal> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Condition->signal</tt> - signal a condition variable @@ -5155,9 +5229,9 @@ It sometimes wakes up more than one thread. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Condition.broadcast> +<anchor name=Thread.Condition.broadcast> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Condition->broadcast</tt> - signal all waiting threads @@ -5172,9 +5246,9 @@ condition. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Fifo> +<anchor name=Thread.Fifo> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Fifo</tt> - first in, first out object @@ -5184,7 +5258,7 @@ Thread.Fifo implements a fixed length fifo. A fifo is a queue of values and is often used as a stream of data between two threads. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Thread.Queue>Thread.Queue</a> +<link to=Thread.Queue>Thread.Queue</link> <p> <dt><encaps>NOTA BENE</encaps><dd> Fifos are only available on systems with POSIX threads support. @@ -5192,9 +5266,9 @@ Fifos are only available on systems with POSIX threads support. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Fifo.create> +<anchor name=Thread.Fifo.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Fifo->create</tt> - initialize the fifo @@ -5214,9 +5288,9 @@ written to the fifo without blocking. The default size is 128. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Fifo.write> +<anchor name=Thread.Fifo.write> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Fifo->write</tt> - queue a value @@ -5232,9 +5306,9 @@ available. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Fifo.read> +<anchor name=Thread.Fifo.read> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Fifo->read</tt> - read a value from the fifo @@ -5251,9 +5325,9 @@ thread writes a value to the fifo. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Fifo.size> +<anchor name=Thread.Fifo.size> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Fifo->size</tt> - return number of values in fifo @@ -5267,13 +5341,13 @@ This function returns how many values are currently in the fifo. <p> </dl> -</a> +</anchor> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Queue> +<anchor name=Thread.Queue> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Queue</tt> - a queue of values @@ -5284,16 +5358,16 @@ between Thread.Queue and Thread.Fifo is that queues will never block in write(), only allocate more memory. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Thread.Fifo>Thread.Fifo</a> +<link to=Thread.Fifo>Thread.Fifo</link> <p> <dt><encaps>NOTA BENE</encaps><dd> Queues are only available on systems with POSIX or UNIX threads support. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Queue.write> +<anchor name=Thread.Queue.write> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Queue->write</tt> - queue a value @@ -5309,9 +5383,9 @@ room for it. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Queue.read> +<anchor name=Thread.Queue.read> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Queue->read</tt> - read a value from the queue @@ -5328,9 +5402,9 @@ thread writes a value to the queue. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Thread.Queue.size> +<anchor name=Thread.Queue.size> <dl> <dt><encaps>NAME</encaps><dd> <tt>Thread.Queue->size</tt> - return number of values in queue @@ -5344,18 +5418,18 @@ This function returns how many values are currently in the queue. <p> </dl> -</a> +</anchor> <hr noshade size=1> </section> <section title="Threads example"> Let's look at an example of how to work with threads. This program is the same -minimal WWW server as in <link to=io> but it has been +minimal WWW server as in <ref to=io> but it has been re-written to use threads, as you can see it is a lot smaller this way. This is because we can use blocking I/O operations instead of non-blocking and callbacks. This also makes the program much easier to follow: -<pre> +<example language=pike> #!/usr/local/bin/pike /* A very small threaded httpd capable of fetching files only. @@ -5427,7 +5501,7 @@ class worker } }; -int main(int argc, string *argv) +int main(int argc, array(string) argv) { werror("Starting minimal threaded httpd\n"); @@ -5442,14 +5516,14 @@ int main(int argc, string *argv) for(int e=1;e<THREADS;e++) thread_create(worker,accept); worker(accept); } -</pre> +</example> <p> As stated in the beginning of this chapter; Pike threads are only available on some UNIX systems. The above example does not work if your systems does not have threads. </section> </chapter> -</a> +</anchor> <chapter title="Modules for specific data types"> @@ -5465,13 +5539,13 @@ is not always used. These functions are mostly implemented in Pike as a complement to those written in C. <hr noshade size=1> -<a name=String.implode_nicely> +<anchor name=String.implode_nicely> <dl> <dt><encaps>NAME</encaps><dd> <tt>String.implode_nicely</tt> - make an english comma separated list <p> <dt><encaps>SYNTAX</encaps><dd> -<tt>string implode_nicely(string *words, string|void separator)<br> +<tt>string implode_nicely(array(string) words, string|void separator)<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -5493,13 +5567,13 @@ Result: green, blue or white<br> <a href=types_string.html>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#multiplication>`*</a> +<link to=multiplication>`*</link> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=String.capitalize> +<anchor name=String.capitalize> <dl> <dt><encaps>NAME</encaps><dd> <tt>String.capitalize</tt> - capitalize a string @@ -5516,14 +5590,14 @@ new string. <a href=types_string.html>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#lower_case>lower_case</a> and <a href=#upper_case>upper_case</a> +<link to=lower_case>lower_case</link> and <link to=upper_case>upper_case</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=String.strmult> +<anchor name=String.strmult> <dl> <dt><encaps>NAME</encaps><dd> <tt>String.strmult</tt> - multiply strings @@ -5537,7 +5611,7 @@ This function multplies 's' by 'num'. The return value is the same as appending 's' to an empty string 'num' times. <p> </dl> -</a> +</anchor> <hr noshade size=1> </section> @@ -5546,7 +5620,7 @@ As with <tt>String</tt> these functions are Pike functions written to suppliment those written in C. <hr noshade size=1> -<a name=Array.map> +<anchor name=Array.map> <dl> <dt><encaps>NAME</encaps><dd> <tt>Array.map</tt> - map an array or mapping over a function @@ -5574,13 +5648,13 @@ arr[x]=arr[x]->fun(@ args); <a href=types_array.html>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Array.sum_arrays>Array.sum_arrays</a> and <a href=#Array.filter>Array.filter</a> +<link to=Array.sum_arrays>Array.sum_arrays</link> and <link to=Array.filter>Array.filter</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Array.filter> +<anchor name=Array.filter> <dl> <dt><encaps>NAME</encaps><dd> <tt>Array.filter</tt> - filter an array or mapping through a function @@ -5608,13 +5682,13 @@ return all that returned true. <a href=types_array.html>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Array.sum_arrays>Array.sum_arrays</a> and <a href=#Array.map>Array.map</a> +<link to=Array.sum_arrays>Array.sum_arrays</link> and <link to=Array.map>Array.map</link> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Array.search_array> +<anchor name=Array.search_array> <dl> <dt><encaps>NAME</encaps><dd> <tt>Array.search_array</tt> - search for something in an array @@ -5636,13 +5710,13 @@ returned values. If no call returns true, -1 is returned. <a href=types_array.html>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Array.sum_arrays.html>Array.sum_arrays</a> and <a href=#Array.filter_array>Array.filter_array</a> +<link to=Array.sum_arrays.html>Array.sum_arrays</link> and <link to=Array.filter_array>Array.filter_array</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Array.sum_arrays> +<anchor name=Array.sum_arrays> <dl> <dt><encaps>NAME</encaps><dd> <tt>Array.sum_arrays</tt> - map any number of arrays over a function. @@ -5670,12 +5744,12 @@ return res;<br> <a href=types_array.html>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Array.map_array>Array.map</a>, <a href=#Array.filter>Array.filter</a> and <a href=#Array.search_array>Array.search_array</a> +<link to=Array.map_array>Array.map</link>, <link to=Array.filter>Array.filter</link> and <link to=Array.search_array>Array.search_array</link> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Array.sort_array> +<anchor name=Array.sort_array> <dl> <dt><encaps>NAME</encaps><dd> <tt>Array.sort_array</tt> - sort an array @@ -5695,12 +5769,12 @@ instead. <a href=types_array.html>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Array.map>Array.map</a> and <a href=#sort>sort</a> +<link to=Array.map>Array.map</link> and <link to=sort>sort</link> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Array.uniq> +<anchor name=Array.uniq> <dl> <dt><encaps>NAME</encaps><dd> <tt>Array.uniq</tt> - return one of each element @@ -5717,7 +5791,7 @@ values removed. The order of the values in the result is undefined. <a href=types_array.html>array</a> <p> </dl> -</a> +</anchor> <hr noshade size=1> </section> @@ -5728,7 +5802,7 @@ values removed. The order of the values in the result is undefined. Pike also include a number of smaller modules. These modules implement support for various algorithms, data structures and system routines. -<a name=System> +<anchor name=System> <section title="System"> The system module contains some system-specific functions that may or may not be available on your system. Most of these functions do exactly the same @@ -5739,7 +5813,7 @@ Please note that these functions are available globally, you do not need to <tt>import System</tt> to use these functions. <hr noshade size=1> -<a name=chroot> +<anchor name=chroot> <dl> <dt><encaps>NAME</encaps><dd> <tt>chroot</tt> - change the root directory @@ -5766,9 +5840,9 @@ the fchroot(2) system call. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=getegid> +<anchor name=getegid> <dl> <dt><encaps>NAME</encaps><dd> <tt>getegid</tt> - get the effective group ID @@ -5784,13 +5858,13 @@ Get the effective group ID. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#setuid>setuid</a>, <a href=#getuid>getuid</a>, <a href=#setgid>setgid</a>, <a href=#getgid>getgid</a>, <a href=#seteuid>seteuid</a>, <a href=#geteuid>geteuid</a> and <a href=#setegid>setegid</a> +<link to=setuid>setuid</link>, <link to=getuid>getuid</link>, <link to=setgid>setgid</link>, <link to=getgid>getgid</link>, <link to=seteuid>seteuid</link>, <link to=geteuid>geteuid</link> and <link to=setegid>setegid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=geteuid> +<anchor name=geteuid> <dl> <dt><encaps>NAME</encaps><dd> <tt>geteuid</tt> - get the effective user ID @@ -5806,13 +5880,13 @@ Get the effective user ID. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#setuid>setuid</a>, <a href=#getuid>getuid</a>, <a href=#setgid>setgid</a>, <a href=#getgid>getgid</a>, <a href=#seteuid>seteuid</a>, <a href=#setegid>setegid</a> and <a href=#getegid>getegid</a> +<link to=setuid>setuid</link>, <link to=getuid>getuid</link>, <link to=setgid>setgid</link>, <link to=getgid>getgid</link>, <link to=seteuid>seteuid</link>, <link to=setegid>setegid</link> and <link to=getegid>getegid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=getgid> +<anchor name=getgid> <dl> <dt><encaps>NAME</encaps><dd> <tt>getgid</tt> - get the group ID @@ -5828,13 +5902,13 @@ Get the real group ID. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#setuid>setuid</a>, <a href=#getuid>getuid</a>, <a href=#setgid>setgid</a>, <a href=#seteuid>seteuid</a>, <a href=#geteuid>geteuid</a>, <a href=#setegid>setegid</a> and <a href=#getegid>getegid</a> +<link to=setuid>setuid</link>, <link to=getuid>getuid</link>, <link to=setgid>setgid</link>, <link to=seteuid>seteuid</link>, <link to=geteuid>geteuid</link>, <link to=setegid>setegid</link> and <link to=getegid>getegid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=gethostbyaddr> +<anchor name=gethostbyaddr> <dl> <dt><encaps>NAME</encaps><dd> <tt>gethostbyaddr</tt> - gets information about a host given its address @@ -5853,13 +5927,13 @@ This function only exists on systems that have the gethostbyaddr(2) or similar system call. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#gethostbyname>gethostbyname</a> +<link to=gethostbyname>gethostbyname</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=gethostbyname> +<anchor name=gethostbyname> <dl> <dt><encaps>NAME</encaps><dd> <tt>gethostbyname</tt> - gets information about a host given its name @@ -5880,13 +5954,13 @@ This function only exists on systems that have the gethostbyname(2) or similar system call. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#gethostbyaddr>gethostbyaddr</a> +<link to=gethostbyaddr>gethostbyaddr</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=gethostname> +<anchor name=gethostname> <dl> <dt><encaps>NAME</encaps><dd> <tt>gethostname</tt> - get the name of this host @@ -5905,9 +5979,9 @@ or uname(2) system calls. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=getpgrp> +<anchor name=getpgrp> <dl> <dt><encaps>NAME</encaps><dd> <tt>getpgrp</tt> - get the process group ID @@ -5927,13 +6001,13 @@ group ID of this process. Processes <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#getpid>getpid</a> and <a href=#getppid>getppid</a> +<link to=getpid>getpid</link> and <link to=getppid>getppid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=getpid> +<anchor name=getpid> <dl> <dt><encaps>NAME</encaps><dd> <tt>getpid</tt> - get the process ID @@ -5949,13 +6023,13 @@ Returns the process ID of this process. Processes <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#getppid>getppid</a> and <a href=#getpgrp>getpgrp</a> +<link to=getppid>getppid</link> and <link to=getpgrp>getpgrp</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=getppid> +<anchor name=getppid> <dl> <dt><encaps>NAME</encaps><dd> <tt>getppid</tt> - get the parent process ID @@ -5971,13 +6045,13 @@ Returns the process ID of the parent process. Processes <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#getpid>getpid</a> and <a href=#getpgrp>getpgrp</a> +<link to=getpid>getpid</link> and <link to=getpgrp>getpgrp</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=getuid> +<anchor name=getuid> <dl> <dt><encaps>NAME</encaps><dd> <tt>getuid</tt> - get the user ID @@ -5993,13 +6067,13 @@ Get the real user ID. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#setuid>setuid</a>, <a href=#setgid>setgid</a>, <a href=#getgid>getgid</a>, <a href=#seteuid>seteuid</a>, <a href=#geteuid>geteuid</a>, <a href=#setegid>setegid</a> and <a href=#getegid>getegid</a> +<link to=setuid>setuid</link>, <link to=setgid>setgid</link>, <link to=getgid>getgid</link>, <link to=seteuid>seteuid</link>, <link to=geteuid>geteuid</link>, <link to=setegid>setegid</link> and <link to=getegid>getegid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=hardlink> +<anchor name=hardlink> <dl> <dt><encaps>NAME</encaps><dd> <tt>hardlink</tt> - create a hardlink @@ -6015,13 +6089,13 @@ Creates a hardlink named 'to' from the file 'from'. <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#symlink>symlink</a>, <a href=#mv>mv</a> and <a href=#rm>rm</a> +<link to=symlink>symlink</link>, <link to=mv>mv</link> and <link to=rm>rm</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=initgroups> +<anchor name=initgroups> <dl> <dt><encaps>NAME</encaps><dd> <tt>initgroups</tt> - initialize the group access list @@ -6039,13 +6113,13 @@ list. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#setuid>setuid</a>, <a href=#getuid>getuid</a>, <a href=#setgid>setgid</a>, <a href=#getgid>getgid</a>, <a href=#seteuid>seteuid</a>, <a href=#geteuid>geteuid</a>, <a href=#setegid>setegid</a>, <a href=#getegid>getegid</a>, system/getgroups and system/setgroups +<link to=setuid>setuid</link>, <link to=getuid>getuid</link>, <link to=setgid>setgid</link>, <link to=getgid>getgid</link>, <link to=seteuid>seteuid</link>, <link to=geteuid>geteuid</link>, <link to=setegid>setegid</link>, <link to=getegid>getegid</link>, system/getgroups and system/setgroups <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=openlog> +<anchor name=openlog> <dl> <dt><encaps>NAME</encaps><dd> <tt>openlog</tt> - initializes the connection to syslogd @@ -6097,9 +6171,9 @@ syslog, closelog and setlogmask <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=readlink> +<anchor name=readlink> <dl> <dt><encaps>NAME</encaps><dd> <tt>readlink</tt> - read a symbolic link @@ -6115,13 +6189,13 @@ Returns what the symbolic link 'linkname' points to. <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#symlink>symlink</a> +<link to=symlink>symlink</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=setegid> +<anchor name=setegid> <dl> <dt><encaps>NAME</encaps><dd> <tt>setegid</tt> - set the effective group ID @@ -6137,13 +6211,13 @@ Sets the effective group ID to 'gid'. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#setuid>setuid</a>, <a href=#getuid>getuid</a>, <a href=#setgid>setgid</a>, <a href=#getgid>getgid</a>, <a href=#seteuid>seteuid</a>, <a href=#geteuid>geteuid</a> and <a href=#getegid>getegid</a> +<link to=setuid>setuid</link>, <link to=getuid>getuid</link>, <link to=setgid>setgid</link>, <link to=getgid>getgid</link>, <link to=seteuid>seteuid</link>, <link to=geteuid>geteuid</link> and <link to=getegid>getegid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=seteuid> +<anchor name=seteuid> <dl> <dt><encaps>NAME</encaps><dd> <tt>seteuid</tt> - set the effective user ID @@ -6159,13 +6233,13 @@ Sets the effective user ID to 'uid'. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#setuid>setuid</a>, <a href=#getuid>getuid</a>, <a href=#setgid>setgid</a>, <a href=#getgid>getgid</a>, <a href=#geteuid>geteuid</a>, <a href=#setegid>setegid</a> and <a href=#getegid>getegid</a> +<link to=setuid>setuid</link>, <link to=getuid>getuid</link>, <link to=setgid>setgid</link>, <link to=getgid>getgid</link>, <link to=geteuid>geteuid</link>, <link to=setegid>setegid</link> and <link to=getegid>getegid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=setgid> +<anchor name=setgid> <dl> <dt><encaps>NAME</encaps><dd> <tt>setgid</tt> - set the group ID @@ -6181,13 +6255,13 @@ Sets the real group ID, effective group ID and saved group ID to 'gid'. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#setuid>setuid</a>, <a href=#getuid>getuid</a>, <a href=#getgid>getgid</a>, <a href=#seteuid>seteuid</a>, <a href=#geteuid>geteuid</a>, <a href=#setegid>setegid</a> and <a href=#getegid>getegid</a> +<link to=setuid>setuid</link>, <link to=getuid>getuid</link>, <link to=getgid>getgid</link>, <link to=seteuid>seteuid</link>, <link to=geteuid>geteuid</link>, <link to=setegid>setegid</link> and <link to=getegid>getegid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=setuid> +<anchor name=setuid> <dl> <dt><encaps>NAME</encaps><dd> <tt>setuid</tt> - set the user ID @@ -6203,13 +6277,13 @@ Sets the real user ID, effective user ID and saved user ID to 'uid'. Usersecurity <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#getuid>getuid</a>, <a href=#setgid>setgid</a>, <a href=#getgid>getgid</a>, <a href=#seteuid>seteuid</a>, <a href=#geteuid>geteuid</a>, <a href=#setegid>setegid</a> and <a href=#getegid>getegid</a> +<link to=getuid>getuid</link>, <link to=setgid>setgid</link>, <link to=getgid>getgid</link>, <link to=seteuid>seteuid</link>, <link to=geteuid>geteuid</link>, <link to=setegid>setegid</link> and <link to=getegid>getegid</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=symlink> +<anchor name=symlink> <dl> <dt><encaps>NAME</encaps><dd> <tt>symlink</tt> - create a symbolic link @@ -6225,13 +6299,13 @@ Creates a symbolic link named 'to' pointing to 'from'. <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#hardlink>hardlink</a>, <a href=#readlink>readlink</a>, <a href=#mv>mv</a> and <a href=#rm>rm</a> +<link to=hardlink>hardlink</link>, <link to=readlink>readlink</link>, <link to=mv>mv</link> and <link to=rm>rm</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=uname> +<anchor name=uname> <dl> <dt><encaps>NAME</encaps><dd> <tt>uname</tt> - get operating system information @@ -6255,16 +6329,16 @@ system call. <p> </dl> -</a> +</anchor> </section> -</a> +</anchor> <hr noshade size=1> -<a name=Process> +<anchor name=Process> <section title="Process"> The Process module contains functions to start and control other programs from Pike. <hr noshade size=1> -<a name=Process.popen> +<anchor name=Process.popen> <dl> <dt><encaps>NAME</encaps><dd> <tt>Process.popen</tt> - pipe open @@ -6279,9 +6353,9 @@ output. See your unix/C manual for details on popen. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Process.system> +<anchor name=Process.system> <dl> <dt><encaps>NAME</encaps><dd> <tt>Process.system</tt> - run an external program @@ -6296,13 +6370,13 @@ is finished. Standard /bin/sh completions/redirections/etc. can be used. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Process.popen>Process.popen</a>, <a href=#Process.exec>Process.exec</a> and <a href=#Process.spawn>Process.spawn</a> +<link to=Process.popen>Process.popen</link>, <link to=Process.exec>Process.exec</link> and <link to=Process.spawn>Process.spawn</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Process.spawn> +<anchor name=Process.spawn> <dl> <dt><encaps>NAME</encaps><dd> <tt>Process.spawn</tt> - spawn a process @@ -6324,21 +6398,21 @@ specify where stdin, stdout and stderr of the spawned processes should go. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Process.popen>Process.popen</a>, <a href=#fork>fork</a>, <a href=#Process.exec>Process.exec</a>, <a href=#Stdio.File.pipe>Stdio.File->pipe</a> and <a href=#Stdio.File.dup2>Stdio.File->dup2</a> +<link to=Process.popen>Process.popen</link>, <link to=fork>fork</link>, <link to=Process.exec>Process.exec</link>, <link to=Stdio.File.pipe>Stdio.File->pipe</link> and <link to=Stdio.File.dup2>Stdio.File->dup2</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=exece> +<anchor name=exece> <dl> <dt><encaps>NAME</encaps><dd> <tt>exece</tt> - execute a program <p> <dt><encaps>SYNTAX</encaps><dd> -<tt>int exece(string <I>file</I>, string *<I>args</I>);<br> +<tt>int exece(string <I>file</I>, array(string) <I>args</I>);<br> or<br> -int exece(string <I>file</I>, string *<I>args</I>, mapping(string:string) <I>env</I>);<br> +int exece(string <I>file</I>, array(string) <I>args</I>, mapping(string:string) <I>env</I>);<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -6360,13 +6434,13 @@ exece("/bin/sh", ({"-c", "echo $HOME"}), (["HOME":"/not/home"]));<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#fork>fork</a> and <a href=#Stdio.File.pipe>Stdio.File->pipe</a> +<link to=fork>fork</link> and <link to=Stdio.File.pipe>Stdio.File->pipe</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Process.exec> +<anchor name=Process.exec> <dl> <dt><encaps>NAME</encaps><dd> <tt>Process.exec</tt> - simple way to use exece() @@ -6387,12 +6461,12 @@ the exec fails for some reason. <br> </tt> </dl> -</a> +</anchor> </section> -</a> +</anchor> -<a name=Regexp> +<anchor name=Regexp> <section title="Regexp"> Regexp is short for <b>Regular Expression</b>. A regular expression is a standardized way to make pattern that match certain strings. In Pike @@ -6443,7 +6517,7 @@ You might wonder what you use regexp for, hopefully it should be more clear when you read about the following functions: <hr noshade size=1> -<a name=Regexp.create> +<anchor name=Regexp.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Regexp.create</tt> - compile regexp @@ -6467,13 +6541,13 @@ argument can be used to free up a little memory after the regexp has been used. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#clone>clone</a> and <a href=#Yp.regexp.match>Yp.regexp->match</a> +<link to=clone>clone</link> and <link to=Yp.regexp.match>Yp.regexp->match</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Regexp.match> +<anchor name=Regexp.match> <dl> <dt><encaps>NAME</encaps><dd> <tt>Regexp.match</tt> - match a regexp @@ -6487,19 +6561,19 @@ Return 1 if s matches the regexp bound to the object regexp, zero otherwise. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Regexp.create>Regexp->create</a> and <a href=#Yp.regexp.split>regexp->split</a> +<link to=Regexp.create>Regexp->create</link> and <link to=Yp.regexp.split>regexp->split</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=split> +<anchor name=split> <dl> <dt><encaps>NAME</encaps><dd> <tt>Regexp.split</tt> - split a string according to a pattern <p> <dt><encaps>SYNTAX</encaps><dd> -<tt>string *split(string s)<br> +<tt>array(string) split(string s)<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -6512,19 +6586,19 @@ If the total regexp didn't match, zero is returned. You can only have 40 subregexps. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Regexp.create>Regexp->create</a> and <a href=#Regexp.match>Regexp->match</a> +<link to=Regexp.create>Regexp->create</link> and <link to=Regexp.match>Regexp->match</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> <!-- FIXME: write and document Regexp->explode --> </section> -</a> +</anchor> -<a name=Gmp> +<anchor name=Gmp> <section title="Gmp"> Gmp is short for GNU MultiPrecision library. It is a set of routines that can manipulate very large numbers. Although much slower than regular integers @@ -6536,7 +6610,7 @@ currently Pike only has support for large integers. The others will be added later or when demand arises. Large integers are implemented as objects cloned from Gmp.Mpz. -<a name=Gmp.mpz> +<anchor name=Gmp.mpz> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz</tt> - bignum program @@ -6553,9 +6627,9 @@ This module is only available if libgmp.a was available and found when Pike was compiled. </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gmp.mpz.create> +<anchor name=Gmp.mpz.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz.create</tt> - initialize a bignum @@ -6578,13 +6652,13 @@ give the number in the string in another base by specifying the base as a second argument. Valid bases are 2-36 and 256. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#clone>clone</a> +<link to=clone>clone</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gmp.mpz.powm> +<anchor name=Gmp.mpz.powm> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz.powm</tt> - raise and modulo @@ -6597,9 +6671,9 @@ base as a second argument. Valid bases are 2-36 and 256. This function returns ( mpz ** a ) % b </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gmp.mpz.sqrt> +<anchor name=Gmp.mpz.sqrt> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz.sqrt</tt> - square root @@ -6613,9 +6687,9 @@ This function return the the truncated integer part of the square root of the value of mpz. </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gmp.mpz.probably_prime_p> +<anchor name=Gmp.mpz.probably_prime_p> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz.probably_prime_p</tt> - is this number a prime? @@ -6629,9 +6703,9 @@ This function returns 1 if mpz is a prime, and 0 most of the time if it is not. </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gmp.mpz.gcd> +<anchor name=Gmp.mpz.gcd> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz.gcd</tt> - greatest common divisor @@ -6644,9 +6718,9 @@ if it is not. This function returns the greatest common divisor for arg and mpz. </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gmp.mpz.cast> +<anchor name=Gmp.mpz.cast> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz.cast</tt> - cast to other type @@ -6668,13 +6742,13 @@ necessary when you want to view, store or use the result of an mpz calculation. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#cast>cast</a> +<link to=cast>cast</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gmp.mpz.digits> +<anchor name=Gmp.mpz.digits> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz.digits</tt> - convert mpz to a string @@ -6691,13 +6765,13 @@ number will be represented in that base. Valid bases are 2-36 and 256. The default base is 10. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Gmp.mpz.cast>Gmp.mpz->cast</a> +<link to=Gmp.mpz.cast>Gmp.mpz->cast</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gmp.mpz.size> +<anchor name=Gmp.mpz.size> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gmp.mpz.size</tt> - how long is a number @@ -6713,16 +6787,16 @@ This function returns how long the mpz would be represented in the specified base. The default base is 2. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Gmp.mpz.digits>Gmp.mpz->digits</a> +<link to=Gmp.mpz.digits>Gmp.mpz->digits</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> </section> -</a> +</anchor> -<a name=Gdbm> +<anchor name=Gdbm> <section title="Gdbm"> Gdbm is short for GNU Data Base Manager. It provides a simple data base similar to a file system. The functionality is similar to a mapping, @@ -6737,7 +6811,7 @@ might not be available in your Pike depending on whether the gdbm library was available on your system when Pike was compiled. <hr noshade size=1> -<a name=Gdbm.create> +<anchor name=Gdbm.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gdbm.create</tt> - open database @@ -6777,9 +6851,9 @@ can be left in an unusable state if Pike is terminated abnormally. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gdbm.close> +<anchor name=Gdbm.close> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gdbm.close</tt> - close database @@ -6793,9 +6867,9 @@ This closes the database. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gdbm.store> +<anchor name=Gdbm.store> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gdbm.store</tt> - store a value in the database @@ -6812,9 +6886,9 @@ the database was not open for writing. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gdbm.fetch> +<anchor name=Gdbm.fetch> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gdbm.fetch</tt> - fetch a value from the databse @@ -6829,9 +6903,9 @@ If there was no such key in the database, zero is returned. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gdbm.delete> +<anchor name=Gdbm.delete> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gdbm.delete</tt> - delete a value from the database @@ -6846,9 +6920,9 @@ if the key does not exist. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gdbm.firstkey> +<anchor name=Gdbm.firstkey> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gdbm.firstkey</tt> - get first key in database @@ -6863,9 +6937,9 @@ database. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gdbm.nextkey> +<anchor name=Gdbm.nextkey> <dl> <dt><encaps>NAME</encaps><dd> <tt>nextkey</tt> - get next key in database @@ -6887,9 +6961,9 @@ for(key=gdbm->firstkey(); k; k=gdbm->nextkey(k))<br> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gdbm.reorganize> +<anchor name=Gdbm.reorganize> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gdbm.reorganize</tt> - reorganize database @@ -6906,9 +6980,9 @@ can take a LOT of time to run. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gdbm.sync> +<anchor name=Gdbm.sync> <dl> <dt><encaps>NAME</encaps><dd> <tt>sync</tt> - synchronize database @@ -6924,12 +6998,12 @@ all such caches to disk and not return until everything is stored on the disk. <p> </dl> -</a> +</anchor> </section> -</a> +</anchor> <hr noshade size=1> -<a name=Getopt> +<anchor name=Getopt> <section title="Getopt"> Getopt is a group of function which can be used to find command line options. Command line options come in two flavours: long and short. The short ones @@ -6941,13 +7015,13 @@ arguments, in which case they cannot be combined. To write an option with an argument you write <tt>-t <i>argument</i></tt> or <tt>-t<i>argument</i></tt> or <tt>--test=<i>argument</i></tt>. <hr noshade size=1> -<a name=Getopt.find_option> +<anchor name=Getopt.find_option> <dl> <dt><encaps>NAME</encaps><dd> <tt>Getopt.find_option</tt> - find command line options <p> <dt><encaps>SYNTAX</encaps><dd> -<tt><p>mixed find_option(string *argv,<br> +<tt><p>mixed find_option(array(string) argv,<br> <dl><dt><dd>string shortform,<br> string longform,<br> string envvar,<br> @@ -6979,7 +7053,7 @@ This function reads options even if they are written after the first non-option on the line. <p> <dt><encaps>EXAMPLE</encaps><dd> -<tt>int main(int argc, string *argv)<br> +<tt>int main(int argc, array(string) argv)<br> {<br> <dl><dt><dd>if(find_option(argv,"f","foo"))<br> <dl><dt><dd>werror("The FOO option was given.\n");<br> @@ -6991,18 +7065,18 @@ find_option(argv,"b","bar","BAR_OPTION","default")+<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Getopt.get_args>Getopt.get_args</a> +<link to=Getopt.get_args>Getopt.get_args</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Getopt.find_all_options> +<anchor name=Getopt.find_all_options> <dl> <dt><encaps>NAME</encaps><dd> <tt>Getopt.find_all_options</tt> - find command line options <p> <dt><encaps>SYNTAX</encaps><dd> -<tt><p>mixed * find_all_options(string *argv, mixed *option, int|void posix_me_harder);<br> +<tt><p>mixed * find_all_options(array(string) argv, mixed *option, int|void posix_me_harder);<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -7062,7 +7136,7 @@ this form: <dd>mixed value <dt>}) </dl> -The <i>name</i> is the identifer from the input and <i>value</i> is the +The <i>name</i> is the identifier from the input and <i>value</i> is the value given to it from the argument, environment variable or <i>default</i>. If no default is given, <i>value</i> will be 1. <p> @@ -7081,12 +7155,12 @@ Result: ({ </pre> <p> This is what it would look like in real code: -<pre> +<example language=pike> import Getopt; int debug=0; -int main(int argc, string *argv +int main(int argc, array(string) argv { foreach(find_all_options(argv, ({ ({ "debug", MAY_HAVE_ARG, ({"-d","--debug"}), "DEBUG", 1}), @@ -7104,21 +7178,21 @@ int main(int argc, string *argv argv=Getopt.get_args(argv); } -</pre> +</example> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Getopt.get_args>Getopt.get_args</a> +<link to=Getopt.get_args>Getopt.get_args</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Getopt.get_args> +<anchor name=Getopt.get_args> <dl> <dt><encaps>NAME</encaps><dd> <tt>Getopt.get_args</tt> - get the non-option arguments <p> <dt><encaps>SYNTAX</encaps><dd> -<tt>string *get_args(string *<I>argv</I>);<br> +<tt>array(string) get_args(array(string) <I>argv</I>);<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -7130,7 +7204,7 @@ exit. Otherwise a new 'argv' array without the parsed options is returned. <p> <dt><encaps>EXAMPLE</encaps><dd> -<tt>int main(int argc, string *argv)<br> +<tt>int main(int argc, array(string) argv)<br> {<br> <dl><dt><dd>if(find_option(argv,"f","foo"))<br> <dl><dt><dd>werror("The FOO option was given.\n");<br> @@ -7141,16 +7215,16 @@ werror("The arguments are: "+(argv*" ")+".\n");<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Getopt.find_option>Getopt.find_option</a> +<link to=Getopt.find_option>Getopt.find_option</link> <p> </dl> -</a> +</anchor> </section> -</a> +</anchor> <hr noshade size=1> -<a name=Gz> +<anchor name=Gz> <section title="Gz"> The Gz module contains functions to compress and uncompress strings using the same algorithm as the program <tt>gzip</tt>. Packing can be done in @@ -7162,7 +7236,7 @@ Note that these functions use the same <i>algorithm</i> as gzip, they do not use the exact same format however, so you cannot directly unzip gzipped files with these routines. Support for this will be added in the future. <p> -<a name=Gz.deflate> +<anchor name=Gz.deflate> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gz.deflate</tt> - string packer @@ -7176,13 +7250,13 @@ This program is only available if libz was available and found when Pike was compiled. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Gz.inflate>Gz.inflate</a> +<link to=Gz.inflate>Gz.inflate</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gz.deflate.create> +<anchor name=Gz.deflate.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gz.deflate->create</tt> - initialize packer @@ -7202,9 +7276,9 @@ default and higher is considered 'slow' but gives better packing. so it can be re-used. </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gz.deflate.deflate> +<anchor name=Gz.deflate.deflate> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gz.deflate->deflate</tt> - pack data @@ -7231,13 +7305,13 @@ used until the end of the data when FINISH should be used. For interactive data PARTIAL_FLUSH should be used. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Gz.inflate.inflate>Gz.inflate->inflate</a> +<link to=Gz.inflate.inflate>Gz.inflate->inflate</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gz.inflate> +<anchor name=Gz.inflate> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gz.inflate</tt> - string unpacker @@ -7251,13 +7325,13 @@ This program is only available if libz was available and found when Pike was compiled. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Gz.deflate>Gz.deflate</a> +<link to=Gz.deflate>Gz.deflate</link> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gz.inflate.create> +<anchor name=Gz.inflate.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gz.inflate->create</tt> - initialize unpacker @@ -7275,9 +7349,9 @@ it. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Gz.inflate.inflate> +<anchor name=Gz.inflate.inflate> <dl> <dt><encaps>NAME</encaps><dd> <tt>Gz.inflate->inflate</tt> - unpack data @@ -7302,23 +7376,23 @@ while(string s=stdin->read(8192))<br> </dl></tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Gz.deflate.deflate>Gz.deflate->deflate</a> +<link to=Gz.deflate.deflate>Gz.deflate->deflate</link> <p> </dl> -</a> +</anchor> </section> -</a> +</anchor> <hr noshade size=1> -<a name=Yp> +<anchor name=Yp> <section title="Yp"> This module is an interface to the Yellow Pages functions. Yp is also known as NIS (Network Information System) and is most commonly used to distribute passwords and similar information within a network. <hr noshade size=1> -<a name=Yp.default_yp_domain> +<anchor name=Yp.default_yp_domain> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.default_yp_domain</tt> - get the default Yp domain @@ -7331,11 +7405,11 @@ distribute passwords and similar information within a network. Returns the default yp-domain. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpDomain> +<anchor name=Yp.YpDomain> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpDomain</tt> - class representing an Yp domain @@ -7355,10 +7429,10 @@ is not configurable from the C interface to Yp either. If no domain is given, the default domain will be used. (As returned by Yp.default_yp_domain) </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpDomain.bind> +<anchor name=Yp.YpDomain.bind> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpDomain->bind</tt> - bind this object to another domain @@ -7371,10 +7445,10 @@ Re-bind the object to another (or the same) domain. If no domain is given, the default domain will be used. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpDomain.match> +<anchor name=Yp.YpDomain.match> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.Ypdomain->match</tt> - match a key in a map @@ -7393,16 +7467,16 @@ the default domain will be used. must match exactly, no pattern matching of any kind is done. <p> <dt><encaps>EXAMPLE</encaps><dd> -<pre> +<example language=pike> object dom = Yp.YpDomain(); write(dom->match("passwd.byname", "root")); -</pre> +</example> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpDomain.all> +<anchor name=Yp.YpDomain.all> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpDomain->all</tt> - return the whole map @@ -7417,10 +7491,10 @@ write(dom->match("passwd.byname", "root")); instead of just <tt>passwd</tt>. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpDomain.map> +<anchor name=Yp.YpDomain.map> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpDomain->map</tt> - call a function for each entry in an Yp map @@ -7436,10 +7510,10 @@ write(dom->match("passwd.byname", "root")); example, passwd.byname instead of just passwd. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpDomain.server> +<anchor name=Yp.YpDomain.server> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpDomain->server</tt> - find an Yp server @@ -7453,10 +7527,10 @@ write(dom->match("passwd.byname", "root")); example, passwd.byname instead of just passwd. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpDomain.order> +<anchor name=Yp.YpDomain.order> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpDomain->order</tt> - get the'order' for specified map @@ -7471,10 +7545,10 @@ write(dom->match("passwd.byname", "root")); the YP-map to search in. This must be the full map name, as an example, passwd.byname instead of just passwd. </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpMap> +<anchor name=Yp.YpMap> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpMap</tt> - class representing one Yp map @@ -7494,10 +7568,10 @@ write(dom->match("passwd.byname", "root")); default domain will be used. This is usualy best. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpMap.match> +<anchor name=Yp.YpMap.match> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpMap->match</tt> - find key in map @@ -7514,11 +7588,11 @@ or<br> This key must match exactly, no pattern matching of any kind is done. </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpMap.all> +<anchor name=Yp.YpMap.all> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpMap->all</tt> - return the whole map as a mapping @@ -7531,10 +7605,10 @@ or<br> <dt><encaps>DESCRIPTION</encaps><dd> Return the whole map as a mapping. </dl> -</a> +</anchor> <hr noshade size=1> <p> -<a name=Yp.YpMap.map> +<anchor name=Yp.YpMap.map> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpMap->map</tt> - call a function for each entry in the map @@ -7546,10 +7620,10 @@ or<br> For each entry in the map, call the function(s) specified by 'over'. The function will be called like 'void over(string key, string value)' </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpMap.server> +<anchor name=Yp.YpMap.server> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpMap->server</tt> - find what server servers this map @@ -7560,10 +7634,10 @@ or<br> <dt><encaps>DESCRIPTION</encaps><dd> Return the hostname of the server serving this map. </dl> -</a> +</anchor> <hr noshade size=1> <p> -<a name=Yp.YpMap.order> +<anchor name=Yp.YpMap.order> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpMap->order()</tt> - find the 'order' of this map @@ -7575,10 +7649,10 @@ or<br> Return the 'order' number for this map. This is usually a time_t (see the global function time()) </dl> -</a> +</anchor> <hr noshade size=1> <p> -<a name=Yp.YpMap._sizeof> +<anchor name=Yp.YpMap._sizeof> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpMap._sizeof</tt> - return the number of entries in the map @@ -7590,11 +7664,11 @@ or<br> Returns the number of entries in the map. This is equivalent to <tt>sizeof((mapping)map);</tt> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=Yp.YpMap._indices> -<a name=Yp.YpMap._values> +<anchor name=Yp.YpMap._indices> +<anchor name=Yp.YpMap._values> <dl> <dt><encaps>NAME</encaps><dd> <tt>Yp.YpMap._indices</tt> - return the indices from the map<br> @@ -7609,8 +7683,8 @@ array(string) values(<i>Yp.Ypmap</i>) be called immediately after. If values is called first, it is the other way around. </dl> -</a> -</a> +</anchor> +</anchor> <p> <hr noshade size=1> @@ -7618,7 +7692,7 @@ Here is an example program using the Yp module, it lists users and their GCOS field from the Yp map "passwd.byname" if your system uses Yp. -<pre> +<example language=pike> import Yp; void print_entry(string key, string val) @@ -7642,12 +7716,12 @@ Yp. o->map(print_entry); // Print username/GECOS pairs } -</pre> +</example> </section> -</a> +</anchor> <hr noshade size=1> -<a name=MIME> +<anchor name=MIME> <section title="MIME"> <a href="http://www.roxen.com/rfc/rfc1521.txt">RFC1521</a>, the @@ -7705,7 +7779,7 @@ containing raw uninterpreted data: <section title="Global functions"> -<a name=MIME.decode> +<anchor name=MIME.decode> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.decode</tt> - Remove transfer encoding @@ -7728,13 +7802,13 @@ The encoding can be any of The encoding string is not case sensitive. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.encode>MIME.encode</a> +<link to=MIME.encode>MIME.encode</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.decode_base64> +<anchor name=MIME.decode_base64> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.decode_base64</tt> - Decode <tt>base64</tt> transfer encoding @@ -7747,13 +7821,13 @@ The encoding string is not case sensitive. This function decodes data encoded using the <tt>base64</tt> transfer encoding. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.encode_base64>MIME.encode_base64</a> +<link to=MIME.encode_base64>MIME.encode_base64</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.decode_qp> +<anchor name=MIME.decode_qp> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.decode_qp</tt> - Decode <tt>quoted-printable</tt> transfer encoding @@ -7767,13 +7841,13 @@ This function decodes data encoded using the <tt>quoted-printable</tt> (a.k.a. quoted-unreadable) transfer encoding. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.encode_qp>MIME.encode_qp</a> +<link to=MIME.encode_qp>MIME.encode_qp</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.decode_uue> +<anchor name=MIME.decode_uue> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.decode_uue</tt> - Decode <tt>x-uue</tt> transfer encoding @@ -7787,13 +7861,13 @@ This function decodes data encoded using the <tt>x-uue</tt> transfer encoding. It can also be used to decode generic UUEncoded files. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.encode_uue>MIME.encode_uue</a> +<link to=MIME.encode_uue>MIME.encode_uue</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.decode_word> +<anchor name=MIME.decode_word> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.decode_word</tt> - Descramble RFC1522 encoding @@ -7812,7 +7886,7 @@ be applied to individual encoded words. <p> <dt><encaps>EXAMPLES</encaps><dd> <pre> -> Array.map("=?iso-8859-1?b?S2lscm95?= was =?us-ascii?q?h=65re?="/" ", +> Array.map("=?iso-8859-1?b?S2lscm95?= was =?us-ascii?q?h=65re?="/" ", MIME.decode_word); Result: ({ /* 3 elements */ ({ /* 2 elements */ @@ -7831,13 +7905,13 @@ Result: ({ /* 3 elements */ </pre> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.encode_word>MIME.encode_word</a> +<link to=MIME.encode_word>MIME.encode_word</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.encode> +<anchor name=MIME.encode> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.encode</tt> - Apply transfer encoding @@ -7865,13 +7939,13 @@ as <i>no_linebreaks</i>, the result string will not contain any linebreaks (base64 and quoted-printable only). <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.decode>MIME.decode</a> +<link to=MIME.decode>MIME.decode</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.encode_base64> +<anchor name=MIME.encode_base64> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.encode_base64</tt> - Encode string using <tt>base64</tt> transfer encoding @@ -7886,13 +7960,13 @@ If a nonzero value is passed as <i>no_linebreaks</i>, the result string will not contain any linebreaks. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.decode_base64>MIME.decode_base64</a> +<link to=MIME.decode_base64>MIME.decode_base64</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.encode_qp> +<anchor name=MIME.encode_qp> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.encode_qp</tt> - Encode string using <tt>quoted-printable</tt> transfer encoding @@ -7908,13 +7982,13 @@ This function encodes data using the <tt>quoted-printable</tt> excuse for using it.</strong> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.decode_qp>MIME.decode_qp</a> +<link to=MIME.decode_qp>MIME.decode_qp</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.encode_uue> +<anchor name=MIME.encode_uue> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.encode_uue</tt> - Encode string using <tt>x-uue</tt> transfer encoding @@ -7931,13 +8005,13 @@ in the encoded data, for extraction purposes. This function can also be used to produce generic UUEncoded files. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.decode_uue>MIME.decode_uue</a> +<link to=MIME.decode_uue>MIME.decode_uue</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.encode_word> +<anchor name=MIME.encode_word> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.encode_word</tt> - Encode word according to RFC1522 @@ -7963,13 +8037,13 @@ Result: Foo </pre> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.decode_word>MIME.decode_word</a> +<link to=MIME.decode_word>MIME.decode_word</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.generate_boundary> +<anchor name=MIME.generate_boundary> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.generate_boundary</tt> - Create a suitable boundary string for multiparts @@ -7987,10 +8061,10 @@ the cast method of the <tt>Message</tt> class if no boundary string is specified. <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.guess_subtype> +<anchor name=MIME.guess_subtype> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.guess_subtype</tt> - Provide a reasonable default for the subtype field @@ -8012,11 +8086,11 @@ the function uses the following guesses: </table> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.quote> +<anchor name=MIME.quote> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.quote</tt> - Create an RFC822 header field from lexical elements @@ -8026,7 +8100,7 @@ the function uses the following guesses: </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> -This function is the inverse of the <a href=#tokenize>tokenize</a> function. +This function is the inverse of the <link to=tokenize>tokenize</link> function. A header field value is constructed from a sequence of lexical elements. Characters (<tt>int</tt>s) are taken to be special-characters, whereas strings are encoded as atoms or quoted-strings, depending on whether @@ -8043,13 +8117,13 @@ There is no way to constuct a domain-literal using this function. Neither can it be used to produce comments. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.tokenize>MIME.tokenize</a> +<link to=MIME.tokenize>MIME.tokenize</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.reconstruct_partial> +<anchor name=MIME.reconstruct_partial> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.reconstruct_partial</tt> - Join a fragmented message to its original form @@ -8081,13 +8155,13 @@ many, -1 is returned. </ul> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.is_partial>MIME.Message->is_partial</a> +<link to=MIME.Message.is_partial>MIME.Message->is_partial</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.tokenize> +<anchor name=MIME.tokenize> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.tokenize</tt> - Separate an RFC822 header field into lexical elements @@ -8137,10 +8211,10 @@ The set of special-characters is the one specified in RFC1521 (i.e. <tt>"<", specified in RFC822. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.quote>MIME.quote</a> +<link to=MIME.quote>MIME.quote</link> <p> </dl> -</a> +</anchor> <hr newpage> </section> @@ -8151,7 +8225,7 @@ This class is used to hold a decoded MIME message. <section title="Public fields"> <hr newpage> -<a name=MIME.Message.body_parts> +<anchor name=MIME.Message.body_parts> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->body_parts</tt> - Multipart submessages @@ -8166,14 +8240,14 @@ Message object for each part of the message. If the message is not a multipart, this field is <tt>0</tt>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.type>MIME.Message->type</a>, -<a href=#MIME.Message.boundary>MIME.Message->boundary</a> +<link to=MIME.Message.type>MIME.Message->type</link>, +<link to=MIME.Message.boundary>MIME.Message->boundary</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.boundary> +<anchor name=MIME.Message.boundary> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.mesage->boundary</tt> - Boundary string for multipart messages @@ -8189,13 +8263,13 @@ are handled internally by the module, you should not need to access this field. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.setboundary>MIME.Message->setboundary</a> +<link to=MIME.Message.setboundary>MIME.Message->setboundary</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.charset> +<anchor name=MIME.Message.charset> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->charset</tt> - Character encoding for text bodies @@ -8211,13 +8285,13 @@ type text. If there is no <tt>Content-Type</tt> header, the value of this field is <tt>"us-ascii"</tt>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.type>MIME.Message->type</a> +<link to=MIME.Message.type>MIME.Message->type</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.disposition> +<anchor name=MIME.Message.disposition> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->disposition</tt> - Multipart subpart disposition @@ -8233,10 +8307,10 @@ application. If there is no <tt>Content-Disposition</tt> header, this field is <tt>0</tt>. <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.disp_params> +<anchor name=MIME.Message.disp_params> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->disp_params</tt> - Content-Disposition parameters @@ -8250,14 +8324,14 @@ A mapping containing all the additional parameters to the <tt>Content-Disposition</tt> header. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.setdisp_param>MIME.Message->setdisp_param</a>, -<a href=#MIME.Message.get_filename>MIME.Message->get_filename</a> +<link to=MIME.Message.setdisp_param>MIME.Message->setdisp_param</link>, +<link to=MIME.Message.get_filename>MIME.Message->get_filename</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.headers> +<anchor name=MIME.Message.headers> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->headers</tt> - All header fields of the message @@ -8282,25 +8356,25 @@ The contents of these fields can be accessed and/or modified through a set of variables and methods available for this purpose. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.type>MIME.Message->type</a>, -<a href=#MIME.Message.subtype>MIME.Message->subtype</a>, -<a href=#MIME.Message.charset>MIME.Message->charset</a>, -<a href=#MIME.Message.boundary>MIME.Message->boundary</a>, -<a href=#MIME.Message.transfer_encoding>MIME.Message->transfer_encoding</a>, -<a href=#MIME.Message.params>MIME.Message->params</a>, -<a href=#MIME.Message.disposition>MIME.Message->disposition</a>, -<a href=#MIME.Message.disp_params>MIME.Message->disp_params</a>, -<a href=#MIME.Message.setencoding>MIME.Message->setencoding</a>, -<a href=#MIME.Message.setparam>MIME.Message->setparam</a>, -<a href=#MIME.Message.setdisp_param>MIME.Message->setdisp_param</a>, -<a href=#MIME.Message.setcharset>MIME.Message->setcharset</a>, -<a href=#MIME.Message.setboundary>MIME.Message->setboundary</a> +<link to=MIME.Message.type>MIME.Message->type</link>, +<link to=MIME.Message.subtype>MIME.Message->subtype</link>, +<link to=MIME.Message.charset>MIME.Message->charset</link>, +<link to=MIME.Message.boundary>MIME.Message->boundary</link>, +<link to=MIME.Message.transfer_encoding>MIME.Message->transfer_encoding</link>, +<link to=MIME.Message.params>MIME.Message->params</link>, +<link to=MIME.Message.disposition>MIME.Message->disposition</link>, +<link to=MIME.Message.disp_params>MIME.Message->disp_params</link>, +<link to=MIME.Message.setencoding>MIME.Message->setencoding</link>, +<link to=MIME.Message.setparam>MIME.Message->setparam</link>, +<link to=MIME.Message.setdisp_param>MIME.Message->setdisp_param</link>, +<link to=MIME.Message.setcharset>MIME.Message->setcharset</link>, +<link to=MIME.Message.setboundary>MIME.Message->setboundary</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.params> +<anchor name=MIME.Message.params> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->params</tt> - Content-Type parameters @@ -8315,15 +8389,15 @@ A mapping containing all the additional parameters to the own, which should be accessed instead of this mapping wherever applicable. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.charset>MIME.Message->charset</a>, -<a href=#MIME.Message.boundary>MIME.Message->boundary</a>, -<a href=#MIME.Message.setparam>MIME.Message->setparam</a> +<link to=MIME.Message.charset>MIME.Message->charset</link>, +<link to=MIME.Message.boundary>MIME.Message->boundary</link>, +<link to=MIME.Message.setparam>MIME.Message->setparam</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.subtype> +<anchor name=MIME.Message.subtype> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->subtype</tt> - The subtype attribute of the Content-Type header @@ -8339,14 +8413,14 @@ header. If there is no <tt>Content-Type</tt> header, the value of this field is <tt>"plain"</tt>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.type>MIME.Message->type</a>, -<a href=#MIME.Message.params>MIME.Message->params</a> +<link to=MIME.Message.type>MIME.Message->type</link>, +<link to=MIME.Message.params>MIME.Message->params</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.transfer_encoding> +<anchor name=MIME.Message.transfer_encoding> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->transfer_encoding</tt> - Body encoding method @@ -8363,13 +8437,13 @@ field should be intrerresting only to applications wishing to do autoconversion of certain transfer encodings. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.setencoding>MIME.Message->setencoding</a> +<link to=MIME.Message.setencoding>MIME.Message->setencoding</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.type> +<anchor name=MIME.Message.type> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->type</tt> - The type attribute of the Content-Type header @@ -8385,11 +8459,11 @@ header. If there is no <tt>Content-Type</tt> header, the value of this field is <tt>"text"</tt>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.subtype>MIME.Message->subtype</a>, -<a href=#MIME.Message.params>MIME.Message->params</a> +<link to=MIME.Message.subtype>MIME.Message->subtype</link>, +<link to=MIME.Message.params>MIME.Message->params</link> <p> </dl> -</a> +</anchor> <hr newpage> </section> @@ -8397,7 +8471,7 @@ is <tt>"text"</tt>. <section title="Public methods"> <hr newpage> -<a name=MIME.Message.cast> +<anchor name=MIME.Message.cast> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->cast</tt> - Encode message into byte stream @@ -8412,7 +8486,7 @@ for transmitting the message over protocols such as ESMTP and NNTP. The body will be encoded using the current transfer encoding, and subparts of a multipart will be collected recursively. If the message is a multipart and no boundary string has been set, one is generated using -<a href=#generate_boundary>generate_boundary</a>. +<link to=generate_boundary>generate_boundary</link>. <p> <dt><encaps>EXAMPLES</encaps><dd> <pre> @@ -8431,13 +8505,13 @@ SGVsbG8sIHdvcmxkIQ== </pre> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.create>MIME.Message->create</a> +<link to=MIME.Message.create>MIME.Message->create</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.create> +<anchor name=MIME.Message.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->create</tt> - Create a Message object @@ -8478,13 +8552,13 @@ Result: iso-8859-1 </pre> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Messag.cast>MIME.Message->cast</a> +<link to=MIME.Messag.cast>MIME.Message->cast</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.getdata> +<anchor name=MIME.Message.getdata> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->getdata</tt> - Obtain raw body data @@ -8495,17 +8569,17 @@ Result: iso-8859-1 <p> <dt><encaps>DESCRIPTION</encaps><dd> This method returns the raw data of the message body entity. The -<a href=#MIME.Message.type>type</a> and <a href=#MIME.Message.subtype>subtype</a> attributes +<link to=MIME.Message.type>type</link> and <link to=MIME.Message.subtype>subtype</link> attributes indicate how this data should be interpreted. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.getencoded>MIME.Message->getencoded</a> +<link to=MIME.Message.getencoded>MIME.Message->getencoded</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.getencoded> +<anchor name=MIME.Message.getencoded> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->getencoded</tt> - Obtain encoded body data @@ -8519,13 +8593,13 @@ This method returns the data of the message body entity, encoded using the current transfer encoding. You should never have to call this function. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.getdata>MIME.Message->getdata</a> +<link to=MIME.Message.getdata>MIME.Message->getdata</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.get_filename> +<anchor name=MIME.Message.get_filename> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->get_filename</tt> - Get supplied filename for body data @@ -8546,10 +8620,10 @@ An interactive application should always query the user for the actual filename to use. This method may provide a reasonable default though. <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.is_partial> +<anchor name=MIME.Message.is_partial> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->is_partial</tt> - Identify <tt>message/partial</tt> message @@ -8571,13 +8645,13 @@ was not available. If this method is called in a message that is not a part of a fragmented message, it will return 0. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.reconstruct_partial>MIME.reconstruct_partial</a> +<link to=MIME.reconstruct_partial>MIME.reconstruct_partial</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.setboundary> +<anchor name=MIME.Message.setboundary> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->setboundary</tt> - Set boundary parameter @@ -8592,13 +8666,13 @@ This is equivalent of calling <tt>msg->setparam("boundary", <i>boundary</i>)</tt>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.setparam>MIME.Message->setparam</a> +<link to=MIME.Message.setparam>MIME.Message->setparam</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.setcharset> +<anchor name=MIME.Message.setcharset> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->setcharset</tt> - Set charset parameter @@ -8613,13 +8687,13 @@ This is equivalent of calling <tt>msg->setparam("charset", <i>charset</i>)</tt>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.setparam>MIME.Message->setparam</a> +<link to=MIME.Message.setparam>MIME.Message->setparam</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.setdata> +<anchor name=MIME.Message.setdata> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->setdata</tt> - Replace body data @@ -8631,17 +8705,17 @@ This is equivalent of calling <dt><encaps>DESCRIPTION</encaps><dd> Replaces the body entity of the data with a new piece of raw data. The new data should comply to the format indicated by the -<a href=#type>type</a> and <a href=#subtype>subtype</a> attributes. +<link to=type>type</link> and <link to=subtype>subtype</link> attributes. Do not use this method unless you know what you are doing. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.getdata>MIME.Message->getdata</a> +<link to=MIME.Message.getdata>MIME.Message->getdata</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.setdisp_param> +<anchor name=MIME.Message.setdisp_param> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->setdisp_param</tt> - Set Content-Disposition parameters @@ -8657,14 +8731,14 @@ the <tt>Content-Disposition</tt> header directly, please use this function instead. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.setparam>MIME.Message->setparam</a>, -<a href=#MIME.Message.get_filename>MIME.Message->get_filename</a> +<link to=MIME.Message.setparam>MIME.Message->setparam</link>, +<link to=MIME.Message.get_filename>MIME.Message->get_filename</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.setencoding> +<anchor name=MIME.Message.setencoding> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->setencoding</tt> - Set transfer encoding for message body @@ -8677,17 +8751,17 @@ function instead. Select a new transfer encoding for this message. The <tt>Content-Transfer-Encoding</tt> header will be modified accordningly, and subsequent calls to <tt>getencoded</tt> will produce data encoded using -the new encoding. See <a href=#MIME.Message.encode>encode</a> for a list of valid +the new encoding. See <link to=MIME.Message.encode>encode</link> for a list of valid encodings. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.getencoded>MIME.Message->getencoded</a> +<link to=MIME.Message.getencoded>MIME.Message->getencoded</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=MIME.Message.setparam> +<anchor name=MIME.Message.setparam> <dl> <dt><encaps>NAME</encaps><dd> <tt>MIME.Message->setparam</tt> - Set Content-Type parameters @@ -8703,19 +8777,19 @@ Common parameters include <tt>charset</tt> for text messages, and the <tt>Content-Type</tt> header directly, please use this function instead. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#MIME.Message.setcharset>MIME.Message->setcharset</a>, -<a href=#MIME.Message.setboundary>MIME.Message->setboundary</a>, -<a href=#MIME.Message.setdisp_param>MIME.Message->setdisp_param</a> +<link to=MIME.Message.setcharset>MIME.Message->setcharset</link>, +<link to=MIME.Message.setboundary>MIME.Message->setboundary</link>, +<link to=MIME.Message.setdisp_param>MIME.Message->setdisp_param</link> <p> </dl> -</a> +</anchor> <hr newpage> </section> </section> </section> -</a> +</anchor> -<a name=Simulate> +<anchor name=Simulate> <section title="Simulate"> This module is used to achive better compatibility with older versions of Pike. It can also be used for convenience, but I would advice against it @@ -8730,7 +8804,7 @@ modules. In addition, these functions are available: <hr newpage> -<a name=Simulate.member_array> +<anchor name=Simulate.member_array> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.member_array</tt> - find first occurance of a value in an array @@ -8746,10 +8820,10 @@ If not found, then -1 is returned. This is the same as <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.previous_object> +<anchor name=Simulate.previous_object> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.previous_object</tt> - return the calling object @@ -8763,15 +8837,15 @@ Returns an object pointer to the object that called current function, if any. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#backtrace>bactrace</a> +<link to=backtrace>bactrace</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.this_function> +<anchor name=Simulate.this_function> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.this_function</tt> - return a function pointer to the current function @@ -8788,14 +8862,14 @@ making recursive lambda-functions. <a href=types_function.html>function</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#backtrace>backtrace</a> +<link to=backtrace>backtrace</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.get_function> +<anchor name=Simulate.get_function> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.get_function</tt> - fetch a function from an object @@ -8809,29 +8883,29 @@ Defined as: return o[name]; <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.map_regexp> +<anchor name=Simulate.map_regexp> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.map_regexp</tt> - filter an array through a regexp <p> <dt><encaps>SYNTAX</encaps><dd> -<tt>string *regexp(string *<I>arr</I>, string <I>reg</I>);<br> +<tt>array(string) regexp(array(string) <I>arr</I>, string <I>reg</I>);<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> Return those strings in arr that matches the regexp in reg. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Regexp>Regexp</a> +<link to=Regexp>Regexp</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.PI> +<anchor name=Simulate.PI> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.PI</tt> - pi @@ -8849,10 +8923,10 @@ constant Pi. <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.all_efuns> +<anchor name=Simulate.all_efuns> <dl> <dt><encaps>NAME</encaps><dd> <tt>all_efuns</tt> - return all 'efuns' @@ -8865,15 +8939,15 @@ constant Pi. This function is the same as all_constants. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#all_constants>all_constants</a> +<link to=all_constants>all_constants</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.filter_array> +<anchor name=Simulate.filter_array> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.filter_array</tt> - filter an array through a function @@ -8894,13 +8968,13 @@ Filter array is the same function as Array.filter. <a href=types_array.html>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Array.filter>Array.filter</a> +<link to=Array.filter>Array.filter</link> <p> </dl> -</a> +</anchor> -<a name=Simulate.map_array> +<anchor name=Simulate.map_array> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.map_array</tt> - map an array over a function @@ -8920,20 +8994,20 @@ This function is the same as Array.map. <a href=types_array.html>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Array.map>Array.map</a> +<link to=Array.map>Array.map</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.implode> +<anchor name=Simulate.implode> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.implode</tt> - implode an array of strings <p> <dt><encaps>SYNTAX</encaps><dd> -<tt>string implode(string *<I>a</I>, string <I>delimeter</I>);<br> +<tt>string implode(array(string) <I>a</I>, string <I>delimeter</I>);<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -8953,15 +9027,15 @@ Result: a and b and c<br> <a href=types_string.html>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Simulate.simulated_explode.html>Simulate.explode</a> +<link to=Simulate.simulated_explode.html>Simulate.explode</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.m_indices> +<anchor name=Simulate.m_indices> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.m_indices</tt> - return all indices from a mapping @@ -8977,13 +9051,13 @@ This function is equal to indices <a href=types_mapping.html>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#indices>indices</a> +<link to=indices>indices</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.m_sizeof> +<anchor name=Simulate.m_sizeof> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.m_sizeof</tt> - Return the size of a mapping @@ -8999,14 +9073,14 @@ This function is equal to sizeof. <a href=types_mapping.html>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sizeof>sizeof</a> +<link to=sizeof>sizeof</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.m_values> +<anchor name=Simulate.m_values> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.m_values</tt> - return all values from a mapping @@ -9022,14 +9096,14 @@ This function is equal to values <a href=types_mapping.html>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#values>values</a> +<link to=values>values</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.strstr> +<anchor name=Simulate.strstr> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.strstr</tt> - find a string inside a string @@ -9046,14 +9120,14 @@ Return the position of str2 in str1, if str2 can't be found in str1 <a href=types_string.html>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sscanf>sscanf</a> and <a href=#Simulate.explode>Simulate.explode</a> +<link to=sscanf>sscanf</link> and <link to=Simulate.explode>Simulate.explode</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.sum> +<anchor name=Simulate.sum> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.sum</tt> - add values together @@ -9080,10 +9154,10 @@ the summation operator. <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.add_efun> +<anchor name=Simulate.add_efun> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.add_efun</tt> - add an efun or constant @@ -9098,13 +9172,13 @@ void add_efun(string func_name)<br> This function is the same as add_constant. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#add_constant>Simulate.add_constant</a> +<link to=add_constant>Simulate.add_constant</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.l_sizeof> +<anchor name=Simulate.l_sizeof> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.l_sizeof</tt> - Return the size of a multiset @@ -9117,13 +9191,13 @@ This function is the same as add_constant. This function is equal to sizeof. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sizeof>sizeof</a> +<link to=sizeof>sizeof</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.listp> +<anchor name=Simulate.listp> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.listp</tt> - is the argument a list? (multiset) @@ -9136,14 +9210,14 @@ This function is equal to sizeof. This function is the same as multisetp. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#multisetp>Simulate.multisetp</a> +<link to=multisetp>Simulate.multisetp</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.mklist> +<anchor name=Simulate.mklist> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.mklist</tt> - make a multiset @@ -9165,14 +9239,14 @@ Result: (< /* 3 elements */<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#aggregage_multiset>aggregate_multiset</a> +<link to=aggregage_multiset>aggregate_multiset</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.aggregage_list> +<anchor name=Simulate.aggregage_list> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.aggregage_list</tt> - aggregate a multiset @@ -9185,14 +9259,14 @@ Result: (< /* 3 elements */<br> This function is exactly the same as aggregate_multiset. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#aggregage_multiset>aggregate_multiset</a> +<link to=aggregage_multiset>aggregate_multiset</link> <p> </dl> -</a> +</anchor> <hr newpage> -<a name=Simulate.query_host_name> +<anchor name=Simulate.query_host_name> <dl> <dt><encaps>NAME</encaps><dd> <tt>Simulate.query_host_name</tt> - return the name of the host we are running on @@ -9208,9 +9282,9 @@ prints. <p> </dl> -</a> +</anchor> </section> -</a> +</anchor> <hr newpage> @@ -9224,7 +9298,7 @@ prints. </chapter> -<a name=Image> +<anchor name=Image> <chapter title="The Image module"> The Image module is used to manipulate bit-mapped color images. It can read PPM images and do various manipulations, or it can be @@ -9249,7 +9323,7 @@ current color you use 'setcolor'. <p> Let's look at an example of how this can be used: -<pre> +<example language=pike> #!/usr/local/bin/pike int main() @@ -9260,7 +9334,7 @@ Let's look at an example of how this can be used: object image=font->write(ctime(time)); write(image->togif()); } -</pre> +</example> This very simple example can be used as a cgi script to produce a gif image which says what time it is in white text on a black background. <p> @@ -9268,93 +9342,93 @@ which says what time it is in white text on a black background. <section title="Image.image"> <dl><dd> -The main object of the <a href=#Image>Image</a> module, this object +The main object of the <link to=Image>Image</link> module, this object is used as drawing area, mask or result of operations. -<p> init: <a href=#Image.image.clear>Image.image->clear</a>, - <a href=#Image.image.clone>Image.image->clone</a>, - <a href=#Image.image.create>Image.image->create</a>, - <a href=#Image.image.xsize>Image.image->xsize</a>, - <a href=#Image.image.ysize>Image.image->ysize</a> - -<p> plain drawing: <a href=#Image.image.box>Image.image->box</a>, - <a href=#Image.image.circle>Image.image->circle</a>, - <a href=#Image.image.getpixel>Image.image->getpixel</a>, - <a href=#Image.image.line>Image.image->line</a>, - <a href=#Image.image.setcolor>Image.image->setcolor</a>, - <a href=#Image.image.setpixel>Image.image->setpixel</a>, - <a href=#Image.image.treshold>Image.image->treshold</a>, - <a href=#Image.image.tuned_box>Image.image->tuned_box</a>, - <a href=#Image.image.polyfill>Image.image->polyfill</a> - -<p> operators: <a href=#Image.image.%60%26>Image.image->`&</a>, - <a href=#Image.image.%60*>Image.image->`*</a>, - <a href=#Image.image.%60+>Image.image->`+</a>, - <a href=#Image.image.%60->Image.image->`-</a>, - <a href=#Image.image.%60|>Image.image->`|</a> - -<p> pasting images, layers: <a href=#Image.image.add_layers>Image.image->add_layers</a>, - <a href=#Image.image.paste>Image.image->paste</a>, - <a href=#Image.image.paste_alpha>Image.image->paste_alpha</a>, - <a href=#Image.image.paste_alpha_color>Image.image->paste_alpha_color</a>, - <a href=#Image.image.paste_mask>Image.image->paste_mask</a> - -<p> getting subimages, scaling, rotating: <a href=#Image.image.autocrop>Image.image->autocrop</a>, - <a href=#Image.image.ccw>Image.image->ccw</a>, - <a href=#Image.image.cw>Image.image->cw</a>, - <a href=#Image.image.clone>Image.image->clone</a>, - <a href=#Image.image.copy>Image.image->copy</a>, - <a href=#Image.image.dct>Image.image->dct</a>, - <a href=#Image.image.mirrorx>Image.image->mirrorx</a>, - <a href=#Image.image.rotate>Image.image->rotate</a>, - <a href=#Image.image.rotate_expand>Image.image->rotate_expand</a>, - <a href=#Image.image.scale>Image.image->scale</a>, - <a href=#Image.image.skewx>Image.image->skewx</a>, - <a href=#Image.image.skewx_expand>Image.image->skewx_expand</a>, - <a href=#Image.image.skewy>Image.image->skewy</a>, - <a href=#Image.image.skewy_expand>Image.image->skewy_expand</a> - -<p> calculation by pixels: <a href=#Image.image.apply_matrix>Image.image->apply_matrix</a>, - <a href=#Image.image.change_color>Image.image->change_color</a>, - <a href=#Image.image.color>Image.image->color</a>, - <a href=#Image.image.distancesq>Image.image->distancesq</a>, - <a href=#Image.image.grey>Image.image->grey</a>, - <a href=#Image.image.invert>Image.image->invert</a>, - <a href=#Image.image.map_closest>Image.image->map_closest</a>, - <a href=#Image.image.map_fast>Image.image->map_fast</a>, - <a href=#Image.image.modify_by_intensity>Image.image->modify_by_intensity</a>, - <a href=#Image.image.select_from>Image.image->select_from</a> - -<p> converting to other datatypes: <a href=#Image.image.cast>Image.image->cast</a>, - <a href=#Image.image.fromgif>Image.image->fromgif</a>, - <a href=#Image.image.frompnm>Image.image->frompnm</a>/<a href=#Image.image.fromppm>Image.image->fromppm</a>, - <a href=#Image.image.gif_add>Image.image->gif_add</a>, - <a href=#Image.image.gif_add_fs>Image.image->gif_add_fs</a>, - <a href=#Image.image.gif_add_fs_nomap>Image.image->gif_add_fs_nomap</a>, - <a href=#Image.image.gif_add_nomap>Image.image->gif_add_nomap</a>, - <a href=#Image.image.gif_begin>Image.image->gif_begin</a>, - <a href=#Image.image.gif_end>Image.image->gif_end</a>, - <a href=#Image.image.gif_netscape_loop>Image.image->gif_netscape_loop</a>, - <a href=#Image.image.to8bit>Image.image->to8bit</a>, - <a href=#Image.image.to8bit_closest>Image.image->to8bit_closest</a>, - <a href=#Image.image.to8bit_fs>Image.image->to8bit_fs</a>, - <a href=#Image.image.to8bit_rgbcube>Image.image->to8bit_rgbcube</a>, - <a href=#Image.image.to8bit_rgbcube_rdither>Image.image->to8bit_rgbcube_rdither</a>, - <a href=#Image.image.tobitmap>Image.image->tobitmap</a>, - <a href=#Image.image.togif>Image.image->togif</a>, - <a href=#Image.image.togif_fs>Image.image->togif_fs</a>, - <a href=#Image.image.toppm>Image.image->toppm</a>, - <a href=#Image.image.tozbgr>Image.image->tozbgr</a> +<p> init: <link to=Image.image.clear>Image.image->clear</link>, + <link to=Image.image.clone>Image.image->clone</link>, + <link to=Image.image.create>Image.image->create</link>, + <link to=Image.image.xsize>Image.image->xsize</link>, + <link to=Image.image.ysize>Image.image->ysize</link> + +<p> plain drawing: <link to=Image.image.box>Image.image->box</link>, + <link to=Image.image.circle>Image.image->circle</link>, + <link to=Image.image.getpixel>Image.image->getpixel</link>, + <link to=Image.image.line>Image.image->line</link>, + <link to=Image.image.setcolor>Image.image->setcolor</link>, + <link to=Image.image.setpixel>Image.image->setpixel</link>, + <link to=Image.image.treshold>Image.image->treshold</link>, + <link to=Image.image.tuned_box>Image.image->tuned_box</link>, + <link to=Image.image.polyfill>Image.image->polyfill</link> + +<p> operators: <link to=Image.image.%60%26>Image.image->`&</link>, + <link to=Image.image.%60*>Image.image->`*</link>, + <link to=Image.image.%60+>Image.image->`+</link>, + <link to=Image.image.%60->Image.image->`-</link>, + <link to=Image.image.%60|>Image.image->`|</link> + +<p> pasting images, layers: <link to=Image.image.add_layers>Image.image->add_layers</link>, + <link to=Image.image.paste>Image.image->paste</link>, + <link to=Image.image.paste_alpha>Image.image->paste_alpha</link>, + <link to=Image.image.paste_alpha_color>Image.image->paste_alpha_color</link>, + <link to=Image.image.paste_mask>Image.image->paste_mask</link> + +<p> getting subimages, scaling, rotating: <link to=Image.image.autocrop>Image.image->autocrop</link>, + <link to=Image.image.ccw>Image.image->ccw</link>, + <link to=Image.image.cw>Image.image->cw</link>, + <link to=Image.image.clone>Image.image->clone</link>, + <link to=Image.image.copy>Image.image->copy</link>, + <link to=Image.image.dct>Image.image->dct</link>, + <link to=Image.image.mirrorx>Image.image->mirrorx</link>, + <link to=Image.image.rotate>Image.image->rotate</link>, + <link to=Image.image.rotate_expand>Image.image->rotate_expand</link>, + <link to=Image.image.scale>Image.image->scale</link>, + <link to=Image.image.skewx>Image.image->skewx</link>, + <link to=Image.image.skewx_expand>Image.image->skewx_expand</link>, + <link to=Image.image.skewy>Image.image->skewy</link>, + <link to=Image.image.skewy_expand>Image.image->skewy_expand</link> + +<p> calculation by pixels: <link to=Image.image.apply_matrix>Image.image->apply_matrix</link>, + <link to=Image.image.change_color>Image.image->change_color</link>, + <link to=Image.image.color>Image.image->color</link>, + <link to=Image.image.distancesq>Image.image->distancesq</link>, + <link to=Image.image.grey>Image.image->grey</link>, + <link to=Image.image.invert>Image.image->invert</link>, + <link to=Image.image.map_closest>Image.image->map_closest</link>, + <link to=Image.image.map_fast>Image.image->map_fast</link>, + <link to=Image.image.modify_by_intensity>Image.image->modify_by_intensity</link>, + <link to=Image.image.select_from>Image.image->select_from</link> + +<p> converting to other datatypes: <link to=Image.image.cast>Image.image->cast</link>, + <link to=Image.image.fromgif>Image.image->fromgif</link>, + <link to=Image.image.frompnm>Image.image->frompnm</link>/<link to=Image.image.fromppm>Image.image->fromppm</link>, + <link to=Image.image.gif_add>Image.image->gif_add</link>, + <link to=Image.image.gif_add_fs>Image.image->gif_add_fs</link>, + <link to=Image.image.gif_add_fs_nomap>Image.image->gif_add_fs_nomap</link>, + <link to=Image.image.gif_add_nomap>Image.image->gif_add_nomap</link>, + <link to=Image.image.gif_begin>Image.image->gif_begin</link>, + <link to=Image.image.gif_end>Image.image->gif_end</link>, + <link to=Image.image.gif_netscape_loop>Image.image->gif_netscape_loop</link>, + <link to=Image.image.to8bit>Image.image->to8bit</link>, + <link to=Image.image.to8bit_closest>Image.image->to8bit_closest</link>, + <link to=Image.image.to8bit_fs>Image.image->to8bit_fs</link>, + <link to=Image.image.to8bit_rgbcube>Image.image->to8bit_rgbcube</link>, + <link to=Image.image.to8bit_rgbcube_rdither>Image.image->to8bit_rgbcube_rdither</link>, + <link to=Image.image.tobitmap>Image.image->tobitmap</link>, + <link to=Image.image.togif>Image.image->togif</link>, + <link to=Image.image.togif_fs>Image.image->togif_fs</link>, + <link to=Image.image.toppm>Image.image->toppm</link>, + <link to=Image.image.tozbgr>Image.image->tozbgr</link> </dl> <encaps>SEE ALSO</encaps> -<dl><dd> <a href=#Image>Image</a>, - <a href=#Image.font>Image.font</a> +<dl><dd> <link to=Image>Image</link>, + <link to=Image.font>Image.font</link> </dl> <hr> -<a name=Image.image.%60%26> +<anchor name=Image.image.%60%26> <dl> <dt><encaps>NAME</encaps><dd> <tt>`&</tt> - makes a new image out of the minimum pixels values<p><dt><encaps>SYNTAX</encaps><dd> @@ -9379,13 +9453,13 @@ makes a new image out of the minimum pixels values the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.%60->Image.image->`-</a>, <a href=#Image.image.%60+>Image.image->`+</a>, <a href=#Image.image.%60|>Image.image->`|</a>, <a href=#Image.image.%60*>Image.image->`*</a> and <a href=#Image.image.add_layers>Image.image->add_layers</a> +<link to=Image.image.%60->Image.image->`-</link>, <link to=Image.image.%60+>Image.image->`+</link>, <link to=Image.image.%60|>Image.image->`|</link>, <link to=Image.image.%60*>Image.image->`*</link> and <link to=Image.image.add_layers>Image.image->add_layers</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.%60*> +<anchor name=Image.image.%60*> <dl> <dt><encaps>NAME</encaps><dd> <tt>`*</tt> - Multiplies pixel values and creates a new image<p><dt><encaps>SYNTAX</encaps><dd> @@ -9414,13 +9488,13 @@ Multiplies pixel values and creates a new image. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.%60->Image.image->`-</a>, <a href=#Image.image.%60+>Image.image->`+</a>, <a href=#Image.image.%60|>Image.image->`|</a>, <a href=#Image.image.%60%26>Image.image->`&</a> and <a href=#Image.image.add_layers>Image.image->add_layers</a> +<link to=Image.image.%60->Image.image->`-</link>, <link to=Image.image.%60+>Image.image->`+</link>, <link to=Image.image.%60|>Image.image->`|</link>, <link to=Image.image.%60%26>Image.image->`&</link> and <link to=Image.image.add_layers>Image.image->add_layers</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.%60+> +<anchor name=Image.image.%60+> <dl> <dt><encaps>NAME</encaps><dd> <tt>`+</tt> - adds two images @@ -9444,13 +9518,13 @@ adds two images; values are truncated at 255. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.%60->Image.image->`-</a>, <a href=#Image.image.%60|>Image.image->`|</a>, <a href=#Image.image.%60%26>Image.image->`&</a>, <a href=#Image.image.%60*>Image.image->`*</a> and <a href=#Image.image.add_layers>Image.image->add_layers</a> +<link to=Image.image.%60->Image.image->`-</link>, <link to=Image.image.%60|>Image.image->`|</link>, <link to=Image.image.%60%26>Image.image->`&</link>, <link to=Image.image.%60*>Image.image->`*</link> and <link to=Image.image.add_layers>Image.image->add_layers</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.%60-> +<anchor name=Image.image.%60-> <dl> <dt><encaps>NAME</encaps><dd> <tt>`-</tt> - makes a new image out of the difference @@ -9475,13 +9549,13 @@ makes a new image out of the difference the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.%60+>Image.image->`+</a>, <a href=#Image.image.%60|>Image.image->`|</a>, <a href=#Image.image.%60%26>Image.image->`&</a>, <a href=#Image.image.%60*>Image.image->`*</a> and <a href=#Image.image.add_layers>Image.image->add_layers</a> +<link to=Image.image.%60+>Image.image->`+</link>, <link to=Image.image.%60|>Image.image->`|</link>, <link to=Image.image.%60%26>Image.image->`&</link>, <link to=Image.image.%60*>Image.image->`*</link> and <link to=Image.image.add_layers>Image.image->add_layers</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.%60|> +<anchor name=Image.image.%60|> <dl> <dt><encaps>NAME</encaps><dd> <tt>`|</tt> - makes a new image out of the maximum pixels values<p><dt><encaps>SYNTAX</encaps><dd> @@ -9506,13 +9580,13 @@ makes a new image out of the maximum pixels values the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.%60->Image.image->`-</a>, <a href=#Image.image.%60+>Image.image->`+</a>, <a href=#Image.image.%60%26>Image.image->`&</a>, <a href=#Image.image.%60*>Image.image->`*</a> and <a href=#Image.image.add_layers>Image.image->add_layers</a> +<link to=Image.image.%60->Image.image->`-</link>, <link to=Image.image.%60+>Image.image->`+</link>, <link to=Image.image.%60%26>Image.image->`&</link>, <link to=Image.image.%60*>Image.image->`*</link> and <link to=Image.image.add_layers>Image.image->add_layers</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.add_layers> +<anchor name=Image.image.add_layers> <dl> <dt><encaps>NAME</encaps><dd> <tt>add_layers</tt> - add layers together @@ -9566,13 +9640,13 @@ Using the called object as base, adds layers using masks, a new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.paste_mask>Image.image->paste_mask</a>, <a href=#Image.image.paste_alpha>Image.image->paste_alpha</a>, <a href=#Image.image.paste_alpha_color>Image.image->paste_alpha_color</a>, <a href=#Image.image.%60|>Image.image->`|</a>, <a href=#Image.image.%60%26>Image.image->`&</a>, <a href=#Image.image.%60*>Image.image->`*</a>, <a href=#Image.image.%60+>Image.image->`+</a> and <a href=#Image.image.%60->Image.image->`-</a> +<link to=Image.image.paste_mask>Image.image->paste_mask</link>, <link to=Image.image.paste_alpha>Image.image->paste_alpha</link>, <link to=Image.image.paste_alpha_color>Image.image->paste_alpha_color</link>, <link to=Image.image.%60|>Image.image->`|</link>, <link to=Image.image.%60%26>Image.image->`&</link>, <link to=Image.image.%60*>Image.image->`*</link>, <link to=Image.image.%60+>Image.image->`+</link> and <link to=Image.image.%60->Image.image->`-</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.apply_matrix> +<anchor name=Image.image.apply_matrix> <dl> <dt><encaps>NAME</encaps><dd> <tt>apply_matrix</tt> - Applies a pixel-transform matrix, or filter, to the image.<p><dt><encaps>SYNTAX</encaps><dd> @@ -9620,7 +9694,7 @@ Applies a pixel-transform matrix, or filter, to the image. ({0, 0,0})}) </pre> -<p> emboss (might prefer to begin with a <a href=#Image.image.grey>Image.image->grey</a> image): +<p> emboss (might prefer to begin with a <link to=Image.image.grey>Image.image->grey</link> image): <pre> ({({2, 1, 0}) ({1, 0,-1}), @@ -9646,10 +9720,10 @@ Applies a pixel-transform matrix, or filter, to the image. the new image object <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.autocrop> +<anchor name=Image.image.autocrop> <dl> <dt><encaps>NAME</encaps><dd> <tt>autocrop</tt> - Removes "unneccesary" borders around the image<p><dt><encaps>SYNTAX</encaps><dd> @@ -9687,13 +9761,13 @@ Removes "unneccesary" borders around the image, adds one of the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.copy>Image.image->copy</a> +<link to=Image.image.copy>Image.image->copy</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.box> +<anchor name=Image.image.box> <dl> <dt><encaps>NAME</encaps><dd> <tt>box</tt> - Draws a filled rectangle on the image @@ -9723,10 +9797,10 @@ Draws a filled rectangle on the image. the object called <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.cast> +<anchor name=Image.image.cast> <dl> <dt><encaps>NAME</encaps><dd> <tt>cast</tt> - convert to other types @@ -9740,13 +9814,13 @@ known bugs: always casts to string... the image data as a string ("rgbrgbrgb...") <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.toppm>Image.image->toppm</a>, <a href=#Image.image.togif>Image.image->togif</a>, <a href=#Image.image.tozbgr>Image.image->tozbgr</a>, <a href=#Image.image.to8bit>Image.image->to8bit</a> and <a href=#Image.image.to8bit_rgbcube>Image.image->to8bit_rgbcube</a> +<link to=Image.image.toppm>Image.image->toppm</link>, <link to=Image.image.togif>Image.image->togif</link>, <link to=Image.image.tozbgr>Image.image->tozbgr</link>, <link to=Image.image.to8bit>Image.image->to8bit</link> and <link to=Image.image.to8bit_rgbcube>Image.image->to8bit_rgbcube</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.ccw> +<anchor name=Image.image.ccw> <dl> <dt><encaps>NAME</encaps><dd> <tt>ccw</tt> - rotates an image 90 degrees counter-clockwise<p><dt><encaps>SYNTAX</encaps><dd> @@ -9759,10 +9833,10 @@ rotates an image counter-clockwise, 90 degrees. the new image object <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.change_color> +<anchor name=Image.image.change_color> <dl> <dt><encaps>NAME</encaps><dd> <tt>change_color</tt> - Replaces one color with another @@ -9772,8 +9846,8 @@ object change_color(int fromr, int fromg, int fromb, int&nb <p> <dt><encaps>DESCRIPTION</encaps><dd> Changes one color (exakt match) to another. - If non-exakt-match is preferred, check <a href=#Image.image.distancesq>Image.image->distancesq</a> - and <a href=#Image.image.paste_alpha_color>Image.image->paste_alpha_color</a>. + If non-exakt-match is preferred, check <link to=Image.image.distancesq>Image.image->distancesq</link> + and <link to=Image.image.paste_alpha_color>Image.image->paste_alpha_color</link>. </p> <dt><encaps>ARGUMENTS</encaps><dd><dl> <dt><tt>int tor</tt> @@ -9790,10 +9864,10 @@ Changes one color (exakt match) to another. a new (the destination) image object <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.circle> +<anchor name=Image.image.circle> <dl> <dt><encaps>NAME</encaps><dd> <tt>circle</tt> - Draw a line on the image @@ -9824,10 +9898,10 @@ Draws a line on the image. The line is <i>not</i> antialiased. the object called <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.clear> +<anchor name=Image.image.clear> <dl> <dt><encaps>NAME</encaps><dd> <tt>clear</tt> - create a new empty image of same size @@ -9849,13 +9923,13 @@ gives a new, cleared image with the same size of drawing area </dl><p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.copy>Image.image->copy</a> and <a href=#Image.image.clone>Image.image->clone</a> +<link to=Image.image.copy>Image.image->copy</link> and <link to=Image.image.clone>Image.image->clone</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.clone> +<anchor name=Image.image.clone> <dl> <dt><encaps>NAME</encaps><dd> <tt>clone</tt> - Copies to or initialize a new image object<p><dt><encaps>SYNTAX</encaps><dd> @@ -9887,13 +9961,13 @@ Copies to or initialize a new image object. the new object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.copy>Image.image->copy</a> and <a href=#Image.image.create>Image.image->create</a> +<link to=Image.image.copy>Image.image->copy</link> and <link to=Image.image.create>Image.image->create</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.color> +<anchor name=Image.image.color> <dl> <dt><encaps>NAME</encaps><dd> <tt>color</tt> - Colorize an image @@ -9925,13 +9999,13 @@ Colorize an image. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.grey>Image.image->grey</a>, <a href=#Image.image.%60*>Image.image->`*</a> and <a href=#Image.image.modify_by_intensity>Image.image->modify_by_intensity</a> +<link to=Image.image.grey>Image.image->grey</link>, <link to=Image.image.%60*>Image.image->`*</link> and <link to=Image.image.modify_by_intensity>Image.image->modify_by_intensity</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.copy> +<anchor name=Image.image.copy> <dl> <dt><encaps>NAME</encaps><dd> <tt>copy</tt> - Copies a part of the image @@ -9965,17 +10039,17 @@ a new image object <p> <dt><encaps>NOTE</encaps> <dd> -<a href=#Image.image.clone>Image.image->clone</a>(void) and <a href=#Image.image.copy>Image.image->copy</a>(void) does the same +<link to=Image.image.clone>Image.image->clone</link>(void) and <link to=Image.image.copy>Image.image->copy</link>(void) does the same operation <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.clone>Image.image->clone</a> and <a href=#Image.image.autocrop>Image.image->autocrop</a> +<link to=Image.image.clone>Image.image->clone</link> and <link to=Image.image.autocrop>Image.image->autocrop</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.create> +<anchor name=Image.image.create> <dl> <dt><encaps>NAME</encaps><dd> <tt>create</tt> - Initializes a new image object @@ -10002,13 +10076,13 @@ Initializes a new image object. </dl><p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.copy>Image.image->copy</a>, <a href=#Image.image.clone>Image.image->clone</a> and <a href=#Image.image>Image.image</a> +<link to=Image.image.copy>Image.image->copy</link>, <link to=Image.image.clone>Image.image->clone</link> and <link to=Image.image>Image.image</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.cw> +<anchor name=Image.image.cw> <dl> <dt><encaps>NAME</encaps><dd> <tt>cw</tt> - rotates an image 90 degrees clockwise<p><dt><encaps>SYNTAX</encaps><dd> @@ -10021,10 +10095,10 @@ rotates an image clockwise, 90 degrees. the new image object <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.dct> +<anchor name=Image.image.dct> <dl> <dt><encaps>NAME</encaps><dd> <tt>dct</tt> - Scales the image to a new size<p><dt><encaps>SYNTAX</encaps><dd> @@ -10062,10 +10136,10 @@ Do NOT use this function if you don't know what you're dealing with! Read some signal theory first... <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.distancesq> +<anchor name=Image.image.distancesq> <dl> <dt><encaps>NAME</encaps><dd> <tt>distancesq</tt> - Makes an grey-scale image for alpha-channel use<p><dt><encaps>SYNTAX</encaps><dd> @@ -10099,13 +10173,13 @@ Makes an grey-scale image, for alpha-channel use. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.select_from>Image.image->select_from</a> +<link to=Image.image.select_from>Image.image->select_from</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.fromgif> +<anchor name=Image.image.fromgif> <dl> <dt><encaps>NAME</encaps><dd> <tt>fromgif</tt> - Reads GIF data to the called image object<p><dt><encaps>SYNTAX</encaps><dd> @@ -10127,14 +10201,14 @@ Reads GIF data to the called image object. the called object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.togif>Image.image->togif</a> and <a href=#Image.image.frompnm>Image.image->frompnm</a> +<link to=Image.image.togif>Image.image->togif</link> and <link to=Image.image.frompnm>Image.image->frompnm</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.frompnm> -<a name=Image.image.fromppm> +<anchor name=Image.image.frompnm> +<anchor name=Image.image.fromppm> <dl> <dt><encaps>NAME</encaps><dd> <tt>frompnm, fromppm</tt> - Reads PNM data to the called image object @@ -10159,14 +10233,14 @@ Reads a PNM (PBM, PGM or PPM in ascii or binary) the called object or a hint of what wronged. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.toppm>Image.image->toppm</a> and <a href=#Image.image.fromgif>Image.image->fromgif</a> +<link to=Image.image.toppm>Image.image->toppm</link> and <link to=Image.image.fromgif>Image.image->fromgif</link> </p> </dl> -</a> -</a> +</anchor> +</anchor> <hr> -<a name=Image.image.getpixel> +<anchor name=Image.image.getpixel> <dl> <dt><encaps>NAME</encaps><dd> <tt>getpixel</tt> - get the value of a pixel @@ -10183,13 +10257,13 @@ the called object or a hint of what wronged. color of the requested pixel -- ({int red,int green,int blue}) <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.gif_add> -<a name=Image.image.gif_add_fs> -<a name=Image.image.gif_add_fs_nomap> -<a name=Image.image.gif_add_nomap> +<anchor name=Image.image.gif_add> +<anchor name=Image.image.gif_add_fs> +<anchor name=Image.image.gif_add_fs_nomap> +<anchor name=Image.image.gif_add_nomap> <dl> <dt><encaps>NAME</encaps><dd> <tt>gif_add, gif_add_fs, gif_add_fs_nomap, gif_add_nomap</tt> - Makes a GIF (sub)image data chunk @@ -10270,16 +10344,16 @@ I (Mirar) recommend reading about the GIF file format before experementing with these. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.gif_add>Image.image->gif_add</a>, <a href=#Image.image.gif_end>Image.image->gif_end</a>, <a href=#Image.image.gif_netscape_loop>Image.image->gif_netscape_loop</a> and <a href=#Image.image.togif */>Image.image->togif */</a> +<link to=Image.image.gif_add>Image.image->gif_add</link>, <link to=Image.image.gif_end>Image.image->gif_end</link>, <link to=Image.image.gif_netscape_loop>Image.image->gif_netscape_loop</link> and <link to=Image.image.togif */>Image.image->togif */</link> </p> </dl> -</a> -</a> -</a> -</a> +</anchor> +</anchor> +</anchor> +</anchor> <hr> -<a name=Image.image.gif_begin> +<anchor name=Image.image.gif_begin> <dl> <dt><encaps>NAME</encaps><dd> <tt>gif_begin</tt> - Makes GIF header<p><dt><encaps>SYNTAX</encaps><dd> @@ -10302,13 +10376,13 @@ Makes GIF header. With no argument, there is no the GIF data <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.gif_add>Image.image->gif_add</a>, <a href=#Image.image.gif_end>Image.image->gif_end</a>, <a href=#Image.image.togif>Image.image->togif</a> and <a href=#Image.image.gif_netscape_loop>Image.image->gif_netscape_loop</a> +<link to=Image.image.gif_add>Image.image->gif_add</link>, <link to=Image.image.gif_end>Image.image->gif_end</link>, <link to=Image.image.togif>Image.image->togif</link> and <link to=Image.image.gif_netscape_loop>Image.image->gif_netscape_loop</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.gif_end> +<anchor name=Image.image.gif_end> <dl> <dt><encaps>NAME</encaps><dd> <tt>gif_end</tt> - Ends GIF data @@ -10322,13 +10396,13 @@ Ends GIF data. the GIF data. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.gif_begin>Image.image->gif_begin</a> +<link to=Image.image.gif_begin>Image.image->gif_begin</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.gif_netscape_loop> +<anchor name=Image.image.gif_netscape_loop> <dl> <dt><encaps>NAME</encaps><dd> <tt>gif_netscape_loop</tt> - makes a gif chunk which defines how many times it should loop @@ -10345,13 +10419,13 @@ string gif_netscape_loop(int loops)</tt> a gif chunk that defines that the GIF animation should loop <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.gif_add>Image.image->gif_add</a>, <a href=#Image.image.gif_begin>Image.image->gif_begin</a> and <a href=#Image.image.gif_end>Image.image->gif_end</a> +<link to=Image.image.gif_add>Image.image->gif_add</link>, <link to=Image.image.gif_begin>Image.image->gif_begin</link> and <link to=Image.image.gif_end>Image.image->gif_end</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.grey> +<anchor name=Image.image.grey> <dl> <dt><encaps>NAME</encaps><dd> <tt>grey</tt> - Makes a grey-scale image @@ -10374,13 +10448,13 @@ Makes a grey-scale image (with weighted values). the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.color>Image.image->color</a>, <a href=#Image.image.%60*>Image.image->`*</a> and <a href=#Image.image.modify_by_intensity>Image.image->modify_by_intensity</a> +<link to=Image.image.color>Image.image->color</link>, <link to=Image.image.%60*>Image.image->`*</link> and <link to=Image.image.modify_by_intensity>Image.image->modify_by_intensity</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.invert> +<anchor name=Image.image.invert> <dl> <dt><encaps>NAME</encaps><dd> <tt>invert</tt> - Invert an image @@ -10395,10 +10469,10 @@ Invert an image. Each pixel value gets to be 255-x, where x the new image object <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.line> +<anchor name=Image.image.line> <dl> <dt><encaps>NAME</encaps><dd> <tt>line</tt> - Draws a line on the image @@ -10428,10 +10502,10 @@ Draws a line on the image. The line is <i>not</i> antialiased. the object called <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.map_closest> +<anchor name=Image.image.map_closest> <dl> <dt><encaps>NAME</encaps><dd> <tt>map_closest</tt> - Maps all pixel colors to the colors given @@ -10454,13 +10528,13 @@ Maps all pixel colors to the colors given. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.map_fast>Image.image->map_fast</a>, <a href=#Image.image.select_colors>Image.image->select_colors</a> and <a href=#Image.image.map_fs>Image.image->map_fs</a> +<link to=Image.image.map_fast>Image.image->map_fast</link>, <link to=Image.image.select_colors>Image.image->select_colors</link> and <link to=Image.image.map_fs>Image.image->map_fs</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.map_closest> +<anchor name=Image.image.map_closest> <dl> <dt><encaps>NAME</encaps><dd> <tt>map_closest</tt> - Selects the best colors to represent the image @@ -10479,13 +10553,13 @@ Selects the best colors to represent the image. an array of colors <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.map_fast>Image.image->map_fast</a> and <a href=#Image.image.select_colors>Image.image->select_colors</a> +<link to=Image.image.map_fast>Image.image->map_fast</link> and <link to=Image.image.select_colors>Image.image->select_colors</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.map_fast> +<anchor name=Image.image.map_fast> <dl> <dt><encaps>NAME</encaps><dd> <tt>map_fast</tt> - Maps all pixel colors to the colors given @@ -10510,13 +10584,13 @@ Maps all pixel colors to the colors given. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.map_fast>Image.image->map_fast</a> and <a href=#Image.image.select_colors>Image.image->select_colors</a> +<link to=Image.image.map_fast>Image.image->map_fast</link> and <link to=Image.image.select_colors>Image.image->select_colors</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.map_fs> +<anchor name=Image.image.map_fs> <dl> <dt><encaps>NAME</encaps><dd> <tt>map_fs</tt> - Maps all pixel colors to the colors given @@ -10542,13 +10616,13 @@ Maps all pixel colors to the colors given. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.map_fast>Image.image->map_fast</a>, <a href=#Image.image.select_colors>Image.image->select_colors</a> and <a href=#Image.image.map_closest>Image.image->map_closest</a> +<link to=Image.image.map_fast>Image.image->map_fast</link>, <link to=Image.image.select_colors>Image.image->select_colors</link> and <link to=Image.image.map_closest>Image.image->map_closest</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.mirrorx> +<anchor name=Image.image.mirrorx> <dl> <dt><encaps>NAME</encaps><dd> <tt>mirrorx</tt> - mirrors an image @@ -10565,10 +10639,10 @@ mirrors an image: the new image object <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.mirrorx> +<anchor name=Image.image.mirrorx> <dl> <dt><encaps>NAME</encaps><dd> <tt>mirrorx</tt> - mirrors an image @@ -10582,10 +10656,10 @@ mirrors an image: </center> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.modify_by_intensity> +<anchor name=Image.image.modify_by_intensity> <dl> <dt><encaps>NAME</encaps><dd> <tt>modify_by_intensity</tt> - Recolor an image from intensity values @@ -10596,7 +10670,7 @@ mirrors an image: Recolor an image from intensity values. <p> For each color an intensity is calculated, from r, g and b factors - (see <a href=#Image.image.grey>Image.image->grey</a>), this gives a value between 0 and max. + (see <link to=Image.image.grey>Image.image->grey</link>), this gives a value between 0 and max. <p> The color is then calculated from the values given, v1 representing the intensity value of 0, vn representing max, and colors between @@ -10616,13 +10690,13 @@ Recolor an image from intensity values. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.grey>Image.image->grey</a>, <a href=#Image.image.%60*>Image.image->`*</a> and <a href=#Image.image.color>Image.image->color</a> +<link to=Image.image.grey>Image.image->grey</link>, <link to=Image.image.%60*>Image.image->`*</link> and <link to=Image.image.color>Image.image->color</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.paste> +<anchor name=Image.image.paste> <dl> <dt><encaps>NAME</encaps><dd> <tt>paste</tt> - Pastes a given image over the current image @@ -10645,13 +10719,13 @@ Pastes a given image over the current image. the object called <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.paste_mask>Image.image->paste_mask</a>, <a href=#Image.image.paste_alpha>Image.image->paste_alpha</a> and <a href=#Image.image.paste_alpha_color>Image.image->paste_alpha_color</a> +<link to=Image.image.paste_mask>Image.image->paste_mask</link>, <link to=Image.image.paste_alpha>Image.image->paste_alpha</link> and <link to=Image.image.paste_alpha_color>Image.image->paste_alpha_color</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.paste_alpha> +<anchor name=Image.image.paste_alpha> <dl> <dt><encaps>NAME</encaps><dd> <tt>paste_alpha</tt> - Pastes a given image over the current image @@ -10681,13 +10755,13 @@ Pastes a given image over the current image, with the object called <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.paste_mask>Image.image->paste_mask</a>, <a href=#Image.image.paste>Image.image->paste</a> and <a href=#Image.image.paste_alpha_color>Image.image->paste_alpha_color</a> +<link to=Image.image.paste_mask>Image.image->paste_mask</link>, <link to=Image.image.paste>Image.image->paste</link> and <link to=Image.image.paste_alpha_color>Image.image->paste_alpha_color</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.paste_alpha_color> +<anchor name=Image.image.paste_alpha_color> <dl> <dt><encaps>NAME</encaps><dd> <tt>paste_alpha_color</tt> - Pastes a given color over the current image @@ -10723,13 +10797,13 @@ Pastes a given color over the current image, the object called <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.paste_mask>Image.image->paste_mask</a>, <a href=#Image.image.paste_alpha>Image.image->paste_alpha</a> and <a href=#Image.image.paste_alpha_color>Image.image->paste_alpha_color</a> +<link to=Image.image.paste_mask>Image.image->paste_mask</link>, <link to=Image.image.paste_alpha>Image.image->paste_alpha</link> and <link to=Image.image.paste_alpha_color>Image.image->paste_alpha_color</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.paste_mask> +<anchor name=Image.image.paste_mask> <dl> <dt><encaps>NAME</encaps><dd> <tt>paste_mask</tt> - Pastes a given image over the current image @@ -10760,13 +10834,13 @@ Pastes a given image over the current image, the object called <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.paste>Image.image->paste</a>, <a href=#Image.image.paste_alpha>Image.image->paste_alpha</a> and <a href=#Image.image.paste_alpha_color>Image.image->paste_alpha_color</a> +<link to=Image.image.paste>Image.image->paste</link>, <link to=Image.image.paste_alpha>Image.image->paste_alpha</link> and <link to=Image.image.paste_alpha_color>Image.image->paste_alpha_color</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.polygone> +<anchor name=Image.image.polygone> <dl> <dt><encaps>NAME</encaps><dd> <tt>polygone</tt> - fills an area with the current color @@ -10793,14 +10867,14 @@ This function is new (april-97) and rather untested. the current object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.box>Image.image->box</a> and <a href=#Image.image.setcolor>Image.image->setcolor</a> +<link to=Image.image.box>Image.image->box</link> and <link to=Image.image.setcolor>Image.image->setcolor</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.rotate> -<a name=Image.image.rotate_expand> +<anchor name=Image.image.rotate> +<anchor name=Image.image.rotate_expand> <dl> <dt><encaps>NAME</encaps><dd> <tt>rotate, rotate_expand</tt> - Rotates an image @@ -10835,11 +10909,11 @@ Rotates an image a certain amount of degrees (360 the new image object <p> </dl> -</a> -</a> +</anchor> +</anchor> <hr> -<a name=Image.image.scale> +<anchor name=Image.image.scale> <dl> <dt><encaps>NAME</encaps><dd> <tt>scale</tt> - scales the image by a given factor @@ -10864,10 +10938,10 @@ scales the image with a factor, the new image object <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.scale> +<anchor name=Image.image.scale> <dl> <dt><encaps>NAME</encaps><dd> <tt>scale</tt> - scales the image to a specified new size @@ -10891,10 +10965,10 @@ scales the image to a specified new size, the new image object <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.select_from> +<anchor name=Image.image.select_from> <dl> <dt><encaps>NAME</encaps><dd> <tt>select_from</tt> - Makes an grey-scale image for alpha-channel use @@ -10910,7 +10984,7 @@ Makes an grey-scale image, for alpha-channel use. The image is scanned from the given pixel, filled with 255 if the color is the same, or 255 minus distance in the colorcube, squared, rightshifted - 8 steps (see <a href=#Image.image.distancesq>Image.image->distancesq</a>). + 8 steps (see <link to=Image.image.distancesq>Image.image->distancesq</link>). <p> When the edge distance is reached, the scan is stopped. Default edge value is 30. @@ -10927,13 +11001,13 @@ Makes an grey-scale image, for alpha-channel use. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.distancesq>Image.image->distancesq</a> +<link to=Image.image.distancesq>Image.image->distancesq</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.setcolor> +<anchor name=Image.image.setcolor> <dl> <dt><encaps>NAME</encaps><dd> <tt>setcolor</tt> - set the current color @@ -10957,10 +11031,10 @@ set the current color the object called <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.setpixel> +<anchor name=Image.image.setpixel> <dl> <dt><encaps>NAME</encaps><dd> <tt>setpixel</tt> - set a pixel in the image @@ -10985,11 +11059,11 @@ object setpixel(int x, int y, int r, int g, int b, int& the object called <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.skewx> -<a name=Image.image.skewx_expand> +<anchor name=Image.image.skewx> +<anchor name=Image.image.skewx_expand> <dl> <dt><encaps>NAME</encaps><dd> <tt>skewx, skewx_expand</tt> - Skews an image an amount of pixels or a factor @@ -11028,12 +11102,12 @@ Skews an image an amount of pixels or a factor; the new image object <p> </dl> -</a> -</a> +</anchor> +</anchor> <hr> -<a name=Image.image.skewy> -<a name=Image.image.skewy_expand> +<anchor name=Image.image.skewy> +<anchor name=Image.image.skewy_expand> <dl> <dt><encaps>NAME</encaps><dd> <tt>skewy, skewy_expand</tt> - Skews an image an amount of pixels or a factor @@ -11072,13 +11146,13 @@ Skews an image an amount of pixels or a factor; the new image object <p> </dl> -</a> -</a> +</anchor> +</anchor> <hr> -<a name=Image.image.to8bit> -<a name=Image.image.to8bit_closest> -<a name=Image.image.to8bit_fs> +<anchor name=Image.image.to8bit> +<anchor name=Image.image.to8bit_closest> +<anchor name=Image.image.to8bit_fs> <dl> <dt><encaps>NAME</encaps><dd> <tt>to8bit, to8bit_closest, to8bit_fs</tt> - Map image to 8-bit data @@ -11097,17 +11171,17 @@ Maps the image to the given colors and returns the calculated string <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.to8bit_rgbcube>Image.image->to8bit_rgbcube</a>, <a href=#Image.image.tozbgr>Image.image->tozbgr</a>, <a href=#Image.image.map_fast>Image.image->map_fast</a>, <a href=#Image.image.map_closest>Image.image->map_closest</a>, <a href=#Image.image.select_colors>Image.image->select_colors</a> and <a href=#Image.image.tobitmap>Image.image->tobitmap</a> +<link to=Image.image.to8bit_rgbcube>Image.image->to8bit_rgbcube</link>, <link to=Image.image.tozbgr>Image.image->tozbgr</link>, <link to=Image.image.map_fast>Image.image->map_fast</link>, <link to=Image.image.map_closest>Image.image->map_closest</link>, <link to=Image.image.select_colors>Image.image->select_colors</link> and <link to=Image.image.tobitmap>Image.image->tobitmap</link> </p> </dl> -</a> -</a> -</a> +</anchor> +</anchor> +</anchor> <hr> -<a name=Image.image.to8bit_rgbcube> -<a name=Image.image.to8bit_rgbcube_rdither> -<a name=Image.image.tozbgr> +<anchor name=Image.image.to8bit_rgbcube> +<anchor name=Image.image.to8bit_rgbcube_rdither> +<anchor name=Image.image.tozbgr> <dl> <dt><encaps>NAME</encaps><dd> <tt>to8bit_rgbcube, to8bit_rgbcube_rdither, tozbgr</tt> - Maps the image into a colorcube @@ -11141,15 +11215,15 @@ Maps the image into a colorcube with the given the calculated string <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.tozbgr>Image.image->tozbgr</a>, <a href=#Image.image.to8bit>Image.image->to8bit</a> and <a href=#Image.image.tobitmap>Image.image->tobitmap</a> +<link to=Image.image.tozbgr>Image.image->tozbgr</link>, <link to=Image.image.to8bit>Image.image->to8bit</link> and <link to=Image.image.tobitmap>Image.image->tobitmap</link> </p> </dl> -</a> -</a> -</a> +</anchor> +</anchor> +</anchor> <hr> -<a name=Image.image.tobitmap> +<anchor name=Image.image.tobitmap> <dl> <dt><encaps>NAME</encaps><dd> <tt>tobitmap</tt> - Maps the image to a bitmap @@ -11168,14 +11242,14 @@ Maps the image to a bitmap. the calculated string <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.tozbgr>Image.image->tozbgr</a>, <a href=#Image.image.to8bit>Image.image->to8bit</a>, <a href=#Image.image.to8bit_rgbcube>Image.image->to8bit_rgbcube</a> and <a href=#Image.image.cast>Image.image->cast</a> +<link to=Image.image.tozbgr>Image.image->tozbgr</link>, <link to=Image.image.to8bit>Image.image->to8bit</link>, <link to=Image.image.to8bit_rgbcube>Image.image->to8bit_rgbcube</link> and <link to=Image.image.cast>Image.image->cast</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.togif> -<a name=Image.image.togif_fs> +<anchor name=Image.image.togif> +<anchor name=Image.image.togif_fs> <dl> <dt><encaps>NAME</encaps><dd> <tt>togif, togif_fs</tt> - Makes GIF data @@ -11212,14 +11286,14 @@ Makes GIF data. The togif_fs variant uses floyd-steinberg the GIF data <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.togif_begin>Image.image->togif_begin</a>, <a href=#Image.image.togif_add>Image.image->togif_add</a>, <a href=#Image.image.togif_end>Image.image->togif_end</a>, <a href=#Image.image.toppm>Image.image->toppm</a> and <a href=#Image.image.fromgif>Image.image->fromgif</a> +<link to=Image.image.togif_begin>Image.image->togif_begin</link>, <link to=Image.image.togif_add>Image.image->togif_add</link>, <link to=Image.image.togif_end>Image.image->togif_end</link>, <link to=Image.image.toppm>Image.image->toppm</link> and <link to=Image.image.fromgif>Image.image->fromgif</link> </p> </dl> -</a> -</a> +</anchor> +</anchor> <hr> -<a name=Image.image.toppm> +<anchor name=Image.image.toppm> <dl> <dt><encaps>NAME</encaps><dd> <tt>toppm</tt> - Returns PPM (P6, binary pixmap) data from the Image @@ -11234,13 +11308,13 @@ Returns PPM (P6, binary pixmap) data from the PPM data <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.frompnm>Image.image->frompnm</a> and <a href=#Image.image.fromgif>Image.image->fromgif</a> +<link to=Image.image.frompnm>Image.image->frompnm</link> and <link to=Image.image.fromgif>Image.image->fromgif</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.treshold> +<anchor name=Image.image.treshold> <dl> <dt><encaps>NAME</encaps><dd> <tt>treshold</tt> - Makes a black-white image @@ -11271,13 +11345,13 @@ Makes a black-white image. the new image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.image.grey>Image.image->grey</a> +<link to=Image.image.grey>Image.image->grey</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.tuned_box> +<anchor name=Image.image.tuned_box> <dl> <dt><encaps>NAME</encaps><dd> <tt>tuned_box</tt> - Draws a filled rectangle with colors (and alpha values) tuned @@ -11314,10 +11388,10 @@ Draws a filled rectangle with colors (and alpha values) tuned the object called <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.xsize> +<anchor name=Image.image.xsize> <dl> <dt><encaps>NAME</encaps><dd> <tt>xsize</tt> - return the width of the image in pixels @@ -11328,10 +11402,10 @@ the object called the width of the image in pixels <p> </dl> -</a> +</anchor> <hr> -<a name=Image.image.ysize> +<anchor name=Image.image.ysize> <dl> <dt><encaps>NAME</encaps><dd> <tt>ysize</tt> - the height of the image in pixels @@ -11342,7 +11416,7 @@ the width of the image in pixels the height of the image <p> </dl> -</a> +</anchor> <hr newpage> </section> @@ -11350,16 +11424,16 @@ the height of the image <dl><dd> This object adds the text-drawing and -creation - capabilities of the <a href=#Image>Image</a> module. + capabilities of the <link to=Image>Image</link> module. <p> For simple usage, see - <a href=#Image.font.write>Image.font->write</a> and <a href=#Image.font.load>Image.font->load</a>. + <link to=Image.font.write>Image.font->write</link> and <link to=Image.font.load>Image.font->load</link>. -<p> other methods: <a href=#Image.font.baseline>Image.font->baseline</a>, - <a href=#Image.font.height>Image.font->height</a>, - <a href=#Image.font.set_xspacing_scale>Image.font->set_xspacing_scale</a>, - <a href=#Image.font.set_yspacing_scale>Image.font->set_yspacing_scale</a>, - <a href=#Image.font.text_extents>Image.font->text_extents</a> +<p> other methods: <link to=Image.font.baseline>Image.font->baseline</link>, + <link to=Image.font.height>Image.font->height</link>, + <link to=Image.font.set_xspacing_scale>Image.font->set_xspacing_scale</link>, + <link to=Image.font.set_yspacing_scale>Image.font->set_yspacing_scale</link>, + <link to=Image.font.text_extents>Image.font->text_extents</link> </dl> @@ -11387,12 +11461,12 @@ Short technical documentation on a font file: <encaps>SEE ALSO</encaps> -<dl><dd> <a href=#Image>Image</a>, - <a href=#Image.image>Image.image</a> +<dl><dd> <link to=Image>Image</link>, + <link to=Image.image>Image.image</link> </dl> <hr> -<a name=Image.font.baseline> +<anchor name=Image.font.baseline> <dl> <dt><encaps>NAME</encaps><dd> <tt>baseline</tt> - Return the font baseline @@ -11403,14 +11477,14 @@ Short technical documentation on a font file: font baseline (pixels from top) <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.font.height>Image.font->height</a> and <a href=#Image.font.text_extents>Image.font->text_extents</a> +<link to=Image.font.height>Image.font->height</link> and <link to=Image.font.text_extents>Image.font->text_extents</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.font.height> -<a name=Image.font.text_extents> +<anchor name=Image.font.height> +<anchor name=Image.font.text_extents> <dl> <dt><encaps>NAME</encaps><dd> <tt>height, text_extents</tt> - Calculate extents of a text-image @@ -11420,7 +11494,7 @@ array(int) text_extents(string text, ...)</tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> Calculate extents of a text-image, - that would be created by calling <a href=#Image.font.write>Image.font->write</a> + that would be created by calling <link to=Image.font.write>Image.font->write</link> with the same arguments. </p> <dt><encaps>ARGUMENTS</encaps><dd><dl> @@ -11432,14 +11506,14 @@ Calculate extents of a text-image, an array of width and height <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.font.write>Image.font->write</a>, <a href=#Image.font.height>Image.font->height</a> and <a href=#Image.font.baseline>Image.font->baseline</a> +<link to=Image.font.write>Image.font->write</link>, <link to=Image.font.height>Image.font->height</link> and <link to=Image.font.baseline>Image.font->baseline</link> </p> </dl> -</a> -</a> +</anchor> +</anchor> <hr> -<a name=Image.font.load> +<anchor name=Image.font.load> <dl> <dt><encaps>NAME</encaps><dd> <tt>load</tt> - Loads a font file to this font object @@ -11458,14 +11532,14 @@ Loads a font file to this font object. zero upon failure, font object upon success <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.font.write>Image.font->write</a> +<link to=Image.font.write>Image.font->write</link> </p> </dl> -</a> +</anchor> <hr> -<a name=Image.font.set_xspacing_scale> -<a name=Image.font.set_yspacing_scale> +<anchor name=Image.font.set_xspacing_scale> +<anchor name=Image.font.set_yspacing_scale> <dl> <dt><encaps>NAME</encaps><dd> <tt>set_xspacing_scale, set_yspacing_scale</tt> - Set character spacing @@ -11484,11 +11558,11 @@ Set spacing scale to write characters closer </dl><p> </dl> -</a> -</a> +</anchor> +</anchor> <hr> -<a name=Image.font.write> +<anchor name=Image.font.write> <dl> <dt><encaps>NAME</encaps><dd> <tt>write</tt> - Writes some text @@ -11508,17 +11582,17 @@ Writes some text; thus creating an image object an Image::image object <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Image.font.text_extents>Image.font->text_extents</a>, <a href=#Image.font.load>Image.font->load</a>, <a href=#Image.image.paste_mask>Image.image->paste_mask</a> and <a href=#Image.image.paste_alpha_color>Image.image->paste_alpha_color</a> +<link to=Image.font.text_extents>Image.font->text_extents</link>, <link to=Image.font.load>Image.font->load</link>, <link to=Image.image.paste_mask>Image.image->paste_mask</link> and <link to=Image.image.paste_alpha_color>Image.image->paste_alpha_color</link> </p> </dl> -</a> +</anchor> <hr newpage> </section> </chapter> -</a> +</anchor> <chapter title="The preprocessor"> -<a name=preprocessor> +<anchor name=preprocessor> Pike has a builtin C-style preprocessor. The preprocessor reads the source before it is compiled and removes comments and expands macros. The preprocessor can also remove code depending on an expression that is evaluated when you @@ -11546,7 +11620,7 @@ the script with </dl> <hr noshade size=1> -<a name=define> +<anchor name=define> <dl> <dt><encaps>DIRECTIVE</encaps><dd> <tt>#define<br> @@ -11561,7 +11635,7 @@ replaced with the replacement string. <p>Define also has the capability to use arguments, thus a line like <p><dl><dt><dd>#define <identifier>(arg1, arg2) <replacement string><br> </dl> -<p>would cause identifer to be a macro. All occurances of +<p>would cause identifier to be a macro. All occurances of 'identifier(something1,something2d)' would be replaced with the replacement string. And in the replacement string, arg1 and arg2 will be replaced with something1 and something2. @@ -11573,7 +11647,7 @@ Note that it is not a good idea to do something like this: code. This will have the effect that the rest of the line will be ignored when the word foo is used. Not exactly what you might expect. <dt><encaps>EXAMPLE</encaps><dd> -<pre> +<example language=pike> #define A "test" #define B 17 #define C(X) (X)+(B)+"\n" @@ -11583,13 +11657,13 @@ int main() { Z->W(C(A)); } -</pre> +</example> <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=undef> +<anchor name=undef> <dl> <dt><encaps>DIRECTIVE</encaps><dd> <tt>#undef<br> @@ -11598,7 +11672,7 @@ int main() <dt><encaps>DESCRIPTION</encaps><dd> This removes the effect of a #define, all subsequent occurances of the undefined identifier will not be replaced by anything. Note that -when undefining a macro, you just give the identifer, not the +when undefining a macro, you just give the identifier, not the arguments. <p> <dt><encaps>EXAMPLES</encaps><dd> @@ -11611,12 +11685,12 @@ arguments. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=if> -<a name=elseif> -<a name=else> -<a name=endif> +<anchor name=if> +<anchor name=elseif> +<anchor name=else> +<anchor name=endif> <dl> <dt><encaps>DIRECTIVE</encaps><dd> <tt>#if<br> @@ -11640,8 +11714,8 @@ evaluate to zero unless they are defined to something else. Integers, strings and floats are the only types that can be used, but all pike operators can be used on these types. <p>Also, two special functions can be used, defined() and constant(). -defined(<identifer>) expands to '1' if the identifier is defined, -'0' otherwise. constant(<identifier>) expands to '1' if identifer is +defined(<identifier>) expands to '1' if the identifier is defined, +'0' otherwise. constant(<identifier>) expands to '1' if identifier is an predefined constant (with add_constant), '0' otherwise. <p> <dt><encaps>EXAMPLES</encaps><dd> @@ -11667,12 +11741,12 @@ inherit "simulate.pike"<br> <p> </dl> -</a> -</a> -</a> -</a> +</anchor> +</anchor> +</anchor> +</anchor> <hr noshade size=1> -<a name=error> +<anchor name=error> <dl> <dt><encaps>DIRECTIVE</encaps><dd> <tt>#error<br> @@ -11691,9 +11765,9 @@ the user that certain functions are missing and similar things. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=include> +<anchor name=include> <dl> <dt><encaps>DIRECTIVE</encaps><dd> <tt>#include<br> @@ -11711,9 +11785,9 @@ The compiler then continues to compile this file. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=line> +<anchor name=line> <dl> <dt><encaps>DIRECTIVE</encaps><dd> <tt>#line<br> @@ -11734,9 +11808,9 @@ tell the compiler where the code originally originated from. <p> </dl> -</a> +</anchor> <hr noshade size=1> -<a name=pragma> +<anchor name=pragma> <dl> <dt><encaps>DIRECTIVE</encaps><dd> <tt>#pragma<br> @@ -11750,19 +11824,19 @@ modifier 'inline' to all functions that follows. <p> </dl> -</a> +</anchor> -</a> +</anchor> </chapter> -<chapter title="All the builtin functions" alias=functions> +<chapter title="All the builtin functions" name=functions> This chapter is a reference for all the builtin functions in pike. They are listed in alphabetical order. <HR NEWPAGE> -<a name=_memory_usage> +<anchor name=_memory_usage> <dl> <dt><encaps>NAME</encaps><dd> <tt>_memory_usage</tt> - check memory usage @@ -11778,14 +11852,14 @@ are currently allocated and how much memory they use. Try evaluating the function in hilfe to see precisly what it returns. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#_verify_internals>_verify_internals</a> +<link to=_verify_internals>_verify_internals</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=_next> +<anchor name=_next> <dl> <dt><encaps>NAME</encaps><dd> <tt>_next</tt> - find the next object/array/whatever @@ -11800,13 +11874,13 @@ in the linked list. It is mainly meant for debugging Pike but can also be used to control memory usage. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#next_object>next_object</a> and <a href=#_prev>_prev</a> +<link to=next_object>next_object</link> and <link to=_prev>_prev</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=_prev> +<anchor name=_prev> <dl> <dt><encaps>NAME</encaps><dd> <tt>_prev</tt> - find the previous object/array/whatever @@ -11822,13 +11896,13 @@ can also be used to control memory usage. Note that this function does not work on strings. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#_next>_next</a> +<link to=_next>_next</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=_refs> +<anchor name=_refs> <dl> <dt><encaps>NAME</encaps><dd> <tt>_refs</tt> - find out how many references a pointer type value has @@ -11845,13 +11919,13 @@ _refs() is mainly meant for debugging Pike but can also be used to control memory usage. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#_next>_next</a> and <a href=#_prev>_prev</a> +<link to=_next>_next</link> and <link to=_prev>_prev</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=_verify_internals> +<anchor name=_verify_internals> <dl> <dt><encaps>NAME</encaps><dd> <tt>_verify_internals</tt> - check Pike internals @@ -11869,10 +11943,10 @@ It is only used for debugging. debugging <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=acos> +<anchor name=acos> <dl> <dt><encaps>NAME</encaps><dd> <tt>acos</tt> - Trigonometrical inverse cosine @@ -11888,13 +11962,13 @@ Return the arcus cosinus value for f. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#cos>cos</a> and <a href=#asin>asin</a> +<link to=cos>cos</link> and <link to=asin>asin</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=add_constant> +<anchor name=add_constant> <dl> <dt><encaps>NAME</encaps><dd> <tt>add_constant</tt> - add new predefined functions or constants @@ -11928,13 +12002,13 @@ add_constant("add_constant");<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#all_constants>all_constants</a> +<link to=all_constants>all_constants</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=add_include_path> +<anchor name=add_include_path> <dl> <dt><encaps>NAME</encaps><dd> <tt>add_include_path</tt> - add a directory to search for include files @@ -11950,13 +12024,13 @@ the added directory will only be searched when using < > to quote the included file. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#remove_include_path>remove_include_path</a> and <a href=#include>#include</a> +<link to=remove_include_path>remove_include_path</link> and <link to=include>#include</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=add_module_path> +<anchor name=add_module_path> <dl> <dt><encaps>NAME</encaps><dd> <tt>add_module_path</tt> - add a directory to search for modules @@ -11968,16 +12042,16 @@ quote the included file. <dt><encaps>DESCRIPTION</encaps><dd> This function adds another directory to the search for modules. This is the same as the command line option <tt>-M</tt>. For more -information about modules, see <link to=modules>. +information about modules, see <ref to=modules>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#remove_module_path>remove_module_path</a> +<link to=remove_module_path>remove_module_path</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=add_program_path> +<anchor name=add_program_path> <dl> <dt><encaps>NAME</encaps><dd> <tt>add_program_path</tt> - add a directory to search for modules @@ -11989,16 +12063,16 @@ information about modules, see <link to=modules>. <dt><encaps>DESCRIPTION</encaps><dd> This function adds another directory to the search for programs. This is the same as the command line option <tt>-P</tt>. For more -information about programs, see <link to=programs>. +information about programs, see <ref to=programs>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#remove_program_path>remove_program_path</a> +<link to=remove_program_path>remove_program_path</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=aggregate> +<anchor name=aggregate> <dl> <dt><encaps>NAME</encaps><dd> <tt>aggregate</tt> - construct an array @@ -12023,13 +12097,13 @@ in C, just int *a=allocate(10); will do. <a href=types_array>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sizeof>sizeof</a>, <a href=#arrayp>arrayp</a> and <a href=#allocate>allocate</a> +<link to=sizeof>sizeof</link>, <link to=arrayp>arrayp</link> and <link to=allocate>allocate</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=aggregate_mapping> +<anchor name=aggregate_mapping> <dl> <dt><encaps>NAME</encaps><dd> <tt>aggregate_mapping</tt> - construct a mapping @@ -12049,13 +12123,13 @@ preferable. <a href=types_mapping>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sizeof>sizeof</a>, <a href=#mappingp>mappingp</a> and <a href=#mkmapping>mkmapping</a> +<link to=sizeof>sizeof</link>, <link to=mappingp>mappingp</link> and <link to=mkmapping>mkmapping</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=aggregate_multiset> +<anchor name=aggregate_multiset> <dl> <dt><encaps>NAME</encaps><dd> <tt>aggregate_multiset</tt> - construct a multiset @@ -12077,13 +12151,13 @@ aggregage_multiset... <a href=types_multiset>multiset</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sizeof>sizeof</a>, <a href=#multisetp>multisetp</a> and <a href=#Simulate.mkmultiset>Simulate.mkmultiset</a> +<link to=sizeof>sizeof</link>, <link to=multisetp>multisetp</link> and <link to=Simulate.mkmultiset>Simulate.mkmultiset</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=alarm> +<anchor name=alarm> <dl> <dt><encaps>NAME</encaps><dd> <tt>alarm</tt> - set an alarm clock for delivery of a signal @@ -12104,13 +12178,13 @@ previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#signal>signal</a> +<link to=signal>signal</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=all_constants> +<anchor name=all_constants> <dl> <dt><encaps>NAME</encaps><dd> <tt>all_constants</tt> - return all predefined constants @@ -12124,13 +12198,13 @@ Return a mapping containing all constants, indexed on the names of the constant, and with the value of the efun as argument. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#add_constant>add_constant</a> +<link to=add_constant>add_constant</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=allocate> +<anchor name=allocate> <dl> <dt><encaps>NAME</encaps><dd> <tt>allocate</tt> - allocate an array @@ -12155,13 +12229,13 @@ in C, just int *a=allocate(10); will do. <a href=types_array>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sizeof>sizeof</a>, <a href=#aggregate>aggregate</a> and <a href=#arrayp>arrayp</a> +<link to=sizeof>sizeof</link>, <link to=aggregate>aggregate</link> and <link to=arrayp>arrayp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=arrayp> +<anchor name=arrayp> <dl> <dt><encaps>NAME</encaps><dd> <tt>arrayp</tt> - is the argument an array? @@ -12177,13 +12251,13 @@ Returns 1 if arg is an array, zero otherwise. <a href=types_array>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#allocate>allocate</a>, <a href=#intp>intp</a>, <a href=#programp>programp</a>, <a href=#floatp>floatp</a>, <a href=#stringp>stringp</a>, <a href=#objectp>objectp</a>, <a href=#mappingp>mappingp</a>, <a href=#multisetp>multisetp</a> and <a href=#functionp>functionp</a> +<link to=allocate>allocate</link>, <link to=intp>intp</link>, <link to=programp>programp</link>, <link to=floatp>floatp</link>, <link to=stringp>stringp</link>, <link to=objectp>objectp</link>, <link to=mappingp>mappingp</link>, <link to=multisetp>multisetp</link> and <link to=functionp>functionp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=asin> +<anchor name=asin> <dl> <dt><encaps>NAME</encaps><dd> <tt>asin</tt> - Trigonometrical inverse sine @@ -12199,13 +12273,13 @@ Return the arcus sinus value for f. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sin>sin</a> and <a href=#acos>acos</a> +<link to=sin>sin</link> and <link to=acos>acos</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=atan> +<anchor name=atan> <dl> <dt><encaps>NAME</encaps><dd> <tt>atan</tt> - Trigonometrical inverse tangent @@ -12221,13 +12295,13 @@ Return the arcus tangent value for f. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#tan>tan</a>, <a href=#asin>asin</a> and <a href=#acos>acos</a> +<link to=tan>tan</link>, <link to=asin>asin</link> and <link to=acos>acos</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=backtrace> +<anchor name=backtrace> <dl> <dt><encaps>NAME</encaps><dd> <tt>backtrace</tt> - get a description of the call stack @@ -12253,13 +12327,13 @@ in the stack. Each entry has this format: that the last but one and so on. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#catch>catch</a> and <a href=#throw>throw</a> +<link to=catch>catch</link> and <link to=throw>throw</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=call_function> +<anchor name=call_function> <dl> <dt><encaps>NAME</encaps><dd> <tt>call_function</tt> - call a function with arguments @@ -12280,13 +12354,13 @@ second syntax instead. <a href=types_function>function</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#backtrace>backtrace</a> and <a href=#Simulate.get_function>Simulate.get_function</a> +<link to=backtrace>backtrace</link> and <link to=Simulate.get_function>Simulate.get_function</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=call_out> +<anchor name=call_out> <dl> <dt><encaps>NAME</encaps><dd> <tt>call_out</tt> - make a delayed call to a function @@ -12302,13 +12376,13 @@ identifies this call out. The return value can be sent to find_call_out or remove_call_out to remove the call out again. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#remove_call_out>remove_call_out</a>, <a href=#find_call_out>find_call_out</a> and <a href=#call_out_info>call_out_info</a> +<link to=remove_call_out>remove_call_out</link>, <link to=find_call_out>find_call_out</link> and <link to=call_out_info>call_out_info</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=call_out_info> +<anchor name=call_out_info> <dl> <dt><encaps>NAME</encaps><dd> <tt>call_out_info</tt> - get info about all call outs @@ -12334,13 +12408,13 @@ contains an array that looks like this: <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#call_out>call_out</a>, <a href=#find_call_out>find_call_out</a> and <a href=#remove_call_out>remove_call_out</a> +<link to=call_out>call_out</link>, <link to=find_call_out>find_call_out</link> and <link to=remove_call_out>remove_call_out</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=_do_call_outs> +<anchor name=_do_call_outs> <dl> <dt><encaps>NAME</encaps><dd> <tt>_do_call_outs</tt> - do all pending call_outs. @@ -12357,13 +12431,13 @@ contains an array that looks like this: <tt>time(1)</tt> to the current time. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#call_out>call_out</a>, <a href=#find_call_out>find_call_out</a> and <a href=#remove_call_out>remove_call_out</a> +<link to=call_out>call_out</link>, <link to=find_call_out>find_call_out</link> and <link to=remove_call_out>remove_call_out</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=catch> +<anchor name=catch> <dl> <dt><encaps>NAME</encaps><dd> <tt>catch</tt> - catch errors @@ -12383,13 +12457,13 @@ is ({ "error message", backtrace }) <a href=index#control>control</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#throw>throw</a> +<link to=throw>throw</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=cd> +<anchor name=cd> <dl> <dt><encaps>NAME</encaps><dd> <tt>cd</tt> - change directory @@ -12406,13 +12480,13 @@ Change the current directory for the whole Pike process, return <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#getcwd>getcwd</a> +<link to=getcwd>getcwd</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=ceil> +<anchor name=ceil> <dl> <dt><encaps>NAME</encaps><dd> <tt>ceil</tt> - Truncate a number upward @@ -12429,14 +12503,14 @@ Note that ceil() does _not_ return an int, merely an integral value. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#floor>floor</a> +<link to=floor>floor</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=clone> -<a name=new> +<anchor name=clone> +<anchor name=new> <dl> <dt><encaps>NAME</encaps><dd> <tt>clone</tt> - clone an object from a program @@ -12456,14 +12530,14 @@ with args as arguments. <a href=types_object>object</a> and <a href=types_program>program</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#destruct>destruct</a>, <a href=#compile_string>compile_string</a> and <a href=#compile_file>compile_file</a> +<link to=destruct>destruct</link>, <link to=compile_string>compile_string</link> and <link to=compile_file>compile_file</link> <p> </dl> -</a> -</a> +</anchor> +</anchor> <HR NEWPAGE> -<a name=column> +<anchor name=column> <dl> <dt><encaps>NAME</encaps><dd> <tt>column</tt> - extract a column @@ -12483,13 +12557,13 @@ the argument index and returns an array with the results. <a href=types_array>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#rows>rows</a> +<link to=rows>rows</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=combine_path> +<anchor name=combine_path> <dl> <dt><encaps>NAME</encaps><dd> <tt>combine_path</tt> - concatenate paths @@ -12516,13 +12590,13 @@ Result: /foo/bar/sune.c<br> <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#getcwd>getcwd</a> +<link to=getcwd>getcwd</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=compile_file> +<anchor name=compile_file> <dl> <dt><encaps>NAME</encaps><dd> <tt>compile_file</tt> - compile a file to a program @@ -12539,13 +12613,13 @@ later be used for cloning. <a href=types_program>program</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#clone>clone</a> and <a href=#compile_string>compile_string</a> +<link to=clone>clone</link> and <link to=compile_string>compile_string</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=compile_string> +<anchor name=compile_string> <dl> <dt><encaps>NAME</encaps><dd> <tt>compile_string</tt> - compile a string to a program @@ -12564,13 +12638,13 @@ error messages and such. <a href=types_program>program</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#compile_string>compile_string</a> and <a href=#clone>clone</a> +<link to=compile_string>compile_string</link> and <link to=clone>clone</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=copy_value> +<anchor name=copy_value> <dl> <dt><encaps>NAME</encaps><dd> <tt>copy_value</tt> - copy a value recursively @@ -12587,13 +12661,13 @@ will always be equal to the copied (tested with the efun equal), but they may not the the same value. (tested with ==) <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#equal>equal</a> +<link to=equal>equal</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=cos> +<anchor name=cos> <dl> <dt><encaps>NAME</encaps><dd> <tt>cos</tt> - Trigonometrical cosine @@ -12609,13 +12683,13 @@ Return the cosinus value for f. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#acos>acos</a> and <a href=#sin>sin</a> +<link to=acos>acos</link> and <link to=sin>sin</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=crypt> +<anchor name=crypt> <dl> <dt><encaps>NAME</encaps><dd> <tt>crypt</tt> - crypt a password @@ -12646,9 +12720,9 @@ matched, 0 otherwise. <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=ctime> +<anchor name=ctime> <dl> <dt><encaps>NAME</encaps><dd> <tt>ctime</tt> - convert time int to readable date string @@ -12667,13 +12741,13 @@ Result: Wed Jan 14 03:36:08 1970<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#time>time</a> +<link to=time>time</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=decode_value> +<anchor name=decode_value> <dl> <dt><encaps>NAME</encaps><dd> <tt>decode_value</tt> - code a value into a string @@ -12687,13 +12761,13 @@ This function takes a string created with encode_value() and converts it back to the value that was coded. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#encode_value>encode_value</a> +<link to=encode_value>encode_value</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=describe_backtrace> +<anchor name=describe_backtrace> <dl> <dt><encaps>NAME</encaps><dd> <tt>describe_backtrace</tt> - make a backtrace readable @@ -12708,13 +12782,13 @@ that describes where the backtrace was made. The argument 'backtrace' should normally be the return value from a call to backtrace() <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#backtrace>backtrace</a> +<link to=backtrace>backtrace</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=destruct> +<anchor name=destruct> <dl> <dt><encaps>NAME</encaps><dd> <tt>destruct</tt> - destruct an object @@ -12733,13 +12807,13 @@ o->destroy. <a href=types_object>object</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#clone>clone</a> +<link to=clone>clone</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=encode_value> +<anchor name=encode_value> <dl> <dt><encaps>NAME</encaps><dd> <tt>encode_value</tt> - code a value into a string @@ -12759,13 +12833,13 @@ structures etc. At present, objects, programs and functions cannot be saved in this way. This is being worked on. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#encode_value>decode_value</a> and <a href=#sprintf>sprintf</a> +<link to=encode_value>decode_value</link> and <link to=sprintf>sprintf</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=equal> +<anchor name=equal> <dl> <dt><encaps>NAME</encaps><dd> <tt>equal</tt> - check if two values are equal or not @@ -12790,13 +12864,13 @@ Result: 1<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#copy_value>copy_value</a> +<link to=copy_value>copy_value</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=errno> +<anchor name=errno> <dl> <dt><encaps>NAME</encaps><dd> <tt>errno</tt> - return system error number @@ -12811,21 +12885,21 @@ Note that you should normally use the function errno in the file object instead. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#errno>errno</a> +<link to=errno>errno</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=exece> +<anchor name=exece> <dl> <dt><encaps>NAME</encaps><dd> <tt>exece</tt> - execute a program <p> <dt><encaps>SYNTAX</encaps><dd> -<tt>int exece(string <I>file</I>, string *<I>args</I>);<br> +<tt>int exece(string <I>file</I>, array(string) <I>args</I>);<br> or<br> -int exece(string <I>file</I>, string *<I>args</I>, mapping(string:string) <I>env</I>);<br> +int exece(string <I>file</I>, array(string) <I>args</I>, mapping(string:string) <I>env</I>);<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -12847,13 +12921,13 @@ exece("/bin/sh", ({"-c", "echo $HOME"}), (["HOME":"/not/home"]));<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#fork>fork</a> and <a href=#Stdio.File.pipe>file->pipe</a> +<link to=fork>fork</link> and <link to=Stdio.File.pipe>file->pipe</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=exit> +<anchor name=exit> <dl> <dt><encaps>NAME</encaps><dd> <tt>exit</tt> - exit Pike interpreter @@ -12870,10 +12944,10 @@ more information about return codes. <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=exp> +<anchor name=exp> <dl> <dt><encaps>NAME</encaps><dd> <tt>exp</tt> - Natural exponent @@ -12890,13 +12964,13 @@ log( exp( x ) ) == x as long as exp(x) doesn't overflow an int. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#pow>pow</a> and <a href=#log>log</a> +<link to=pow>pow</link> and <link to=log>log</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=file_stat> +<anchor name=file_stat> <dl> <dt><encaps>NAME</encaps><dd> <tt>file_stat</tt> - stat a file @@ -12932,13 +13006,13 @@ You can never get -3 as size if you don't give a second argument.<br> <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#get_dir>get_dir</a> +<link to=get_dir>get_dir</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=find_call_out> +<anchor name=find_call_out> <dl> <dt><encaps>NAME</encaps><dd> <tt>find_call_out</tt> - find a call out in the queue @@ -12959,13 +13033,13 @@ before that call will be executed. If no call is found, zero_type(find_call_out(f)) will return 1. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#call_out>call_out</a>, <a href=#remove_call_out>remove_call_out</a> and <a href=#call_out_info>call_out_info</a> +<link to=call_out>call_out</link>, <link to=remove_call_out>remove_call_out</link> and <link to=call_out_info>call_out_info</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=floatp> +<anchor name=floatp> <dl> <dt><encaps>NAME</encaps><dd> <tt>floatp</tt> - is the argument an float? @@ -12981,13 +13055,13 @@ Returns 1 if arg is a float, zero otherwise. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#intp>intp</a>, <a href=#programp>programp</a>, <a href=#arrayp>arrayp</a>, <a href=#stringp>stringp</a>, <a href=#objectp>objectp</a>, <a href=#mappingp>mappingp</a>, <a href=#multisetp>multisetp</a> and <a href=#functionp>functionp</a> +<link to=intp>intp</link>, <link to=programp>programp</link>, <link to=arrayp>arrayp</link>, <link to=stringp>stringp</link>, <link to=objectp>objectp</link>, <link to=mappingp>mappingp</link>, <link to=multisetp>multisetp</link> and <link to=functionp>functionp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=floor> +<anchor name=floor> <dl> <dt><encaps>NAME</encaps><dd> <tt>floor</tt> - Truncate a number downward @@ -13004,13 +13078,13 @@ Note that floor() does _not_ return an int, merely an integral value. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#ceil>ceil</a> +<link to=ceil>ceil</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=fork> +<anchor name=fork> <dl> <dt><encaps>NAME</encaps><dd> <tt>fork</tt> - fork the process in two @@ -13027,13 +13101,13 @@ pid of the child. Refer to your unix manual for further details. This function cause endless bugs if used without proper care. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Simulate.exec>Simulate.exec</a> and <a href=#Stdio.File.pipe>Stdio.File->pipe</a> +<link to=Simulate.exec>Simulate.exec</link> and <link to=Stdio.File.pipe>Stdio.File->pipe</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=function_name> +<anchor name=function_name> <dl> <dt><encaps>NAME</encaps><dd> <tt>function_name</tt> - return the name of a function, if known @@ -13050,13 +13124,13 @@ a pre-defined function in the driver, zero will be returned. <a href=types_function>function</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#function_object>function_object</a> and <a href=Simulate.get_function>Simulate.get_function</a> +<link to=function_object>function_object</link> and <link to=Simulate.get_function>Simulate.get_function</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=function_object> +<anchor name=function_object> <dl> <dt><encaps>NAME</encaps><dd> <tt>function_object</tt> - return what object a function is in @@ -13074,13 +13148,13 @@ returned. <a href=types_function>function</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#function_name>function_name</a> and <a href=#Simulate.get_function>Simulate.get_function</a> +<link to=function_name>function_name</link> and <link to=Simulate.get_function>Simulate.get_function</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=functionp> +<anchor name=functionp> <dl> <dt><encaps>NAME</encaps><dd> <tt>functionp</tt> - is the argument an function? @@ -13096,13 +13170,13 @@ Returns 1 if arg is a function, zero otherwise. <a href=types_function>function</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#intp>intp</a>, <a href=#programp>programp</a>, <a href=#arrayp>arrayp</a>, <a href=#stringp>stringp</a>, <a href=#objectp>objectp</a>, <a href=#mappingp>mappingp</a>, <a href=#multisetp>multisetp</a> and <a href=#floatp>floatp</a> +<link to=intp>intp</link>, <link to=programp>programp</link>, <link to=arrayp>arrayp</link>, <link to=stringp>stringp</link>, <link to=objectp>objectp</link>, <link to=mappingp>mappingp</link>, <link to=multisetp>multisetp</link> and <link to=floatp>floatp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=gc> +<anchor name=gc> <dl> <dt><encaps>NAME</encaps><dd> <tt>gc</tt> - do garbage collection @@ -13122,16 +13196,16 @@ when 20% of all arrays/object/programs in memory is 'garbage' and call this routine then.) </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=get_dir> +<anchor name=get_dir> <dl> <dt><encaps>NAME</encaps><dd> <tt>get_dir</tt> - read a directory <p> <dt><encaps>SYNTAX</encaps><dd> -<tt>string *get_dir(string <I>dirname</I>);<br> +<tt>array(string) get_dir(string <I>dirname</I>);<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -13142,13 +13216,13 @@ no such directory exists. <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#mkdir>mkdir</a> and <a href=#cd>cd</a> +<link to=mkdir>mkdir</link> and <link to=cd>cd</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=getcwd> +<anchor name=getcwd> <dl> <dt><encaps>NAME</encaps><dd> <tt>getcwd</tt> - return current working directory @@ -13164,13 +13238,13 @@ getcwd returns the current working directory. <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#cd>cd</a> +<link to=cd>cd</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=getenv> +<anchor name=getenv> <dl> <dt><encaps>NAME</encaps><dd> <tt>getenv</tt> - get an environment variable @@ -13187,10 +13261,10 @@ if no such environment variable exists, zero is returned. This function is provided by master.c <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=getpid> +<anchor name=getpid> <dl> <dt><encaps>NAME</encaps><dd> <tt>getpid</tt> - get the process id of this process @@ -13204,13 +13278,13 @@ This returns the pid of this process. Useful for sending signals to yourself. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#kill>kill</a>, <a href=#fork>fork</a> and <a href=#signal>signal</a> +<link to=kill>kill</link>, <link to=fork>fork</link> and <link to=signal>signal</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=glob> +<anchor name=glob> <dl> <dt><encaps>NAME</encaps><dd> <tt>glob</tt> - match strings against globs @@ -13218,7 +13292,7 @@ signals to yourself. <dt><encaps>SYNTAX</encaps><dd> <tt>int glob(string <I>glob</I>, string <I>str</I>);<br> or<br> -string *glob(string <I>glob</I>, string *<I>arr</I>);<br> +array(string) glob(string <I>glob</I>, array(string) <I>arr</I>);<br> </tt> <p> <dt><encaps>DESCRIPTION</encaps><dd> @@ -13229,13 +13303,13 @@ which reflects if the 'str' matches 'glob'. When given an array as second argument, an array containing all matching strings is returned. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sscanf>sscanf</a> and <a href=#Regexp.regexp>Regexp.regexp</a> +<link to=sscanf>sscanf</link> and <link to=Regexp.regexp>Regexp.regexp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=hash> +<anchor name=hash> <dl> <dt><encaps>NAME</encaps><dd> <tt>hash</tt> - hash a string @@ -13255,10 +13329,10 @@ is given, the result will be >= 0 and lesser than that argument. <a href=types_string>string</a> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=indices> +<anchor name=indices> <dl> <dt><encaps>NAME</encaps><dd> <tt>indices</tt> - return an array of all index possible for a value @@ -13277,13 +13351,13 @@ kind of value. For objects, the result is an array of strings. <a href=types_mapping>mapping</a> and <a href=types_multiset>multiset</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#values>values</a> +<link to=values>values</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=intp> +<anchor name=intp> <dl> <dt><encaps>NAME</encaps><dd> <tt>intp</tt> - is the argument an int? @@ -13299,13 +13373,13 @@ Returns 1 if arg is an int, zero otherwise. <a href=types_int>int</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#arrayp>arrayp</a>, <a href=#programp>programp</a>, <a href=#floatp>floatp</a>, <a href=#stringp>stringp</a>, <a href=#objectp>objectp</a>, <a href=#mappingp>mappingp</a>, <a href=#multisetp>multisetp</a> and <a href=#functionp>functionp</a> +<link to=arrayp>arrayp</link>, <link to=programp>programp</link>, <link to=floatp>floatp</link>, <link to=stringp>stringp</link>, <link to=objectp>objectp</link>, <link to=mappingp>mappingp</link>, <link to=multisetp>multisetp</link> and <link to=functionp>functionp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=kill> +<anchor name=kill> <dl> <dt><encaps>NAME</encaps><dd> <tt>kill</tt> - send signal to other process @@ -13350,13 +13424,13 @@ Kill sends a signal to another process. If something goes wrong to its number. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#signal>signal</a>, <a href=#signum>signum</a>, <a href=#signame>signame</a> and <a href=#fork>fork</a> +<link to=signal>signal</link>, <link to=signum>signum</link>, <link to=signame>signame</link> and <link to=fork>fork</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=load_module> +<anchor name=load_module> <dl> <dt><encaps>NAME</encaps><dd> <tt>load_module</tt> - load a binary module @@ -13383,10 +13457,10 @@ name. If you use just "foo.se" the module will not be found. <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=localtime> +<anchor name=localtime> <dl> <dt><encaps>NAME</encaps><dd> <tt>localtime</tt> - break down time() into intelligible components @@ -13418,13 +13492,13 @@ components: The 'timezone' might not be available on all platforms. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#time>time</a> +<link to=time>time</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=log> +<anchor name=log> <dl> <dt><encaps>NAME</encaps><dd> <tt>log</tt> - Natural logarithm @@ -13441,13 +13515,13 @@ exp( log(x) ) == x for x > 0. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#pow>pow</a> and <a href=#exp>exp</a> +<link to=pow>pow</link> and <link to=exp>exp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=lower_case> +<anchor name=lower_case> <dl> <dt><encaps>NAME</encaps><dd> <tt>lower_case</tt> - convert a string to lower case @@ -13463,13 +13537,13 @@ Return a string with all capital letters converted to lower case. <a href=types_string>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#upper_case>upper_case</a> +<link to=upper_case>upper_case</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=m_delete> +<anchor name=m_delete> <dl> <dt><encaps>NAME</encaps><dd> <tt>m_delete</tt> - remove an index from a mapping @@ -13489,13 +13563,13 @@ the mapping for compatibility reasons. <a href=types_mapping>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#mappingp>mappingp</a> +<link to=mappingp>mappingp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=mappingp> +<anchor name=mappingp> <dl> <dt><encaps>NAME</encaps><dd> <tt>mappingp</tt> - is the argument an mapping? @@ -13511,13 +13585,13 @@ Returns 1 if arg is a mapping, zero otherwise. <a href=types_mapping>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#intp>intp</a>, <a href=#programp>programp</a>, <a href=#arrayp>arrayp</a>, <a href=#stringp>stringp</a>, <a href=#objectp>objectp</a>, <a href=#multisetp>multisetp</a>, <a href=#floatp>floatp</a> and <a href=#functionp>functionp</a> +<link to=intp>intp</link>, <link to=programp>programp</link>, <link to=arrayp>arrayp</link>, <link to=stringp>stringp</link>, <link to=objectp>objectp</link>, <link to=multisetp>multisetp</link>, <link to=floatp>floatp</link> and <link to=functionp>functionp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=master> +<anchor name=master> <dl> <dt><encaps>NAME</encaps><dd> <tt>master</tt> - return the master object @@ -13533,10 +13607,10 @@ Master is added by the master object to make it easier to access it. <a href=types_object>object</a> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=mkdir> +<anchor name=mkdir> <dl> <dt><encaps>NAME</encaps><dd> <tt>mkdir</tt> - make directory @@ -13552,14 +13626,14 @@ Create a directory, return zero if it fails and nonzero if it successful. <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#rm>rm</a> and <a href=#cd>cd</a> +<link to=rm>rm</link> and <link to=cd>cd</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=mkmapping> +<anchor name=mkmapping> <dl> <dt><encaps>NAME</encaps><dd> <tt>mkmapping</tt> - make a mapping from two arrays @@ -13577,13 +13651,13 @@ This is the inverse operation of indices and values. <a href=types_mapping>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#indices>indices</a> and <a href=#values>values</a> +<link to=indices>indices</link> and <link to=values>values</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=mkmultiset> +<anchor name=mkmultiset> <dl> <dt><encaps>NAME</encaps><dd> <tt>mkmultiset</tt> - make a multiset @@ -13608,14 +13682,14 @@ Result: (< /* 3 elements */<br> <a href=types_multiset>multiset</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#aggregage_multiset>aggregate_multiset</a> +<link to=aggregage_multiset>aggregate_multiset</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=mktime> +<anchor name=mktime> <dl> <dt><encaps>NAME</encaps><dd> <tt>mktime</tt> - convert date and time to seconds @@ -13646,13 +13720,13 @@ call this function with a mapping containing the following elements: Or you can just send them all on one line as the second syntax suggests. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#time>time</a> +<link to=time>time</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=multisetp> +<anchor name=multisetp> <dl> <dt><encaps>NAME</encaps><dd> <tt>multisetp</tt> - is the argument a multiset? @@ -13668,13 +13742,13 @@ Returns 1 if arg is a multiset, zero otherwise. <a href=types_multiset>multiset</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#intp>intp</a>, <a href=#programp>programp</a>, <a href=#arrayp>arrayp</a>, <a href=#stringp>stringp</a>, <a href=#objectp>objectp</a>, <a href=#mappingp>mappingp</a>, <a href=#floatp>floatp</a> and <a href=#functionp>functionp</a> +<link to=intp>intp</link>, <link to=programp>programp</link>, <link to=arrayp>arrayp</link>, <link to=stringp>stringp</link>, <link to=objectp>objectp</link>, <link to=mappingp>mappingp</link>, <link to=floatp>floatp</link> and <link to=functionp>functionp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=mv> +<anchor name=mv> <dl> <dt><encaps>NAME</encaps><dd> <tt>mv</tt> - move a file (may handle directiories as well) @@ -13692,13 +13766,13 @@ file already exists, it will be overwritten. Returns 1 on success, <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#rm>rm</a> +<link to=rm>rm</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=next_object> +<anchor name=next_object> <dl> <dt><encaps>NAME</encaps><dd> <tt>next_object</tt> - get next object @@ -13725,13 +13799,13 @@ for(o=next_object();o;o=next_object(o))<br> <a href=types_object>object</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#clone>clone</a> and <a href=#destruct>destruct</a> +<link to=clone>clone</link> and <link to=destruct>destruct</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=object_program> +<anchor name=object_program> <dl> <dt><encaps>NAME</encaps><dd> <tt>object_program</tt> - get the program asociated with the object @@ -13748,13 +13822,13 @@ If o is not an object, or o was destructed zero is returned. <a href=types_object>object</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#clone>clone</a> +<link to=clone>clone</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=objectp> +<anchor name=objectp> <dl> <dt><encaps>NAME</encaps><dd> <tt>objectp</tt> - is the argument an object? @@ -13770,14 +13844,14 @@ Returns 1 if arg is an object, zero otherwise. <a href=types_object>object</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#intp>intp</a>, <a href=#programp>programp</a>, <a href=#floatp>floatp</a>, <a href=#stringp>stringp</a>, <a href=#arrayp>arrayp</a>, <a href=#mappingp>mappingp</a>, <a href=#multisetp>multisetp</a> and <a href=#functionp>functionp</a> +<link to=intp>intp</link>, <link to=programp>programp</link>, <link to=floatp>floatp</link>, <link to=stringp>stringp</link>, <link to=arrayp>arrayp</link>, <link to=mappingp>mappingp</link>, <link to=multisetp>multisetp</link> and <link to=functionp>functionp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=pow> +<anchor name=pow> <dl> <dt><encaps>NAME</encaps><dd> <tt>pow</tt> - Raise a number to the power of another. @@ -13793,13 +13867,13 @@ Return n raised to the power of x. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#exp>exp</a> and <a href=#log>log</a> +<link to=exp>exp</link> and <link to=log>log</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=programp> +<anchor name=programp> <dl> <dt><encaps>NAME</encaps><dd> <tt>programp</tt> - is the argument an program? @@ -13815,13 +13889,13 @@ Returns 1 if arg is a program, zero otherwise. <a href=types_program>program</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#intp>intp</a>, <a href=#multisetp>multisetp</a>, <a href=#arrayp>arrayp</a>, <a href=#stringp>stringp</a>, <a href=#objectp>objectp</a>, <a href=#mappingp>mappingp</a>, <a href=#floatp>floatp</a> and <a href=#functionp>functionp</a> +<link to=intp>intp</link>, <link to=multisetp>multisetp</link>, <link to=arrayp>arrayp</link>, <link to=stringp>stringp</link>, <link to=objectp>objectp</link>, <link to=mappingp>mappingp</link>, <link to=floatp>floatp</link> and <link to=functionp>functionp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=putenv> +<anchor name=putenv> <dl> <dt><encaps>NAME</encaps><dd> <tt>putenv</tt> - put environment variable @@ -13834,13 +13908,13 @@ Returns 1 if arg is a program, zero otherwise. This function sets the environment variable 'varname' to 'value'. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#getenv>getenv</a> and <a href=#exece>exece</a> +<link to=getenv>getenv</link> and <link to=exece>exece</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=query_host_name> +<anchor name=query_host_name> <dl> <dt><encaps>NAME</encaps><dd> <tt>query_host_name</tt> - return the name of the host we are running on @@ -13856,10 +13930,10 @@ prints. <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=query_num_arg> +<anchor name=query_num_arg> <dl> <dt><encaps>NAME</encaps><dd> <tt>query_num_arg</tt> - find out how many arguments were given @@ -13873,13 +13947,13 @@ Query_num_arg returns the number of arguments given when this function was called. This is only useful for varargs functions. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#call_function>call_function</a> +<link to=call_function>call_function</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=random> +<anchor name=random> <dl> <dt><encaps>NAME</encaps><dd> <tt>random</tt> - return a random number @@ -13895,13 +13969,13 @@ This function returns a random number in the range 0 - max-1. <a href=types_int>int</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#random_seed>random_seed</a> +<link to=random_seed>random_seed</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=random_seed> +<anchor name=random_seed> <dl> <dt><encaps>NAME</encaps><dd> <tt>random_seed</tt> - seed random generator @@ -13938,13 +14012,13 @@ Result: 94<br> <a href=types_int>int</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#random>random</a> +<link to=random>random</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=remove_call_out> +<anchor name=remove_call_out> <dl> <dt><encaps>NAME</encaps><dd> <tt>remove_call_out</tt> - remove a call out from the call out queue @@ -13963,13 +14037,13 @@ will return 1. You can also give a call out id as argument. (as returned by call_out) <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#call_out_info>call_out_info</a>, <a href=#call_out>call_out</a> and <a href=#find_call_out>find_call_out</a> +<link to=call_out_info>call_out_info</link>, <link to=call_out>call_out</link> and <link to=find_call_out>find_call_out</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=remove_include_path> +<anchor name=remove_include_path> <dl> <dt><encaps>NAME</encaps><dd> <tt>remove_include_path</tt> - remove a directory to search for include files @@ -13983,13 +14057,13 @@ This function removes a directory from the list of directories to search for include files. It is the opposite of add_include_path. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#add_include_path>add_include_path</a> and <a href=#include>#include</a> +<link to=add_include_path>add_include_path</link> and <link to=include>#include</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=remove_module_path> +<anchor name=remove_module_path> <dl> <dt><encaps>NAME</encaps><dd> <tt>remove_module_path</tt> - remove a directory to search for modules @@ -14001,16 +14075,16 @@ for include files. It is the opposite of add_include_path. <dt><encaps>DESCRIPTION</encaps><dd> This function removes a directory from the list of directories to search for modules. It is the opposite of add_module_path. For more information -about modules, see <link to=modules>. +about modules, see <ref to=modules>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#add_module_path>add_module_path</a> +<link to=add_module_path>add_module_path</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=remove_program_path> +<anchor name=remove_program_path> <dl> <dt><encaps>NAME</encaps><dd> <tt>remove_program_path</tt> - remove a directory to search for modules @@ -14022,16 +14096,16 @@ about modules, see <link to=modules>. <dt><encaps>DESCRIPTION</encaps><dd> This function removes a directory from the list of directories to search for program. It is the opposite of add_program_path. For more information -about programs, see <link to=programs>. +about programs, see <ref to=programs>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#add_program_path>add_program_path</a> +<link to=add_program_path>add_program_path</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=replace> +<anchor name=replace> <dl> <dt><encaps>NAME</encaps><dd> <tt>replace</tt> - generic replace function @@ -14039,7 +14113,7 @@ about programs, see <link to=programs>. <dt><encaps>SYNTAX</encaps><dd> <tt>string replace(string <I>s</I>, string <I>from</I>, string <I>to</I>);<br> or<br> -string replace(string <I>s</I>, string *<I>from</I>, string *<I>to</I>);<br> +string replace(string <I>s</I>, array(string) <I>from</I>, array(string) <I>to</I>);<br> or<br> array replace(array <I>a</I>, mixed <I>from</I>, mixed <I>to</I>);<br> or<br> @@ -14053,7 +14127,7 @@ different syntaxes do different things as follow: <p><dl><dt><dd>When given strings as second and third argument, a copy of<br> s with every occurance of 'from' replaced with 'to' is returned.<br> </dl> -<p>string replace(string s, string *from, string *to); +<p>string replace(string s, array(string) from, array(string) to); <p><dl><dt><dd>When given arrays of strings as second and third argument,<br> every occurance of from[0] in s is replaced by to[0],<br> from[1] is replaced by to[1] and so on...<br> @@ -14072,10 +14146,10 @@ to destructively.<br> <a href=types_string>string</a>, <a href=types_array>array</a> and <a href=types_mapping>mapping</a> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=replace_master> +<anchor name=replace_master> <dl> <dt><encaps>NAME</encaps><dd> <tt>replace_master</tt> - replace the master object @@ -14092,10 +14166,10 @@ a good idea to have your master inherit the original master and only re-define certain functions. <!-- FIXME, tell how to inherit the master --> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=reverse> +<anchor name=reverse> <dl> <dt><encaps>NAME</encaps><dd> <tt>reverse</tt> - reverse a string, array or int @@ -14118,14 +14192,14 @@ which require scanning backwards. <a href=types_string>string</a>, <a href=types_array>array</a> and <a href=types_int>int</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sscanf>sscanf</a> +<link to=sscanf>sscanf</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=rm> +<anchor name=rm> <dl> <dt><encaps>NAME</encaps><dd> <tt>rm</tt> - remove file or directory @@ -14141,13 +14215,13 @@ Remove a file or directory, return 0 if it fails. Nonzero otherwise. <a href=index#file>file</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#mkdir>mkdir</a> +<link to=mkdir>mkdir</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=rows> +<anchor name=rows> <dl> <dt><encaps>NAME</encaps><dd> <tt>rows</tt> - select a set of rows from an array @@ -14167,13 +14241,13 @@ returns an array with the results. <a href=types_array>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#column>column</a> +<link to=column>column</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=rusage> +<anchor name=rusage> <dl> <dt><encaps>NAME</encaps><dd> <tt>rusage</tt> - return resource usage @@ -14220,13 +14294,13 @@ be zero. The elements are as follows: more information. (Note that all values may not be present though) <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#time>time</a> +<link to=time>time</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=search> +<anchor name=search> <dl> <dt><encaps>NAME</encaps><dd> <tt>search</tt> - search for a value in a string or array @@ -14258,13 +14332,13 @@ This function replaces strstr and member_array from Pike4. <a href=types_string>string</a>, <a href=types_array>array</a> and <a href=types_mapping>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#indices>indices</a>, <a href=#values>values</a> and <a href=#zero_type>zero_type</a> +<link to=indices>indices</link>, <link to=values>values</link> and <link to=zero_type>zero_type</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=signal> +<anchor name=signal> <dl> <dt><encaps>NAME</encaps><dd> <tt>signal</tt> - trap signals @@ -14288,13 +14362,13 @@ is restored to the default handler. <p>If the second argument is zero, the signal will be completely ignored. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#kill>kill</a>, <a href=#signame>signame</a> and <a href=#signum>signum</a> +<link to=kill>kill</link>, <link to=signame>signame</link> and <link to=signum>signum</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=signame> +<anchor name=signame> <dl> <dt><encaps>NAME</encaps><dd> <tt>signame</tt> - get the name of a signal @@ -14312,13 +14386,13 @@ Result: SIGKILL<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#kill>kill</a>, <a href=#signum>signum</a> and <a href=#signal>signal</a> +<link to=kill>kill</link>, <link to=signum>signum</link> and <link to=signal>signal</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=signum> +<anchor name=signum> <dl> <dt><encaps>NAME</encaps><dd> <tt>signum</tt> - get a signal number given a descriptive string @@ -14336,13 +14410,13 @@ Result: 9<br> </tt> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#signame>signame</a>, <a href=#kill>kill</a> and <a href=#signal>signal</a> +<link to=signame>signame</link>, <link to=kill>kill</link> and <link to=signal>signal</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=sin> +<anchor name=sin> <dl> <dt><encaps>NAME</encaps><dd> <tt>sin</tt> - Trigonometrical sine @@ -14358,13 +14432,13 @@ Return the sinus value for f. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#asin>asin</a> and <a href=#cos>cos</a> +<link to=asin>asin</link> and <link to=cos>cos</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=sizeof> +<anchor name=sizeof> <dl> <dt><encaps>NAME</encaps><dd> <tt>sizeof</tt> - return the size of an array, string, multiset or mapping @@ -14382,10 +14456,10 @@ size. <a href=types_string>string</a>, <a href=types_multiset>multiset</a>, <a href=types_mapping>mapping</a> and <a href=types_array>array</a> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=sleep> +<anchor name=sleep> <dl> <dt><encaps>NAME</encaps><dd> <tt>sleep</tt> - let interpreter doze off for a while @@ -14400,13 +14474,13 @@ handlers can interrupt the sleep. Other callbacks are not called during sleep. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#signal>signal</a> +<link to=signal>signal</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=sort> +<anchor name=sort> <dl> <dt><encaps>NAME</encaps><dd> <tt>sort</tt> - sort an array destructively @@ -14430,13 +14504,13 @@ Arrays will be sorted first on the first element of each array. <a href=types_array>array</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#reverse>reverse</a> +<link to=reverse>reverse</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=sprintf> +<anchor name=sprintf> <dl> <dt><encaps>NAME</encaps><dd> <tt>sprintf</tt> - print the result from sprintf @@ -14621,13 +14695,13 @@ Exiting.<br> <a href=types_string>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sscanf>sscanf</a> +<link to=sscanf>sscanf</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=sqrt> +<anchor name=sqrt> <dl> <dt><encaps>NAME</encaps><dd> <tt>sqrt</tt> - Square root @@ -14646,13 +14720,13 @@ truncated to the closest lower integer. <a href=types_float>float</a> and <a href=types_int>int</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#pow>pow</a>, <a href=#log>log</a>, <a href=#exp>exp</a> and <a href=#floor>floor</a> +<link to=pow>pow</link>, <link to=log>log</link>, <link to=exp>exp</link> and <link to=floor>floor</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=strerror> +<anchor name=strerror> <dl> <dt><encaps>NAME</encaps><dd> <tt>strerror</tt> - return a string describing an error @@ -14672,10 +14746,10 @@ code is usually obtained from the file->errno() call. This function may not be available on all platforms. <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=stringp> +<anchor name=stringp> <dl> <dt><encaps>NAME</encaps><dd> <tt>stringp</tt> - is the argument an string? @@ -14691,13 +14765,13 @@ Returns 1 if arg is a string, zero otherwise. <a href=types_string>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#intp>intp</a>, <a href=#multisetp>multisetp</a>, <a href=#arrayp>arrayp</a>, <a href=#programp>programp</a>, <a href=#objectp>objectp</a>, <a href=#mappingp>mappingp</a>, <a href=#floatp>floatp</a> and <a href=#functionp>functionp</a> +<link to=intp>intp</link>, <link to=multisetp>multisetp</link>, <link to=arrayp>arrayp</link>, <link to=programp>programp</link>, <link to=objectp>objectp</link>, <link to=mappingp>mappingp</link>, <link to=floatp>floatp</link> and <link to=functionp>functionp</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=strlen> +<anchor name=strlen> <dl> <dt><encaps>NAME</encaps><dd> <tt>strlen</tt> - Return the length of a string @@ -14713,14 +14787,14 @@ This function is equal to sizeof. <a href=types_string>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#sizeof>sizeof</a> +<link to=sizeof>sizeof</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=tan> +<anchor name=tan> <dl> <dt><encaps>NAME</encaps><dd> <tt>tan</tt> - Trigonometrical tangent @@ -14736,13 +14810,13 @@ Return the tangent value for f. <a href=types_float>float</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#atan>atan</a>, <a href=#sin>sin</a> and <a href=#cos>cos</a> +<link to=atan>atan</link>, <link to=sin>sin</link> and <link to=cos>cos</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=this_object> +<anchor name=this_object> <dl> <dt><encaps>NAME</encaps><dd> <tt>this_object</tt> - return the object we are evaluating in currently @@ -14758,10 +14832,10 @@ This function returns the object we are curently evaluating in. <a href=types_object>object</a> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=throw> +<anchor name=throw> <dl> <dt><encaps>NAME</encaps><dd> <tt>throw</tt> - throw a value to catch or global error handling @@ -14779,13 +14853,13 @@ index contains an error message and the second index is a backtrace, like a real error by overlying functions. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#catch>catch</a> +<link to=catch>catch</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=time> +<anchor name=time> <dl> <dt><encaps>NAME</encaps><dd> <tt>time</tt> - return the current time @@ -14803,13 +14877,13 @@ The function ctime() converts this integer to a readable string. but is only updated in the backed. (when pike code isn't running) <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#time>time</a> +<link to=time>time</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=trace> +<anchor name=trace> <dl> <dt><encaps>NAME</encaps><dd> <tt>trace</tt> - change debug trace level @@ -14828,10 +14902,10 @@ these opcodes are printed as well. See the command lines options for more information <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=typeof> +<anchor name=typeof> <dl> <dt><encaps>NAME</encaps><dd> <tt>typeof</tt> - check return type of expression @@ -14858,10 +14932,10 @@ Result: int<br> <a href=index#pike>pike</a> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=ualarm> +<anchor name=ualarm> <dl> <dt><encaps>NAME</encaps><dd> <tt>ualarm</tt> - set an alarm clock for delivery of a signal @@ -14883,13 +14957,13 @@ ualarm returns the number of microseconds seconds remaining<br> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#signal>signal</a> +<link to=signal>signal</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=upper_case> +<anchor name=upper_case> <dl> <dt><encaps>NAME</encaps><dd> <tt>upper_case</tt> - convert a string to upper case @@ -14906,13 +14980,13 @@ to upper case character. <a href=types_string>string</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#lower_case>lower_case</a> +<link to=lower_case>lower_case</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=values> +<anchor name=values> <dl> <dt><encaps>NAME</encaps><dd> <tt>values</tt> - return an array of all possible values from indexing @@ -14932,13 +15006,13 @@ may contain any kind of value. <a href=types_mapping>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#indices>indices</a> +<link to=indices>indices</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=version> +<anchor name=version> <dl> <dt><encaps>NAME</encaps><dd> <tt>version</tt> - return version info @@ -14957,10 +15031,10 @@ Result: Pike v0.3<br> </tt> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=write> +<anchor name=write> <dl> <dt><encaps>NAME</encaps><dd> <tt>write</tt> - write text to stdout @@ -14971,16 +15045,16 @@ Result: Pike v0.3<br> <p> <dt><encaps>DESCRIPTION</encaps><dd> Added by the master, it directly calls write in a -<a href=Stdio.stdout>Stdio.stdout</a>. +<link to=Stdio.stdout>Stdio.stdout</link>. <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#Stdio.werror>Stdio.werror</a> +<link to=Stdio.werror>Stdio.werror</link> <p> </dl> -</a> +</anchor> <HR NEWPAGE> -<a name=zero_type> +<anchor name=zero_type> <dl> <dt><encaps>NAME</encaps><dd> <tt>zero_type</tt> - return the type of zero @@ -15005,24 +15079,14 @@ returned. Otherwise zero_type will return zero. <a href=types_int>int</a> and <a href=types_mapping>mapping</a> <p> <dt><encaps>SEE ALSO</encaps><dd> -<a href=#find_call_out>find_call_out</a> +<link to=find_call_out>find_call_out</link> <p> </dl> -</a> - -<HR NEWPAGE> -<HR NEWPAGE> -<HR NEWPAGE> -<HR NEWPAGE> -<HR NEWPAGE> -<!-- Find me! --> -<HR NEWPAGE> -<HR NEWPAGE> -<HR NEWPAGE> -<HR NEWPAGE> - +</anchor> </chapter> +<!-- + <H1>XXX. Things to describe somewhere</H1> <ul> <li>garbage collection @@ -15075,7 +15139,7 @@ in the <b>master object</b>: in a program. It is normally used for loading modules. It is supposed to return <tt>([])[0]</tt> if the master doesn't know what the value should be, and the value in question otherwise. -<dt> <tt>void _main(string *<i>argv</i>, string *<i>env</i>)</tt> +<dt> <tt>void _main(array(string) <i>argv</i>, array(string) <i>env</i>)</tt> <dd> This function is supposed to start a Pike script. It receives all the command line arguments in the first array and all environment variables on the form <tt>"<i>var</i>=<i>value</i>"</tt>. @@ -15125,7 +15189,7 @@ and the master object will not change in the future, so be careful if you do this. <p> Let's look an example: -<pre> +<example language=pike> #!/usr/local/bin/pike class new_master { @@ -15151,13 +15215,13 @@ Let's look an example: } }; - int main(int argc, string *argv) + int main(int argc, array(string) argv) { replace_master(new_master()); /* Run rest of program */ exit(0); } -</pre> +</example> This example installs a master object which logs run time errors to file instead of writing them to stderr. <p> @@ -15192,6 +15256,8 @@ instead of writing them to stderr. </ul> </chapter> +--> + <appendix title="Terms and jargon"> <dl> @@ -15216,11 +15282,11 @@ instead of writing them to stderr. </dl> </appendix> -<appendix title="Register program" alias=register_program> +<appendix title="Register program" name=register_program> Here is a complete listing of the example program from chapter 2. -<pre> +<example language=pike> #!/usr/local/bin/pike mapping records(string:aray(string)) = ([ @@ -15245,7 +15311,7 @@ mapping records(string:aray(string)) = ([ void list_records() { int i; - string *record_names=sort(indices(records)); + array(string) record_names=sort(indices(records)); write("Records:\n"); for(i=0;i<sizeof(record_names);i++) @@ -15255,7 +15321,7 @@ void list_records() void show_record(int num) { int i; - string *record_names=sort(indices(records)); + array(string) record_names=sort(indices(records)); string name=record_names[num-1]; string songs=records[name]; @@ -15340,7 +15406,7 @@ void load(string file_name) void delete_record(int num) { - string *record_names=sort(indices(records)); + array(string) record_names=sort(indices(records)); string name=record_names[num-1]; m_delete(records,name); @@ -15368,7 +15434,7 @@ void find_song(string title) if(!hits) write("Not found.\n"); } -int main(int argc, string * argv) +int main(int argc, array(string) argv) { string cmd; while(cmd=readline("Command: ")) @@ -15412,7 +15478,7 @@ int main(int argc, string * argv) } } } -</pre> +</example> </appendix> <appendix title="Reserved words"> @@ -15444,7 +15510,7 @@ This is the BNF for Pike: <tr valign=top><td>variable_name</td><td>::=</td><td>{ "*" } identifier [ "=" expression2 ]</td></tr> <tr valign=top><td>constant</td><td>::=</td><td>modifiers <b>constant</b> constant_names ";" </td></tr> <tr valign=top><td>constant_names</td><td>::=</td><td>constant_name { "," constant_name }</td></tr> -<tr valign=top><td>constant_name</td><td>::=</td><td>identifer "=" expression2</td></tr> +<tr valign=top><td>constant_name</td><td>::=</td><td>identifier "=" expression2</td></tr> <tr valign=top><td>class_def</td><td>::=</td><td>modifiers <b>class</b> [ ";" ] </td></tr> <tr valign=top><td>class</td><td>::=</td><td><b>class</b> [ identifier ] "{" program "}"</td></tr> <tr valign=top><td>modifiers</td><td>::=</td><td> { <b>static</b> | <b>private</b> | <b>nomask</b> | <b>public</b> | <b>protected</b> | <b>inline</b> }</td></tr> @@ -15465,7 +15531,7 @@ This is the BNF for Pike: <tr valign=top><td>expression3</td><td>::=</td><td>expression4 '?' expression3 ":" expression3 </td></tr> <tr valign=top><td>expression4</td><td>::=</td><td>{ expression5 ( "||" | "&&" | "|" | "^" | "&" | "==" | "!=" | ">" | "<" | ">=" | "<=" | "<<" | ">>" | "+" | "*" | "/" | "%" ) } expression5</td></tr> <tr valign=top><td>expression5</td><td>::=</td><td>expression6 | "(" type ")" expression5 | "--" expression6 | "++" expression6 | expression6 "--" | expression6 "++" | "~" expression5 | "-" expression5 </td></tr> -<tr valign=top><td>expression6</td><td>::=</td><td>string | number | float | catch | guage | typeof | sscanf | lambda | class | constant_identifer | call | index | mapping | multiset | array | parenthesis | arrow </td></tr> +<tr valign=top><td>expression6</td><td>::=</td><td>string | number | float | catch | guage | typeof | sscanf | lambda | class | constant_identifier | call | index | mapping | multiset | array | parenthesis | arrow </td></tr> <tr valign=top><td>number</td><td>::=</td><td>digit { digit } | "0x" { digits } | "'" character "'" </td></tr> <tr valign=top><td>float</td><td>::=</td><td>digit { digit } "." { digit }</td></tr> <tr valign=top><td>catch</td><td>::=</td><td><b>catch</b> ( "(" expression ")" | block )</td></tr> @@ -15474,7 +15540,7 @@ This is the BNF for Pike: <tr valign=top><td>lvalue</td><td>::=</td><td><b>lambda</b> expression6 | type identifier </td></tr> <tr valign=top><td>lambda</td><td>::=</td><td><b>lambda</b> "(" arguments ")" block</td></tr> -<tr valign=top><td>constant_identifer</td><td>::=</td><td>identifer { "." identifer }</td></tr> +<tr valign=top><td>constant_identifier</td><td>::=</td><td>identifier { "." identifier }</td></tr> <tr valign=top><td>call</td><td>::=</td><td>expression6 "(" expression_list ")" </td></tr> <tr valign=top><td>index</td><td>::=</td><td>expression6 "[" expression [ ".." expression ] "]"</td></tr> <tr valign=top><td>array</td><td>::=</td><td>"({" expression_list "})"</td></tr> @@ -15497,7 +15563,7 @@ This is the BNF for Pike: </appendix> -<appendix title="How to install Pike" alias=install> +<appendix title="How to install Pike" name=install> To install pike, you need a C compiler, a couple of Mb of disk space, the source for Pike, and a bit of patience. The latest version of Pike is always available from <a href=http://pike.infovav.se>the Pike home page</a>. @@ -15555,8 +15621,4 @@ earlier. You are now ready to use Pike. </appendix> -</appendixes> - -<h1> Index </h1> - -<index> +<index title=Index>