Herramientas de usuario

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anteriorRevisión previa
Próxima revisión
Revisión previa
ecce.c [2023/06/23 15:38] peronecce.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://ecce.sourceforge.net/ecce.c +
-   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 ecce.c +
-  +
-   You may need to do: export LC_ALL=en_US.UTF-8 +
-  +
-   Although it's reasonable portable C, there are now +
-   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.  Look for *SYS* +
-   in the source below.  Feedback portability improvements +
-   to gtoal@gtoal.com please.  Note that we assume that +
-   even a linux system is single-user.  The use of +
-   tmpnam() for saving in an emergency is potentially +
-   unsafe in a multi-user environment if there are +
-   bad actors. +
-  +
-   Version 2.10a adds support for more robust embedding +
-   of ecce in Emacs, by making a version of the "-command" +
-   parameter (-hex-command) accept a hex string in order +
-   to pass the ecce command as a parameter while avoiding +
-   problems such as the use of " characters in the ecce command. +
-  +
-  +
-*SYS* +
-Add this to your ~/.emacs file (or some equivalent for Windows): +
-  +
-;; hex encoding needed below. Came from https://github.com/jwiegley/emacs-release/blob/master/lisp/hex-util.el +
-(eval-when-compile +
-  (defmacro num-to-hex-char (num) +
-    `(aref "0123456789abcdef" ,num)) +
-  ) +
-  +
-(defun encode-hex-string (string) +
-  "Encode octet STRING to hexadecimal 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) +
-                         "/bin/bash" +
-                         t t nil +
-                         "-c" +
-                         (concat "ecce - - -hex-command " +
-                                 (concat (encode-hex-string (concat (concat (format "(r,m)%d(l,m-r0)?\n" (point)) ecce_command) +
-                                                                    (format "\ni/%%EMACS%dCURSOR%%/\n%%c" (+ 495620 oldpoint)) +
-                                                                    ) +
-                         ) " 2> ~/.ecce-emacs.err")) +
-    ) +
-    (goto-char (point-min)) +
-    (search-forward (format "%%EMACS%dCURSOR%%" (+ 495620 oldpoint))) +
-    (replace-match "" nil nil) +
-  ) +
-+
-  +
-(global-set-key "\C-e" 'e) +
-  +
- */ +
- +
 #define VERSION "V2.10b" /* %V */ #define VERSION "V2.10b" /* %V */
  static const char *RCS_Version = "$Revision: 1.4 $"; /* only relevant to my home linux /usr/local/src/ecce */  static const char *RCS_Version = "$Revision: 1.4 $"; /* only relevant to my home linux /usr/local/src/ecce */
 #define DATE "$Date: 2021/11/30 03:55:52 $" #define DATE "$Date: 2021/11/30 03:55:52 $"
- +
 #include <stdio.h> #include <stdio.h>
 #include <string.h> #include <string.h>
Línea 84: Línea 10:
 #include <signal.h> #include <signal.h>
 #include <errno.h> #include <errno.h>
- +
 #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 <wchar.h> #include <wchar.h>
 #include <locale.h> #include <locale.h>
- +
 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:
 /*                                                */ /*                                                */
 /*                                                */ /*                                                */
-/*     ECCE was designed by Hamish Dewar, now     */ +/*     ECCE fue diseñado por Hamish Dewar, ahora  */ 
-/* retired.  This implementation is by Graham     */ +/* retirado.  Esta implementación es de Graham    */ 
-/* 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 authorwithout restriction.            */+/* público por su autorsin restricciones        */
 /*                                                */ /*                                                */
 /* (c) Graham Toal, 1984. (Original BCPL version, */ /* (c) Graham Toal, 1984. (Original BCPL version, */
 /*   translated into C in 1992).                  */ /*   translated into C in 1992).                  */
 /**************************************************/ /**************************************************/
- +
 /**************************************************************************/ /**************************************************************************/
-  + 
- +
 #define NOTE_FILE "/tmp/Note0" /* Specific to Linux - unfortunately, /tmp is shared by other users */ #define NOTE_FILE "/tmp/Note0" /* Specific to Linux - unfortunately, /tmp is shared by other users */
              /* 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 "/dev/shm/Note0" // Specific to the variation of Linux I'm using (ram disk)  *SYS*/ /* #define NOTE_FILE "/dev/shm/Note0" // Specific to the variation of Linux I'm using (ram disk)  *SYS*/
- +
  /* I'm aware that this area of the code needs work to be made robust.  It looks like I can't  /* I'm aware that this area of the code needs work to be made robust.  It looks like I can't
    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 "/tmp/Note%c" would be a small improvement,  */               /* Something like "/tmp/Note%c" would be a small improvement,  */
               /* 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's)       */               /* to keep this source OS-independent. (without ifdef's)       */
- +
               /* 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 '0'        */               /* Index of variable part in name above (i.e. of '0'        */
- +
 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;
- +
 #define    F        /* FROM */ #define    F        /* FROM */
 #define    T        /* TO */ #define    T        /* TO */
 #define    L        /* LOG */ #define    L        /* LOG */
 #define    C        /* COMMAND */ #define    C        /* COMMAND */
- +
 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, 0L, SEEK_END);   (void)fseek(tmp, 0L, SEEK_END);
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 */
- +
 #define    bs              8 #define    bs              8
 #define    bell            7 #define    bell            7
Línea 200: Línea 126:
 #define    minusbit        casebit #define    minusbit        casebit
 #define    plusbit         0x80 #define    plusbit         0x80
- +
 /* 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.  I increased the size of these considerably    work on that eventually.  I increased the size of these considerably
Línea 210: Línea 136:
 #define    Max_parameter     4095 #define    Max_parameter     4095
 #define    Max_prompt_length 4095 #define    Max_prompt_length 4095
- +
 #define    rep             1 #define    rep             1
 #define    txt             2 #define    txt             2
Línea 229: Línea 155:
 #define    star            8 #define    star            8
 #define    termin          15 #define    termin          15
- +
 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   max_unit; static int   max_unit;
 static ecce_int pending_sym; static ecce_int pending_sym;
- +
 /* significance of file pointers using the 'buffer gap' method: */ /* significance of file pointers using the 'buffer gap' method: */
- +
 /* [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's implementations forced the top part of the buffer out /* Hamish's implementations forced the top part of the buffer out
    to file when the buffer was full (cf 'makespace()'); this isn't    to file when the buffer was full (cf 'makespace()'); this isn't
    really an option in today's environment.  Alternative choices    really an option in today's environment.  Alternative choices
    are:    are:
- +
    1) crash.  (what we did, prior to 2.7)    1) crash.  (what we did, prior to 2.7)
    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 'insert string' operation would fail    A complete 'get line' or 'insert string' operation would fail
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] = {
    ext+termin,          /*NL*/    ext+termin,          /*NL*/
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 (('0' <= c) && (c <= '9')) return c - '0';   if (('0' <= c) && (c <= '9')) return c - '0';
   if (('A' <= c) && (c <= 'F')) return c - 'A' + 10;   if (('A' <= c) && (c <= 'F')) return c - 'A' + 10;
   if (('a' <= c) && (c <= 'f')) return c - 'a' + 10;   if (('a' <= c) && (c <= 'f')) return c - 'a' + 10;
-  fprintf(stderr, "%s: hex-command parameter corrupt - char '%c' is not hex\n", ProgName, c);+  fprintf(stderr, "%s: hex-command parámetro corrupto - char '%c' no es hex\n", ProgName, c);
   exit(1);   exit(1);
 } }
- +
 char *hex_to_ascii(char *hex) { char *hex_to_ascii(char *hex) {
   static char commandline[Max_parameter], *f, *t;   static char commandline[Max_parameter], *f, *t;
   if (strlen(hex)/2+3 >= Max_parameter) {   if (strlen(hex)/2+3 >= Max_parameter) {
-    fprintf(stderr, "%s: hex-command parameter was too long.\n", ProgName);+    fprintf(stderr, "%s: hex-command parámetro muy largo.\n", ProgName);
     exit(1);     exit(1);
   }   }
Línea 543: Línea 469:
     c1 = h(*f++);     c1 = h(*f++);
     if (*f == '\0') {     if (*f == '\0') {
-      fprintf(stderr, "%s: hex-command parameter corrupt. (Odd noof chars)\n", ProgName);+      fprintf(stderr, "%s: hex-command parámetro corrupto. (nroimpar de caracteres)\n", ProgName);
       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't use UTF-8 encoding    /* If your native locale doesn't use UTF-8 encoding 
Línea 568: Línea 494:
   char *locale = setlocale(LC_ALL, "");   char *locale = setlocale(LC_ALL, "");
 #endif #endif
- +
   backup_save = tmpnam(backup_save_buf);  /*SYS*/   backup_save = tmpnam(backup_save_buf);  /*SYS*/
- +
   /* Historical code, not really needed nowadays as   /* Historical code, not really needed nowadays as
      people only use Windows and Unix variants :-( */      people only use Windows and Unix variants :-( */
- +  
   ProgName = argv[0];   ProgName = argv[0];
   s = strrchr(ProgName, '/');   s = strrchr(ProgName, '/');
Línea 582: Línea 508:
   ProgName = malloc(strlen(s)+1); strcpy(ProgName, s);   ProgName = malloc(strlen(s)+1); strcpy(ProgName, s);
   s = strchr(ProgName, '.'); if (s != NULL) *s = '\0';   s = strchr(ProgName, '.'); if (s != NULL) *s = '\0';
- +
   /* 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] == '-') offset += 1;       if (argv[argno][1] == '-') offset += 1;
-      if (strcmp(argv[argno]+offset, "from") == 0) {+      if (strcmp(argv[argno]+offset, "desde") == 0) {
         parameter[F] = argv[argno+1];         parameter[F] = argv[argno+1];
-      } else if (strcmp(argv[argno]+offset, "to") == 0) {+      } else if (strcmp(argv[argno]+offset, "a") == 0) {
         parameter[T] = argv[argno+1];         parameter[T] = argv[argno+1];
       } else if (strcmp(argv[argno]+offset, "log") == 0) {       } else if (strcmp(argv[argno]+offset, "log") == 0) {
Línea 597: Línea 523:
       } else if (strcmp(argv[argno]+offset, "hex-command") == 0) {       } else if (strcmp(argv[argno]+offset, "hex-command") == 0) {
         if (parameter[C] != NULL) {         if (parameter[C] != NULL) {
-          fprintf(stderr, "%s: only one -hex-command \"...\" or -command \"...\" is allowed\n", ProgName);+          fprintf(stderr, "%s: solo un -hex-command \"...\" -comando \"...\" se permite\n", ProgName);
           exit(1);           exit(1);
         }         }
Línea 613: Línea 539:
         buffer_size = strtoul(buf_size_str, &endptr, 10);         buffer_size = strtoul(buf_size_str, &endptr, 10);
         if (errno != 0) {         if (errno != 0) {
-          fprintf(stderr, "%s: parámetro de tamaño malo '%s'\n", ProgName, buf_size_str);+          fprintf(stderr, "%s: parámetro de tamaño incorrecto '%s'\n", ProgName, buf_size_str);
           exit(1);           exit(1);
  }  }
Línea 624: Línea 550:
    } else {    } else {
             fprintf(stderr,             fprintf(stderr,
-                    "%s: tipo de unidad mala '%s' (espero %luK o %luM)\n",+                    "%s: tipo incorrecto de unidad '%s' (se espera %luK o %luM)\n",
                     ProgName, endptr, buffer_size, buffer_size);                     ProgName, endptr, buffer_size, buffer_size);
             exit(1);             exit(1);
Línea 631: Línea 557:
       } else {       } else {
         fprintf (stderr,         fprintf (stderr,
-                 "%s: opción desconocida'%s'\n",+                 "%s: Opción desconocida '%s'\n",
  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]);
    parameter[F] = argv[1];    parameter[F] = argv[1];
- +
    if (parameter[F] == NULL) {    if (parameter[F] == NULL) {
       fprintf (stderr,       fprintf (stderr,
-         "%s: {-from} fichero_entrada {{-to} fichero_salida}? {-log archivo}? {-{hex-}command 'comandos;%%c'} {-size bytes}?\n",+         "%s: {-desde} fichero_entrada {{-to} fichero_salida}? {-log fichero}? {-{hex-}comando 'comandos;%%c'} {-tamaño_ bytes}?\n",
           ProgName);           ProgName);
       exit (30);       exit (30);
    }    }
- +
    IntSeen = FALSE;    IntSeen = FALSE;
- +
    tty_in = stdin;    tty_in = stdin;
    tty_out = stderr;    tty_out = stderr;
- +
    if ((strcmp(parameter[F], "-") == 0) || (strcmp(parameter[F], "/dev/stdin") == 0)) {  /*SYS*/    if ((strcmp(parameter[F], "-") == 0) || (strcmp(parameter[F], "/dev/stdin") == 0)) {  /*SYS*/
       /* 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, "%s: \"-command '...'\" opción requerida cuando el fichero de entrada es la entrada estándar\n", ProgName); exit(1);+        fprintf(stderr, "%s: \"-comando '...'\" opción requerida cuando el fichero de entrada es la entrada estándar\n", ProgName); exit(1);
       }        } 
       main_in = stdin;       main_in = stdin;
Línea 667: Línea 593:
       tty_in = fopen("/dev/tty", "rb"); /*SYS*/       tty_in = fopen("/dev/tty", "rb"); /*SYS*/
       if (tty_in) {       if (tty_in) {
- fprintf(stderr, "%s: usando /dev/tty para la entrada de comando\n", ProgName);+ fprintf(stderr, "%s: usando /dev/tty para entrada de comando\n", ProgName);
       } else {       } else {
             tty_in = fopen("CON:", "r");             tty_in = fopen("CON:", "r");
             if (tty_in) {              if (tty_in) { 
-        fprintf(stderr, "%s: using CON: for command input\n", ProgName);+        fprintf(stderr, "%s: usando CON: para entrada de comando\n", ProgName);
      } else {      } else {
                tty_in = fopen("/dev/null", "rb");                tty_in = fopen("/dev/null", "rb");
                if (tty_in == NULL) tty_in = fopen("NUL:", "rb");                if (tty_in == NULL) tty_in = fopen("NUL:", "rb");
-        fprintf(stderr, "%s: cuidado - no hay cadena de entrada de comando\n", ProgName);+        fprintf(stderr, "%s: cuidado - no hay cadena de entrado de comando\n", ProgName);
                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], "rb");       main_in = fopen (parameter[F], "rb");
    }    }
- +
    if (main_in == NULL) {    if (main_in == NULL) {
       fprintf (stderr, "Fichero \"%s\" no encontrado\n", parameter[F]);       fprintf (stderr, "Fichero \"%s\" no encontrado\n", parameter[F]);
       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], "wb");       log_out = fopen (parameter[L], "wb");
       if (log_out == NULL) {       if (log_out == NULL) {
-         fprintf (stderr, "%s: Advertencia - No puedo crear \"%s\"\n",+         fprintf (stderr, "%s: Cuidado - No puedo crear \"%s\"\n",
           ProgName, parameter[L]);           ProgName, parameter[L]);
       }       }
    }    }
- +
    init_globals ();    init_globals ();
- +
    a[0]           = '\n';    a[0]           = '\n';
    a[buffer_size] = '\n';    a[buffer_size] = '\n';
- +
    fprintf (tty_out, "Ecce\n");    fprintf (tty_out, "Ecce\n");
- +
    if (main_in != NULL) load_file ();    if (main_in != NULL) load_file ();
- +
    signal(SIGINT, &gotint);    signal(SIGINT, &gotint);
- +
    percent ('E'); /* Select either-case searches, case-flipping C command. */    percent ('E'); /* Select either-case searches, case-flipping C command. */
    for (;;) {    for (;;) {
Línea 718: Línea 644:
          if (!printed) execute_command ();          if (!printed) execute_command ();
       }       }
- +
       if (IntSeen) {       if (IntSeen) {
         signal(SIGINT, &gotint);         signal(SIGINT, &gotint);
- +
         IntSeen = FALSE;         IntSeen = FALSE;
         fprintf(stderr, "* Escape!\n");         fprintf(stderr, "* Escape!\n");
       }       }
- +
    }    }
 } }
- +
 void init_globals (void) { void init_globals (void) {
- +
    a = malloc ((buffer_size+1) * sizeof(ecce_char));    a = malloc ((buffer_size+1) * sizeof(ecce_char));
- +
    note_file = malloc (Max_parameter+1);    note_file = malloc (Max_parameter+1);
- +
    com  = (ecce_int *) malloc ((Max_command_units+1)*sizeof(ecce_int));    com  = (ecce_int *) malloc ((Max_command_units+1)*sizeof(ecce_int));
    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));
- +
    com_prompt = malloc (Max_prompt_length+1);    com_prompt = malloc (Max_prompt_length+1);
- +
    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 espacio de almacenamiento\n");
       free_buffers();       free_buffers();
       exit (40);       exit (40);
    }    }
-  + 
-   fprintf (stderr, "Espacio de buffer = %d KBytes\n", (int)(buffer_size>>10)); +   fprintf (stderr, "Espacio de Almacén = %d KBytes\n", (int)(buffer_size>>10)); 
-  + 
- +
    fbeg = a+1;    fbeg = a+1;
    lbeg = fbeg;    lbeg = fbeg;
Línea 767: Línea 693:
    pending_sym = '\n';    pending_sym = '\n';
    blank_line = TRUE;    blank_line = TRUE;
- +
    (void)strcpy (note_file, NOTE_FILE);    (void)strcpy (note_file, NOTE_FILE);
    noted = NULL;    noted = NULL;
Línea 774: Línea 700:
    (void)strcpy (com_prompt, ">");    (void)strcpy (com_prompt, ">");
 } }
- +
 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. */
    ecce_int lsym;    ecce_int lsym;
- +
    if (commandp) {    if (commandp) {
       lsym = *commandp;       lsym = *commandp;
Línea 800: Línea 726:
       return;       return;
    }    }
- +
    if (blank_line) {fprintf(tty_out, "%s", eprompt); fflush(tty_out); }    /* stderr usually unbuffered, but flush needed for cygwin */    if (blank_line) {fprintf(tty_out, "%s", eprompt); fflush(tty_out); }    /* stderr usually unbuffered, but flush needed for cygwin */
- +
    lsym = fgetwc (tty_in);    lsym = fgetwc (tty_in);
    if (IntSeen) {    if (IntSeen) {
Línea 811: Línea 737:
      fputwc('^', tty_out); fputwc('C', tty_out); fputwc('\n', tty_out);      fputwc('^', tty_out); fputwc('C', tty_out); fputwc('\n', tty_out);
    }    }
- +   
    if (lsym == WEOF) {    if (lsym == WEOF) {
- +
       IntSeen = FALSE;       IntSeen = FALSE;
       signal(SIGINT, SIG_IGN);       signal(SIGINT, SIG_IGN);
       fputwc('\n', tty_out); /* Undo the prompt */       fputwc('\n', tty_out); /* Undo the prompt */
- +
       percent ('c');       percent ('c');
       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 (('a' <= culprit) && (culprit <= 'z')) {    if (('a' <= culprit) && (culprit <= 'z')) {
       dirn_sign = '-';       dirn_sign = '-';
Línea 858: Línea 784:
    return (ok = FALSE);    return (ok = FALSE);
 } }
-  + 
- +
 void read_item(void) { void read_item(void) {
    ecce_int saved_digit;    ecce_int saved_digit;
Línea 866: Línea 792:
    type = sym_type(sym);    type = sym_type(sym);
    if ((type & ext) == 0) return;    if ((type & ext) == 0) return;
- +
    switch (type & 15) {    switch (type & 15) {
- +
       case star:       case star:
          number = 0L;          number = 0L;
          return;          return;
- +
       case pling:       case pling:
          number = stopper-1;          number = stopper-1;
          return;          return;
- +
       case dig:       case dig:
          saved_digit = sym;          saved_digit = sym;
Línea 887: Línea 813:
          sym = saved_digit; /* for printing in errors */          sym = saved_digit; /* for printing in errors */
          return;          return;
- +
       default:       default:
          return;          return;
    }    }
 } }
- +
 void percent (ecce_int Command_sym) { void percent (ecce_int Command_sym) {
    static int note_sec = '0'; /* This one MUST be a static */    static int note_sec = '0'; /* This one MUST be a static */
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;
    }    }
    switch (Command_sym) {    switch (Command_sym) {
- +
       case 'L':       case 'L':
          to_upper_case = ~0;          to_upper_case = ~0;
Línea 913: Línea 839:
          caseflip = 0;          caseflip = 0;
          break;          break;
- +
       case 'U':       case 'U':
          to_upper_case = ~casebit;          to_upper_case = ~casebit;
Línea 920: Línea 846:
          caseflip = 0;          caseflip = 0;
          break;          break;
- +
       case 'N':       case 'N':
          to_upper_case = ~0;          to_upper_case = ~0;
Línea 926: Línea 852:
          caseflip = casebit;          caseflip = casebit;
          break;          break;
- +
       case 'E':       case 'E':
          to_upper_case = ~casebit; /* Only for searches - not in C command */          to_upper_case = ~casebit; /* Only for searches - not in C command */
Línea 939: Línea 865:
          fprintf (tty_out, " en C %s\n", DATE+7);          fprintf (tty_out, " en C %s\n", DATE+7);
          break;          break;
- +
       case 'W':       case 'W':
  if ((strcmp(parameter[parameter[T] == NULL ? F : T], "-") == 0) ||  if ((strcmp(parameter[parameter[T] == NULL ? F : T], "-") == 0) ||
             ((parameter[T] != NULL) && (strcmp(parameter[T], "/dev/stdout") == 0))) { /*SYS*/             ((parameter[T] != NULL) && (strcmp(parameter[T], "/dev/stdout") == 0))) { /*SYS*/
-           fprintf(stderr, "* %%W is not allowed when the output file is stdout\n");+           fprintf(stderr, "* %%W no está permitido cuando la salida del fichero es stdout\n");
     break;     break;
  }  }
       case 'C':       case 'C':
          do { read_sym (); } while (sym_type(sym) != sym_type(';'));          do { read_sym (); } while (sym_type(sym) != sym_type(';'));
- +   
       case 'c':       case 'c':
- +
          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 */
          /*************** This block is copied from the %S code below;          /*************** This block is copied from the %S code below;
Línea 966: Línea 892:
             (void)strcpy (com_prompt, ">");             (void)strcpy (com_prompt, ">");
             if (sec_out == NULL) {             if (sec_out == NULL) {
-               (void) fail_with ("No puedo salvar contexto", ' ');+               (void) fail_with ("No puedo guardar contexto", ' ');
                break;                break;
             }             }
Línea 998: Línea 924:
             if (main_out == NULL) {             if (main_out == NULL) {
                fprintf(stderr,                fprintf(stderr,
-                       "Lo siento - No puedo salvar su edición (incluso %s falló)\n", backup_save);+                       "Lo siento, no puedo guardar su edición (incluso %s ha fallado)\n", backup_save);
                exit(90);                exit(90);
             }             }
Línea 1009: Línea 935:
             if (main_out == NULL) {             if (main_out == NULL) {
                fprintf (stderr,                fprintf (stderr,
-                        "No puedo crear \"%s\" - intento salvar en %s en su lugar\n",+                        "No puedo crear \"%s\" - intento guardarlo en %s en su lugar\n",
                         parameter[inoutlog], backup_save);                         parameter[inoutlog], backup_save);
                main_out = fopen (backup_save, "w");                main_out = fopen (backup_save, "w");
                if (main_out == NULL) {                if (main_out == NULL) {
-                 fprintf(stderr, "No puedo salvar el fichero de ninguna forma. Me rindo. Lo siento!\n");+                 fprintf(stderr, "Imposible guardar fichero de todos modos. Me rindo. Lo siento!\n");
                  exit(1);                  exit(1);
         }         }
Línea 1019: Línea 945:
                if (inoutlog == T) {                if (inoutlog == T) {
                   fprintf (tty_out,                   fprintf (tty_out,
-                           "Ecce: Guardando %s a %s.\n", parameter[F], parameter[T]);+                           "Ecce %s a %s completando.\n", parameter[F], parameter[T]);
                } else {                } else {
-                  fprintf (tty_out, "Ecce: Guardando %s.\n", parameter[F]);+                  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 == 'W') {          if (Command_sym == 'W') {
             pending_sym = '\n';             pending_sym = '\n';
             break;             break;
          }          }
- +
          if (log_out != NULL) {          if (log_out != NULL) {
             fclose (log_out);             fclose (log_out);
          }          }
-/*         fprintf (tty_out, "Ecce completado\n");      */+/*         fprintf (tty_out, "Ecce complete\n");      */
          free_buffers ();          free_buffers ();
          exit (0);          exit (0);
- +
       case 'A':       case 'A':
          if (log_out != NULL) {          if (log_out != NULL) {
Línea 1053: Línea 979:
          free_buffers ();          free_buffers ();
          exit (60);          exit (60);
- +
       case 'S':       case 'S':
          local_echo (&sec_no);          local_echo (&sec_no);
Línea 1093: Línea 1019:
             (void)strcpy (com_prompt, ">");             (void)strcpy (com_prompt, ">");
             if (sec_out == NULL) {             if (sec_out == NULL) {
-               (void) fail_with ("No puedo salvar contexto", ' ');+               (void) fail_with ("No puede guardar contexto", ' ');
                return;                return;
             }             }
Línea 1126: Línea 1052:
             if (sec_in == NULL) {             if (sec_in == NULL) {
                if (file_wanted) {                if (file_wanted) {
-                  (void) fail_with ("No puedo abrir fichero", ' ');+                  (void) fail_with ("No puede abrir fichero", ' ');
                } else {                } else {
-                  (void) fail_with ("Contexto desconocido", sec_no);+                  (void) fail_with ("Context desconocido", sec_no);
                }                }
                return;                return;
Línea 1136: Línea 1062:
             in_second = TRUE;             in_second = TRUE;
             *pp = '\n';             *pp = '\n';
- +
             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:
          }          }
          break;          break;
- +
       default:       default:
          (void) fail_with ("Porciento", Command_sym);          (void) fail_with ("Porciento", Command_sym);
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) {
    com[this_unit]  = command;    com[this_unit]  = command;
Línea 1183: Línea 1109:
    this_unit++;    this_unit++;
 } }
- +
 void execute_command(void) { void execute_command(void) {
    cindex i;    cindex i;
    ecce_int sym;    ecce_int sym;
- +
    ok = TRUE;    ok = TRUE;
    switch (command & (~plusbit)) {    switch (command & (~plusbit)) {
- +
       case 'p':       case 'p':
       case 'P':       case 'P':
Línea 1227: Línea 1153:
          }          }
          return;          return;
- +
       case 'g':       case 'g':
       case 'G':       case 'G':
          local_echo (&sym);          local_echo (&sym);
- +
          if (sym == ':') {          if (sym == ':') {
             local_echo (&sym);             local_echo (&sym);
Línea 1242: Línea 1168:
          left_star();          left_star();
          for (;;) {          for (;;) {
-            if (pp == fp) /* LLENO! */ { ok = FALSE; } else *pp++ = sym;+            if (pp == fp) /* FULL! */ { ok = FALSE; } else *pp++ = sym;
             if (sym == '\n') break;             if (sym == '\n') break;
             local_echo (&sym);             local_echo (&sym);
Línea 1252: Línea 1178:
          }          }
          return;          return;
- +
       case 'E':       case 'E':
          if (fp == lend) {          if (fp == lend) {
Línea 1263: Línea 1189:
          } else fp++;          } else fp++;
          return;          return;
- +
       case 'e':       case 'e':
          if (pp == lbeg) {          if (pp == lbeg) {
Línea 1274: Línea 1200:
          } else --pp;          } else --pp;
          return;          return;
- +
       case 'C':       case 'C':
          if (fp == lend) {          if (fp == lend) {
Línea 1291: Línea 1217:
          }          }
          return;          return;
- +
       case 'c':       case 'c':
          if (pp == lbeg) {          if (pp == lbeg) {
Línea 1308: Línea 1234:
          }          }
          return;          return;
- +
       case 'l':       case 'l':
       case 'R':       case 'R':
Línea 1317: Línea 1243:
          ms_back = NULL;          ms_back = NULL;
          return;          return;
- +
       case 'r':       case 'r':
       case 'L':       case 'L':
Línea 1326: Línea 1252:
          ms = NULL;          ms = NULL;
          return;          return;
- +
       case 'B':       case 'B':
-         if (pp == fp) /* LLENO! */ { ok = FALSE; return; }+         if (pp == fp) /* FULL! */ { ok = FALSE; return; }
          *pp++ = '\n';          *pp++ = '\n';
          lbeg = pp;          lbeg = pp;
          return;          return;
- +
       case 'b':       case 'b':
-         if (pp == fp) /* LLENO! */ { ok = FALSE; return; }+         if (pp == fp) /* FULL! */ { ok = FALSE; return; }
          *--fp = '\n';          *--fp = '\n';
          lend = fp;          lend = fp;
          return;          return;
- +
       case 'J':       case 'J':
          right_star();          right_star();
Línea 1349: Línea 1275:
             lend++;             lend++;
          return;          return;
- +
       case 'j':       case 'j':
          left_star();          left_star();
Línea 1360: Línea 1286:
          lbeg++;          lbeg++;
          return;          return;
- +
       case 'M':       case 'M':
          if (repeat_count == 0L) {          if (repeat_count == 0L) {
Línea 1369: Línea 1295:
          }          }
          return;          return;
- +
       case 'm':       case 'm':
          if (repeat_count == 0L) {          if (repeat_count == 0L) {
Línea 1378: Línea 1304:
          }          }
          return;          return;
- +
       case 'k':       case 'k':
       case 'K':       case 'K':
Línea 1394: Línea 1320:
          while (*lend != '\n') lend++;          while (*lend != '\n') lend++;
          return;          return;
- +
       case 'V':       case 'V':
          (void) verify ();          (void) verify ();
          return;          return;
- +
       case 'v':       case 'v':
          (void) verify_back ();          (void) verify_back ();
          return;          return;
- +
       case 'F':       case 'F':
          (void) find ();          (void) find ();
          return;          return;
- +
       case 'f':       case 'f':
          (void) find_back ();          (void) find_back ();
          return;          return;
- +
       case 'U':       case 'U':
          if (!find ()) return;          if (!find ()) return;
Línea 1418: Línea 1344:
          lbeg++;          lbeg++;
          return;          return;
- +
       case 'u':       case 'u':
          if (!find_back ()) return;          if (!find_back ()) return;
Línea 1426: Línea 1352:
             lend++;             lend++;
          return;          return;
- +
       case 'D':       case 'D':
          if (!find ()) return;          if (!find ()) return;
Línea 1432: Línea 1358:
          ms = fp;          ms = fp;
          return;          return;
- +
       case 'd':       case 'd':
          if (!find_back ()) return;          if (!find_back ()) return;
Línea 1438: Línea 1364:
          ms_back = pp;          ms_back = pp;
          return;          return;
- +
       case 'T':       case 'T':
          if (!find ()) return;          if (!find ()) return;
          while (fp != ml) *pp++ = *fp++;          while (fp != ml) *pp++ = *fp++;
          return;          return;
- +
       case 't':       case 't':
          if (!find_back ()) return;          if (!find_back ()) return;
          while (pp != ml_back) *--fp = *--pp;          while (pp != ml_back) *--fp = *--pp;
          return;          return;
- +
       case 'I':       case 'I':
          insert ();          insert ();
          return;          return;
- +
       case 'i':       case 'i':
          insert_back ();          insert_back ();
          return;          return;
- +
       case 's':       case 's':
       case 'S':       case 'S':
Línea 1473: Línea 1399:
          }          }
          return;          return;
- +
       case '(':       case '(':
          num[pointer] = repeat_count;          num[pointer] = repeat_count;
          repeat_count = 1L;          repeat_count = 1L;
          return;          return;
- +
       case ')':       case ')':
          --(num[this_unit]);          --(num[this_unit]);
Línea 1486: Línea 1412:
          repeat_count = 1L;          repeat_count = 1L;
          return;          return;
- +
       case '\\':       case '\\':
          ok = FALSE;          ok = FALSE;
          return;          return;
- +
       case '?':       case '?':
          return;          return;
- +
       case ',':       case ',':
          this_unit = pointer - 1;          this_unit = pointer - 1;
          return;          return;
- +
       case 'N':       case 'N':
          noted = pp;          noted = pp;
          changes = fp-pp;          changes = fp-pp;
          return;          return;
- +
       case 'A':       case 'A':
          if ((noted == NULL)          if ((noted == NULL)
Línea 1514: Línea 1440:
             FILE *note_out = fopen (note_file, "wb");             FILE *note_out = fopen (note_file, "wb");
             cindex p = noted;             cindex p = noted;
- +
             if (note_out == NULL) {             if (note_out == NULL) {
                ok = FALSE;                ok = FALSE;
                return;                return;
             }             }
- +
             do {             do {
                fputwc (*p++, note_out);                fputwc (*p++, note_out);
             } 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;
          return;          return;
- +
       case 'H':       case 'H':
          note_file[CONTEXT_OFFSET] = lim[this_unit]+'0';          note_file[CONTEXT_OFFSET] = lim[this_unit]+'0';
Línea 1542: Línea 1468:
                return;                return;
             }             }
- +
             { cindex p = pp;             { cindex p = pp;
- +
                for (;;) {                for (;;) {
                   sym = fgetwc(note_in);                   sym = fgetwc(note_in);
Línea 1562: Línea 1488:
          }          }
          return;          return;
- +
       default:       default:
-         (void) fail_with ("Comando no reconocido", command);+         (void) fail_with ("Comando desconocido", command);
          return;          return;
    }    }
 } }
- +
 void Scan_sign(void) { void Scan_sign(void) {
    read_sym ();    read_sym ();
Línea 1580: Línea 1506:
    }    }
 } }
- +
 void Scan_scope(void) {                      /* ditto macro */ void Scan_scope(void) {                      /* ditto macro */
    ecce_int uppercase_command = command & (~(minusbit | plusbit));    ecce_int uppercase_command = command & (~(minusbit | plusbit));
Línea 1591: Línea 1517:
    }    }
 } }
- + 
 void Scan_text(void) { void Scan_text(void) {
    ecce_int last;    ecce_int last;
- +
    read_sym ();    read_sym ();
    last = sym;    last = sym;
Línea 1629: Línea 1555:
    ok = TRUE;    ok = TRUE;
 } }
- +
 void Scan_repeat (void) { void Scan_repeat (void) {
    number = 1L;    number = 1L;
Línea 1636: Línea 1562:
    repeat_count = number;    repeat_count = number;
 } }
- +
 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 {
          switch (type & 15) {          switch (type & 15) {
- +
             case termin:             case termin:
                pending_sym = '\n';  /* for skipping on error */                pending_sym = '\n';  /* for skipping on error */
                unchain ();                unchain ();
                if (pointer >= 0) {                if (pointer >= 0) {
-                  return (fail_with ("Missing", ')'));+                  return (fail_with ("Faltante", ')'));
                }                }
                max_unit = this_unit;                max_unit = this_unit;
Línea 1706: Línea 1632:
                stack ();                stack ();
                return (ok);                return (ok);
- +
             case lpar:             case lpar:
                command = '(';                command = '(';
Línea 1712: Línea 1638:
                last_unit = this_unit;                last_unit = this_unit;
                break;                break;
- +
             case comma:             case comma:
                command = ',';                command = ',';
Línea 1718: Línea 1644:
                last_unit = this_unit;                last_unit = this_unit;
                break;                break;
- +
             case rpar:             case rpar:
                command = ')';                command = ')';
Línea 1735: Línea 1661:
     /* on items */     /* on items */
 } }
- +
 void load_file (void) { void load_file (void) {
    cindex p = fbeg;    cindex p = fbeg;
    ecce_int sym;    ecce_int sym;
- +
    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) {
-           fprintf (stderr, "File too large!\n");+           fprintf (stderr, "Fichero muy grande!\n");
            percent ('A');            percent ('A');
         }         }
       }       }
- +
       sym = fgetwc(main_in);       sym = fgetwc(main_in);
 #ifdef WANT_UTF8 #ifdef WANT_UTF8
       if (errno == EILSEQ) {       if (errno == EILSEQ) {
- fprintf(stderr, "Se hencontró un caracter ancho. Puede necesitar usar: export LC_ALL=en_US.UTF-8\n");  /*SYS*/+ fprintf(stderr, "Se encontró un caracter ancho inválido. Puede necesitar ejecutar: export LC_ALL=en_US.UTF-8\n");  /*SYS*/
  exit(1);                                                  exit(1);                                                
       }       }
Línea 1759: Línea 1685:
    }    }
    fclose (main_in);    fclose (main_in);
- +
    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) {
    ecce_int culprit;    ecce_int culprit;
- +
    command = com[this_unit];    command = com[this_unit];
    culprit = command;    culprit = command;
    pointer = link[this_unit];    pointer = link[this_unit];
- +
    repeat_count = num[this_unit];    repeat_count = num[this_unit];
    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 ')': /* Should test for '\\' and '?' following? */                case ')': /* Should test for '\\' and '?' following? */
                   --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;
- +
                default: /* Possible bugfix - what happens on missing cases? */;                default: /* Possible bugfix - what happens on missing cases? */;
             }             }
             if (com[this_unit] == 0) {/* 0 denotes end of command-line. */             if (com[this_unit] == 0) {/* 0 denotes end of command-line. */
-               return (fail_with ("Fracaso:", culprit));+               return (fail_with ("Fallo:", culprit));
             }             }
           /* end of seq */           /* end of seq */
Línea 1839: Línea 1765:
    } /* executing repeats */    } /* executing repeats */
 } }
- +
 void execute_all (void) { void execute_all (void) {
    eprompt = ":";    eprompt = ":";
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 #define'd macros */    I might recode some of them as #define'd macros */
- +
 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:
    return (sym);    return (sym);
 } }
- +
 bool right (void) { bool right (void) {
    if (fp == lend) {    if (fp == lend) {
Línea 1882: Línea 1808:
    return (ok = TRUE);    return (ok = TRUE);
 } }
- +
 bool left (void) { bool left (void) {
    if (pp == lbeg) {    if (pp == lbeg) {
Línea 1890: Línea 1816:
    return (ok = TRUE);    return (ok = TRUE);
 } }
- +
 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:
    ms_back = NULL;    ms_back = NULL;
 } }
- +
 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:
    ms_back = NULL;    ms_back = NULL;
 } }
- +
 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:
    ms_back = NULL;    ms_back = NULL;
 } }
- +
 bool verify (void) { bool verify (void) {
    int x = pointer;    int x = pointer;
Línea 1973: Línea 1899:
    ecce_int if_sym;    ecce_int if_sym;
    ecce_int sym ;    ecce_int sym ;
- +
    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;
    ms_back = NULL;    ms_back = NULL;
- +
    return (ok = TRUE);    return (ok = TRUE);
 } }
- +
 bool verify_back (void) { bool verify_back (void) {
    int x = pointer - 1;    int x = pointer - 1;
Línea 1993: Línea 1919:
    ecce_int if_sym;    ecce_int if_sym;
    ecce_int sym;    ecce_int sym;
- +
    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_back = pp;    ms_back = pp;
    ml_back = pp - y + 1;    ml_back = pp - y + 1;
    ms = NULL;    ms = NULL;
- +
    return (ok = TRUE);    return (ok = TRUE);
 } }
- +
 bool find (void) { bool find (void) {
    ecce_int sym = text[pointer] | casebit;    ecce_int sym = text[pointer] | casebit;
- +
    pp_before = pp;    pp_before = pp;
    limit = lim[this_unit];    limit = lim[this_unit];
Línea 2027: Línea 1953:
       }       }
    }    }
- +
    return (ok = FALSE);    return (ok = FALSE);
 } }
- +
 bool find_back (void) { bool find_back (void) {
    fp_before = fp;    fp_before = fp;
Línea 2046: Línea 1972:
       }       }
    }    }
- +
    return (ok = FALSE);    return (ok = FALSE);
 } }
-</code>+</file>

Este sitio web utiliza cookies para guardar datos esenciales de su actividad, como su autenticación. Al entrar acepta el uso de cookies.

Más información