autodoc.git/
autodoc.xml
Branch:
Tag:
Non-build tags
All tags
No tags
1996-08-14
1996-08-14 23:39:41 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
563f98cc47aaf69f5c840a1362f1ee0c6f5a447e (
125
lines) (+
118
/-
7
)
[
Show
|
Annotate
]
Branch:
ulpc
Tags:
v0.000002
(cast)mpz documented
Rev: src/modules/gmpmod/doc/mpz:1.2
67:
<p>would cause identifer 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.
-
</p>
+
will be replaced with something1 and something2.</p>
</text>
-
+
<group><bugs/><text>
+
<p>Note that it is not a good idea to do something like this:
+
</p>
+
<p>#define foo bar // a comment
+
</p>
+
<p>The comment will be included in the define, and thus inserted in the
+
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.
+
</p>
+
<p/>
+
</text></group>
+
</doc> </docgroup> <docgroup homogen-type='directive'>
145:
<group><example/><text> <tt><p>#if !efun(write_file)<br/>
-
#error
Move
object
is missing<br/>
+
#error
Write
file
efun
is missing<br/>
#endif<br/> <br/> </p>
987:
allocated and does not need to be declared as in C. The values in the array can be set when creating the array as in the first construction or anytime afterwards like this: arr[index]=data where
-
index is an integer
greater
or
equal
to
0 and
smaller
than
the array
-
size
. Note that arrays are shared and use reference counts to keep
+
index is an integer
.
Index
is
normally
0
<= index < sizeof(arr),
and
+
refers
to
the corresponding element in the array. If index is less
+
than
zero, it is
the
same as doing arr[sizeof(arr)+index]. This
+
means that negative index will index the
array
from the end rather
+
than from the beginning
.
+
</p>
+
<p>
Note that arrays are shared and use reference counts to keep
track of their references. This will have the effect that you can have two variables pointing to the same array, and when you change an index in in it, both variables will show the change.
1241:
given by that string. It will then put the program in a chache in case you cast the same string to a program again later. </p>
+
<p>Castring from string to object will call cast_to_object in the
+
master object and request an object to return. The standard master
+
object will consider the string a file name, cast it to a program
+
and return a clone of that file. If the same cast is attempted again
+
later, the _same_ object will be returned.
+
</p>
+
<p>When casting an object, the method o->cast will be called with a string
+
with the name of the type as argument. o->cast can then return any
+
value.
+
</p>
<p>In all other cases, casts are just compiler hints.</p>
-
+
</text>
-
lpc</text>
+
<group><example/><text>
+
<tt><p><matrix>
+
<r><c> (program)"/precompiled/file" </c><c> // returns the file program </c></r>
+
<r><c> (object)"/precompiled/file" </c><c> // returns a clone of the file program </c></r>
+
<r><c> (int)(object)"/precompiled/mpz" // returns 0 </c></r>
+
</matrix>
+
</p>
+
</tt>
+
lpc</text>
</group>
<group><seealso/><text> <p><ref resolved='predef::compile_file' to='compile_file'>compile_file</ref> and <ref resolved='predef::sscanf' to='sscanf'>sscanf</ref></p>
2589:
</doc> </docgroup>
+
<docgroup homogen-name='index' homogen-type='method'>
+
<method name='index'/><doc placeholder='true'>
+
<text>
+
<p><tt>index</tt> - get/set an element in an array/string/mapping/object</p>
+
+
<tt><p>a [ b ]<br/>
+
or<br/>
+
a [ b ] = c<br/>
+
or<br/>
+
a -> b<br/>
+
</p>
+
</tt>
+
<p><matrix>
+
<r><c> This operator does a lookup in 'a' to find the element named 'b' in </c></r>
+
<r><c> 'a'. The last syntax (a->b) is equal to a [ "b" ]. Different usage </c></r>
+
<r><c> applies </c><c> to different types. </c></r>
+
</matrix>
+
+
</p>
+
<p><matrix>
+
<r><c> Strings </c><c> With strings, the index operator can only be used to get values </c></r>
+
<r><c> </c><c> not change them. The index must be an integer, and the return value will be the ascii value of the corresponding character in the string. The first character is numbered 0. </c></r>
+
<r><c> Arrays </c><c> As with strings, arrays can only be indexed on integers. However, values can also be changed by using indexing on the left side of an assignment. The values in the array can have any type. As with strings, the first index is 0. </c></r>
+
<r><c> Mappings </c><c> Mappings can be indexed on any type of value, quite often they are indexed on strings. Values can be changed as with arrays. Mappings do not have a fixed size, nor do they have a specific order in which the values are stored. If you attempt to set a value in a mapping that does not already exists, the mapping will grow to include the new value. There is no 'first' index for mappings. </c></r>
+
<r><c> Lists </c><c> Lists can be also be indexed on any value, but the return value only reflects a true/false status depending on weather that index was present in the list. As with mappings, lists will grow when you try to set a value in it that is does not already exists. However lists will only grow if the inserted 'c' is nonzero. </c></r>
+
<r><c> Object </c><c> Objects can only be indexed on strings. It then gets/sets the value of the variable with that name. If the 'variable' isn't a variable at all, but a function it will return a pointer to that function but you can't change it. </c></r>
+
</matrix>
+
</p>
+
</text>
+
+
<group><example/><text>
+
<tt><p><matrix>
+
<r><c> "foobar"[2] </c><c> returns 111 /* ascii for 'o' */ </c></r>
+
<r><c> "foobar"[0] </c><c> returns 102 /* ascii for 'f' */ </c></r>
+
<r><c> ({1,2,3})[1] </c><c> returns 2 </c></r>
+
<r><c> ([1:2})[1] </c><c> returns 2 </c></r>
+
<r><c> (<1,2,3>)[2] </c><c> returns 1 </c></r>
+
</matrix>
+
</p>
+
</tt>
+
operators</text></group>
+
+
<group><seealso/><text>
+
<p><ref resolved='predef::index' to='index'>index</ref></p>
+
</text></group>
+
+
</doc>
+
</docgroup>
<docgroup homogen-name='indices' homogen-type='method'> <method name='indices'/><doc placeholder='true'> <text>
3783:
operators</text></group> <group><seealso/><text>
-
<p><ref to='index'>index</ref></p>
+
<p><ref
resolved='predef::index'
to='index'>index</ref></p>
</text></group> </doc>
6014:
</text></group> </doc>
+
<docgroup homogen-name='cast' homogen-type='method'>
+
<method name='cast'>
+
</method>
+
<doc placeholder='true'>
+
<text>
+
<p><tt>cast</tt> - cast to other type</p>
+
+
<tt><p>object mpz->gcd( "string" | "int" | "<i>float</i>" );<br/>
+
or<br/>
+
(string) mpz<br/>
+
or<br/>
+
(int) mpz<br/>
+
or<br/>
+
(float) mpz<br/>
+
</p>
+
</tt>
+
<p>This function converts an mpz to a string, int or float. This is
+
nessesary when you want to view, store or use the result of an mpz
+
calculation.</p>
+
</text>
+
+
<group><seealso/><text>
+
<p><ref resolved='predef::/precompiled/mpz.cast' to='cast'>cast</ref></p>
+
</text></group>
+
+
</doc>
+
</docgroup>
<docgroup homogen-name='create' homogen-type='method'> <method name='create'> </method>