「Sds link」の版間の差分
編集の要約なし |
編集の要約なし |
||
16行目: | 16行目: | ||
; サンプル | ; サンプル | ||
<pre class="brush: cpp;"> | <pre class="brush: cpp;"> | ||
/* Prototype for an sds application */ | |||
#include <stdio.h> | |||
#include "sdslib.h" | |||
/* MAIN -- the main routine */ | |||
void | |||
main(argc, argv) | |||
int argc; | |||
char *argv[]; | |||
{ | |||
int stat; | |||
short scode = RSRSLT; /* Default result code */ | |||
sds_init(argc, argv); /* Initialize the interface */ | |||
for ( ;; ) { /* Infinite loop */ | |||
if ((stat = sds_link(scode)) < 0) { | |||
printf("TEMPLATE: bad status from sds_link() = %d\n", stat); | |||
/* Can't use sds_printf() to display this message, because the link failed */ | |||
fflush(stdout); | |||
exit(1); /* exit() only req'd for abnormal termination */ | |||
} | |||
scode = RSRSLT; /* Default return value */ | |||
/* The cases in this switch check for AutoLISP request codes */ | |||
switch (stat) { | |||
case RQXLOAD: | |||
scode = loadfuncs() == GOOD ? RSRSLT : | |||
RSERR; | |||
break; | |||
case RQSUBR: /* Usually implemented to call an external function */ | |||
break; | |||
case RQXUNLD: /* Usually implemented just to return RSRSLT, */ | |||
case RQSAVE: /* not often needed */ | |||
case RQEND: | |||
case RQQUIT: | |||
default: /* Return RSRSLT */ | |||
break; | |||
} | |||
} | |||
} | |||
/* LOADFUNCS -- Define external functions by calling sds_defun */ | |||
static int loadfuncs() | |||
{ | |||
return GOOD; | |||
} | |||
</pre> | </pre> | ||
2010年10月19日 (火) 15:04時点における最新版
- 構文
- int sds_link (int lispmsg);
- 機能
- LISPにSDSアプリケーションの準備ができているか知らせる。
- エラーがあった場合、コマンドラインに "Error: SDS error in evaluation" を表示する。
- 引数
-
- lispmsg : LISPへのメッセージ。
- 戻り値
- 準備ができていれば RSRSLT、そうでなければ RSERR
- サンプル
/* Prototype for an sds application */ #include <stdio.h> #include "sdslib.h" /* MAIN -- the main routine */ void main(argc, argv) int argc; char *argv[]; { int stat; short scode = RSRSLT; /* Default result code */ sds_init(argc, argv); /* Initialize the interface */ for ( ;; ) { /* Infinite loop */ if ((stat = sds_link(scode)) < 0) { printf("TEMPLATE: bad status from sds_link() = %d\n", stat); /* Can't use sds_printf() to display this message, because the link failed */ fflush(stdout); exit(1); /* exit() only req'd for abnormal termination */ } scode = RSRSLT; /* Default return value */ /* The cases in this switch check for AutoLISP request codes */ switch (stat) { case RQXLOAD: scode = loadfuncs() == GOOD ? RSRSLT : RSERR; break; case RQSUBR: /* Usually implemented to call an external function */ break; case RQXUNLD: /* Usually implemented just to return RSRSLT, */ case RQSAVE: /* not often needed */ case RQEND: case RQQUIT: default: /* Return RSRSLT */ break; } } } /* LOADFUNCS -- Define external functions by calling sds_defun */ static int loadfuncs() { return GOOD; }