12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841 |
- /* openmath.c Copyright (C) 1998 NAG Ltd. */
- #ifdef OPENMATH
- /*
- * Reading and writing of OpenMath objects, using the INRIA OpenMath library.
- * Developed as a deliverable of the OpenMath Project (ESPRIT Project 24969).
- *
- * Initial version: Vilya Harvey, Nov 24th, 1998.
- *
- * Note: to add this to CCL, the following files had to be modified:
- * Makefile
- * cslbase\entries.h
- * cslbase\externs.h
- * cslbase\restart.c
- * cclbase\exports.lsp
- *
- * Note: to make sure that the OpenMath support is compiled into CCL, the
- * symbol OPENMATH must be #defined.
- */
- /* Signature: 52632b41 08-Apr-2002 */
- #include <stdarg.h>
- #include <string.h>
- #include <ctype.h>
- #ifdef __WATCOMC__
- #include <float.h>
- #endif
- #include "machine.h"
- #include "tags.h"
- #include "cslerror.h"
- #include "externs.h"
- #include "entries.h"
- #include "arith.h"
- #include "read.h"
- #include <OM.h>
- #include <OMconn.h>
- #include <math.h>
- #include "openmath.h"
- #define OMCCL_ELEM_BITS 31 /* #bits in bignum element. */
- #define OMCCL_MAX_BITS 15 /* Must be < OMCCL_ELEM_BITS */
- #define OMCCL_MAX_VAL (1 << OMCCL_MAX_BITS)
- #define OMCCL_MAX_MASK (OMCCL_MAX_VAL - 1)
- #define OMCCL_INV_LOG_2 1.44269504 /* 1 / ln(2) */
- /*
- * Error reporting macro. The status parameter should be of type OMstatus; the
- * return value is a Lisp_Object representing the appropriate error.
- */
- #define om_error(status) error(0, (int)(status) + 33)
- /*
- * Local functions for dealing with property lists.
- */
- Lisp_Object om_getLispProperty(Lisp_Object obj, Lisp_Object name);
- Lisp_Object om_setLispProperty(Lisp_Object obj, Lisp_Object name, Lisp_Object val);
- /*
- * External CCL functions.
- */
- extern char *get_string_data(Lisp_Object name, char *why, int32 *l);
- OMdev
- om_toDev(Lisp_Object obj)
- /* This routine converts a Lisp_Object to an OMdev. It does
- * not check that the object it is given actually *is* an
- * OMdev - that's the caller's responsibility.
- */
- {
- OMdev dev;
-
- /* DEBUG */
- if (!is_bignum(obj)) {
- err_printf("[om_toDev] not a bignum!\n");
- }
- else {
- int blen = (bignum_length(obj) >> 2) - 1;
- if (blen != 1)
- err_printf("[om_toDev] bignum length is %d (should be 1)!\n", blen);
- }
- /* END DEBUG */
-
- if (!is_bignum(obj))
- return NULL;
- else if (((bignum_length(obj) >> 2) - 1) != 1)
- return NULL;
- dev = (OMdev) ( bignum_digits(obj)[0] );
- return dev;
- }
- Lisp_Object
- om_fromDev(OMdev dev)
- {
- Lisp_Object obj;
- obj = make_one_word_bignum((int32)dev);
- return obj;
- }
- OMstatus
- om_toStatus(Lisp_Object obj)
- {
- OMstatus status;
- if (!is_fixnum(obj))
- return OMinternalError;
- status = (OMstatus)( int_of_fixnum(obj) );
- return status;
- }
- Lisp_Object
- om_fromStatus(OMstatus status)
- {
- Lisp_Object obj;
- obj = fixnum_of_int((int32)status);
- return obj;
- }
- OMencodingType
- om_toEncodingType(Lisp_Object obj)
- {
- OMencodingType enc;
- if (!is_fixnum(obj))
- return OMencodingUnknown;
- enc = (OMencodingType)( int_of_fixnum(obj) );
- return enc;
- }
- Lisp_Object
- om_fromEncodingType(OMencodingType enc)
- {
- Lisp_Object obj;
- obj = fixnum_of_int((int32)enc);
- return obj;
- }
- char *
- om_toBigNumStr(Lisp_Object num)
- {
- static char hexdigit[] = "0123456789ABCDEF";
- char *str;
- int numDigits, digit;
- int bdigit, boffset;
- int i, j, val;
- int strPos;
- int leading;
- /* Determine the number of digits needed. */
- i = ((bignum_length(num) >> 2) - 1) * 31;
- numDigits = (i >> 2) + (((i & 0x3) != 0) ? 1 : 0);
- str = (char *)malloc((numDigits + 1) * sizeof(char));
- memset(str, 0, (numDigits + 1) * sizeof(char));
- strPos = 0;
- leading = 1;
- digit = 0;
- while (digit < numDigits) {
- i = (numDigits - digit - 1) << 2;
- bdigit = i / 31;
- boffset = i % 31;
- j = 31 - boffset;
-
- switch (j) {
- case 3:
- val = (bignum_digits(num)[bdigit] >> boffset) & 0x7;
- val |= ((bignum_digits(num)[bdigit+1] & 0x1) << 3);
- break;
- case 2:
- val = (bignum_digits(num)[bdigit] >> boffset) & 0x3;
- val |= ((bignum_digits(num)[bdigit+1] & 0x3) << 2);
- break;
- case 1:
- val = (bignum_digits(num)[bdigit] >> boffset) & 0x1;
- val |= ((bignum_digits(num)[bdigit+1] & 0x7) << 1);
- break;
- default:
- val = (bignum_digits(num)[bdigit] >> boffset) & 0xF;
- break;
- }
-
- str[strPos] = hexdigit[val];
- digit++;
- if (hexdigit[val] != '0' || !leading) {
- leading = 0;
- strPos++;
- }
- }
- return str;
- }
- Lisp_Object
- om_fromBigNumStr(char *inData, int len, int sign, OMbigIntType fmt)
- {
- Lisp_Object obj, radix, digit;
- int i;
- if (len == 0)
- return fixnum_of_int(0);
- else
- obj = fixnum_of_int(0);
- switch (fmt) {
- case OMbigIntBase10:
- radix = fixnum_of_int(10);
- break;
- case OMbigIntBase16:
- radix = fixnum_of_int(16);
- break;
- default:
- return om_error(OMinternalError);
- }
- for (i = 0; i < len; i++) {
- obj = times2(obj, radix);
- switch (fmt) {
- case OMbigIntBase10:
- digit = fixnum_of_int( (int)(inData[i] - '0') );
- break;
- case OMbigIntBase16:
- if (inData[i] >= 'a' && inData[i] <= 'f')
- digit = fixnum_of_int( (int)(inData[i] - 'a') + 10 );
- else if (inData[i] >= 'A' && inData[i] <= 'F')
- digit = fixnum_of_int( (int)(inData[i] - 'A') + 10 );
- else
- digit = fixnum_of_int( (int)(inData[i] - '0') );
- break;
- }
- obj = plus2(obj, digit);
- }
- if (sign < 0)
- obj = negateb(obj);
- return obj;
- }
- OMconn
- om_toConn(Lisp_Object obj)
- {
- OMconn conn;
-
- /* DEBUG */
- if (!is_bignum(obj)) {
- err_printf("[om_toConn] not a bignum!\n");
- }
- else {
- int blen = (bignum_length(obj) >> 2) - 1;
- if (blen != 1)
- err_printf("[om_toConn] bignum length is %d (should be 1)!\n", blen);
- }
- /* END DEBUG */
-
- if (!is_bignum(obj))
- return NULL;
- else if (((bignum_length(obj) >> 2) - 1) != 1)
- return NULL;
- conn = (OMconn)(bignum_digits(obj)[0]);
- return conn;
- }
- Lisp_Object
- om_fromConn(OMconn conn)
- {
- Lisp_Object obj;
- obj = make_one_word_bignum((int32)conn);
- return obj;
- }
- char **
- om_toCString(Lisp_Object obj)
- /* Converts a lisp object which wraps a C string into a C string (a char
- * pointer, where the memory block is allocated on the heap, outside of the
- * control of the CCL garbage collection). Does not check that the Lisp object
- * *is* a C string though.
- */
- {
- char **pstr = NULL;
-
- /* DEBUG */
- if (!is_bignum(obj) && !stringp(obj)) {
- err_printf("[om_toCString] not a bignum or a string!\n");
- }
- else if (is_bignum(obj)) {
- int blen = (bignum_length(obj) >> 2) - 1;
- if (blen != 1)
- err_printf("[om_toCString] bignum length is %d (should be 1)!\n", blen);
- }
- /* END DEBUG */
-
- if (!is_bignum(obj) && !stringp(obj))
- return NULL;
- else if (is_bignum(obj)) {
- if (((bignum_length(obj) >> 2) - 1) != 1)
- return NULL;
- pstr = (char **)(bignum_digits(obj)[0]);
- }
- else {
- char *tmp = NULL;
- int len = 0;
- tmp = get_string_data(obj, "om_toCString", &len);
- tmp[len] = '\0';
- pstr = (char **)malloc(sizeof(char *));
- *pstr = strdup(tmp);
- }
- return pstr;
- }
- Lisp_Object
- om_fromCString(char **str)
- {
- Lisp_Object obj;
- obj = make_one_word_bignum((int32)str);
- return obj;
- }
- Lisp_Object
- om_cStringFromLispString(Lisp_Object lstr)
- {
- Lisp_Object cstr;
- cstr = om_fromCString(om_toCString(lstr));
- return cstr;
- }
- Lisp_Object
- om_lispStringFromCString(Lisp_Object cstr)
- {
- Lisp_Object lstr;
- char **pstr = om_toCString(cstr);
- lstr = make_string(*pstr);
- return lstr;
- }
- /*
- * Local functions for dealing with property lists.
- */
- Lisp_Object
- om_getLispProperty(Lisp_Object obj, Lisp_Object name)
- {
- return get(obj, name, C_nil);
- }
- Lisp_Object
- om_setLispProperty(Lisp_Object obj, Lisp_Object name, Lisp_Object val)
- {
- return putprop(obj, name, val);
- }
- /*
- * Exposed OpenMath Device manipulation functions.
- */
- Lisp_Object MS_CDECL
- om_openFileDev(Lisp_Object nil, int nargs, ...)
- /* Opens a file and creates an OpenMath device for it. The return value is the
- * LISP object which wraps the created device. The parameters are:
- * fname - string - the name of the file to open.
- * fmode - string - the mode, as passed to the fopen routine.
- * fenc - string - the OpenMath encoding type of the file.
- */
- {
- va_list args;
- Lisp_Object lname, lmode, lenc;
- char *fname, *fmode;
- OMencodingType fenc;
- FILE *f;
- OMdev dev;
- int32 len;
- Lisp_Object lispDev;
- CSL_IGNORE(nil);
- /* Unpack the parameters into Lisp_Objects. */
- argcheck(nargs, 3, "om_openFileDev");
- va_start(args, nargs);
- lname = va_arg(args, Lisp_Object);
- lmode = va_arg(args, Lisp_Object);
- lenc = va_arg(args, Lisp_Object);
- va_end(args);
- push3(lname, lmode, lenc);
- /* Convert the parameters into their C equivalents. */
- if (!is_vector(lname) || !(type_of_header(vechdr(lname)) == TYPE_STRING))
- return aerror("om_openFileDev");
- errexitn(3);
- fname = get_string_data(lname, "om_openFileDev", &len);
- errexitn(3);
- fname[len] = '\0';
- if (!is_vector(lmode) || !(type_of_header(vechdr(lmode)) == TYPE_STRING))
- return aerror("om_openFileDev");
- errexitn(3);
- fmode = get_string_data(lmode, "om_openFileDev", &len);
- errexitn(3);
- fmode[len] = '\0';
- if (!is_fixnum(lenc))
- return aerror("om_openFileDev");
- errexitn(3);
- /* This gets OMencodingTypes as an integer then casts it to OMencodingType.
- * That may be a bit dodgy... */
- fenc = om_toEncodingType(lenc);
- pop3(lname, lmode, lenc);
- f = fopen(fname, fmode);
- if (f == NULL)
- return aerror("om_openFileDev: couldn't open named file!");
- /* Create an OpenMath device on the given file. */
- dev = OMmakeDevice(fenc, OMmakeIOFile(f));
- /* Wrap the OpenMath device in a LISP object and return it. */
- lispDev = om_fromDev(dev);
- return onevalue(lispDev);
- }
- Lisp_Object
- om_openStringDev(Lisp_Object nil, Lisp_Object lstr, Lisp_Object lenc)
- /* Creates an OpenMath string device on an existing string. The return value is
- * the LISP object which wraps the created device. The parameters are:
- * lstr - string - The string to create the device on. This must be a C
- string pointer wrapped in a Lisp object.
- * lenc - int - The OpenMath encoding type of the string.
- */
- {
- /* There may be a problem with the OM library directly accessing the string
- * data of a Lisp_Object - see if there is a way around that (if it is a
- * problem).
- */
- char **pstr = NULL;
- OMencodingType enc;
- OMdev dev;
- Lisp_Object ldev;
- CSL_IGNORE(nil);
- push2(lstr, lenc);
- pstr = om_toCString(lstr);
- errexitn(2);
- enc = om_toEncodingType(lenc);
- errexitn(2);
-
- dev = OMmakeDevice(enc, OMmakeIOString(pstr));
- ldev = om_fromDev(dev);
- pop2(lstr, lenc);
- return onevalue(ldev);
- }
- Lisp_Object
- om_closeDev(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- CSL_IGNORE(nil);
- push(ldev);
- dev = om_toDev(ldev);
- errexitn(1);
- OMcloseDevice(dev);
- pop(ldev);
- return lisp_true;
- }
- Lisp_Object
- om_setDevEncoding(Lisp_Object nil, Lisp_Object ldev, Lisp_Object lenc)
- {
- OMdev dev;
- OMencodingType enc;
- CSL_IGNORE(nil);
- push2(ldev, lenc);
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_setDevEncoding: invalid device");
- errexitn(2);
- if (!is_fixnum(lenc))
- return aerror("om_setDevEncoding: invalid encoding");
- errexitn(2);
- /* This gets OMencodingTypes as an integer then casts it to OMencodingType.
- * That may be a bit dodgy... */
- enc = om_toEncodingType(lenc);
- errexitn(2);
- pop2(ldev, lenc);
- OMsetDeviceEncoding(dev, enc);
- return onevalue(om_fromDev(dev));
- }
- /*
- * Exposed OpenMath Connection manipulation functions.
- */
- Lisp_Object
- om_makeConn(Lisp_Object nil, Lisp_Object ltimeout)
- {
- OMconn conn;
- int32 timeout;
- CSL_IGNORE(nil);
- push(ltimeout);
- if (!is_fixnum(ltimeout))
- return aerror("om_makeConn: timeout value must be a fixnum");
- errexitn(1);
- timeout = int_of_fixnum(ltimeout);
- errexitn(1);
- conn = OMmakeConn(timeout);
- pop(ltimeout);
- return onevalue(om_fromConn(conn));
- }
- Lisp_Object
- om_closeConn(Lisp_Object nil, Lisp_Object lconn)
- {
- OMconn conn;
- OMstatus status;
- CSL_IGNORE(nil);
- push(lconn);
- conn = om_toConn(lconn);
- errexitn(1);
- if (!conn)
- return aerror("om_toConn");
- errexitn(1);
- pop(lconn);
- status = OMconnClose(conn);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_getConnInDev(Lisp_Object nil, Lisp_Object lconn)
- {
- OMconn conn;
- OMdev dev;
- CSL_IGNORE(nil);
- push(lconn);
- conn = om_toConn(lconn);
- errexitn(1);
- if (!conn)
- return aerror("om_toConn");
- errexitn(1);
- pop(lconn);
- dev = OMconnIn(conn);
- return onevalue(om_fromDev(dev));
- }
- Lisp_Object
- om_getConnOutDev(Lisp_Object nil, Lisp_Object lconn)
- {
- OMconn conn;
- OMdev dev;
- CSL_IGNORE(nil);
- push(lconn);
- conn = om_toConn(lconn);
- errexitn(1);
- if (!conn)
- return aerror("om_toConn");
- errexitn(1);
- pop(lconn);
- dev = OMconnOut(conn);
- return om_fromDev(dev);
- }
- /*
- * Exposed OpenMath client/server functions.
- */
- Lisp_Object MS_CDECL
- om_connectTCP(Lisp_Object nil, int nargs, ...)
- {
- va_list args;
- Lisp_Object lconn, lhost, lport;
- OMconn conn;
- char *host = NULL;
- int32 hostlen;
- int32 port;
- OMstatus status;
- CSL_IGNORE(nil);
- /* Unpack the parameters into Lisp_Objects. */
- argcheck(nargs, 3, "om_connectTCP");
- va_start(args, nargs);
- lconn = va_arg(args, Lisp_Object);
- lhost = va_arg(args, Lisp_Object);
- lport = va_arg(args, Lisp_Object);
- va_end(args);
- push3(lconn, lhost, lport);
- /* Convert the parameters into their C equivalents. */
- conn = om_toConn(lconn);
- errexitn(3);
- if (!conn)
- return aerror("om_toConn");
- errexitn(3);
-
- if (!stringp(lhost))
- return aerror("om_connectTCP: host name must be a string");
- errexitn(3);
- host = get_string_data(lhost, "om_putString", &hostlen);
- errexitn(3);
- if (host != NULL)
- host[hostlen] = '\0';
- if (!is_fixnum(lport))
- return aerror("om_connectTCP: port number must be a fixnum");
- errexitn(3);
- port = int_of_fixnum(lport);
- errexitn(3);
- pop3(lconn, lhost, lport);
- status = OMconnTCP(conn, host, port);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_bindTCP(Lisp_Object nil, Lisp_Object lconn, Lisp_Object lport)
- {
- OMconn conn;
- int32 port;
- OMstatus status;
- CSL_IGNORE(nil);
- push2(lconn, lport);
- conn = om_toConn(lconn);
- errexitn(2);
- if (!conn)
- return aerror("om_toConn");
- errexitn(2);
- if (!is_fixnum(lport))
- return aerror("om_bindTCP: port number must be a fixnum");
- errexitn(2);
- port = int_of_fixnum(lport);
- errexitn(2);
- pop2(lconn, lport);
- status = OMbindTCP(conn, port);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- /*
- * Exposed OpenMath Device output functions.
- */
- Lisp_Object
- om_putApp(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputApp(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putEndApp(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputEndApp(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putAtp(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputAtp(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putEndAtp(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputEndAtp(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putAttr(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputAttr(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putEndAttr(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputEndAttr(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putBind(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputBind(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putEndBind(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputEndBind(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putBVar(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputBVar(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putEndBVar(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputEndBVar(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putError(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputError(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putEndError(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputEndError(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putObject(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputObject(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putEndObject(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMputEndObject(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putInt(Lisp_Object nil, Lisp_Object ldev, Lisp_Object val)
- /* This routine expects val to be a Lisp integer of some sort.
- * The decision of whether to put it as an int32 or a bigint
- * will be made by this routine.
- */
- {
- OMdev dev;
- OMstatus status;
- int size, sign;
- char *data;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- if (!is_number(val) || is_float(val))
- return aerror("om_putInt");
-
- if (is_fixnum(val)) {
- int32 ival = int_of_fixnum(val);
- status = OMputInt32(dev, ival);
- }
- else {
- data = om_toBigNumStr(val);
- size = strlen(data);
- sign = minusp(val) ? -1 : 1;
- status = OMputBigInt(dev, data, size, sign, OMbigIntBase16);
- free(data);
- }
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putFloat(Lisp_Object nil, Lisp_Object ldev, Lisp_Object val)
- /* This routine expects val to be a real-valued number of some
- * sort (this includes floats, rationals, etc.) and puts it
- * out as an IEEE 64-bit floating point number.
- */
- {
- /* TODO: check this generates correct output for all real numbers. */
- OMdev dev;
- OMstatus status;
- double fval;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- if (!is_number(val))
- return aerror("om_putFloat");
- fval = float_of_number(val);
- /* err_printf("[om-putFloat] fval = %.30lf\n", fval); */
- status = OMputFloat64(dev, &fval);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- Lisp_Object
- om_putByteArray(Lisp_Object nil, Lisp_Object ldev, Lisp_Object val)
- /* This routine expects val to be a Lisp vector of 8-bit values.
- */
- {
- OMdev dev;
- OMstatus status;
- int32 len;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- if (!is_vector(val) || !(type_of_header(vechdr(val)) == TYPE_VEC8))
- return aerror("om_toDev");
-
- /* Get the length of the array. */
- len = length_of_header(val) - 4; /* is this correct??? */
- /* Write out the array data. */
- status = OMputByteArray(dev, ((char *)val - TAG_VECTOR + 4), len);
- if (status != OMsuccess) return om_error(status);
- else return lisp_true;
- }
- Lisp_Object
- om_putVar(Lisp_Object nil, Lisp_Object ldev, Lisp_Object val)
- /* This routine expects val to be a symbol.
- */
- {
- OMdev dev;
- OMstatus status;
- char *name;
- int32 len;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- if (!is_symbol(val))
- return aerror("om_putVar");
-
- /* Do I need to free the memory for name myself? I don't know... */
- name = get_string_data(val, "om_putVar", &len);
- if (name == NULL)
- return om_error(OMinternalError);
- else {
- status = OMputVarN(dev, name, len);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- }
- Lisp_Object
- om_putString(Lisp_Object nil, Lisp_Object ldev, Lisp_Object val)
- /* This routine expects val to be a Lisp string.
- */
- {
- OMdev dev;
- OMstatus status;
- char *name;
- int32 len;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- if (!is_vector(val) || !(type_of_header(vechdr(val)) == TYPE_STRING))
- return aerror("om_putString");
- /* Do I need to free the memory for name myself? I don't know... */
- name = get_string_data(val, "om_putString", &len);
- if (name == NULL)
- return om_error(OMinternalError);
- else {
- status = OMputStringN(dev, name, len);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- }
- Lisp_Object
- om_putSymbol(Lisp_Object nil, Lisp_Object ldev, Lisp_Object val)
- /* This routine expects val to be a cons cell where the first element is the
- * name of the content dictionary and the second (and final) element is the
- * name of the symbol.
- */
- {
- Lisp_Object cdObj, nameObj;
- /* Check that the value passed in is in the correct format. */
- if (!is_cons(val))
- return aerror("om_putSymbol");
- /* Get the cd and name properties (checking that they are set). */
- cdObj = qcar(val);
- if (cdObj == nil)
- return aerror("om_putSymbol: The cd property was not set");
- nameObj = qcar(qcdr(val));
- if (nameObj == nil)
- return aerror("om_putSymbol: The name property was not set");
- /* Invoke the verbose form of the putSymbol routine to output the data. */
- return om_putSymbol2(nil, 3, ldev, cdObj, nameObj);
- }
- Lisp_Object MS_CDECL
- om_putSymbol2(Lisp_Object nil, int nargs, ...)
- /*
- * A different form of putSymbol, where the cd and symbol names are given as strings.
- * The parameters are: (om-putSymbol omdevice "cdname" "symbolname")
- */
- {
- va_list args;
- Lisp_Object ldev;
- Lisp_Object lcd, lname;
- OMdev dev;
- char *cd, *name;
- int32 cdLen, nameLen;
- OMstatus status;
- /* Get the arguments from the arglist. */
- argcheck(nargs, 3, "om_putSymbol2");
- va_start(args, nargs);
- ldev = va_arg(args, Lisp_Object);
- lcd = va_arg(args, Lisp_Object);
- lname = va_arg(args, Lisp_Object);
- va_end(args);
- /* err_printf("[om_putSymbol2] about to convert params to C equivalents...\n"); */
-
- /* Convert the parameters into their C equivalents. */
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- if (!is_vector(lcd) || !(type_of_header(vechdr(lcd)) == TYPE_STRING))
- return aerror("om_putSymbol2");
- cd = get_string_data(lcd, "om_putSymbol2", &cdLen);
- if (cd == NULL) {
- status = OMinternalError;
- return om_error(status);
- }
- /* err_printf("[om_putSymbol2] converted cd name (%s)\n", cd); */
- if (!is_vector(lname) || !(type_of_header(vechdr(lname)) == TYPE_STRING))
- return aerror("om_putSymbol2");
- name = get_string_data(lname, "om_putSymbol2", &nameLen);
- if (name == NULL) {
- status = OMinternalError;
- return om_error(status);
- }
- /* err_printf("[om_putSymbol2] converted symbol name (%s)\n", name); */
- /* Now write out the symbol. */
- status = OMputSymbolN(dev, cd, cdLen, name, nameLen);
- if (status != OMsuccess)
- return om_error(status);
- else
- return lisp_true;
- }
- /*
- * OpenMath input routines.
- */
- Lisp_Object
- om_getApp(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetApp(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMA");
- }
- Lisp_Object
- om_getEndApp(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetEndApp(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMA-END");
- }
- Lisp_Object
- om_getAtp(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetAtp(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMATP");
- }
- Lisp_Object
- om_getEndAtp(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetEndAtp(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMATP-END");
- }
- Lisp_Object
- om_getAttr(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetAttr(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMATTR");
- }
- Lisp_Object
- om_getEndAttr(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetEndAttr(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMATTR-END");
- }
- Lisp_Object
- om_getBind(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
-
- status = OMgetBind(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMBIND");
- }
- Lisp_Object
- om_getEndBind(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetEndBind(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMBIND-END");
- }
- Lisp_Object
- om_getBVar(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetBVar(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMBVAR");
- }
- Lisp_Object
- om_getEndBVar(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetEndBVar(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMBVAR-END");
- }
- Lisp_Object
- om_getError(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetError(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OME");
- }
- Lisp_Object
- om_getEndError(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetEndError(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OME-END");
- }
- Lisp_Object
- om_getObject(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetObject(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMOBJ");
- }
- Lisp_Object
- om_getEndObject(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
-
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetEndObject(dev);
- if (status != OMsuccess)
- return om_error(status);
- else
- return make_undefined_symbol("OMOBJ-END");
- }
- Lisp_Object
- om_getInt(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- OMtokenType ttype;
- Lisp_Object obj;
- dev = om_toDev(ldev);
- if (!dev)
- return aerror("om_toDev");
- status = OMgetType(dev, &ttype);
- if (status == OMsuccess) {
- switch (ttype) {
- case OMtokenInt32:
- {
- int32 val;
- status = OMgetInt32(dev, &val);
- if (status == OMsuccess) {
- /* If none of the top 4 bits are set, we can make this a
- * fixnum */
- /* On second thoughts, the top bit is the sign, and the <<
- * operation is sign preserving (I believe), so we only
- * need to check bits 28-30. */
- if ((val & 0x70000000) == 0)
- obj = fixnum_of_int(val);
- else
- obj = make_one_word_bignum(val);
- }
- break;
- }
- case OMtokenBigInt:
- {
- /* TODO: This is broken. Fix it. */
- char *data;
- int len, sign;
- OMbigIntType fmt;
- status = OMgetBigInt(dev, &data, &len, &sign, &fmt);
- if (status == OMsuccess)
- obj = om_fromBigNumStr(data, len, sign, fmt);
- free(data);
- break;
- }
- default:
- {
- obj = om_error(OMmalformedInput);
- break;
- }
- }
- }
- else obj = om_error(status);
- return onevalue(obj);
- }
- Lisp_Object
- om_getFloat(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- OMtokenType ttype;
- double val;
- dev = om_toDev(ldev);
- if (dev == NULL)
- return aerror("om_toDev");
- status = OMgetType(dev, &ttype);
- if (status == OMsuccess) {
- status = OMgetFloat64(dev, &val);
- if (status == OMsuccess) {
- /* err_printf("[om_getFloat] fval = %.30lf\n", val); */
- return make_boxfloat(val, TYPE_DOUBLE_FLOAT);
- }
- else
- return om_error(status);
- }
- else return om_error(status);
- }
- Lisp_Object
- om_getByteArray(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- int len;
- Lisp_Object obj;
- dev = om_toDev(ldev);
- if (dev == NULL)
- return aerror("om_toDev");
-
- status = OMgetLength(dev, &len);
- if (status != OMsuccess)
- return om_error(status);
- else {
- /* I hope this is right... */
- obj = getvector(TAG_VECTOR, TYPE_VEC8, len + 4);
- status = OMgetByteArrayN(dev, ((char *)obj - TAG_VECTOR + 4), len);
- if (status != OMsuccess)
- return om_error(status);
- else
- return obj;
- }
- }
- Lisp_Object
- om_getVar(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- char *var;
- Lisp_Object obj;
- dev = om_toDev(ldev);
- if (dev == NULL)
- return aerror("om_toDev");
- status = OMgetVar(dev, &var);
- if (status != OMsuccess)
- return om_error(status);
- else {
- obj = make_symbol(var, 2, /* do not convert name to upper case */
- undefined1, undefined2, undefinedn);
- free(var);
- return obj;
- }
- }
- Lisp_Object
- om_getString(Lisp_Object nil, Lisp_Object ldev)
- {
- OMdev dev;
- OMstatus status;
- char *str;
- Lisp_Object obj;
- dev = om_toDev(ldev);
- if (dev == NULL)
- return aerror("om_toDev");
- status = OMgetString(dev, &str);
- if (status != OMsuccess)
- return om_error(status);
- else {
- obj = make_string(str);
- free(str);
- return obj;
- }
- }
- Lisp_Object
- om_getSymbol(Lisp_Object nil, Lisp_Object ldev)
- /* This returns the Lisp symbol OMS, with a cd property and a name property set
- * to appropriate string values.
- */
- {
- OMdev dev;
- OMstatus status;
- char *cd, *name;
- int cdLen, nameLen;
- Lisp_Object cdstr, namestr, obj;
- CSL_IGNORE(nil);
- push(ldev);
- dev = om_toDev(ldev);
- errexitn(1);
- if (dev == NULL)
- return aerror("om_toDev");
- errexitn(1);
- pop(ldev);
- status = OMgetSymbolLength(dev, &cdLen, &nameLen);
- if (status != OMsuccess)
- return om_error(status);
- cd = (char *)malloc(sizeof(char) * (cdLen + 1));
- name = (char *)malloc(sizeof(char) * (nameLen + 1));
- if (cd == NULL || name == NULL) {
- if (cd != NULL) free(cd);
- else if (name != NULL) free(name);
- return om_error(OMinternalError);
- }
- cd[cdLen] = '\0';
- name[nameLen] = '\0';
- status = OMgetSymbolN(dev, cd, cdLen, name, nameLen);
- if (status != OMsuccess)
- obj = om_error(status);
- else {
- cdstr = make_string(cd);
- namestr = make_string(name);
- /* FIXME: is this needed? push2(cdstr, namestr);*/
- obj = cons(cdstr, cons(namestr, C_nil));
- }
- free(cd);
- free(name);
- /*return onevalue(obj);*/
- return obj;
- }
- #define om_errmsg0(msg) \
- err_printf("[om_getType] %s\n", msg)
- #define om_errmsg1(msg,a1) \
- err_printf("[om_getType] %s%s\n", msg,a1)
- #define om_errmsg2(msg,a1,a2) \
- err_printf("[om_getType] %s%s%s\n", msg,a1,a2)
- Lisp_Object
- om_getType(Lisp_Object nil, Lisp_Object ldev)
- {
- static char *typenames[] = {
- "OMtokenApp", "OMtokenEndApp",
- "OMtokenAtp", "OMtokenEndAtp",
- "OMtokenAttr", "OMtokenEndAttr",
- "OMtokenBind", "OMtokenEndBind",
- "OMtokenBVar", "OMtokenEndBVar",
- "OMtokenError", "OMtokenEndError",
- "OMtokenObject", "OMtokenEndObject",
- "OMtokenInt",
- "OMtokenFloat",
- "OMtokenByteArray",
- "OMtokenVar",
- "OMtokenString",
- "OMtokenSymbol"
- };
-
- OMdev dev;
- OMstatus status;
- OMtokenType ttype;
- char *typename;
- Lisp_Object obj;
- dev = om_toDev(ldev);
- if (dev == NULL)
- return aerror("om_toDev");
- status = OMgetType(dev, &ttype);
- if (status != OMsuccess)
- return om_error(status);
- else {
- switch (ttype) {
- case OMtokenApp: typename = typenames[0]; break;
- case OMtokenEndApp: typename = typenames[1]; break;
- case OMtokenAtp: typename = typenames[2]; break;
- case OMtokenEndAtp: typename = typenames[3]; break;
- case OMtokenAttr: typename = typenames[4]; break;
- case OMtokenEndAttr: typename = typenames[5]; break;
- case OMtokenBind: typename = typenames[6]; break;
- case OMtokenEndBind: typename = typenames[7]; break;
- case OMtokenBVar: typename = typenames[8]; break;
- case OMtokenEndBVar: typename = typenames[9]; break;
- case OMtokenError: typename = typenames[10]; break;
- case OMtokenEndError: typename = typenames[11]; break;
- case OMtokenObject: typename = typenames[12]; break;
- case OMtokenEndObject: typename = typenames[13]; break;
- case OMtokenInt32: typename = typenames[14]; break;
- case OMtokenBigInt: typename = typenames[14]; break;
- case OMtokenFloat64: typename = typenames[15]; break;
- case OMtokenByteArray: typename = typenames[16]; break;
- case OMtokenVar: typename = typenames[17]; break;
- case OMtokenString: typename = typenames[18]; break;
- case OMtokenSymbol: typename = typenames[19]; break;
- }
- obj = make_undefined_symbol(typename);
- return obj;
- }
- }
- Lisp_Object
- om_stringToStringPtr(Lisp_Object nil, Lisp_Object lstr)
- {
- return om_cStringFromLispString(lstr);
- }
- Lisp_Object
- om_stringPtrToString(Lisp_Object nil, Lisp_Object lpstr)
- {
- return om_lispStringFromCString(lpstr);
- }
- setup_type const om_setup[] = {
- /* LISP Name */ /* Unary */ /* Binary */ /* Nary */
- {"om-openFileDev", wrong_no_3a, wrong_no_3b, om_openFileDev},
- {"om-openStringDev", too_few_2, om_openStringDev, wrong_no_2},
- {"om-closeDev", om_closeDev, too_many_1, wrong_no_1},
- {"om-setDevEncoding", too_few_2, om_setDevEncoding, wrong_no_2},
- {"om-makeConn", om_makeConn, too_many_1, wrong_no_1},
- {"om-closeConn", om_closeConn, too_many_1, wrong_no_1},
- {"om-getConnInDev", om_getConnInDev, too_many_1, wrong_no_1},
- {"om-getConnOutDev", om_getConnOutDev, too_many_1, wrong_no_1},
- {"om-connectTCP", wrong_no_3a, wrong_no_3b, om_connectTCP},
- {"om-bindTCP", too_few_2, om_bindTCP, wrong_no_2},
- {"om-putApp", om_putApp, too_many_1, wrong_no_1},
- {"om-putEndApp", om_putEndApp, too_many_1, wrong_no_1},
- {"om-putAtp", om_putAtp, too_many_1, wrong_no_1},
- {"om-putEndAtp", om_putEndAtp, too_many_1, wrong_no_1},
- {"om-putAttr", om_putAttr, too_many_1, wrong_no_1},
- {"om-putEndAttr", om_putEndAttr, too_many_1, wrong_no_1},
- {"om-putBind", om_putBind, too_many_1, wrong_no_1},
- {"om-putEndBind", om_putEndBind, too_many_1, wrong_no_1},
- {"om-putBVar", om_putBVar, too_many_1, wrong_no_1},
- {"om-putEndBVar", om_putEndBVar, too_many_1, wrong_no_1},
- {"om-putError", om_putError, too_many_1, wrong_no_1},
- {"om-putEndError", om_putEndError, too_many_1, wrong_no_1},
- {"om-putObject", om_putObject, too_many_1, wrong_no_1},
- {"om-putEndObject", om_putEndObject, too_many_1, wrong_no_1},
- {"om-putInt", too_few_2, om_putInt, wrong_no_2},
- {"om-putFloat", too_few_2, om_putFloat, wrong_no_2},
- {"om-putByteArray", too_few_2, om_putByteArray, wrong_no_2},
- {"om-putVar", too_few_2, om_putVar, wrong_no_2},
- {"om-putString", too_few_2, om_putString, wrong_no_2},
- {"om-putSymbol", too_few_2, om_putSymbol, om_putSymbol2},
- {"om-getApp", om_getApp, too_many_1, wrong_no_1},
- {"om-getEndApp", om_getEndApp, too_many_1, wrong_no_1},
- {"om-getAtp", om_getAtp, too_many_1, wrong_no_1},
- {"om-getEndAtp", om_getEndAtp, too_many_1, wrong_no_1},
- {"om-getAttr", om_getAttr, too_many_1, wrong_no_1},
- {"om-getEndAttr", om_getEndAttr, too_many_1, wrong_no_1},
- {"om-getBind", om_getBind, too_many_1, wrong_no_1},
- {"om-getEndBind", om_getEndBind, too_many_1, wrong_no_1},
- {"om-getBVar", om_getBVar, too_many_1, wrong_no_1},
- {"om-getEndBVar", om_getEndBVar, too_many_1, wrong_no_1},
- {"om-getError", om_getError, too_many_1, wrong_no_1},
- {"om-getendError", om_getEndError, too_many_1, wrong_no_1},
- {"om-getObject", om_getObject, too_many_1, wrong_no_1},
- {"om-getEndObject", om_getEndObject, too_many_1, wrong_no_1},
- {"om-getInt", om_getInt, too_many_1, wrong_no_1},
- {"om-getFloat", om_getFloat, too_many_1, wrong_no_1},
- {"om-getByteArray", om_getByteArray, too_many_1, wrong_no_1},
- {"om-getVar", om_getVar, too_many_1, wrong_no_1},
- {"om-getString", om_getString, too_many_1, wrong_no_1},
- {"om-getSymbol", om_getSymbol, too_many_1, wrong_no_1},
- {"om-getType", om_getType, too_many_1, wrong_no_1},
- {"om-stringToStringPtr", om_stringToStringPtr, too_many_1, wrong_no_1},
- {"om-stringPtrToString", om_stringPtrToString, too_many_1, wrong_no_1},
- {NULL, 0, 0, 0}
- };
- #endif /* OPENMATH */
|