assemble - Maple Programming Help

Home : Support : Online Help : Programming : Resource Management : assemble

assemble

assemble a sequence of addresses into an object

disassemble

break an object into its component addresses

pointto

obtain the expression pointed to by an address

obtain the address that points to an expression

Parameters

 objectid - integer or symbolic object type identifier addrseq - sequence of integer addresses addr - integer representing an address expr - Maple expression

Description

 • This collection of four functions is known as the hackware package'' in Maple.  These functions allow access to the internal representations of Maple objects and to the addresses pointing to them.
 • You should become familiar with the internal representation of Maple objects before using this collection of functions. For details, refer to the Appendix in the Maple Programming Guide.
 • Extreme care is required when using these functions, because their use can lead to various types of unrecoverable internal errors. Maple does some rudimentary checks of the objects created through these functions, but it is not possible to check everything.
 • The functions assemble and disassemble are a complementary pair of functions:

$\mathrm{assemble}\left(\mathrm{addrseq}\right)\to \mathrm{addr}$

$\mathrm{disassemble}\left(\mathrm{addr}\right)\to \mathrm{addrseq}$

 • The first function, assemble, assembles an object identifier and a sequence of integer addresses into a Maple object and returns an integer addr that gives the address of the object.
 The second function, disassemble, looks at the Maple object pointed to by the integer address addr, disassembles the object into its component parts, and returns the sequence of addresses of the component parts.
 The object identifier objectid represents the type of the object, and can be expressed as an integer, or as a symbolic name. The valid object identifier names are:

 AND ASSIGN BINARY BREAK CATENATE COMPLEX CONTROL DCOLON DEBUG EQUATION ERROR EXPSEQ FLOAT FOR FOREIGN FUNCTION GARBAGE HASH HASHTAB HFLOAT IF IMPLIES INEQUAT INTNEG INTPOS LESSEQ LESSTHAN LEXICAL LIST LOCAL MEMBER MODDEF MODULE NAME NEXT NOT OR PARAM POLY POWER PROC PROD RANGE RATIONAL READ RETURN RTABLE SAVE SDPOLY SERIES SET STATSEQ STOP STRING SUM TABLE TABLEREF TRY UNEVAL USE XOR ZPPOLY

 The kernelopts function with option dagtag can be used to map among these symbolic names and the corresponding integer values.
 • The functions pointto and addressof are a complementary pair of functions:

$\mathrm{pointto}\left(\mathrm{addr}\right)\to \mathrm{expr}$

$\mathrm{addressof}\left(\mathrm{expr}\right)\to \mathrm{addr}$

 • The function pointto takes an integer address addr and returns the Maple expression to which it points.
 The addressof function takes a Maple expression and returns the integer address that points to it.
 • An object whose only reference is through an addressof() reference could be collected by garbage collection. To avoid this, either make sure that all the objects for which you compute addressof() are assigned to variables, or delay garbage collection (see gc).

 • The assemble, disassemble, pointto and addressof commands are thread-safe as of Maple 15.

Examples

 > $f≔3{x}^{2}+5.0$
 ${f}{≔}{3}{}{{x}}^{{2}}{+}{5.0}$ (1)
 > $a≔\mathrm{addressof}\left(f\right)$
 ${a}{≔}{18446884220468552238}$ (2)
 > $\mathrm{pointto}\left(a\right)$
 ${3}{}{{x}}^{{2}}{+}{5.0}$ (3)
 > $d≔\mathrm{disassemble}\left(a\right)$
 ${d}{≔}{16}{,}{18446884220468252102}{,}{18446744073709551621}{,}{18446884220468407262}{,}{18446744073709551617}$ (4)
 > $\mathrm{kernelopts}\left(\mathrm{dagtag}=d\left[1\right]\right)$
 ${\mathrm{SUM}}$ (5)
 > $\mathrm{pointto}\left(d\left[2\right]\right)$
 ${{x}}^{{2}}$ (6)
 > $\mathrm{pointto}\left(d\left[3\right]\right)$
 ${3}$ (7)
 > $\mathrm{pointto}\left(d\left[4\right]\right)$
 ${5.0}$ (8)
 > $\mathrm{pointto}\left(d\left[5\right]\right)$
 ${1}$ (9)
 > $g≔\mathrm{assemble}\left(d\left[1\right],d\left[2\right],d\left[3\right]\right)$
 ${g}{≔}{18446884220407305990}$ (10)
 > $\mathrm{pointto}\left(g\right)$
 ${3}{}{{x}}^{{2}}$ (11)
 > $\mathrm{addressof}\left(g\right)$
 ${18446884220470315998}$ (12)
 > $h≔y=\mathrm{diff}\left({x}^{2},x\right)$
 ${h}{≔}{y}{=}{2}{}{x}$ (13)
 > $b≔\mathrm{addressof}\left(h\right)$
 ${b}{≔}{18446884220407042406}$ (14)
 > $j≔\mathrm{disassemble}\left(b\right)$
 ${j}{≔}{22}{,}{18446884220472661598}{,}{18446884220407042358}$ (15)
 > $\mathrm{kernelopts}\left(\mathrm{dagtag}=j\left[1\right]\right)$
 ${\mathrm{EQUATION}}$ (16)
 > $\mathrm{pointto}\left(j\left[2\right]\right)$
 ${y}$ (17)
 > $\mathrm{pointto}\left(j\left[3\right]\right)$
 ${2}{}{x}$ (18)
 > $n≔\mathrm{assemble}\left(\mathrm{INEQUAT},j\left[2\right],j\left[3\right]\right)$
 ${n}{≔}{18446884220406738158}$ (19)
 > $\mathrm{pointto}\left(n\right)$
 ${y}{\ne }{2}{}{x}$ (20)