version 1.12, 2003/01/15 05:08:10 |
version 1.14, 2003/01/17 11:31:10 |
|
|
/* -*- mode: C -*- */ |
/* -*- mode: C -*- */ |
/* $OpenXM: OpenXM/src/ox_math/mlo.c,v 1.11 2003/01/13 12:04:53 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_math/mlo.c,v 1.13 2003/01/15 10:46:09 ohara Exp $ */ |
|
|
/* |
/* |
Copyright (C) Katsuyoshi OHARA, 2000. |
Copyright (C) Katsuyoshi OHARA, 2000. |
Line 33 static mlo *ml_return0(); |
|
Line 33 static mlo *ml_return0(); |
|
/* #define STATE_NONE */ |
/* #define STATE_NONE */ |
#define STATE_INTERRUPTED 1 |
#define STATE_INTERRUPTED 1 |
#define STATE_ABORTED 2 |
#define STATE_ABORTED 2 |
#define STATE_RESERVE_INTERRUTION 4 |
#define STATE_RESERVE_INTERRUPTION 4 |
#define STATE_RESERVE_ABORTION 8 |
#define STATE_RESERVE_ABORTION 8 |
#define STATE_IDLE 16 |
#define STATE_IDLE 16 |
|
|
Line 41 static unsigned state = 0; |
|
Line 41 static unsigned state = 0; |
|
|
|
static int ml_current_packet = -1; |
static int ml_current_packet = -1; |
|
|
|
static double mathkernel_version; |
|
|
/* If this flag sets then we identify MLTKSYM to CMO_INDETERMINATE. */ |
/* If this flag sets then we identify MLTKSYM to CMO_INDETERMINATE. */ |
int flag_mlo_symbol = FLAG_MLTKSYM_IS_INDETERMINATE; |
int flag_mlo_symbol = FLAG_MLTKSYM_IS_INDETERMINATE; |
|
|
Line 51 mlo *receive_mlo_real() |
|
Line 53 mlo *receive_mlo_real() |
|
{ |
{ |
char *s; |
char *s; |
cmo *ob; |
cmo *ob; |
|
|
|
#if 1 |
|
double d; |
|
MLGetReal(stdlink, &d); |
|
ox_printf("MLTKREAL(%lf)", d); |
|
ob = new_cmo_double(d); |
|
#else |
/* Yet we have no implementation of CMO_DOUBLE... */ |
/* Yet we have no implementation of CMO_DOUBLE... */ |
MLGetString(stdlink, &s); |
MLGetString(stdlink, &s); |
ox_printf("MLTKREAL(%s)", s); |
ox_printf("MLTKREAL(%s)", s); |
ob = (cmo *)new_cmo_string(s); |
ob = (cmo *)new_cmo_string(s); |
MLDisownString(stdlink, s); |
MLDisownString(stdlink, s); |
|
#endif |
return ob; |
return ob; |
} |
} |
|
|
|
|
ox_printf("Mathematica Kernel not found.\n"); |
ox_printf("Mathematica Kernel not found.\n"); |
exit(1); |
exit(1); |
} |
} |
|
/* set the version of Mathematica kernel. */ |
|
ml_evaluateStringByLocalParser("$VersionNumber"); |
|
mathkernel_version = ((cmo_double *)ml_return())->d; |
|
ox_printf("Kernel Version = %lf\n", mathkernel_version); |
return 0; |
return 0; |
} |
} |
|
|
|
|
{ |
{ |
while(!MLReady(stdlink)) { |
while(!MLReady(stdlink)) { |
#if 0 |
#if 0 |
if (state == STATE_RESERVE_INTERRUTION) { |
if (state == STATE_RESERVE_INTERRUPTION) { |
ml_interrupt(); |
ml_interrupt(); |
}else if (state == STATE_RESERVE_ABORTION) { |
}else if (state == STATE_RESERVE_ABORTION) { |
ml_abort(); |
ml_abort(); |