-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmathlink.h
5523 lines (4446 loc) · 223 KB
/
mathlink.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*************************************************************************
Copyright 1986 through 2012 by Wolfram Research Inc.
All rights reserved
*************************************************************************/
#ifndef _MATHLINK_H
#define _MATHLINK_H
#if __BORLANDC__ && ! __BCPLUSPLUS__
#pragma warn -stu
#endif
#ifndef _MLVERS_H
#define _MLVERS_H
#ifndef _MLPLATFM_H
#define _MLPLATFM_H
#if ! WINDOWS_MATHLINK && ! UNIX_MATHLINK
# define UNIX_MATHLINK 1
#endif
#if defined(__GNUC__)
# if defined(__GNUC_PATCHLEVEL__)
# define GCC_MATHLINK_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
# else
# define GCC_MATHLINK_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100)
# endif
#endif
#if WINDOWS_MATHLINK
# if defined(WIN64) || defined(__WIN64__) || defined(_WIN64)
# define WIN64_MATHLINK 1
# if( _M_IX86 || __i386 || __i386__ || i386)
# define I86_WIN32_MATHLINK 1
# endif
# elif defined(WIN32) || defined(__WIN32__) || defined(__NT__) || defined(_WIN32)
# define WIN32_MATHLINK 1
# if( _M_IX86 || __i386 || __i386__ || i386)
# define I86_WIN32_MATHLINK 1
# elif _M_ALPHA || __alpha || __alpha__ || alpha
# define ALPHA_WIN32_MATHLINK 1
# else
# endif
# else
# define WIN16_MATHLINK 1
# endif
#elif UNIX_MATHLINK
# if (__sun || __sun__ || sun) && !defined(SUN_MATHLINK)
# define SUN_MATHLINK 1
# if __sparcv9 || __sparcv9__
# if __SUNPRO_C >= 0x590
# define STUDIO12_U64_SOLARIS_MATHLINK 1
# else
# define U64_SOLARIS_MATHLINK 1
# endif
# elif __SVR4 || __svr4__
# define U32_SOLARIS_MATHLINK 1
# else
# define SUNOS_MATHLINK 1
# endif
# if __sparc || __sparc__ || sparc
# define SPARC_SUN_MATHLINK 1
# elif __i386 || __i386__ || i386
# define I386_SOLARIS_MATHLINK 1
# elif __x86_64 || __x86_64__ || x86_64
# define X86_64_SOLARIS_MATHLINK 1
# else
unknown platform
# endif
# elif (__MACH || __MACH__ || MACH) && !defined(DARWIN_MATHLINK)
# define DARWIN_MATHLINK 1
# if __ppc || __ppc__ || ppc
# define PPC_DARWIN_MATHLINK 1
# elif __ppc64 || __ppc64__ || ppc64
# define PPC64_DARWIN_MATHLINK 1
# elif __i386 || __i386__ || i386
# define X86_DARWIN_MATHLINK 1
# elif __x86_64 || __x86_64__ || x86_64
# define X86_64_DARWIN_MATHLINK 1
# elif __arm__
# define ARM_DARWIN_MATHLINK 1
# else
not yet implemented
# endif
# if __DARWIN_UNIX03
# define DARWIN_MATHLINK_UNIX03 1
# endif /* __DARWIN_UNIX03 */
# elif (__linux || __linux__ || linux) && !defined(LINUX_MATHLINK)
# define LINUX_MATHLINK 1
# if __x86_64 || __x86_64__ || x86_64
# define X86_64_LINUX_MATHLINK 1
# elif __ia64 || __ia64__ || ia64
# define IA64_LINUX_MATHLINK 1
# elif __i386 || __i386__ || i386
# define I86_LINUX_MATHLINK 1
# elif __PPC || __PPC__ || PPC
# define PPC_LINUX_MATHLINK 1
# elif __alpha || __alpha__ || alpha
# define AXP_LINUX_MATHLINK 1
# elif __arm || __arm__ || arm
# define ARM_LINUX_MATHLINK 1
# else
not yet implemented
# endif
# elif (__osf || __osf__ || osf || OSF1) && !defined(DIGITAL_MATHLINK)
# define DIGITAL_MATHLINK 1
# if __alpha || __alpha__ || alpha
# define ALPHA_DIGITAL_MATHLINK 1
# else
unknown platform
# endif
# elif (_AIX || _IBMR2 || __xlC__) && !defined(AIX_MATHLINK)
# define AIX_MATHLINK 1
# if __64BIT__
# define A64_AIX_MATHLINK 1
# endif
# elif (__sgi || __sgi__ || sgi || mips) && !defined(IRIX_MATHLINK)
# define IRIX_MATHLINK 1
# if _MIPS_SZLONG == 32
# define N32_IRIX_MATHLINK 1
# elif _MIPS_SZLONG == 64
# define M64_IRIX_MATHLINK 1
# else
not yet implemented
# endif
# elif (hpux || __hpux) && !defined(HPUX_MATHLINK)
# define HPUX_MATHLINK 1
# if __LP64__
# define LP64_HPUX_MATHLINK 1
# endif
# elif (M_I386 || _SCO_DS || SCO) && !defined(SCO_MATHLINK)
# define SCO_MATHLINK 1
# elif (__NetBSD__) && !defined(NETBSD_MATHLINK)
# define NETBSD_MATHLINK 1
# elif (__FreeBSD__) && !defined(FREEBSD_MATHLINK)
# define FREEBSD_MATHLINK 1
# elif (bsdi || __bsdi__) && !defined(BSDI_MATHLINK)
# define BSDI_MATHLINK 1
# else
# endif
#endif
#ifndef NO_GLOBAL_DATA
# define NO_GLOBAL_DATA 0
#endif
#if WINDOWS_MATHLINK || __i386 || __i386__ || i386 || _M_IX86 || __x86_64 || __x86_64__ || x86_64 || __ia64 || __ia64__ || ia64 || __alpha || __alpha__ || alpha || __arm__
# define LITTLEENDIAN_NUMERIC_TYPES 1
#else
# define BIGENDIAN_NUMERIC_TYPES 1
#endif
#endif /* _MLPLATFM_H */
#ifndef MLVERSION
/* APPIDSERV */
# define MLVERSION 4
#endif
#if !OLD_VERSIONING
/*
* MathLink adopts a simple versioning strategy that can be adapted to many
* compile-time and run-time environments. In particular, it is amenable to
* the various shared library facilities in use. (Although certain of these
* facilities provide more sophisticated mechanisms than are required by the
* following simple strategy.)
*
* MathLink evolves by improving its implementation and by improving its
* interface. The values of MLREVISION or MLINTERFACE defined here are
* incremented whenever an improvement is made and released.
*
* MLREVISION is the current revision number. It is incremented every time
* a change is made to the source and MathLink is rebuilt and distributed
* on any platform. (Bug fixes, optimizations, or other improvements
* transparent to the interface increment only this number.)
*
* MLINTERFACE is a name for a documented interface to MathLink. This
* number is incremented whenever a named constant or function is added,
* removed, or its behavior is changed in a way that could break existing
* correct* client programs. It is expected that the interface to MathLink
* is improved over time so that implemenations of higher numbered
* interfaces are more complete or more convenient to use for writing
* effective client programs. In particular, a specific interface provides
* all the useful functionality of an earlier interface.
*
* *(It is possible that an incorrect MathLink program still works
* because it relies on some undocumented detail of a particular
* revision. It may not always be possible to change the interface
* number when such a detail changes. For example, one program may
* be relying on a bug in MathLink that a great many other programs
* need fixed. In this case, we would likely choose to potentially
* break the incorrect program in order to fix the correct programs
* by incrementing the revision number leaving the interface number
* unchanged. It is possible to bind to a particular revision of a
* MathLink interface if that is important for some programs. One
* could use a statically linked version of the library, make use of
* the search algorithm used by the runtime loader, or dynamically
* load the MathLink library manually.)
*
*
* If a distributed MathLink implmentation were labeled with its revision
* and interface numbers in dotted notation so that, say, ML.1.6 means the
* sixth revision of interface one, then the following may represent the
* distribution history of MathLink.
*
* first distribution
* ML.1.5 (Perhaps earlier revisions were never
* distributed for this platform.)
*
* second distribution
* ML.1.6 (Bug fixes or other improvements were
* made that don't affect the interface.)
*
* third distribution
* ML.2.7 (Perhaps some new functions were added.)
*
* ML.1.7 (And improvements were made that don't
* affect the old interface.)
*
* fourth distribution
* ML.3.8 (Perhaps the return values of an existing
* function changed.)
* ML.2.8 (Revision 8 also adds improvements transparent
* to interface 2.)
* ML.1.7 (Clients of interface 1 see no improvements
* in this eighth revision.)
*
* Note that the distribution history may not be the same on different
* platforms. But revision numbers represent a named body of source code
* across all platforms.
*
* The mechanism for deploying this strategy differs between platforms
* because of differing platform-specific facilities and conventions.
* The interface and revision numbers may form part of the filename of
* the MathLink library, or they may not. This information is always
* available in some conventional form so that it is easy and natural for
* client programs to bind with and use the best available implementation
* of a particular MathLink interface. The details are described in the
* MathLink Developer's Guide for each platform.
*/
#define MLREVISION 24
#define MLMATHVERSION 9.0.0
#define MLCREATIONID 3823834
#define MLAPI1REVISION 1 /* the first revision to support interface 1 */
#define MLAPI2REVISION 6 /* the first revision to support interface 2 */
#define MLAPI3REVISION 16 /* the first revision to support interface 3 */
#define MLAPI4REVISION 19 /* the first revision to support interface 4 */
#ifndef MLINTERFACE
# define MLINTERFACE 3
# define MLAPIREVISION MLAPI3REVISION
/*
* Interface 3 adds the following exported functions:
* MLClearAllSymbolReplacements
* MLClearSymbolReplacement
* MLConvertUCS2String
* MLConvertUCS2StringNL
* MLConvertUTF8String
* MLConvertUTF8StringNL
* MLConvertUTF16String
* MLConvertUTF16StringNL
* MLConvertUTF32String
* MLConvertUTF32StringNL
* MLEnvironmentData
* MLGetDomainNameList
* MLGetInteger16
* MLGetInteger16Array
* MLGetInteger16ArrayData
* MLGetInteger16List
* MLGetInteger32
* MLGetInteger32Array
* MLGetInteger32ArrayData
* MLGetInteger32List
* MLGetInteger64
* MLGetInteger64Array
* MLGetInteger64ArrayData
* MLGetInteger64List
* MLGetLinkedEnvIDString
* MLGetMessageHandler
* MLGetNetworkAddressList
* MLGetReal128
* MLGetReal128Array
* MLGetReal128ArrayData
* MLGetReal128List
* MLGetReal32
* MLGetReal32Array
* MLGetReal32ArrayData
* MLGetReal32List
* MLGetReal64
* MLGetReal64Array
* MLGetReal64ArrayData
* MLGetReal64List
* MLGetUCS2Characters
* MLGetUCS2String
* MLGetUCS2Symbol
* MLGetUTF16Characters
* MLGetUTF16String
* MLGetUTF16Symbol
* MLGetUTF32Characters
* MLGetUTF32String
* MLGetUTF32Symbol
* MLGetUTF8Characters
* MLGetUTF8String
* MLGetUTF8Symbol
* MLGetYieldFunction
* MLLinkName
* MLOldConvertUCS2String
* MLOpenArgcArgv
* MLPutInteger16
* MLPutInteger16Array
* MLPutInteger16ArrayData
* MLPutInteger16List
* MLPutInteger32
* MLPutInteger32Array
* MLPutInteger32ArrayData
* MLPutInteger32List
* MLPutInteger64
* MLPutInteger64Array
* MLPutInteger64ArrayData
* MLPutInteger64List
* MLPutMessageWithArg
* MLPutReal128
* MLPutReal128Array
* MLPutReal128ArrayData
* MLPutReal128List
* MLPutReal32
* MLPutReal32Array
* MLPutReal32ArrayData
* MLPutReal32List
* MLPutReal64
* MLPutReal64Array
* MLPutReal64ArrayData
* MLPutReal64List
* MLPutUCS2Characters
* MLPutUCS2String
* MLPutUCS2Symbol
* MLPutUTF16Characters
* MLPutUTF16String
* MLPutUTF16Symbol
* MLPutUTF32Characters
* MLPutUTF32String
* MLPutUTF32Symbol
* MLPutUTF8Characters
* MLPutUTF8String
* MLPutUTF8Symbol
* MLReadyParallel
* MLReleaseBinaryNumberArray
* MLReleaseByteArray
* MLReleaseByteString
* MLReleaseByteSymbol
* MLReleaseDomainNameList
* MLReleaseInteger16Array
* MLReleaseInteger16List
* MLReleaseInteger32Array
* MLReleaseInteger32List
* MLReleaseInteger64Array
* MLReleaseInteger64List
* MLReleaseNetworkAddressList
* MLReleaseReal128Array
* MLReleaseReal128List
* MLReleaseReal32Array
* MLReleaseReal32List
* MLReleaseReal64Array
* MLReleaseReal64List
* MLReleaseString
* MLReleaseSymbol
* MLReleaseUCS2String
* MLReleaseUCS2Symbol
* MLReleaseUTF16String
* MLReleaseUTF16Symbol
* MLReleaseUTF32String
* MLReleaseUTF32Symbol
* MLReleaseUTF8String
* MLReleaseUTF8Symbol
* MLSetEncodingParameter
* MLSetEnvIDString
* MLSetEnvironmentData
* MLSetSignalHandler
* MLSetSignalHandlerFromFunction
* MLSetSymbolReplacement
* MLTestHead
* MLUnsetSignalHandler
* MLVersionNumbers
*
* Interface 3 removes all the special MathLink types such as kcharp_ct, long_st, etc.
* The API functions now all take standard C data types.
*/
/*
* Interface 2 adds the following exported functions:
* MLGetBinaryNumberArray0
* MLTransfer0
* MLNextCharacter0
* And, for WINDOWS_MATHLINK, some constants in "mlntypes.h"
* were changed in a way that causes MLGetRawType to return
* different values.
*
*/
#else
# if MLINTERFACE == 1
# define MLAPIREVISION MLAPI1REVISION
# elif MLINTERFACE == 2
# define MLAPIREVISION MLAPI2REVISION
# elif MLINTERFACE == 3
# define MLAPIREVISION MLAPI3REVISION
# elif MLINTERFACE == 4
# define MLAPIREVISION MLAPI4REVISION
# else
/*\ syntax\ error\ */\ )
# endif
#endif
/* It may be possible for an implementation of one MathLink interface to
* fully support an earlier interface. MLNewParameters() may succeed when
* passed an interface number less than the value of MLAPIREVISION when the
* library was built. This would happen, if the newer interface is a proper
* superset of the older interface, or if the implementation can adjust its
* behavior at runtime to conform to the older requested interface.
*/
#ifndef MLOLDDEFINITION
# if WINDOWS_MATHLINK
# if MLINTERFACE == 1
# define MLOLDDEFINITION MLAPI1REVISION
# elif MLINTERFACE == 2
# define MLOLDDEFINITION MLAPI2REVISION
# elif MLINTERFACE == 3
# define MLOLDDEFINITION MLAPI2REVISION
# else
/*\ syntax\ error\ */\ )
# endif
# else
# define MLOLDDEFINITION MLAPI1REVISION
# endif
#endif
#else
/*\ syntax\ error\ */\ )
#endif
#endif /* _MLVERS_H */
#ifndef ML_EXTERN_C
#if defined(__cplusplus)
# define ML_C "C"
# define ML_EXTERN_C extern "C" {
# define ML_END_EXTERN_C }
#else
# define ML_C
# define ML_EXTERN_C
# define ML_END_EXTERN_C
#endif
#endif
#if WINDOWS_MATHLINK && (MPREP_REVISION || !defined(APIENTRY) || !defined(FAR))
#if defined(WIN32_LEAN_AND_MEAN) && defined(WIN32_EXTRA_LEAN)
# include <windows.h>
#elif defined( WIN32_LEAN_AND_MEAN)
# define WIN32_EXTRA_LEAN
# include <windows.h>
# undef WIN32_EXTRA_LEAN
#elif defined( WIN32_EXTRA_LEAN)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_LEAN_AND_MEAN
#else
# define WIN32_EXTRA_LEAN
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# undef WIN32_EXTRA_LEAN
# undef WIN32_LEAN_AND_MEAN
#endif
#endif
#ifndef _MLDEVICE_H
#define _MLDEVICE_H
#ifndef P
# ifndef MLPROTOTYPES
# define MLPROTOTYPES 1
# endif
# if MLPROTOTYPES || __STDC__ || defined(__cplusplus) || ! UNIX_MATHLINK
# define P(s) s
# undef MLPROTOTYPES
# define MLPROTOTYPES 1
# else
# define P(s) ()
# undef MLPROTOTYPES
# define MLPROTOTYPES 0
# endif
#endif
#ifndef _MLFAR_H
#define _MLFAR_H
#ifndef FAR
#if WINDOWS_MATHLINK
# ifndef FAR
/*\ syntax\ error\ */\ )
# endif
#else
# define FAR
#endif
#endif
/* //rename this file mlfarhuge.h */
#ifndef MLHUGE
# if WINDOWS_MATHLINK && !(WIN32_MATHLINK || WIN64_MATHLINK)
# define MLHUGE huge
# else
# define MLHUGE
# endif
#endif
#endif /* _MLFAR_H */
#ifndef _MLTYPES_H
#define _MLTYPES_H
#ifndef _MLBASICTYPES_H
#define _MLBASICTYPES_H
#ifndef _MLINT64_H
#define _MLINT64_H
#if WIN64_MATHLINK || X86_64_SOLARIS_MATHLINK || IA64_LINUX_MATHLINK || X86_64_LINUX_MATHLINK || A64_AIX_MATHLINK || M64_IRIX_MATHLINK || LP64_HPUX_MATHLINK || PPC64_DARWIN_MATHLINK || X86_64_DARWIN_MATHLINK || DIGITAL_MATHLINK || U64_SOLARIS_MATHLINK || STUDIO12_U64_SOLARIS_MATHLINK
#define ML64BIT_MATHLINK 1
#endif
#endif /* MLINT64_H */
#define ML_SMALLEST_SIGNED_64BIT -9223372036854775807L - 1
#define ML_LARGEST_SIGNED_64BIT 9223372036854775807L
#define ML_LARGEST_UNSIGNED_64BIT 18446744073709551615UL
#if WIN64_MATHLINK
typedef __int64 mlint64;
typedef unsigned __int64 mluint64;
#elif X86_64_SOLARIS_MATHLINK || IA64_LINUX_MATHLINK || X86_64_LINUX_MATHLINK || A64_AIX_MATHLINK || M64_IRIX_MATHLINK || LP64_HPUX_MATHLINK || PPC64_DARWIN_MATHLINK || X86_64_DARWIN_MATHLINK || DIGITAL_MATHLINK || U64_SOLARIS_MATHLINK || STUDIO12_U64_SOLARIS_MATHLINK
typedef long mlint64;
typedef unsigned long mluint64;
#else /* All other 32 bit platforms */
#ifndef NO_INT64_STRUCT
#define NO_INT64_STRUCT
#if LITTLEENDIAN_NUMERIC_TYPES
typedef struct _wint{
unsigned long low, hi;
} wint64;
#else
typedef struct _wint{
unsigned long hi, low;
} wint64;
#endif /* LITTLEENDIAN_NUMERIC_TYPES */
typedef wint64 mlint64;
typedef wint64 mluint64;
#endif /* NO_INT64_STRUCT */
#endif
#endif /* _MLBASICTYPES_H */
#if WINDOWS_MATHLINK
# ifndef APIENTRY
# define APIENTRY far pascal
# endif
# ifndef CALLBACK
# define CALLBACK APIENTRY
# endif
# if (WIN32_MATHLINK || WIN64_MATHLINK)
/* try this #define MLEXPORT __declspec(dllexport) */
# define MLEXPORT
# else
# define MLEXPORT __export
# endif
# define MLCB APIENTRY MLEXPORT
# define MLAPI APIENTRY
#else
# define MLCB
# define MLAPI
# define MLEXPORT
#endif
#define MLAPI_ MLAPI
#ifndef MLDEFN
# define MLDEFN( rtype, name, params) extern rtype MLAPI MLEXPORT name params
#endif
#ifndef MLDECL
# define MLDECL( rtype, name, params) extern rtype MLAPI name P(params)
#endif
#ifndef ML_DEFN
# define ML_DEFN( rtype, name, params) extern rtype MLAPI_ MLEXPORT name params
#endif
#ifndef ML_DECL
# define ML_DECL( rtype, name, params) extern ML_C rtype MLAPI_ name P(params)
#endif
#ifndef MLCBPROC
# define MLCBPROC( rtype, name, params) typedef rtype (MLCB * name) P(params)
#endif
#ifndef MLCBDECL
# define MLCBDECL( rtype, name, params) extern rtype MLCB name P(params)
#endif
#ifndef MLCBDEFN
# define MLCBDEFN( rtype, name, params) extern rtype MLCB name params
#endif
/* move into mlalert.h */
#ifndef MLDPROC
# define MLDPROC MLCBPROC
#endif
#ifndef MLDDECL
# define MLDDECL MLCBDECL
#endif
#ifndef MLDDEFN
# define MLDDEFN MLCBDEFN
#endif
/* move into ml3state.h or mlstrenv.h */
#ifndef MLTPROC
# define MLTPROC MLCBPROC
#endif
#ifndef MLTDECL
# define MLTDECL MLCBDECL
#endif
#ifndef MLTDEFN
# define MLTDEFN MLCBDEFN
#endif
/* move into mlnumenv.h */
#ifndef MLNPROC
# define MLNPROC MLCBPROC
#endif
#ifndef MLNDECL
# define MLNDECL MLCBDECL
#endif
#ifndef MLNDEFN
# define MLNDEFN MLCBDEFN
#endif
/* move into mlalloc.h */
#ifndef MLAPROC
# define MLAPROC MLCBPROC
#endif
#ifndef MLADECL
# define MLADECL MLCBDECL
#endif
#ifndef MLADEFN
# define MLADEFN MLCBDEFN
#endif
#ifndef MLFPROC
# define MLFPROC MLCBPROC
#endif
#ifndef MLFDECL
# define MLFDECL MLCBDECL
#endif
#ifndef MLFDEFN
# define MLFDEFN MLCBDEFN
#endif
#ifndef MLRAPROC
# define MLRAPROC MLCBPROC
#endif
#ifndef MLRADECL
# define MLRADECL MLCBDECL
#endif
#ifndef MLRADEFN
# define MLRADEFN MLCBDEFN
#endif
/* move into mlstddev.h */
#ifndef MLYPROC
# define MLYPROC MLCBPROC
#endif
#ifndef MLYDECL
# define MLYDECL MLCBDECL
#endif
#ifndef MLYDEFN
# define MLYDEFN MLCBDEFN
#endif
#ifndef MLMPROC
# define MLMPROC MLCBPROC
#endif
#ifndef MLMDECL
# define MLMDECL MLCBDECL
#endif
#ifndef MLMDEFN
# define MLMDEFN MLCBDEFN
#endif
/* move into mlmake.h */
#ifndef MLUPROC
# define MLUPROC MLCBPROC
#endif
#ifndef MLUDECL
# define MLUDECL MLCBDECL
#endif
#ifndef MLUDEFN
# define MLUDEFN MLCBDEFN
#endif
/* move into mlmake.h */
#ifndef MLBPROC
# define MLBPROC MLCBPROC
#endif
#ifndef MLBDECL
# define MLBDECL MLCBDECL
#endif
#ifndef MLBDEFN
# define MLBDEFN MLCBDEFN
#endif
#ifndef MLDMPROC
# define MLDMPROC MLCBPROC
#endif
#ifndef MLDMDECL
# define MLDMDECL MLCBDECL
#endif
#ifndef MLDMDEFN
# define MLDMDEFN MLCBDEFN
#endif
#ifndef __uint_ct__
#define __uint_ct__ unsigned int
#endif
#ifndef __int_ct__
#define __int_ct__ int
#endif
typedef unsigned char uchar_ct;
typedef uchar_ct FAR * ucharp_ct;
typedef ucharp_ct FAR * ucharpp_ct;
typedef ucharpp_ct FAR * ucharppp_ct;
typedef unsigned short ushort_ct;
typedef ushort_ct FAR * ushortp_ct;
typedef ushortp_ct FAR * ushortpp_ct;
typedef ushortpp_ct FAR * ushortppp_ct;
typedef __uint_ct__ uint_ct;
#if MLINTERFACE >= 3
typedef __uint_ct__ FAR * uintp_ct;
typedef uintp_ct FAR * uintpp_ct;
#endif
typedef __int_ct__ int_ct;
typedef void FAR * voidp_ct;
typedef voidp_ct FAR * voidpp_ct;
typedef char FAR * charp_ct;
typedef charp_ct FAR * charpp_ct;
typedef charpp_ct FAR * charppp_ct;
typedef long long_ct;
typedef long_ct FAR * longp_ct;
typedef longp_ct FAR * longpp_ct;
typedef unsigned long ulong_ct;
typedef ulong_ct FAR * ulongp_ct;
#ifndef MLCONST
# if MLPROTOTYPES
# define MLCONST const
# else
# define MLCONST
# endif
#endif
typedef MLCONST unsigned short FAR * kushortp_ct;
typedef MLCONST unsigned short FAR * FAR * kushortpp_ct;
typedef MLCONST unsigned int FAR * kuintp_ct;
typedef MLCONST unsigned int FAR * FAR * kuintpp_ct;
typedef MLCONST unsigned char FAR * kucharp_ct;
typedef MLCONST unsigned char FAR * FAR * kucharpp_ct;
typedef MLCONST char FAR * kcharp_ct;
typedef MLCONST char FAR * FAR * kcharpp_ct;
typedef MLCONST void FAR * kvoidp_ct;
typedef void FAR * MLPointer;
#ifndef __MLENV__
typedef struct ml_environment FAR *MLENV;
typedef MLENV MLEnvironment;
# define __MLENV__
#endif
#ifndef __MLINK__
typedef struct MLink FAR *MLINK;
# define __MLINK__
#endif
#ifndef __MLMARK__
typedef struct MLinkMark FAR *MLMARK;
typedef MLMARK MLINKMark;
# define __MLMARK__
#endif
#ifndef __mlapi_token__
#define __mlapi_token__ int_ct
#endif
typedef __mlapi_token__ mlapi_token;
typedef unsigned long mlapi__token;
typedef mlapi__token FAR * mlapi__tokenp;
#ifndef __mlapi_packet__
#define __mlapi_packet__ int_ct
#endif
typedef __mlapi_packet__ mlapi_packet;
typedef long mlapi_error;
typedef long mlapi__error;
typedef long long_st;
typedef longp_ct longp_st;
typedef longp_st* longpp_st;
typedef long long_et;
#ifndef __mlapi_result__
#define __mlapi_result__ int_ct
#endif
typedef __mlapi_result__ mlapi_result;
#define MLSUCCESS (1) /*bugcheck: this stuff doesnt belong where it can be seen at MLAPI_ layer */
#define MLFAILURE (0)
ML_EXTERN_C
#if WINDOWS_MATHLINK
typedef int (CALLBACK *__MLProcPtr__)();
#else
typedef long (* __MLProcPtr__)(void);
#endif
ML_END_EXTERN_C
#endif /* _MLTYPES_H */
#if WINDOWS_MATHLINK
# ifndef APIENTRY
# define APIENTRY far pascal
# endif
# define MLBN APIENTRY /* bottleneck function: upper layer calls lower layer */
#else
# define MLBN
#endif
#define BN MLBN
/* #include "mlcfm.h" */
ML_EXTERN_C
typedef void FAR * dev_voidp;
typedef dev_voidp dev_type;
typedef dev_type FAR * dev_typep;
typedef long devproc_error;
typedef unsigned long devproc_selector;
#define MLDEV_WRITE_WINDOW 0
#define MLDEV_WRITE 1
#define MLDEV_HAS_DATA 2
#define MLDEV_READ 3
#define MLDEV_READ_COMPLETE 4
#define MLDEV_ACKNOWLEDGE 5
#define T_DEV_WRITE_WINDOW MLDEV_WRITE_WINDOW
#define T_DEV_WRITE MLDEV_WRITE
#define T_DEV_HAS_DATA MLDEV_HAS_DATA
#define T_DEV_READ MLDEV_READ
#define T_DEV_READ_COMPLETE MLDEV_READ_COMPLETE
#ifndef SCATTERED
#define SCATTERED 0
#undef NOT_SCATTERED
#define NOT_SCATTERED 1
#endif
typedef struct read_buf {
unsigned short length;
unsigned char* ptr;
} read_buf;
typedef read_buf FAR * read_bufp;
typedef read_bufp FAR * read_bufpp;
MLDMPROC( devproc_error, MLDeviceProcPtr, ( dev_type dev, devproc_selector selector, dev_voidp p1, dev_voidp p2));
MLDMDECL( devproc_error, MLDeviceMain, ( dev_type dev, devproc_selector selector, dev_voidp p1, dev_voidp p2));
typedef MLDeviceProcPtr MLDeviceUPP;
#define CallMLDeviceProc(userRoutine, thing, selector, p1, p2) (*(userRoutine))((thing), (selector), (dev_voidp)(p1), (dev_voidp)(p2))
#define NewMLDeviceProc(userRoutine) (userRoutine)
typedef MLDeviceUPP dev_main_type;
typedef dev_main_type FAR * dev_main_typep;
ML_END_EXTERN_C
#endif /* _MLDEVICE_H */
#ifndef _MLAPI_H
#define _MLAPI_H
ML_EXTERN_C
#ifndef _MLALLOC_H
#define _MLALLOC_H
/* #include "mlcfm.h" */
#if MLINTERFACE >= 3
#if WIN64_MATHLINK
MLAPROC( void*, MLAllocatorProcPtr, (unsigned __int64));
#else
MLAPROC( void*, MLAllocatorProcPtr, (unsigned long));
#endif
#else