Processing sharing of sysmodule parameter
@@ -7311,46 +7311,25 @@ | ||
7311 | 7311 | |
7312 | 7312 | int Seq(Context* cx, Node* goalscar, List* module) |
7313 | 7313 | { |
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; | |
7320 | 7321 | } |
7321 | 7322 | |
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 | - | |
7330 | 7323 | if (nvar->kind() != UNDEF) { |
7331 | 7324 | syserr("usage : <seq VAR INIT LAST>\n"); |
7332 | 7325 | return 0; |
7333 | 7326 | } |
7334 | 7327 | |
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 | - | |
7342 | 7328 | if (ninit->kind() != ATOM) { |
7343 | 7329 | syserr("usage : <seq VAR INIT LAST>\n"); |
7344 | 7330 | return 0; |
7345 | 7331 | } |
7346 | 7332 | |
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 | - | |
7354 | 7333 | if (nlast->kind() != ATOM) { |
7355 | 7334 | syserr("usage : <seq VAR INIT LAST>\n"); |
7356 | 7335 | return 0; |
@@ -7388,35 +7367,20 @@ | ||
7388 | 7367 | |
7389 | 7368 | int Padding(Context* cx, Node* goalscar, List* module) |
7390 | 7369 | { |
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; | |
7398 | 7377 | } |
7399 | 7378 | |
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 | - | |
7408 | 7379 | if (nvar->kind() != UNDEF) { |
7409 | 7380 | syserr("usage : <padding VAR NUM ITEM>\n"); |
7410 | 7381 | return 0; |
7411 | 7382 | } |
7412 | 7383 | |
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 | - | |
7420 | 7384 | if (nnum->kind() != ATOM) { |
7421 | 7385 | syserr("usage : <padding VAR NUM ITEM>\n"); |
7422 | 7386 |
@@ -7430,13 +7394,6 @@ | ||
7430 | 7394 | return 0; |
7431 | 7395 | } |
7432 | 7396 | |
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 | - | |
7440 | 7397 | Node* n = Nil; |
7441 | 7398 | long long i; |
7442 | 7399 |
@@ -7564,46 +7521,25 @@ | ||
7564 | 7521 | |
7565 | 7522 | int DoAppend(Context* cx, Node* goalscar, List* module) |
7566 | 7523 | { |
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; | |
7573 | 7531 | } |
7574 | 7532 | |
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 | - | |
7583 | 7533 | if (nvar->kind() != UNDEF) { |
7584 | 7534 | syserr("usage : <append VAR LIST1 LIST2>\n"); |
7585 | 7535 | return 0; |
7586 | 7536 | } |
7587 | 7537 | |
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 | - | |
7595 | 7538 | if ((nlist1->kind() != LIST) && (nlist1 != Nil)) { |
7596 | 7539 | syserr("usage : <append VAR LIST1 LIST2>\n"); |
7597 | 7540 | return 0; |
7598 | 7541 | } |
7599 | 7542 | |
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 | - | |
7607 | 7543 | if ((nlist2->kind() != LIST) && (nlist2 != Nil)) { |
7608 | 7544 | syserr("usage : <append VAR LIST1 LIST2>\n"); |
7609 | 7545 | return 0; |
@@ -9246,48 +9182,25 @@ | ||
9246 | 9182 | |
9247 | 9183 | int readRecord(Context* cx, Node* goalscar, List* module) |
9248 | 9184 | { |
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; | |
9255 | 9192 | } |
9256 | 9193 | |
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 | - | |
9265 | 9194 | if (nvar->kind() != UNDEF) { |
9266 | 9195 | syserr("usage : <readRecord VAR filename NUM_LIST> \n"); |
9267 | 9196 | return 0; |
9268 | 9197 | } |
9269 | 9198 | |
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 | - | |
9278 | 9199 | if (nfilename->kind() != ATOM) { |
9279 | 9200 | syserr("usage : <readRecord VAR filename NUM_LIST> \n"); |
9280 | 9201 | return 0; |
9281 | 9202 | } |
9282 | 9203 | |
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 | - | |
9291 | 9204 | if (nlist->kind() != LIST) { |
9292 | 9205 | syserr("usage : <readRecord VAR filename NUM_LIST> \n"); |
9293 | 9206 | return 0; |
@@ -9350,7 +9263,7 @@ | ||
9350 | 9263 | } else { |
9351 | 9264 | int sl = 0; |
9352 | 9265 | 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); | |
9354 | 9267 | if (sl >= slen) { |
9355 | 9268 | fputc(' ', fd); |
9356 | 9269 | continue; |
@@ -9405,46 +9318,25 @@ | ||
9405 | 9318 | |
9406 | 9319 | int writeRecord(Context* cx, Node* goalscar, List* module) |
9407 | 9320 | { |
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; | |
9412 | 9328 | } |
9413 | 9329 | |
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 | - | |
9424 | 9330 | if (nfname->kind() != ATOM) { |
9425 | 9331 | syserr("usage: ::sys <writeRecord FILENAME DATA_LIST NUM_LIST>\n"); |
9426 | 9332 | return 0; |
9427 | 9333 | } |
9428 | 9334 | |
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 | - | |
9436 | 9335 | if (ndatalist->kind() != LIST) { |
9437 | 9336 | syserr("usage: ::sys <writeRecord FILENAME DATA_LIST NUM_LIST>\n"); |
9438 | 9337 | return 0; |
9439 | 9338 | } |
9440 | 9339 | |
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 | - | |
9448 | 9340 | if (nnumlist->kind() != LIST) { |
9449 | 9341 | syserr("usage: ::sys <writeRecord FILENAME DATA_LIST NUM_LIST>\n"); |
9450 | 9342 | return 0; |