Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| ecce.c [2023/06/23 15:38] – peron | ecce.c [2026/04/21 16:06] (actual) – editor externo 127.0.0.1 | ||
|---|---|---|---|
| Línea 1: | Línea 1: | ||
| - | + | <file c ecce.c> | |
| - | + | ||
| - | <code c> | + | |
| - | /* This file is http:// | + | |
| - | It is written in reasonably portable C and should | + | |
| - | be easy to compile with any C compiler, eg on Linux: | + | |
| - | cc -o ecce -DWANT_UTF8 | + | |
| - | + | ||
| - | You may need to do: export LC_ALL=en_US.UTF-8 | + | |
| - | + | ||
| - | | + | |
| - | a couple of places where linux filenames are used - | + | |
| - | you may need to make some small changes if compiling | + | |
| - | for Windows or other non-unix systems. | + | |
| - | in the source below. | + | |
| - | to gtoal@gtoal.com please. | + | |
| - | even a linux system is single-user. | + | |
| - | | + | |
| - | | + | |
| - | bad actors. | + | |
| - | + | ||
| - | | + | |
| - | of ecce in Emacs, by making a version of the " | + | |
| - | | + | |
| - | to pass the ecce command as a parameter while avoiding | + | |
| - | | + | |
| - | + | ||
| - | + | ||
| - | *SYS* | + | |
| - | Add this to your ~/.emacs file (or some equivalent for Windows): | + | |
| - | + | ||
| - | ;; hex encoding needed below. Came from https:// | + | |
| - | (eval-when-compile | + | |
| - | (defmacro num-to-hex-char (num) | + | |
| - | `(aref " | + | |
| - | ) | + | |
| - | + | ||
| - | (defun encode-hex-string (string) | + | |
| - | " | + | |
| - | (let* ((len (length string)) | + | |
| - | (dst (make-string (* len 2) 0)) | + | |
| - | (idx 0)(pos 0)) | + | |
| - | (while (< pos len) | + | |
| - | (aset dst idx (num-to-hex-char (/ (aref string pos) 16))) | + | |
| - | (setq idx (1+ idx)) | + | |
| - | (aset dst idx (num-to-hex-char (% (aref string pos) 16))) | + | |
| - | (setq idx (1+ idx) pos (1+ pos))) | + | |
| - | dst)) | + | |
| - | + | ||
| - | ;; Embedded ECCE support | + | |
| - | + | ||
| - | (defun e (ecce_command) | + | |
| - | (interactive "sEcce> ") | + | |
| - | (let (oldpoint (point)) | + | |
| - | (setq oldpoint (point)) | + | |
| - | (call-process-region (point-min) (point-max) | + | |
| - | "/ | + | |
| - | t t nil | + | |
| - | " | + | |
| - | | + | |
| - | | + | |
| - | (format " | + | |
| - | ) | + | |
| - | ) " 2> ~/ | + | |
| - | ) | + | |
| - | (goto-char (point-min)) | + | |
| - | (search-forward (format " | + | |
| - | (replace-match "" | + | |
| - | ) | + | |
| - | ) | + | |
| - | + | ||
| - | (global-set-key " | + | |
| - | + | ||
| - | */ | + | |
| - | + | ||
| #define VERSION " | #define VERSION " | ||
| | | ||
| #define DATE " | #define DATE " | ||
| - | + | ||
| #include < | #include < | ||
| #include < | #include < | ||
| Línea 84: | Línea 10: | ||
| #include < | #include < | ||
| #include < | #include < | ||
| - | + | ||
| #ifdef WANT_UTF8 | #ifdef WANT_UTF8 | ||
| /* EXPERIMENTAL SUPPORT FOR UTF-8 - been tested for a few years now, seems robust enough to make default. */ | /* EXPERIMENTAL SUPPORT FOR UTF-8 - been tested for a few years now, seems robust enough to make default. */ | ||
| #include < | #include < | ||
| #include < | #include < | ||
| - | + | ||
| typedef wint_t ecce_int; | typedef wint_t ecce_int; | ||
| typedef wchar_t ecce_char; | typedef wchar_t ecce_char; | ||
| Línea 105: | Línea 31: | ||
| /* */ | /* */ | ||
| /* */ | /* */ | ||
| - | /* | + | /* |
| - | /* retired. | + | /* retirado. |
| - | /* Toal, of the Edinburgh Computer History | + | /* Toal, del Proyecto de Historia del Cómputo |
| - | /* Project. | + | /* de Edimburgo. */ |
| /* */ | /* */ | ||
| - | /* This source is released into the public domain | + | /* Este código fuente fue lanzado al dominio |
| - | /* by the author, without restriction. | + | /* público por su autor, sin restricciones |
| /* */ | /* */ | ||
| /* (c) Graham Toal, 1984. (Original BCPL version, */ | /* (c) Graham Toal, 1984. (Original BCPL version, */ | ||
| /* | /* | ||
| / | / | ||
| - | + | ||
| / | / | ||
| - | + | ||
| - | + | ||
| #define NOTE_FILE "/ | #define NOTE_FILE "/ | ||
| /* so this version of Ecce is really only expected to be used on a single-user system */ | /* so this version of Ecce is really only expected to be used on a single-user system */ | ||
| - | + | ||
| /* #define NOTE_FILE "/ | /* #define NOTE_FILE "/ | ||
| - | + | ||
| /* I'm aware that this area of the code needs work to be made robust. | /* I'm aware that this area of the code needs work to be made robust. | ||
| have robustness without some OS-specific code. | have robustness without some OS-specific code. | ||
| - | + | ||
| This code is already less portable than was first intended. | This code is already less portable than was first intended. | ||
| Look for lines containing the marker *SYS* to see if the | Look for lines containing the marker *SYS* to see if the | ||
| small deviations from portability affect your system. | small deviations from portability affect your system. | ||
| - | + | ||
| Note that the libraries with most windows C compilers try to handle | Note that the libraries with most windows C compilers try to handle | ||
| some unix constructs such as / as a filename separator, so even some | some unix constructs such as / as a filename separator, so even some | ||
| of the code marked *SYS* is likely to work on Windows. | of the code marked *SYS* is likely to work on Windows. | ||
| */ | */ | ||
| - | + | ||
| /* Name of temp file for multiple contexts - system dependant. */ | /* Name of temp file for multiple contexts - system dependant. */ | ||
| /* Something like "/ | /* Something like "/ | ||
| /* but using a proper function like tmpnam() would be best. */ | /* but using a proper function like tmpnam() would be best. */ | ||
| - | + | ||
| /* Unfortunately tmpnam is deprecated due to timing issues | /* Unfortunately tmpnam is deprecated due to timing issues | ||
| /* with setting up file permissions - but it is the only call */ | /* with setting up file permissions - but it is the only call */ | ||
| /* in this area that is portable to Win/DOS, and I'm trying | /* in this area that is portable to Win/DOS, and I'm trying | ||
| /* to keep this source OS-independent. (without ifdef' | /* to keep this source OS-independent. (without ifdef' | ||
| - | + | ||
| /* This is the remaining code issue I'ld like to fix before | /* This is the remaining code issue I'ld like to fix before | ||
| /* moving this to sourceforge. | /* moving this to sourceforge. | ||
| - | + | ||
| - | + | ||
| #define CONTEXT_OFFSET (strlen(NOTE_FILE)-1) | #define CONTEXT_OFFSET (strlen(NOTE_FILE)-1) | ||
| /* Index of variable part in name above (i.e. of ' | /* Index of variable part in name above (i.e. of ' | ||
| - | + | ||
| static char *ProgName = NULL; | static char *ProgName = NULL; | ||
| static char *parameter[4] = {NULL, NULL, NULL, NULL}; /* parameters - from, to, log, command */ | static char *parameter[4] = {NULL, NULL, NULL, NULL}; /* parameters - from, to, log, command */ | ||
| static char *commandp = NULL; | static char *commandp = NULL; | ||
| - | + | ||
| # | # | ||
| # | # | ||
| # | # | ||
| # | # | ||
| - | + | ||
| unsigned long estimate_buffer_size(char *fname) | unsigned long estimate_buffer_size(char *fname) | ||
| { | { | ||
| Línea 167: | Línea 93: | ||
| unsigned long maxbuf = 0UL; | unsigned long maxbuf = 0UL; | ||
| long rc; | long rc; | ||
| - | + | ||
| /* since we allocate RAM for the whole file, don't bother handling | /* since we allocate RAM for the whole file, don't bother handling | ||
| files longer than 32 bits. It's just a text editor after all... */ | files longer than 32 bits. It's just a text editor after all... */ | ||
| - | + | ||
| if (tmp == NULL) return 2UL*1024UL*1024UL; | if (tmp == NULL) return 2UL*1024UL*1024UL; | ||
| (void)fseek(tmp, | (void)fseek(tmp, | ||
| Línea 178: | Línea 104: | ||
| return (maxbuf + 1024UL*256UL) * 3UL; | return (maxbuf + 1024UL*256UL) * 3UL; | ||
| } | } | ||
| - | + | ||
| / | / | ||
| - | + | ||
| #define FALSE (0!=0) | #define FALSE (0!=0) | ||
| #define TRUE (0==0) | #define TRUE (0==0) | ||
| - | + | ||
| /* Types */ | /* Types */ | ||
| - | + | ||
| typedef int bool; | typedef int bool; | ||
| typedef ecce_char *cindex; | typedef ecce_char *cindex; | ||
| - | + | ||
| /* Consts */ | /* Consts */ | ||
| - | + | ||
| # | # | ||
| # | # | ||
| Línea 200: | Línea 126: | ||
| # | # | ||
| # | # | ||
| - | + | ||
| /* I know it is bad practise to have these fixed length arrays and I will | /* I know it is bad practise to have these fixed length arrays and I will | ||
| work on that eventually. | work on that eventually. | ||
| Línea 210: | Línea 136: | ||
| # | # | ||
| # | # | ||
| - | + | ||
| # | # | ||
| # | # | ||
| Línea 229: | Línea 155: | ||
| # | # | ||
| # | # | ||
| - | + | ||
| void init_globals (void); | void init_globals (void); | ||
| void free_buffers (void); | void free_buffers (void); | ||
| Línea 262: | Línea 188: | ||
| bool find (void); | bool find (void); | ||
| bool find_back (void); | bool find_back (void); | ||
| - | + | ||
| /* Global variables */ | /* Global variables */ | ||
| - | + | ||
| static unsigned long buffer_size = 0UL; | static unsigned long buffer_size = 0UL; | ||
| static char *note_file; | static char *note_file; | ||
| Línea 272: | Línea 198: | ||
| static int | static int | ||
| static ecce_int pending_sym; | static ecce_int pending_sym; | ||
| - | + | ||
| /* significance of file pointers using the ' | /* significance of file pointers using the ' | ||
| - | + | ||
| /* [NL] o n e NL t w . . . o NL n e x t NL . . NL l a s t NL [NL] */ | /* [NL] o n e NL t w . . . o NL n e x t NL . . NL l a s t NL [NL] */ | ||
| /* ! ! | /* ! ! | ||
| Línea 281: | Línea 207: | ||
| /* e e n n */ | /* e e n n */ | ||
| /* g g d d */ | /* g g d d */ | ||
| - | + | ||
| /* Note that when the buffer is 100% full, pp and fp are equal, | /* Note that when the buffer is 100% full, pp and fp are equal, | ||
| and any insertion operations will fail. This is valid as | and any insertion operations will fail. This is valid as | ||
| pp is exclusive and fp is inclusive. */ | pp is exclusive and fp is inclusive. */ | ||
| - | + | ||
| /* When editing a secondary input buffer, these pointers are saved | /* When editing a secondary input buffer, these pointers are saved | ||
| and re-created within the buffer gap */ | and re-created within the buffer gap */ | ||
| - | + | ||
| /* Hamish' | /* Hamish' | ||
| to file when the buffer was full (cf ' | to file when the buffer was full (cf ' | ||
| | | ||
| are: | are: | ||
| - | + | ||
| 1) crash. | 1) crash. | ||
| 2) fail to insert (what we do now) | 2) fail to insert (what we do now) | ||
| Línea 305: | Línea 231: | ||
| to what we had on EMAS) - but the argument against is just | to what we had on EMAS) - but the argument against is just | ||
| a delayed version of (3) above. | a delayed version of (3) above. | ||
| - | + | ||
| Note that the failure mode of this code is *not* atomic. | Note that the failure mode of this code is *not* atomic. | ||
| A complete 'get line' or ' | A complete 'get line' or ' | ||
| Línea 312: | Línea 238: | ||
| cost of the buffer-full test. | cost of the buffer-full test. | ||
| */ | */ | ||
| - | + | ||
| static cindex fbeg; | static cindex fbeg; | ||
| static cindex lbeg; | static cindex lbeg; | ||
| Línea 319: | Línea 245: | ||
| static cindex lend; | static cindex lend; | ||
| static cindex fend; | static cindex fend; | ||
| - | + | ||
| static int type; | static int type; | ||
| static ecce_int command; | static ecce_int command; | ||
| Línea 347: | Línea 273: | ||
| static bool in_second; | static bool in_second; | ||
| static char *com_prompt; | static char *com_prompt; | ||
| - | + | ||
| static int symtype[256] = { | static int symtype[256] = { | ||
| | | ||
| Línea 495: | Línea 421: | ||
| err, err, err, err, err, err, err, err | err, err, err, err, err, err, err, err | ||
| }; | }; | ||
| - | + | ||
| static int sym_type(ecce_char c) { | static int sym_type(ecce_char c) { | ||
| if ((0 <= c) && (c <= 255)) return symtype[(unsigned int)c]; | if ((0 <= c) && (c <= 255)) return symtype[(unsigned int)c]; | ||
| return err; | return err; | ||
| } | } | ||
| - | + | ||
| static cindex a; | static cindex a; | ||
| static FILE *main_in; | static FILE *main_in; | ||
| Línea 507: | Línea 433: | ||
| static FILE *tty_out; | static FILE *tty_out; | ||
| static FILE *log_out; | static FILE *log_out; | ||
| - | + | ||
| static ecce_int *com; | static ecce_int *com; | ||
| static int *link; | static int *link; | ||
| Línea 513: | Línea 439: | ||
| static long *num; | static long *num; | ||
| static long *lim; | static long *lim; | ||
| - | + | ||
| / | / | ||
| - | + | ||
| static int IntSeen = FALSE; /* set asynchronously by signal routine on ^C */ | static int IntSeen = FALSE; /* set asynchronously by signal routine on ^C */ | ||
| - | + | ||
| void gotint(int n) { | void gotint(int n) { | ||
| (void)n; /* Supress the annoying 'not used' warning message... */ | (void)n; /* Supress the annoying 'not used' warning message... */ | ||
| IntSeen = TRUE; | IntSeen = TRUE; | ||
| } | } | ||
| - | + | ||
| int h(char c) { | int h(char c) { | ||
| if ((' | if ((' | ||
| if ((' | if ((' | ||
| if ((' | if ((' | ||
| - | fprintf(stderr, | + | fprintf(stderr, |
| exit(1); | exit(1); | ||
| } | } | ||
| - | + | ||
| char *hex_to_ascii(char *hex) { | char *hex_to_ascii(char *hex) { | ||
| static char commandline[Max_parameter], | static char commandline[Max_parameter], | ||
| if (strlen(hex)/ | if (strlen(hex)/ | ||
| - | fprintf(stderr, | + | fprintf(stderr, |
| exit(1); | exit(1); | ||
| } | } | ||
| Línea 543: | Línea 469: | ||
| c1 = h(*f++); | c1 = h(*f++); | ||
| if (*f == ' | if (*f == ' | ||
| - | fprintf(stderr, | + | fprintf(stderr, |
| exit(1); | exit(1); | ||
| } | } | ||
| Línea 552: | Línea 478: | ||
| return commandline; | return commandline; | ||
| } | } | ||
| - | + | ||
| char *backup_save; | char *backup_save; | ||
| - | + | ||
| int main(int argc, char **argv) { | int main(int argc, char **argv) { | ||
| static char backup_save_buf[256+L_tmpnam+1]; | static char backup_save_buf[256+L_tmpnam+1]; | ||
| Línea 560: | Línea 486: | ||
| int argno = 1, inoutlog = 0; | int argno = 1, inoutlog = 0; | ||
| char *s; | char *s; | ||
| - | + | ||
| #ifdef WANT_UTF8 | #ifdef WANT_UTF8 | ||
| /* If your native locale doesn' | /* If your native locale doesn' | ||
| Línea 568: | Línea 494: | ||
| char *locale = setlocale(LC_ALL, | char *locale = setlocale(LC_ALL, | ||
| #endif | #endif | ||
| - | + | ||
| backup_save = tmpnam(backup_save_buf); | backup_save = tmpnam(backup_save_buf); | ||
| - | + | ||
| /* Historical code, not really needed nowadays as | /* Historical code, not really needed nowadays as | ||
| | | ||
| - | + | | |
| ProgName = argv[0]; | ProgName = argv[0]; | ||
| s = strrchr(ProgName, | s = strrchr(ProgName, | ||
| Línea 582: | Línea 508: | ||
| ProgName = malloc(strlen(s)+1); | ProgName = malloc(strlen(s)+1); | ||
| s = strchr(ProgName, | s = strchr(ProgName, | ||
| - | + | ||
| /* decode argv into parameter[0..3] and buffer_size */ | /* decode argv into parameter[0..3] and buffer_size */ | ||
| for (;;) { | for (;;) { | ||
| Línea 589: | Línea 515: | ||
| int offset = 1; | int offset = 1; | ||
| if (argv[argno][1] == ' | if (argv[argno][1] == ' | ||
| - | if (strcmp(argv[argno]+offset, | + | if (strcmp(argv[argno]+offset, |
| parameter[F] = argv[argno+1]; | parameter[F] = argv[argno+1]; | ||
| - | } else if (strcmp(argv[argno]+offset, | + | } else if (strcmp(argv[argno]+offset, |
| parameter[T] = argv[argno+1]; | parameter[T] = argv[argno+1]; | ||
| } else if (strcmp(argv[argno]+offset, | } else if (strcmp(argv[argno]+offset, | ||
| Línea 597: | Línea 523: | ||
| } else if (strcmp(argv[argno]+offset, | } else if (strcmp(argv[argno]+offset, | ||
| if (parameter[C] != NULL) { | if (parameter[C] != NULL) { | ||
| - | fprintf(stderr, | + | fprintf(stderr, |
| exit(1); | exit(1); | ||
| } | } | ||
| Línea 613: | Línea 539: | ||
| buffer_size = strtoul(buf_size_str, | buffer_size = strtoul(buf_size_str, | ||
| if (errno != 0) { | if (errno != 0) { | ||
| - | fprintf(stderr, | + | fprintf(stderr, |
| exit(1); | exit(1); | ||
| } | } | ||
| Línea 624: | Línea 550: | ||
| } else { | } else { | ||
| fprintf(stderr, | fprintf(stderr, | ||
| - | "%s: tipo de unidad | + | "%s: tipo incorrecto |
| ProgName, endptr, buffer_size, | ProgName, endptr, buffer_size, | ||
| exit(1); | exit(1); | ||
| Línea 631: | Línea 557: | ||
| } else { | } else { | ||
| fprintf (stderr, | fprintf (stderr, | ||
| - | " | + | " |
| ProgName, argv[argno]); | ProgName, argv[argno]); | ||
| exit(1); | exit(1); | ||
| Línea 641: | Línea 567: | ||
| } | } | ||
| } | } | ||
| - | + | ||
| if (buffer_size == 0UL) buffer_size = estimate_buffer_size(parameter[F]); | if (buffer_size == 0UL) buffer_size = estimate_buffer_size(parameter[F]); | ||
| | | ||
| - | + | ||
| if (parameter[F] == NULL) { | if (parameter[F] == NULL) { | ||
| fprintf (stderr, | fprintf (stderr, | ||
| - | " | + | " |
| ProgName); | ProgName); | ||
| exit (30); | exit (30); | ||
| } | } | ||
| - | + | ||
| | | ||
| - | + | ||
| | | ||
| | | ||
| - | + | ||
| if ((strcmp(parameter[F], | if ((strcmp(parameter[F], | ||
| /* If the input file is stdin, you cannot read commands from stdin as well. */ | /* If the input file is stdin, you cannot read commands from stdin as well. */ | ||
| if (commandp == NULL) { | if (commandp == NULL) { | ||
| - | fprintf(stderr, | + | fprintf(stderr, |
| } | } | ||
| main_in = stdin; | main_in = stdin; | ||
| Línea 667: | Línea 593: | ||
| tty_in = fopen("/ | tty_in = fopen("/ | ||
| if (tty_in) { | if (tty_in) { | ||
| - | fprintf(stderr, | + | fprintf(stderr, |
| } else { | } else { | ||
| tty_in = fopen(" | tty_in = fopen(" | ||
| if (tty_in) { | if (tty_in) { | ||
| - | | + | |
| } else { | } else { | ||
| | | ||
| if (tty_in == NULL) tty_in = fopen(" | if (tty_in == NULL) tty_in = fopen(" | ||
| - | | + | |
| if (tty_in == NULL) tty_in = stdin; /* It'll be EOF by the time it is used */ | if (tty_in == NULL) tty_in = stdin; /* It'll be EOF by the time it is used */ | ||
| } | } | ||
| Línea 682: | Línea 608: | ||
| main_in = fopen (parameter[F], | main_in = fopen (parameter[F], | ||
| } | } | ||
| - | + | ||
| if (main_in == NULL) { | if (main_in == NULL) { | ||
| fprintf (stderr, " | fprintf (stderr, " | ||
| exit (30); | exit (30); | ||
| } | } | ||
| - | + | ||
| if (parameter[L] == NULL) { | if (parameter[L] == NULL) { | ||
| log_out = NULL; | log_out = NULL; | ||
| Línea 693: | Línea 619: | ||
| log_out = fopen (parameter[L], | log_out = fopen (parameter[L], | ||
| if (log_out == NULL) { | if (log_out == NULL) { | ||
| - | | + | |
| ProgName, parameter[L]); | ProgName, parameter[L]); | ||
| } | } | ||
| } | } | ||
| - | + | ||
| | | ||
| - | + | ||
| | | ||
| | | ||
| - | + | ||
| | | ||
| - | + | ||
| if (main_in != NULL) load_file (); | if (main_in != NULL) load_file (); | ||
| - | + | ||
| | | ||
| - | + | ||
| | | ||
| for (;;) { | for (;;) { | ||
| Línea 718: | Línea 644: | ||
| if (!printed) execute_command (); | if (!printed) execute_command (); | ||
| } | } | ||
| - | + | ||
| if (IntSeen) { | if (IntSeen) { | ||
| signal(SIGINT, | signal(SIGINT, | ||
| - | + | ||
| IntSeen = FALSE; | IntSeen = FALSE; | ||
| fprintf(stderr, | fprintf(stderr, | ||
| } | } | ||
| - | + | ||
| } | } | ||
| } | } | ||
| - | + | ||
| void init_globals (void) { | void init_globals (void) { | ||
| - | + | ||
| a = malloc ((buffer_size+1) * sizeof(ecce_char)); | a = malloc ((buffer_size+1) * sizeof(ecce_char)); | ||
| - | + | ||
| | | ||
| - | + | ||
| | | ||
| link = (int *) malloc ((Max_command_units+1)*sizeof(int)); | link = (int *) malloc ((Max_command_units+1)*sizeof(int)); | ||
| text = (ecce_char *) malloc ((Max_command_units+1) * sizeof(ecce_char)); | text = (ecce_char *) malloc ((Max_command_units+1) * sizeof(ecce_char)); | ||
| - | + | ||
| num = (long *) malloc ((Max_command_units+1)*sizeof(long)); | num = (long *) malloc ((Max_command_units+1)*sizeof(long)); | ||
| lim = (long *) malloc ((Max_command_units+1)*sizeof(long)); | lim = (long *) malloc ((Max_command_units+1)*sizeof(long)); | ||
| - | + | ||
| | | ||
| - | + | ||
| if (a == NULL || note_file == NULL || com == NULL || | if (a == NULL || note_file == NULL || com == NULL || | ||
| link == NULL || text == NULL || num == NULL || lim == NULL || | link == NULL || text == NULL || num == NULL || lim == NULL || | ||
| com_prompt == NULL) { | com_prompt == NULL) { | ||
| - | fprintf (stderr, "Imposible reclamar el espacio de buffer\n"); | + | fprintf (stderr, "Incapaz de referir |
| free_buffers(); | free_buffers(); | ||
| exit (40); | exit (40); | ||
| } | } | ||
| - | + | ||
| - | | + | |
| - | + | ||
| - | + | ||
| fbeg = a+1; | fbeg = a+1; | ||
| lbeg = fbeg; | lbeg = fbeg; | ||
| Línea 767: | Línea 693: | ||
| | | ||
| | | ||
| - | + | ||
| | | ||
| noted = NULL; | noted = NULL; | ||
| Línea 774: | Línea 700: | ||
| | | ||
| } | } | ||
| - | + | ||
| void free_buffers (void) { /* only needed if checking that we have no heap lossage at end */ | void free_buffers (void) { /* only needed if checking that we have no heap lossage at end */ | ||
| if (a) free (a); a = NULL; | if (a) free (a); a = NULL; | ||
| Línea 786: | Línea 712: | ||
| if (ProgName) free (ProgName); ProgName = NULL; | if (ProgName) free (ProgName); ProgName = NULL; | ||
| } | } | ||
| - | + | ||
| void local_echo (ecce_int *sym) { /* Later, make this a char fn. */ | void local_echo (ecce_int *sym) { /* Later, make this a char fn. */ | ||
| | | ||
| - | + | ||
| if (commandp) { | if (commandp) { | ||
| lsym = *commandp; | lsym = *commandp; | ||
| Línea 800: | Línea 726: | ||
| return; | return; | ||
| } | } | ||
| - | + | ||
| if (blank_line) {fprintf(tty_out, | if (blank_line) {fprintf(tty_out, | ||
| - | + | ||
| lsym = fgetwc (tty_in); | lsym = fgetwc (tty_in); | ||
| if (IntSeen) { | if (IntSeen) { | ||
| Línea 811: | Línea 737: | ||
| | | ||
| } | } | ||
| - | + | ||
| if (lsym == WEOF) { | if (lsym == WEOF) { | ||
| - | + | ||
| IntSeen = FALSE; | IntSeen = FALSE; | ||
| signal(SIGINT, | signal(SIGINT, | ||
| fputwc(' | fputwc(' | ||
| - | + | ||
| percent (' | percent (' | ||
| exit (50); | exit (50); | ||
| } | } | ||
| - | + | ||
| if (log_out != NULL) { | if (log_out != NULL) { | ||
| fputwc (lsym, log_out); | fputwc (lsym, log_out); | ||
| Línea 828: | Línea 754: | ||
| *sym = lsym; | *sym = lsym; | ||
| } | } | ||
| - | + | ||
| void read_sym (void) { | void read_sym (void) { | ||
| if (pending_sym == 0) { | if (pending_sym == 0) { | ||
| Línea 838: | Línea 764: | ||
| } | } | ||
| } | } | ||
| - | + | ||
| bool fail_with (char *mess, ecce_int culprit) { | bool fail_with (char *mess, ecce_int culprit) { | ||
| int dirn_sign; | int dirn_sign; | ||
| - | + | ||
| if ((' | if ((' | ||
| dirn_sign = ' | dirn_sign = ' | ||
| Línea 858: | Línea 784: | ||
| | | ||
| } | } | ||
| - | + | ||
| - | + | ||
| void read_item(void) { | void read_item(void) { | ||
| | | ||
| Línea 866: | Línea 792: | ||
| type = sym_type(sym); | type = sym_type(sym); | ||
| if ((type & ext) == 0) return; | if ((type & ext) == 0) return; | ||
| - | + | ||
| | | ||
| - | + | ||
| case star: | case star: | ||
| | | ||
| | | ||
| - | + | ||
| case pling: | case pling: | ||
| | | ||
| | | ||
| - | + | ||
| case dig: | case dig: | ||
| | | ||
| Línea 887: | Línea 813: | ||
| sym = saved_digit; | sym = saved_digit; | ||
| | | ||
| - | + | ||
| default: | default: | ||
| | | ||
| } | } | ||
| } | } | ||
| - | + | ||
| void percent (ecce_int Command_sym) { | void percent (ecce_int Command_sym) { | ||
| | | ||
| Línea 902: | Línea 828: | ||
| ok = TRUE; | ok = TRUE; | ||
| if (!isalpha(Command_sym)) { | if (!isalpha(Command_sym)) { | ||
| - | (void) fail_with ("letter for", ' | + | (void) fail_with ("letra para", ' |
| return; | return; | ||
| } | } | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 913: | Línea 839: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 920: | Línea 846: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 926: | Línea 852: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 939: | Línea 865: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if ((strcmp(parameter[parameter[T] == NULL ? F : T], " | if ((strcmp(parameter[parameter[T] == NULL ? F : T], " | ||
| ((parameter[T] != NULL) && (strcmp(parameter[T], | ((parameter[T] != NULL) && (strcmp(parameter[T], | ||
| - | | + | |
| | | ||
| } | } | ||
| case ' | case ' | ||
| do { read_sym (); } while (sym_type(sym) != sym_type(';' | do { read_sym (); } while (sym_type(sym) != sym_type(';' | ||
| - | + | ||
| case ' | case ' | ||
| - | + | ||
| if (parameter[T] == NULL) { | if (parameter[T] == NULL) { | ||
| inoutlog = F; /* So use input file as output file */ | inoutlog = F; /* So use input file as output file */ | ||
| Línea 956: | Línea 882: | ||
| inoutlog = T; | inoutlog = T; | ||
| } | } | ||
| - | + | ||
| if (in_second) { /* Copied bit */ | if (in_second) { /* Copied bit */ | ||
| / | / | ||
| Línea 966: | Línea 892: | ||
| (void)strcpy (com_prompt, | (void)strcpy (com_prompt, | ||
| if (sec_out == NULL) { | if (sec_out == NULL) { | ||
| - | | + | |
| | | ||
| } | } | ||
| Línea 998: | Línea 924: | ||
| if (main_out == NULL) { | if (main_out == NULL) { | ||
| | | ||
| - | " | + | " |
| | | ||
| } | } | ||
| Línea 1009: | Línea 935: | ||
| if (main_out == NULL) { | if (main_out == NULL) { | ||
| | | ||
| - | "No puedo crear \" | + | "No puedo crear \" |
| parameter[inoutlog], | parameter[inoutlog], | ||
| | | ||
| if (main_out == NULL) { | if (main_out == NULL) { | ||
| - | | + | |
| | | ||
| } | } | ||
| Línea 1019: | Línea 945: | ||
| if (inoutlog == T) { | if (inoutlog == T) { | ||
| fprintf (tty_out, | fprintf (tty_out, | ||
| - | " | + | " |
| } else { | } else { | ||
| - | fprintf (tty_out, "Ecce: Guardando | + | fprintf (tty_out, "Ecce %s completando.\n", parameter[F]); |
| } | } | ||
| } | } | ||
| } | } | ||
| - | + | ||
| P = fbeg; | P = fbeg; | ||
| for (;;) { | for (;;) { | ||
| Línea 1033: | Línea 959: | ||
| } | } | ||
| if (main_out != stdout) fclose (main_out); | if (main_out != stdout) fclose (main_out); | ||
| - | + | ||
| if (Command_sym == ' | if (Command_sym == ' | ||
| pending_sym = ' | pending_sym = ' | ||
| break; | break; | ||
| } | } | ||
| - | + | ||
| if (log_out != NULL) { | if (log_out != NULL) { | ||
| fclose (log_out); | fclose (log_out); | ||
| } | } | ||
| - | /* | + | /* |
| | | ||
| exit (0); | exit (0); | ||
| - | + | ||
| case ' | case ' | ||
| if (log_out != NULL) { | if (log_out != NULL) { | ||
| Línea 1053: | Línea 979: | ||
| | | ||
| exit (60); | exit (60); | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 1093: | Línea 1019: | ||
| (void)strcpy (com_prompt, | (void)strcpy (com_prompt, | ||
| if (sec_out == NULL) { | if (sec_out == NULL) { | ||
| - | | + | |
| | | ||
| } | } | ||
| Línea 1126: | Línea 1052: | ||
| if (sec_in == NULL) { | if (sec_in == NULL) { | ||
| if (file_wanted) { | if (file_wanted) { | ||
| - | (void) fail_with (" | + | (void) fail_with (" |
| } else { | } else { | ||
| - | (void) fail_with ("Contexto | + | (void) fail_with ("Context |
| } | } | ||
| | | ||
| Línea 1136: | Línea 1062: | ||
| in_second = TRUE; | in_second = TRUE; | ||
| *pp = ' | *pp = ' | ||
| - | + | ||
| fbeg = pp + 1; | fbeg = pp + 1; | ||
| fend = fp - 1; | fend = fp - 1; | ||
| Línea 1149: | Línea 1075: | ||
| *P++ = sym; | *P++ = sym; | ||
| if (P == fend) { | if (P == fend) { | ||
| - | (void) fail_with ("%S corrupto - no ha espacio", | + | (void) fail_with ("%S corrupto - sin espacio", |
| fclose (sec_in); | fclose (sec_in); | ||
| return; | return; | ||
| Línea 1160: | Línea 1086: | ||
| } | } | ||
| | | ||
| - | + | ||
| default: | default: | ||
| | | ||
| Línea 1166: | Línea 1092: | ||
| do { read_sym(); } while (sym_type(sym) != sym_type(';' | do { read_sym(); } while (sym_type(sym) != sym_type(';' | ||
| } | } | ||
| - | + | ||
| void unchain(void) { | void unchain(void) { | ||
| do { | do { | ||
| Línea 1175: | Línea 1101: | ||
| } while (com[pointer] != ' | } while (com[pointer] != ' | ||
| } | } | ||
| - | + | ||
| void stack(void) { | void stack(void) { | ||
| | | ||
| Línea 1183: | Línea 1109: | ||
| | | ||
| } | } | ||
| - | + | ||
| void execute_command(void) { | void execute_command(void) { | ||
| | | ||
| | | ||
| - | + | ||
| ok = TRUE; | ok = TRUE; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| case ' | case ' | ||
| Línea 1227: | Línea 1153: | ||
| } | } | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| case ' | case ' | ||
| | | ||
| - | + | ||
| if (sym == ':' | if (sym == ':' | ||
| local_echo (&sym); | local_echo (&sym); | ||
| Línea 1242: | Línea 1168: | ||
| | | ||
| for (;;) { | for (;;) { | ||
| - | if (pp == fp) /* LLENO! */ { ok = FALSE; } else *pp++ = sym; | + | if (pp == fp) /* FULL! */ { ok = FALSE; } else *pp++ = sym; |
| if (sym == ' | if (sym == ' | ||
| local_echo (&sym); | local_echo (&sym); | ||
| Línea 1252: | Línea 1178: | ||
| } | } | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (fp == lend) { | if (fp == lend) { | ||
| Línea 1263: | Línea 1189: | ||
| } else fp++; | } else fp++; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (pp == lbeg) { | if (pp == lbeg) { | ||
| Línea 1274: | Línea 1200: | ||
| } else --pp; | } else --pp; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (fp == lend) { | if (fp == lend) { | ||
| Línea 1291: | Línea 1217: | ||
| } | } | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (pp == lbeg) { | if (pp == lbeg) { | ||
| Línea 1308: | Línea 1234: | ||
| } | } | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| case ' | case ' | ||
| Línea 1317: | Línea 1243: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| case ' | case ' | ||
| Línea 1326: | Línea 1252: | ||
| ms = NULL; | ms = NULL; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| - | if (pp == fp) /* LLENO! */ { ok = FALSE; return; } | + | if (pp == fp) /* FULL! */ { ok = FALSE; return; } |
| *pp++ = ' | *pp++ = ' | ||
| lbeg = pp; | lbeg = pp; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| - | if (pp == fp) /* LLENO! */ { ok = FALSE; return; } | + | if (pp == fp) /* FULL! */ { ok = FALSE; return; } |
| *--fp = ' | *--fp = ' | ||
| lend = fp; | lend = fp; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 1349: | Línea 1275: | ||
| lend++; | lend++; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 1360: | Línea 1286: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (repeat_count == 0L) { | if (repeat_count == 0L) { | ||
| Línea 1369: | Línea 1295: | ||
| } | } | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (repeat_count == 0L) { | if (repeat_count == 0L) { | ||
| Línea 1378: | Línea 1304: | ||
| } | } | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| case ' | case ' | ||
| Línea 1394: | Línea 1320: | ||
| while (*lend != ' | while (*lend != ' | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (!find ()) return; | if (!find ()) return; | ||
| Línea 1418: | Línea 1344: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (!find_back ()) return; | if (!find_back ()) return; | ||
| Línea 1426: | Línea 1352: | ||
| lend++; | lend++; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (!find ()) return; | if (!find ()) return; | ||
| Línea 1432: | Línea 1358: | ||
| ms = fp; | ms = fp; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (!find_back ()) return; | if (!find_back ()) return; | ||
| Línea 1438: | Línea 1364: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (!find ()) return; | if (!find ()) return; | ||
| while (fp != ml) *pp++ = *fp++; | while (fp != ml) *pp++ = *fp++; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if (!find_back ()) return; | if (!find_back ()) return; | ||
| while (pp != ml_back) *--fp = *--pp; | while (pp != ml_back) *--fp = *--pp; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| case ' | case ' | ||
| Línea 1473: | Línea 1399: | ||
| } | } | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 1486: | Línea 1412: | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| ok = FALSE; | ok = FALSE; | ||
| | | ||
| - | + | ||
| case '?': | case '?': | ||
| | | ||
| - | + | ||
| case ',': | case ',': | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| noted = pp; | noted = pp; | ||
| | | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| if ((noted == NULL) | if ((noted == NULL) | ||
| Línea 1514: | Línea 1440: | ||
| FILE *note_out = fopen (note_file, " | FILE *note_out = fopen (note_file, " | ||
| cindex p = noted; | cindex p = noted; | ||
| - | + | ||
| if (note_out == NULL) { | if (note_out == NULL) { | ||
| ok = FALSE; | ok = FALSE; | ||
| | | ||
| } | } | ||
| - | + | ||
| do { | do { | ||
| | | ||
| } while (p != pp); | } while (p != pp); | ||
| - | + | ||
| fclose (note_out); | fclose (note_out); | ||
| - | + | ||
| pp = noted; | pp = noted; | ||
| lbeg = pp; | lbeg = pp; | ||
| Línea 1533: | Línea 1459: | ||
| noted = NULL; | noted = NULL; | ||
| | | ||
| - | + | ||
| case ' | case ' | ||
| | | ||
| Línea 1542: | Línea 1468: | ||
| | | ||
| } | } | ||
| - | + | ||
| { cindex p = pp; | { cindex p = pp; | ||
| - | + | ||
| for (;;) { | for (;;) { | ||
| sym = fgetwc(note_in); | sym = fgetwc(note_in); | ||
| Línea 1562: | Línea 1488: | ||
| } | } | ||
| | | ||
| - | + | ||
| default: | default: | ||
| - | | + | |
| | | ||
| } | } | ||
| } | } | ||
| - | + | ||
| void Scan_sign(void) { | void Scan_sign(void) { | ||
| | | ||
| Línea 1580: | Línea 1506: | ||
| } | } | ||
| } | } | ||
| - | + | ||
| void Scan_scope(void) { /* ditto macro */ | void Scan_scope(void) { /* ditto macro */ | ||
| | | ||
| Línea 1591: | Línea 1517: | ||
| } | } | ||
| } | } | ||
| - | + | ||
| void Scan_text(void) { | void Scan_text(void) { | ||
| | | ||
| - | + | ||
| | | ||
| last = sym; | last = sym; | ||
| Línea 1629: | Línea 1555: | ||
| ok = TRUE; | ok = TRUE; | ||
| } | } | ||
| - | + | ||
| void Scan_repeat (void) { | void Scan_repeat (void) { | ||
| | | ||
| Línea 1636: | Línea 1562: | ||
| | | ||
| } | } | ||
| - | + | ||
| bool analyse (void) { | bool analyse (void) { | ||
| int saved_type; | int saved_type; | ||
| - | + | ||
| ok = TRUE; | ok = TRUE; | ||
| pos = 0; | pos = 0; | ||
| Línea 1692: | Línea 1618: | ||
| } else { | } else { | ||
| | | ||
| - | + | ||
| case termin: | case termin: | ||
| | | ||
| | | ||
| if (pointer >= 0) { | if (pointer >= 0) { | ||
| - | return (fail_with ("Missing", ' | + | return (fail_with ("Faltante", ' |
| } | } | ||
| | | ||
| Línea 1706: | Línea 1632: | ||
| stack (); | stack (); | ||
| | | ||
| - | + | ||
| case lpar: | case lpar: | ||
| | | ||
| Línea 1712: | Línea 1638: | ||
| | | ||
| | | ||
| - | + | ||
| case comma: | case comma: | ||
| | | ||
| Línea 1718: | Línea 1644: | ||
| | | ||
| | | ||
| - | + | ||
| case rpar: | case rpar: | ||
| | | ||
| Línea 1735: | Línea 1661: | ||
| | | ||
| } | } | ||
| - | + | ||
| void load_file (void) { | void load_file (void) { | ||
| | | ||
| | | ||
| - | + | ||
| sym = fgetwc(main_in); | sym = fgetwc(main_in); | ||
| while (sym != WEOF) { | while (sym != WEOF) { | ||
| Línea 1745: | Línea 1671: | ||
| *p++ = sym; | *p++ = sym; | ||
| if (p == fend) { | if (p == fend) { | ||
| - | | + | |
| | | ||
| } | } | ||
| } | } | ||
| - | + | ||
| sym = fgetwc(main_in); | sym = fgetwc(main_in); | ||
| #ifdef WANT_UTF8 | #ifdef WANT_UTF8 | ||
| if (errno == EILSEQ) { | if (errno == EILSEQ) { | ||
| - | fprintf(stderr, | + | fprintf(stderr, |
| exit(1); | exit(1); | ||
| } | } | ||
| Línea 1759: | Línea 1685: | ||
| } | } | ||
| | | ||
| - | + | ||
| while (p != fbeg) *--fp = *--p; | while (p != fbeg) *--fp = *--p; | ||
| lend = fp; | lend = fp; | ||
| Línea 1765: | Línea 1691: | ||
| lend++; | lend++; | ||
| } | } | ||
| - | + | ||
| bool execute_unit (void) { | bool execute_unit (void) { | ||
| | | ||
| - | + | ||
| | | ||
| | | ||
| | | ||
| - | + | ||
| | | ||
| for (;;) { /* On repeats of this_unit */ | for (;;) { /* On repeats of this_unit */ | ||
| Línea 1810: | Línea 1736: | ||
| command = com[this_unit]; | command = com[this_unit]; | ||
| switch (command) { | switch (command) { | ||
| - | + | ||
| case ' | case ' | ||
| this_unit = link[this_unit]; | this_unit = link[this_unit]; | ||
| break; /* Skip over (...) as if it were single command. */ | break; /* Skip over (...) as if it were single command. */ | ||
| - | + | ||
| case ',': | case ',': | ||
| return (ok); | return (ok); | ||
| - | + | ||
| case ' | case ' | ||
| --num[this_unit]; | --num[this_unit]; | ||
| Línea 1828: | Línea 1754: | ||
| /* rely on enclosing for-loop to handle \ and ? correctly! */ | /* rely on enclosing for-loop to handle \ and ? correctly! */ | ||
| goto breaklab; | goto breaklab; | ||
| - | + | ||
| | | ||
| } | } | ||
| if (com[this_unit] == 0) {/* 0 denotes end of command-line. */ | if (com[this_unit] == 0) {/* 0 denotes end of command-line. */ | ||
| - | | + | |
| } | } | ||
| | | ||
| Línea 1839: | Línea 1765: | ||
| } /* executing repeats */ | } /* executing repeats */ | ||
| } | } | ||
| - | + | ||
| void execute_all (void) { | void execute_all (void) { | ||
| | | ||
| Línea 1854: | Línea 1780: | ||
| ok = TRUE; | ok = TRUE; | ||
| } | } | ||
| - | + | ||
| /* All of the following could be static inlines under GCC, or | /* All of the following could be static inlines under GCC, or | ||
| I might recode some of them as # | I might recode some of them as # | ||
| - | + | ||
| ecce_int case_op (ecce_int sym) { /* should be made a macro */ | ecce_int case_op (ecce_int sym) { /* should be made a macro */ | ||
| int chr = sym | casebit; | int chr = sym | casebit; | ||
| Línea 1874: | Línea 1800: | ||
| | | ||
| } | } | ||
| - | + | ||
| bool right (void) { | bool right (void) { | ||
| if (fp == lend) { | if (fp == lend) { | ||
| Línea 1882: | Línea 1808: | ||
| | | ||
| } | } | ||
| - | + | ||
| bool left (void) { | bool left (void) { | ||
| if (pp == lbeg) { | if (pp == lbeg) { | ||
| Línea 1890: | Línea 1816: | ||
| | | ||
| } | } | ||
| - | + | ||
| void right_star(void) { /* Another macro */ | void right_star(void) { /* Another macro */ | ||
| while (fp != lend) *pp++ = *fp++; | while (fp != lend) *pp++ = *fp++; | ||
| } | } | ||
| - | + | ||
| void left_star(void) { /* Likewise... */ | void left_star(void) { /* Likewise... */ | ||
| while (pp != lbeg) *--fp = *--pp; | while (pp != lbeg) *--fp = *--pp; | ||
| } | } | ||
| - | + | ||
| void move (void) { | void move (void) { | ||
| ok = TRUE; | ok = TRUE; | ||
| Línea 1912: | Línea 1838: | ||
| | | ||
| } | } | ||
| - | + | ||
| void move_back(void) { | void move_back(void) { | ||
| ok = TRUE; | ok = TRUE; | ||
| Línea 1927: | Línea 1853: | ||
| ms = NULL; | ms = NULL; | ||
| } | } | ||
| - | + | ||
| void move_star (void) { | void move_star (void) { | ||
| while (fp != fend) *pp++ = *fp++; | while (fp != fend) *pp++ = *fp++; | ||
| Línea 1936: | Línea 1862: | ||
| | | ||
| } | } | ||
| - | + | ||
| void move_back_star (void) { | void move_back_star (void) { | ||
| while (pp != fbeg) *--fp = *--pp; | while (pp != fbeg) *--fp = *--pp; | ||
| Línea 1945: | Línea 1871: | ||
| ms = NULL; | ms = NULL; | ||
| } | } | ||
| - | + | ||
| void insert (void) { | void insert (void) { | ||
| int p = pointer; | int p = pointer; | ||
| Línea 1956: | Línea 1882: | ||
| ms = NULL; | ms = NULL; | ||
| } | } | ||
| - | + | ||
| void insert_back (void) { | void insert_back (void) { | ||
| int p = pointer; | int p = pointer; | ||
| Línea 1967: | Línea 1893: | ||
| | | ||
| } | } | ||
| - | + | ||
| bool verify (void) { | bool verify (void) { | ||
| int x = pointer; | int x = pointer; | ||
| Línea 1973: | Línea 1899: | ||
| | | ||
| | | ||
| - | + | ||
| do { | do { | ||
| sym = case_op (text[x++]); | sym = case_op (text[x++]); | ||
| if_sym = case_op (*++y); | if_sym = case_op (*++y); | ||
| } while (sym == if_sym); | } while (sym == if_sym); | ||
| - | + | ||
| if (sym != 0) return (ok = FALSE); | if (sym != 0) return (ok = FALSE); | ||
| - | + | ||
| ms = fp; | ms = fp; | ||
| ml = y; | ml = y; | ||
| | | ||
| - | + | ||
| | | ||
| } | } | ||
| - | + | ||
| bool verify_back (void) { | bool verify_back (void) { | ||
| int x = pointer - 1; | int x = pointer - 1; | ||
| Línea 1993: | Línea 1919: | ||
| | | ||
| | | ||
| - | + | ||
| do { | do { | ||
| sym = case_op (text[++x]); | sym = case_op (text[++x]); | ||
| if_sym = case_op (*(pp - ++y)); | if_sym = case_op (*(pp - ++y)); | ||
| } while (sym == if_sym); | } while (sym == if_sym); | ||
| - | + | ||
| if (sym != 0) return (ok = FALSE); | if (sym != 0) return (ok = FALSE); | ||
| - | + | ||
| | | ||
| | | ||
| ms = NULL; | ms = NULL; | ||
| - | + | ||
| | | ||
| } | } | ||
| - | + | ||
| bool find (void) { | bool find (void) { | ||
| | | ||
| - | + | ||
| | | ||
| limit = lim[this_unit]; | limit = lim[this_unit]; | ||
| Línea 2027: | Línea 1953: | ||
| } | } | ||
| } | } | ||
| - | + | ||
| | | ||
| } | } | ||
| - | + | ||
| bool find_back (void) { | bool find_back (void) { | ||
| | | ||
| Línea 2046: | Línea 1972: | ||
| } | } | ||
| } | } | ||
| - | + | ||
| | | ||
| } | } | ||
| - | </code> | + | </file> |
