11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

306 • Chapter 7: <strong>Advanced</strong> ConnectivityThe following table describes the external types and the Maple typesthat can be converted. The first listed Maple type is the one to which aresult of the corresponding external type is converted into.External Type Allowed Maple Type(s)boolean[n] booleaninteger[n] integerfloat[n] float, rational, integer, numericcomplex[n] complex, numeric, float, rational, integerchar[n] one-character stringstring[n] string, symbol, 0ARRAY() Array, Vector, Matrix, name, 0STRUCT() list, tableUNION() tablePROC()procedureFor STRUCTs, either lists or tables are valid for a particular declaration.Once declared, only one of the types (a list or a table) is acceptable. Theycannot be used interchangeably unless the wrapper is regenerated. ForUNIONs, only tables are permitted, and the table must contain exactly oneentry when passed (corresponding to one of the members of the union).If an argument of an incompatible type is passed, an error occurs,and the external function is not called. Likewise, if a value is passed thatis out of range for the specified type (for example, integer too large), anerror occurs. When passing floating-point values, precision in excess ofthat supported by the external type is discarded, provided the magnitudeof the value is within the range of the external type.Arguments that were declared as REFerences, that is, passed byreference,can be passed either a name, a zero, or the declared kind ofMaple expression.• If a name is passed, it is evaluated, and the value is passed by referenceto the external function. After the external function returns, therevised value is converted back to the type specified for the argumentand assigned back to the name.• If the name passed has no value, then either NULL is passed, or apointer to newly allocated space for the structure is passed. This behavioris determined by the presence or absence of ALLOC in the REFdeclaration.• If a zero is passed, NULL is passed to the external function.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!