version 1.4, 2013/02/20 05:20:49 |
version 1.6, 2013/02/21 07:30:56 |
|
|
/* |
/* |
$OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.3 2013/02/20 01:06:38 takayama Exp $ |
$OpenXM: OpenXM/src/hgm/mh/src/wmain.c,v 1.5 2013/02/20 05:56:16 takayama Exp $ |
License: LGPL |
License: LGPL |
*/ |
*/ |
#include <stdio.h> |
#include <stdio.h> |
Line 38 static int setParamTest(void); |
|
Line 38 static int setParamTest(void); |
|
static int setParamDefault(void); |
static int setParamDefault(void); |
static int setParam(char *fname); |
static int setParam(char *fname); |
static int showParam(void); |
static int showParam(void); |
|
static int next(struct SFILE *fp,char *s, char *msg); |
|
|
/* #define DEBUG */ |
/* #define DEBUG */ |
#ifdef DEBUG |
#ifdef DEBUG |
Line 55 void mh_freeWorkArea(void) { |
|
Line 56 void mh_freeWorkArea(void) { |
|
mh_rf(0.0, NULL, 0, NULL, 0); |
mh_rf(0.0, NULL, 0, NULL, 0); |
MH_deallocate=0; /* switch to the normal mode. */ |
MH_deallocate=0; /* switch to the normal mode. */ |
} |
} |
void *mh_malloc(int s) { |
|
void *p; |
|
p = (void*)malloc(s); |
|
if (p == NULL) { |
|
fprintf(stderr,"No memory.\n"); mh_exit(-1); |
|
} |
|
return(p); |
|
} |
|
mh_free(void *p) { |
|
free(p); |
|
return(0); |
|
} |
|
static mypower(int x,int n) { |
static mypower(int x,int n) { |
int a,i; |
int a,i; |
a = 1; |
a = 1; |
Line 75 static mypower(int x,int n) { |
|
Line 64 static mypower(int x,int n) { |
|
} |
} |
#ifdef STANDALONE |
#ifdef STANDALONE |
main(int argc,char *argv[]) { |
main(int argc,char *argv[]) { |
|
mh_exit(MH_RESET_EXIT); /* standalone mode */ |
/* mh_main(argc,argv); |
/* mh_main(argc,argv); |
mh_freeWorkArea(); */ |
mh_freeWorkArea(); */ |
mh_main(argc,argv); |
mh_main(argc,argv); |
Line 212 static setParamDefault() { |
|
Line 202 static setParamDefault() { |
|
Xng = 10.0; |
Xng = 10.0; |
} |
} |
|
|
next(struct SFILE *sfp,char *s,char *msg) { |
static next(struct SFILE *sfp,char *s,char *msg) { |
s[0] = '%'; |
s[0] = '%'; |
while (s[0] == '%') { |
while (s[0] == '%') { |
if (!mh_fgets(s,SMAX,sfp)) { |
if (!mh_fgets(s,SMAX,sfp)) { |
|
|
printf("%%Xng=\n%lf\n",Xng); |
printf("%%Xng=\n%lf\n",Xng); |
} |
} |
|
|
mh_exit(int n) { |
|
#ifdef STANDALONE |
|
exit(n); |
|
#else |
|
/* todo, use setjmp, longjmp */ |
|
fprintf(stderr,"Fatal error mh_exit(%d) in mh-w-n.\n",n); |
|
#endif |
|
} |
|