home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / editor / tvx_edit.arc / TVX_DEFS.IC < prev    next >
Text File  |  1986-03-17  |  17KB  |  433 lines

  1. /*
  2.   TVX - A full screen editor written in C
  3.  
  4.    This version of TVX Copyright (c) 1986 by Bruce E. Wampler
  5.  
  6.    Permission is hereby granted for free, unrestricted nonprofit
  7.    use of this software.  Please feel free to modify, distribute,
  8.    and share this software as long as you aren't making any money
  9.    from it.  If you want to use this code in a profit making environment,
  10.    please contact the author for permission.
  11.  
  12.   Revison summary:  (edit ALL cases of VERSION when change)
  13.       Version
  14.     1/10/    - this code first released to USENET
  15.     1/29/86  - memory code fixed, changes contained in first fix notice
  16.     1/30/86  - fixed insert mode msg problem in unkill
  17.     2/6/86   - cleaned up atari stdio.h problem, bug with noteloc
  18.     2/11/86  - added required code for Unix System V
  19.     2/14/86  - GETSIO option, allows fgets I/O if faster than fgetc
  20.     2/17/86  - bug in multi-line repeat loop, bug in addfil: ALMOSTOUT
  21.     2/22/86  - vi emulation + modeless version for emacs and tvx0
  22.     2/25/86  - added SCR_BUF stuff from decvax!gancarz (Mike Gancarz)
  23.     3/6/86  - added hires screen for atari st [released to mod.sources]
  24.  
  25. *********************************************************************  */
  26.  
  27.  
  28. /* ======================================================================== */
  29. /* Define the editor being emulated: (possibly by -D switch to cc)
  30.  
  31.     TVX_EM - The original tvx (this really IS tvx)
  32.     VI_EM  - emulates vi
  33.     EMAX_EM - emulates emacs
  34.     TVX0M_EM - a tvx flavored modeless editor
  35. */
  36.  
  37. /* #define TVX_EM */
  38. /* #define VI_EM */        /* vi emulation */
  39. /* #define TVX0M_EM */        /* modeless emulation */
  40. /* #define EMAX_EM */
  41.  
  42. /* ======================================================================== */
  43. /* ====> Select terminal version: #define at most ONE of <================= */
  44. /*       the following symbols debending the terminal used. (except SUN)    */
  45.  
  46. #undef IBMPC
  47. #undef ATARI520
  48. /* #define VT100 */
  49. #undef HP2621
  50. #define TERMCAP             /* Unix TERMCAP version */
  51. /* #define SUN */        /* define for SUN in addition to TERMCAP */
  52.  
  53.  
  54. /* ======================================================================== */
  55. /* ==================> Select ONE operating system  <====================== */
  56.  
  57. /* #define OSCPM */        /* CP/M-80 */
  58. #undef MSDOS            /* 8086 MS-DOS */
  59. #undef GEMDOS            /* atari 520 gemdos */
  60.  
  61. /* NOTE:  If you define UNIX, please look at the beginning of tvx_unix.c
  62.    for additional Unix related options */
  63. #define UNIX         /* unix is a bit different! */
  64.  
  65. /* !!!! following defines used in ADDITION to UNIX if used !!!! */
  66. /* #define SYSV */    /* define this in ADDITION to UNIX for System V */
  67. /* #define ULTRIX11 */    /* for DEC PDP-11 Ultrix */
  68. /* #define PRO350 */    /* DEC PRO-350 system */
  69.  
  70. #define SCR_BUF        /* buffered screen update much faster on Unix */
  71.     /* not implemented for other systems yet, but should be easy */
  72. #define S_BUFSIZE 2048    /* size of screen buffer */
  73.  
  74. /* ======================================================================== */
  75.  
  76. /* the include for stdio.h is here after os has been defined */
  77.  
  78. #ifdef GEMDOS
  79. /* GEMDOS requires that the brain damaged stdio.h provided with the
  80.    developer's kit be replaced to get rid of conflicts with the
  81.    portab.h file - ugly.  A special file called stdiotvx.h is provided
  82.    with the atari distribution */
  83.  
  84. #include "stdiotvx.h"
  85.  
  86. #else
  87. #include <stdio.h>
  88. #endif
  89.  
  90. /* ========> select other options by defining appropriate symbols <======== */
  91.  
  92. #define VB /**/        /* whether or not to create backup log version */
  93.  
  94. #undef ULBD        /* supports underline, bold in ^U, ^B format */
  95.  
  96. #define NEED_MISC_DEFS /**/
  97. /* ======================================================================== */
  98. #ifdef NEED_MISC_DEFS
  99. /* following definitons are usually not defined in most stdio.h's */
  100.  
  101. #define NIL (-1)        /* nil ptr for lists */
  102. #define TRUE 1
  103. #define FALSE 0
  104.  
  105. /* following might not be defined in some C's stdio.h, but usually are */
  106.  
  107. /* #define EOF (-1) */    /* standard end of file */
  108. /* #define EOS '\0' */    /* standard end of string */
  109. #endif
  110.  
  111. /* ********************************************************************** */
  112. /* ********************************************************************** */
  113.  
  114. /*  Other options now selected automatically depending on above #defines  */
  115.  
  116. /* ********************************************************************** */
  117. /* ********************************************************************** */
  118.  
  119. /* ----------------- Emulator Version ----------------------------------- */
  120.  
  121. #ifdef TVX_EM
  122. #define TVX_CMDSET            /* command set used by tvx */
  123. #define START_IDM "TVX - Full Screen Editor"
  124. #define START_HELPM "Press ? for help after starting"
  125. #define VERSION " - TVX (3/6/86) - " 
  126. #define DEF_CUTMODE 0
  127. #endif
  128.  
  129. #ifdef VI_EM
  130. #define START_IDM "TVX - Editor emulating vi"
  131. #define VERSION " - VIX (3/6/86) - " 
  132. #define START_HELPM "Press = for help after starting"
  133. #define DEF_CUTMODE 1
  134.  
  135. #undef VI_MODS        
  136. /* VI_MODS defines some "extensions" or enhancements to vi that
  137.    the local users prefer to the way vi does things.  Specifically:
  138.    1) j and k become line oriented rather than column oriented. ^P behaves
  139.    in the usual up column, and ^N work like the usual down arrow.
  140.    2) r is changed to advance the cursor after the changed char.
  141. */
  142. #endif
  143.  
  144. #ifdef EMAX_EM
  145. #define NOMODE_LEX
  146. #define START_IDM "EMAX - TVX/EMAX Full Screen Editor"
  147. #define START_HELPM "Press <ESC>? for help after starting"
  148. #define VERSION " - EMAX (3/6/86) - " 
  149. #define DEF_CUTMODE 1
  150. #endif
  151.  
  152. #ifdef TVX0M_EM
  153. #define TVX_CMDSET
  154. #define NOMODE_LEX
  155. #define START_IDM "Modeless TVX - Full Screen Editor"
  156. #define START_HELPM "Press <ESC>? for help after starting"
  157. #define VERSION " - TVX/0 (3/6/86) - " 
  158. #define DEF_CUTMODE 0
  159. #endif
  160.  
  161. /* ---------------- Operating System dependent defintions --------------- */
  162.  
  163. /* important note: max value for REPEATBUFS is 9!               */
  164.  
  165. /* ---------------------------------------------------------------------- */
  166. #ifdef OSCPM            /* uses Software Toolworks C/80 */
  167. #define BACKUPNAME "BACKUP.LOG"    /* backup log file name */
  168. #define BUFFLIMIT 2500        /* how much empty space to save in buffer */
  169. #define FILEREAD "rb"        /* read a file in binary */
  170. #define FILEWRITE "wb"        /* write a binary file */
  171. #define FNAMESIZE 14        /* size of file names */
  172. #define INT16 /**/        /* ints are 16 bits */
  173. #define LINELIMIT 75        /* number of spare lines to save */
  174. #define MAKE_BACKUP 1        /* 1 (true), want to make .bak file by default */
  175. #define MAXBUFF 40000        /* maximum number of total characters */
  176. #define MAXLINE 1150        /* maximum number of lines (abt. MAXBUFF/30) */
  177. #define REPEATBUFS 3        /* number of repeat buffers allowed */
  178. #define USELF /**/        /* using line feed on video */
  179. #define FILELF /**/            /* also in files */
  180. #define NEWLINE 13        /* 1st line separator: CR */
  181. #define USECTRLZ /**/
  182. #define NEEDTVLIB /**/        /* need standard c lib routines */
  183. #define BUFFINDEX unsigned int
  184. #define FAST static
  185. #define SLOW static
  186. #endif
  187.  
  188. /* ---------------------------------------------------------------------- */
  189. #ifdef MSDOS
  190. #define HELP /**/        /* help available */
  191. #define FULLHELP /**/        /* all of it */
  192. #ifdef TVX_EM
  193. #define CONFIGFILE /**/        /* allow -c switch */
  194. #endif
  195. #define BACKUPNAME "BACKUP.LOG"    /* backup log file name */
  196. #define BUFFLIMIT 3000        /* how much empty space to save in buffer */
  197. #define FILEREAD "rb"        /* read a file in binary */
  198. #define FILEWRITE "wb"        /* write a binary file */
  199. #define FNAMESIZE 70        /* size of file names, allows paths */
  200. #undef GETSIO            /* fgets slower than fgetc for cii-86 */
  201. #define INT16 /**/        /* ints are 16 bits */
  202. #define LINELIMIT 75        /* number of spare lines to save */
  203. #define MAKE_BACKUP 1        /* 1 (true), want to make .bak file by default */
  204. #define MAXBUFF 60000        /* maximum number of total characters */
  205. #define MAXLINE 3500        /* maximum number of lines (abt. MAXBUFF/30) */
  206. #define REPEATBUFS 5        /* number of repeat buffers allowed */
  207. #define USELF /**/        /* using line feed */
  208. #define FILELF    /**/        /* also in files */
  209. #define NEWLINE 13        /* 1st line separator: CR */
  210. #define BUFFINDEX unsigned int
  211. /* #define USECTRLZ */        /* default value for ^Z */
  212. #define FAST static
  213. #define SLOW static
  214. #endif
  215. /* ---------------------------------------------------------------------- */
  216. /* ---------------------------------------------------------------------- */
  217. #ifdef GEMDOS
  218. #define HELP /**/        /* help available */
  219. #define FULLHELP /**/        /* all of it */
  220. #ifdef TVX_EM
  221. #define CONFIGFILE /**/        /* allow -c switch */
  222. #endif
  223. #define BACKUPNAME "BACKUP.LOG"    /* backup log file name */
  224. #define BUFFLIMIT 3000        /* how much empty space to save in buffer */
  225. #define FILEREAD "r"        /* read a file in binary */
  226. #define FILEWRITE "w"        /* write a binary file */
  227. #define fopen fopenb
  228. #define FNAMESIZE 70        /* size of file names, allows paths */
  229. #define GETSIO            /* use fgets for main file I/O */
  230. #define INT16 /**/        /* ints are 16 bits */
  231. #define LINELIMIT 75        /* number of spare lines to save */
  232. #define MAKE_BACKUP 1        /* 1 (true), want to make .bak file by default */
  233. #define MAXBUFF 60000        /* maximum number of total characters */
  234. #define MAXLINE 3500        /* maximum number of lines (abt. MAXBUFF/30) */
  235. #define REPEATBUFS 5        /* number of repeat buffers allowed */
  236. #define USELF /**/        /* using line feed */
  237. #define FILELF /**/        /* also in files */
  238. #define NEWLINE 13        /* 1st line separator: CR */
  239. #define USECTRLZ /**/
  240. #define BUFFINDEX long
  241. #define FAST register
  242. #define SLOW static
  243. #endif
  244. /* ---------------------------------------------------------------------- */
  245.  
  246. /* ---------------------------------------------------------------------- */
  247. #ifdef UNIX
  248. #define getchr fgetc
  249. #define FLOWCONTROL /**/    /* define this if you want ^S/^Q enabled */
  250. #undef COMMA_BAK        /* #define if you want ".," backup files */
  251.  
  252. #define NO_EXTEND_CHAR        /* only allow 127 displayable chars */
  253.  
  254. #define HELP /**/        /* help available */
  255. #define FULLHELP /**/        /* all of it */
  256. #ifdef TVX_EM
  257. #define CONFIGFILE /**/        /* allow -c switch */
  258. #endif
  259. #define BACKUPNAME "BACKUP.LOG"    /* backup log file name */
  260. #define BUFFLIMIT 4000        /* how much empty space to save in buffer */
  261. #define FILEREAD "r"        /* read a file in binary */
  262. #define FILEWRITE "w"        /* write a binary file */
  263. #define FNAMESIZE 80        /* size of file names, allows paths */
  264. #define GETSIO            /* use fgets for main file I/O */
  265. #define LINELIMIT 100        /* number of spare lines to save */
  266. #define MAKE_BACKUP 1        /* 1 (true), want to make .B file by default */
  267.         /* change to 0 if don't want, which is like other Unix eds */
  268. #define MAXBUFF 120000        /* maximum number of total characters */
  269. #define MAXLINE 5000        /* maximum number of lines (abt. MAXBUFF/30) */
  270. #define NEWLINE 10
  271. #define REPEATBUFS 9        /* number of repeat buffers allowed */
  272. #define USELF /**/        /* using line feed on screen */
  273. #define BUFFINDEX unsigned int
  274. #define FAST register
  275. #define SLOW             /* dynamics */
  276. #endif
  277.  
  278. /* ---------------------------------------------------------------------- */
  279.  
  280. #ifdef ULTRIX11
  281. #undef MAXBUFF
  282. #undef MAXLINE
  283. #define MAXBUFF 40000        /* maximum number of total characters */
  284. #define MAXLINE 1150        /* maximum number of lines (abt. MAXBUFF/30) */
  285. #endif
  286.  
  287. /* ---------------------------------------------------------------------- */
  288. /* ---------------------- Misc defintions ------------------------------- */
  289.  
  290. #define ARB 100
  291. #define ALMOSTOUT 300   /* garbage collect when ALMOSTOUT characters left */
  292. #define BACKSPACE 8
  293. #define BELL 7       /* bell */
  294. #define CR 13 
  295. #define ESC 27 
  296. #define ENDFILE 26
  297. #define LF 10 
  298. #define NO 0
  299. #define TOGUNDERLINE 21     /* ^U for underline */
  300. #define TOGBOLD 2         /* ^B for bold */
  301. #define TAB 9
  302. #define YES 1
  303. /* these look like they can be changed, but beware, especially
  304.    with positive values (you can't change ENDLINE to LF, for example) */
  305. #define BEGLINE (char)(0xff)
  306. #define ENDLINE 0          /* marks end of a line */
  307. #define GARBAGE (char)(0xfe)  /* filler character for gbgcol */
  308.  
  309. #define E0 0            /* element 0 of arrays (skipped) */
  310.  
  311. /* ---------------------- Wild card values ----------------------------------- */
  312. #define W_letter 12        /* ^L is letter */
  313. #define W_digit 4        /* ^D is digit */
  314. #define W_alpha 1        /* ^A is alpha num */
  315. #define W_punc 16        /* ^P is punctuation */
  316. #define W_anything 24        /* ^X is any character */
  317. #define W_others 15        /* ^O is non-alpha */
  318. #define W_user 21        /* ^U is user set */
  319. #define W_span 23        /* ^W is "word" of */
  320. #define W_skip 14        /* ^N is not in word of*/
  321. /* -------------------- Command Definitions ----------------------------- */
  322.  
  323. #ifdef TVX_CMDSET        /* both 2 mode and modeless tvx use the same */
  324. #define VRIGHT 1        /* lex val right, or foward one character */
  325. #define VLEFT 2         /* left or backwards one character */
  326. #define VDOWNLINE 3        /* down line, to beg. of next line */
  327. #define VUPLINE 4        /* up line, to beg. of prev. line */
  328. #define VDOWNCOL 5        /* down in column ^D */
  329. #define VUPCOL 6        /* up in column ^U */
  330. #define VDELLAST 7        /* delete previous character */
  331. #define VDELNEXT 8        /* delete forward */
  332. #define VINSERT 9        /* insert text */
  333. #define VKILLALL 10        /* kill entire current line */
  334. #define VKILLREST 11        /* kill rest of current line */
  335. #define VKILLPREV 12        /* kill previous part of line */
  336. #define VBEGLINE 13        /* beginning of current line */
  337. #define VENDLINE 14        /* back of current line */
  338. #define VSEARCH 15        /* find a string */
  339. #define VNEXT 16        /* next - search across pages */
  340. #define VFLIP 17        /* page a screen full */
  341. #define VTOP 18            /* top of buffer */
  342. #define VBOTTOM 19        /* bottom of buffer */
  343. #define VFBEGIN 20        /* beginning of file */
  344. #define VVERIFY 21        /* verify: rewrite screen or show dot */
  345. #define VOPENLINE 22        /* open a new line */
  346. #define VREMOVE 23        /* remove last thing maniuplated */
  347. #define VSAVE 24        /* put text in save buffer */
  348. #define VGET 25            /* get or restore save buffer */
  349. #define VWPAGE 26        /* write current page, fetch next page */
  350. #define VYANK 27        /* "save" from external file */
  351. #define VQUIT 28        /* quit */
  352. #define VSAGAIN 29        /* search for the thing again */
  353. #define VXREPEAT 30        /* execute repeat buffer */
  354. #define VMEMORY 31        /* print remaining buffer space */
  355. #define VSETPARS 32        /* set parameters */
  356. #define VRMVINS 33        /* remove last, enter insert mode */
  357. #define VUNKILL 34        /* unkill last line killed */
  358. #define VMVWORD 35        /* move over a word at a time */
  359. #define VMVBWORD 36        /* move over words backwards */
  360. #define VSAPPEND 37        /* append to save buffer */
  361. #define VPRINTS 38        /* print screen */
  362. #define VHELP 39        /* show contents of repeat buffer */
  363. #define VHALFP 40        /* half a page down */
  364. #define VABORT 41        /* abort */
  365. #define VCHANGE 42        /* change n chars */
  366. #define VJUMP 43        /* jump back to prev loc */
  367. #define VTIDY 44        /* tidy - justify */
  368. #define VNOTELOC 45        /* note current location */
  369. #define VRETNOTE 46        /* ^N  - Return to noted loc */
  370. #define VSYSTEM 47        /* call operating system */
  371. #define VEDITRPT 48        /* edit repeat buffer n */
  372. #define VSTORERPT 49        /* store in repeat buffer n */
  373. #define VEXECRPT 50        /* execute repeat buffer k n time */
  374. #define VINSPAT 51        /* insert search pattern */
  375. #define VUSER1 52        /* spare 1 */
  376. #define VUSER2 53        /* spare 2 */
  377. #define VFOLDCASE 54        /* fold case */
  378. #define LEXVALUES 54        /* total number of lexical values */
  379. #endif
  380.  
  381. #ifdef VI_EM            /* needed vi_em lexical values */
  382. #define VMEMORY 4
  383. #define VHELP 7
  384. #define VSEARCH 12
  385. #define VRSEARCH 15
  386. #define VDOWNCOL 23
  387. #define VUPCOL 24
  388. #define VSAPPEND 32
  389. #define VENDZ 33
  390. #define VMVBWORD 36
  391. #define VRSAGAIN 27
  392. #define VPUT 29
  393. #define VTVX 30
  394. #define VSAPPEND 32
  395. #define VENDZ 33
  396. #define VMVBWORD 36
  397. #define VINSERT 40
  398. #define VNOTELOC 44
  399. #define VSAGAIN 45
  400. #define VGET 47
  401. #define VMVWORD 51
  402. #define VSAVE 53
  403. #define VNOOP 50
  404.  
  405. #define LEXVALUES 54        /* total number of lexical values */
  406. #endif
  407.  
  408. #ifdef EMAX_EM
  409. #define VSAVE 100
  410. #define VSAPPEND 101
  411. #define VNEXT 102
  412. #define VSAGAIN 103
  413. #define VTVX 3
  414. #define VNOOP 7
  415. #define VDOWNCOL 11
  416. #define VUPCOL 13
  417. #define VOPENLINE 12
  418. #define VRSEARCH 14
  419. #define VSEARCH 15
  420. #define VGET 18
  421. #define VEXTEND 17
  422. #define VQUIT 19
  423. #define VMVBWORD 24
  424. #define VMVWORD 25
  425. #define VHELP 27
  426.  
  427. #define LEXVALUES 27
  428. #endif
  429.  
  430. #define UNKNOWN (-5)        /* unknown lexical value */
  431.  
  432. /* ********************************************************************* */
  433.