comparison src/mule-ccl.c @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 538048ae2ab8
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
163 int 163 int
164 ccl_driver (struct ccl_program *ccl, CONST unsigned char *src, 164 ccl_driver (struct ccl_program *ccl, CONST unsigned char *src,
165 unsigned_char_dynarr *dst, int n, int end_flag) 165 unsigned_char_dynarr *dst, int n, int end_flag)
166 { 166 {
167 int code, op, rrr, cc, i, j; 167 int code, op, rrr, cc, i, j;
168 CONST unsigned char *s, *s_end; 168 CONST unsigned char *s = NULL, *s_end = NULL;
169 int ic = ccl->ic; 169 int ic = ccl->ic;
170 int *reg = ccl->reg; 170 int *reg = ccl->reg;
171 Lisp_Object *prog = ccl->prog; 171 Lisp_Object *prog = ccl->prog;
172 172
173 if (!ic) 173 if (!ic)
430 int numregs, int initial_ic) 430 int numregs, int initial_ic)
431 { 431 {
432 int i; 432 int i;
433 433
434 ccl->saved_vector = val; 434 ccl->saved_vector = val;
435 ccl->prog = XVECTOR (val)->contents; 435 ccl->prog = XVECTOR_DATA (val);
436 ccl->size = XVECTOR (val)->size; 436 ccl->size = XVECTOR_LENGTH (val);
437 if (initial_ic == 0) 437 if (initial_ic == 0)
438 ccl->ic = CCL_HEADER_MAIN; 438 ccl->ic = CCL_HEADER_MAIN;
439 else 439 else
440 ccl->ic = initial_ic; 440 ccl->ic = initial_ic;
441 for (i = 0; i < numregs; i++) 441 for (i = 0; i < numregs; i++)
458 int ic; 458 int ic;
459 459
460 CHECK_VECTOR (prog); 460 CHECK_VECTOR (prog);
461 CHECK_VECTOR (status); 461 CHECK_VECTOR (status);
462 462
463 if (vector_length (XVECTOR (status)) != 9) 463 if (XVECTOR_LENGTH (status) != 9)
464 signal_simple_error ("Must specify values for the eight registers and IC", 464 signal_simple_error ("Must specify values for the eight registers and IC",
465 status); 465 status);
466 for (i = 0; i < 8; i++) 466 for (i = 0; i < 8; i++)
467 { 467 {
468 Lisp_Object regval = XVECTOR (status)->contents[i]; 468 Lisp_Object regval = XVECTOR_DATA (status)[i];
469 if (NILP (regval)) 469 if (NILP (regval))
470 intregs[i] = 0; 470 intregs[i] = 0;
471 else 471 else
472 { 472 {
473 CHECK_INT (regval); 473 CHECK_INT (regval);
474 intregs[i] = XINT (regval); 474 intregs[i] = XINT (regval);
475 } 475 }
476 } 476 }
477 477
478 { 478 {
479 Lisp_Object lic = XVECTOR (status)->contents[8]; 479 Lisp_Object lic = XVECTOR_DATA (status)[8];
480 if (NILP (lic)) 480 if (NILP (lic))
481 ic = 0; 481 ic = 0;
482 else 482 else
483 { 483 {
484 CHECK_NATNUM (lic); 484 CHECK_NATNUM (lic);
494 struct ccl_program *ccl) 494 struct ccl_program *ccl)
495 { 495 {
496 int i; 496 int i;
497 497
498 for (i = 0; i < 8; i++) 498 for (i = 0; i < 8; i++)
499 XVECTOR (status)->contents[i] = make_int (ccl->reg[i]); 499 XVECTOR_DATA (status)[i] = make_int (ccl->reg[i]);
500 XVECTOR (status)->contents[8] = make_int (ccl->ic); 500 XVECTOR_DATA (status)[8] = make_int (ccl->ic);
501 } 501 }
502 502
503 503
504 DEFUN ("execute-ccl-program", Fexecute_ccl_program, 2, 2, 0, /* 504 DEFUN ("execute-ccl-program", Fexecute_ccl_program, 2, 2, 0, /*
505 Execute CCL-PROGRAM with registers initialized by STATUS. 505 Execute CCL-PROGRAM with registers initialized by STATUS.
506 CCL-PROGRAM is a vector of compiled CCL code created by `ccl-compile'. 506 CCL-PROGRAM is a vector of compiled CCL code created by `ccl-compile'.
507 STATUS must be a vector of nine values, specifying the initial value 507 STATUS must be a vector of nine values, specifying the initial value
612 { 612 {
613 fprintf (stderr, "%s: Can't read file %s", argv[0], argv[1]); 613 fprintf (stderr, "%s: Can't read file %s", argv[0], argv[1]);
614 exit (1); 614 exit (1);
615 } 615 }
616 616
617 XVECTOR (ccl_prog)->size = 0; 617 XVECTOR_LENGTH (ccl_prog) = 0;
618 while (fscanf (progf, "%x", &i) == 1) 618 while (fscanf (progf, "%x", &i) == 1)
619 XVECTOR (ccl_prog)->contents[XVECTOR (ccl_prog)->size++] = make_int (i); 619 XVECTOR_DATA (ccl_prog)[XVECTOR_LENGTH (ccl_prog)++] = make_int (i);
620 set_ccl_program (&ccl, ccl_prog, 0, 0, 0); 620 set_ccl_program (&ccl, ccl_prog, 0, 0, 0);
621 621
622 outbuf = Dynarr_new (unsigned char); 622 outbuf = Dynarr_new (unsigned char);
623 623
624 while ((i = fread (inbuf, 1, INBUF_SIZE, stdin)) == INBUF_SIZE) 624 while ((i = fread (inbuf, 1, INBUF_SIZE, stdin)) == INBUF_SIZE)