date and time created 83/02/11 15:44:54 by rrh
[unix-history] / usr / src / usr.bin / ex / ex_temp.h
index 438367a..935c425 100644 (file)
@@ -1,12 +1,13 @@
-/* Copyright (c) 1979 Regents of the University of California */
+/* Copyright (c) 1981 Regents of the University of California */
+/* sccs id:    @(#)ex_temp.h   7.3     %G%  */
 /*
  * The editor uses a temporary file for files being edited, in a structure
  * similar to that of ed.  The first block of the file is used for a header
  * block which guides recovery after editor/system crashes.
  * Lines are represented in core by a pointer into the temporary file which
 /*
  * The editor uses a temporary file for files being edited, in a structure
  * similar to that of ed.  The first block of the file is used for a header
  * block which guides recovery after editor/system crashes.
  * Lines are represented in core by a pointer into the temporary file which
- * is packed into 16 bits.  15 of these bits index the temporary file,
- * the 16'th is used by global commands.  The parameters below control
- * how much the 15 bits are shifted left before they index the temp file.
+ * is packed into 16 bits (32 on VMUNIX).  All but the low bit index the temp
+ * file; the last is used by global commands.  The parameters below control
+ * how much the other bits are shifted left before they index the temp file.
  * Larger shifts give more slop in the temp file but allow larger files
  * to be edited.
  *
  * Larger shifts give more slop in the temp file but allow larger files
  * to be edited.
  *
  *
  * The following temp file parameters allow 256k bytes in the temporary
  * file.  By changing to the numbers in comments you can get 512k.
  *
  * The following temp file parameters allow 256k bytes in the temporary
  * file.  By changing to the numbers in comments you can get 512k.
- * By typedefing line to long (32 bit) integers you could get much more
- * space in the temp file with (then) no waste.  This would double core
- * requirements and would probably require some editor debugging.
+ * For VMUNIX you get more than you could ever want.
+ * VMUNIX uses long (32 bit) integers giving much more
+ * space in the temp file and no waste.  This doubles core
+ * requirements but allows files of essentially unlimited size to be edited.
  */
  */
+#ifndef VMUNIX
 #define        BLKMSK  0777            /* 01777 */
 #define        BNDRY   8               /* 16 */
 #define        INCRMT  0200            /* 0100 */
 #define        BLKMSK  0777            /* 01777 */
 #define        BNDRY   8               /* 16 */
 #define        INCRMT  0200            /* 0100 */
 #define        OFFBTS  7               /* 6 */
 #define        OFFMSK  0177            /* 077 */
 #define        SHFT    2               /* 3 */
 #define        OFFBTS  7               /* 6 */
 #define        OFFMSK  0177            /* 077 */
 #define        SHFT    2               /* 3 */
+#else
+#define        BLKMSK  077777
+#define        BNDRY   2
+#define        INCRMT  02000
+#define        LBTMSK  01776
+#define        NMBLKS  077770
+#define        OFFBTS  10
+#define        OFFMSK  01777
+#define        SHFT    0
+#endif
 
 /*
  * The editor uses three buffers into the temporary file (ed uses two
  * and is very similar).  These are two read buffers and one write buffer.
 
 /*
  * The editor uses three buffers into the temporary file (ed uses two
  * and is very similar).  These are two read buffers and one write buffer.
- * Basically, the editor deals with the file as a sequence of 512 character
- * blocks (BUFSIZ).  Each block contains some number of lines (and lines
+ * Basically, the editor deals with the file as a sequence of BUFSIZ character
+ * blocks.  Each block contains some number of lines (and lines
  * can run across block boundaries.
  *
  * New lines are written into the last block in the temporary file
  * can run across block boundaries.
  *
  * New lines are written into the last block in the temporary file
  * spends (spent) roughly 30% of its time in the system read routine,
  * this can be a big help.
  */
  * spends (spent) roughly 30% of its time in the system read routine,
  * this can be a big help.
  */
-bool   hitin2;                 /* Last read hit was ibuff2 not ibuff */
-bool   ichang2;                /* Have actually changed ibuff2 */
-bool   ichanged;               /* Have actually changed ibuff */
-short  iblock;                 /* Temp file block number of ibuff (or -1) */
-short  iblock2;                /* Temp file block number of ibuff2 (or -1) */
-short  ninbuf;                 /* Number useful chars left in input buffer */
-short  nleft;                  /* Number usable chars left in output buffer */
-short  oblock;                 /* Temp file block number of obuff (or -1) */
-short  tline;                  /* Current temp file ptr */
+var bool       hitin2;         /* Last read hit was ibuff2 not ibuff */
+var bool       ichang2;        /* Have actually changed ibuff2 */
+var bool       ichanged;       /* Have actually changed ibuff */
+var short      iblock;         /* Temp file block number of ibuff (or -1) */
+var short      iblock2;        /* Temp file block number of ibuff2 (or -1) */
+var short      ninbuf;         /* Number useful chars left in input buffer */
+var short      nleft;          /* Number usable chars left in output buffer */
+var short      oblock;         /* Temp file block number of obuff (or -1) */
+#ifndef VMUNIX
+var short      tline;          /* Current temp file ptr */
+#else
+var int        tline;
+#endif
 
 
-char   ibuff[BUFSIZ];
-char   ibuff2[BUFSIZ];
-char   obuff[BUFSIZ];
+var char       ibuff[BUFSIZ];
+var char       ibuff2[BUFSIZ];
+var char       obuff[BUFSIZ];
 
 /*
  * Structure of the descriptor block which resides
 
 /*
  * Structure of the descriptor block which resides
@@ -82,11 +99,16 @@ char        obuff[BUFSIZ];
 /* This definition also appears in expreserve.c... beware */
 struct         header {
        time_t  Time;                   /* Time temp file last updated */
 /* This definition also appears in expreserve.c... beware */
 struct         header {
        time_t  Time;                   /* Time temp file last updated */
-       short   Uid;
+       int     Uid;
+#ifndef VMUNIX
        short   Flines;                 /* Number of lines in file */
        short   Flines;                 /* Number of lines in file */
+#else
+       int     Flines;
+#endif
        char    Savedfile[FNSIZE];      /* The current file name */
        short   Blocks[LBLKS];          /* Blocks where line pointers stashed */
        char    Savedfile[FNSIZE];      /* The current file name */
        short   Blocks[LBLKS];          /* Blocks where line pointers stashed */
-} H;
+}; 
+var struct     header H;
 
 #define        uid             H.Uid
 #define        flines          H.Flines
 
 #define        uid             H.Uid
 #define        flines          H.Flines