• R/O
  • SSH
  • HTTPS

descartes: Commit


Commit MetaInfo

Revision1636 (tree)
Time2012-11-03 21:23:04
Authorhniwa

Log Message

Processing sharing of sysmodule parameter

Change Summary

Incremental Difference

--- trunk/descartes/sysmodule.c (revision 1635)
+++ trunk/descartes/sysmodule.c (revision 1636)
@@ -7311,46 +7311,25 @@
73117311
73127312 int Seq(Context* cx, Node* goalscar, List* module)
73137313 {
7314- Node* g = goalscar->Cdr()->Val();
7315- int arglen = ListLength(g);
7316-
7317- if (arglen != 3) {
7318- syserr("usage : <seq VAR INIT LAST>\n");
7319- return 0;
7314+ Node* nvar = Nil;
7315+ Node* ninit = Nil;
7316+ Node* nlast = Nil;
7317+ if (!Parm3(cx, goalscar, module, "usage : <seq VAR INIT LAST>\n",
7318+ "seq: failed in the evaluation of the argument. \n",
7319+ nvar, ninit, nlast)) {
7320+ return 0;
73207321 }
73217322
7322- Node* nvar = g->Car()->Val();
7323- int rn;
7324-
7325- if ((rn = FuncArg(cx, nvar, goalscar, module)) <= 0) {
7326- syserr("seq: failed in the evaluation of the argument. \n");
7327- return 0;
7328- }
7329-
73307323 if (nvar->kind() != UNDEF) {
73317324 syserr("usage : <seq VAR INIT LAST>\n");
73327325 return 0;
73337326 }
73347327
7335- g = g->Cdr();
7336- Node* ninit = g->Car()->Val();
7337- if ((rn = FuncArg(cx, ninit, goalscar, module)) <= 0) {
7338- syserr("seq: failed in the evaluation of the argument. \n");
7339- return 0;
7340- }
7341-
73427328 if (ninit->kind() != ATOM) {
73437329 syserr("usage : <seq VAR INIT LAST>\n");
73447330 return 0;
73457331 }
73467332
7347- g = g->Cdr();
7348- Node* nlast = g->Car()->Val();
7349- if ((rn = FuncArg(cx, nlast, goalscar, module)) <= 0) {
7350- syserr("seq: failed in the evaluation of the argument. \n");
7351- return 0;
7352- }
7353-
73547333 if (nlast->kind() != ATOM) {
73557334 syserr("usage : <seq VAR INIT LAST>\n");
73567335 return 0;
@@ -7388,35 +7367,20 @@
73887367
73897368 int Padding(Context* cx, Node* goalscar, List* module)
73907369 {
7391- Node* g = goalscar->Cdr()->Val();
7392- int arglen = ListLength(g);
7393-
7394- if (arglen != 3) {
7395- syserr("usage : <padding VAR NUM ITEM>\n");
7396-
7397- return 0;
7370+ Node* nvar = Nil;
7371+ Node* nnum = Nil;
7372+ Node* nitem = Nil;
7373+ if (!Parm3(cx, goalscar, module, "usage : <padding VAR NUM ITEM>\n",
7374+ "padding: failed in the evaluation of the argument. \n",
7375+ nvar, nnum, nitem)) {
7376+ return 0;
73987377 }
73997378
7400- Node* nvar = g->Car()->Val();
7401- int rn;
7402-
7403- if ((rn = FuncArg(cx, nvar, goalscar, module)) <= 0) {
7404- syserr("padding: failed in the evaluation of the argument. \n");
7405- return 0;
7406- }
7407-
74087379 if (nvar->kind() != UNDEF) {
74097380 syserr("usage : <padding VAR NUM ITEM>\n");
74107381 return 0;
74117382 }
74127383
7413- g = g->Cdr();
7414- Node* nnum = g->Car()->Val();
7415- if ((rn = FuncArg(cx, nnum, goalscar, module)) <= 0) {
7416- syserr("padding: failed in the evaluation of the argument. \n");
7417- return 0;
7418- }
7419-
74207384 if (nnum->kind() != ATOM) {
74217385 syserr("usage : <padding VAR NUM ITEM>\n");
74227386
@@ -7430,13 +7394,6 @@
74307394 return 0;
74317395 }
74327396
7433- g = g->Cdr();
7434- Node* nitem = g->Car()->Val();
7435- if ((rn = FuncArg(cx, nitem, goalscar, module)) <= 0) {
7436- syserr("padding: failed in the evaluation of the argument. \n");
7437- return 0;
7438- }
7439-
74407397 Node* n = Nil;
74417398 long long i;
74427399
@@ -7564,46 +7521,25 @@
75647521
75657522 int DoAppend(Context* cx, Node* goalscar, List* module)
75667523 {
7567- Node* g = goalscar->Cdr()->Val();
7568- int arglen = ListLength(g);
7569-
7570- if (arglen != 3) {
7571- syserr("usage : <append VAR LIST1 LIST2>\n");
7572- return 0;
7524+ Node* nvar = Nil;
7525+ Node* nlist1 = Nil;
7526+ Node* nlist2 = Nil;
7527+ if (!Parm3(cx, goalscar, module, "usage : <append VAR LIST1 LIST2>\n",
7528+ "append: failed in the evaluation of the argument. \n",
7529+ nvar, nlist1, nlist2)) {
7530+ return 0;
75737531 }
75747532
7575- Node* nvar = g->Car()->Val();
7576- int rn;
7577-
7578- if ((rn = FuncArg(cx, nvar, goalscar, module)) <= 0) {
7579- syserr("append: failed in the evaluation of the argument. \n");
7580- return 0;
7581- }
7582-
75837533 if (nvar->kind() != UNDEF) {
75847534 syserr("usage : <append VAR LIST1 LIST2>\n");
75857535 return 0;
75867536 }
75877537
7588- g = g->Cdr();
7589- Node* nlist1 = g->Car()->Val();
7590- if ((rn = FuncArg(cx, nlist1, goalscar, module)) <= 0) {
7591- syserr("append: failed in the evaluation of the argument. \n");
7592- return 0;
7593- }
7594-
75957538 if ((nlist1->kind() != LIST) && (nlist1 != Nil)) {
75967539 syserr("usage : <append VAR LIST1 LIST2>\n");
75977540 return 0;
75987541 }
75997542
7600- g = g->Cdr();
7601- Node* nlist2 = g->Car()->Val();
7602- if ((rn = FuncArg(cx, nlist2, goalscar, module)) <= 0) {
7603- syserr("append: failed in the evaluation of the argument. \n");
7604- return 0;
7605- }
7606-
76077543 if ((nlist2->kind() != LIST) && (nlist2 != Nil)) {
76087544 syserr("usage : <append VAR LIST1 LIST2>\n");
76097545 return 0;
@@ -9246,48 +9182,25 @@
92469182
92479183 int readRecord(Context* cx, Node* goalscar, List* module)
92489184 {
9249- Node* g = goalscar->Cdr()->Val();
9250- int arglen = ListLength(g);
9251-
9252- if (arglen != 3) {
9253- syserr("usage : <readRecord VAR filename NUM_LIST> \n");
9254- return 0;
9185+ Node* nvar = Nil;
9186+ Node* nfilename = Nil;
9187+ Node* nlist = Nil;
9188+ if (!Parm3(cx, goalscar, module, "usage : <readRecord VAR filename NUM_LIST> \n",
9189+ "readRecord: failed in the evaluation of the argument. \n",
9190+ nvar, nfilename, nlist)) {
9191+ return 0;
92559192 }
92569193
9257- Node* nvar = g->Car()->Val();
9258- int rn;
9259-
9260- if ((rn = FuncArg(cx, nvar, goalscar, module)) <= 0) {
9261- syserr("readRecord: failed in the evaluation of the argument. \n");
9262- return 0;
9263- }
9264-
92659194 if (nvar->kind() != UNDEF) {
92669195 syserr("usage : <readRecord VAR filename NUM_LIST> \n");
92679196 return 0;
92689197 }
92699198
9270- g = g->Cdr();
9271- Node* nfilename = g->Car()->Val();
9272-
9273- if ((rn = FuncArg(cx, nfilename, goalscar, module)) <= 0) {
9274- syserr("readRecord: failed in the evaluation of the argument. \n");
9275- return 0;
9276- }
9277-
92789199 if (nfilename->kind() != ATOM) {
92799200 syserr("usage : <readRecord VAR filename NUM_LIST> \n");
92809201 return 0;
92819202 }
92829203
9283- g = g->Cdr();
9284- Node* nlist = g->Car()->Val();
9285-
9286- if ((rn = FuncArg(cx, nlist, goalscar, module)) <= 0) {
9287- syserr("readRecord: failed in the evaluation of the argument. \n");
9288- return 0;
9289- }
9290-
92919204 if (nlist->kind() != LIST) {
92929205 syserr("usage : <readRecord VAR filename NUM_LIST> \n");
92939206 return 0;
@@ -9350,7 +9263,7 @@
93509263 } else {
93519264 int sl = 0;
93529265 for (i = 0; sl < len; i++, sl++) {
9353-printf("sl %d len %d slen %d \n", sl, len, slen);
9266+//printf("sl %d len %d slen %d \n", sl, len, slen);
93549267 if (sl >= slen) {
93559268 fputc(' ', fd);
93569269 continue;
@@ -9405,46 +9318,25 @@
94059318
94069319 int writeRecord(Context* cx, Node* goalscar, List* module)
94079320 {
9408- int len = ListLength(goalscar->Cdr());
9409- if (len != 3) {
9410- syserr("usage: ::sys <writeRecord FILENAME DATA_LIST NUM_LIST>\n");
9411- return 0;
9321+ Node* nfname = Nil;
9322+ Node* ndatalist = Nil;
9323+ Node* nnumlist = Nil;
9324+ if (!Parm3(cx, goalscar, module, "usage: <writeRecord FILENAME DATA_LIST NUM_LIST>\n",
9325+ "writeRecord: failed in the evaluation of the argument. \n",
9326+ nfname, ndatalist, nnumlist)) {
9327+ return 0;
94129328 }
94139329
9414- Node* g = goalscar->Cdr()->Val();
9415-
9416- int rn;
9417-
9418- Node* nfname = g->Car()->Val();
9419- if ((rn = FuncArg(cx, nfname, goalscar, module)) <= 0) {
9420- syserr("writeRecord: failed in the evaluation of the argument. \n");
9421- return 0;
9422- }
9423-
94249330 if (nfname->kind() != ATOM) {
94259331 syserr("usage: ::sys <writeRecord FILENAME DATA_LIST NUM_LIST>\n");
94269332 return 0;
94279333 }
94289334
9429- g = g->Cdr();
9430- Node* ndatalist = g->Car()->Val();
9431- if ((rn = FuncArg(cx, ndatalist, goalscar, module)) <= 0) {
9432- syserr("writeRecord: failed in the evaluation of the argument. \n");
9433- return 0;
9434- }
9435-
94369335 if (ndatalist->kind() != LIST) {
94379336 syserr("usage: ::sys <writeRecord FILENAME DATA_LIST NUM_LIST>\n");
94389337 return 0;
94399338 }
94409339
9441- g = g->Cdr();
9442- Node* nnumlist = g->Car()->Val();
9443- if ((rn = FuncArg(cx, nnumlist, goalscar, module)) <= 0) {
9444- syserr("writeRecord: failed in the evaluation of the argument. \n");
9445- return 0;
9446- }
9447-
94489340 if (nnumlist->kind() != LIST) {
94499341 syserr("usage: ::sys <writeRecord FILENAME DATA_LIST NUM_LIST>\n");
94509342 return 0;
Show on old repository browser