home *** CD-ROM | disk | FTP | other *** search
/ Der Mediaplex Sampler - Die 6 von Plex / 6_v_plex.zip / 6_v_plex / DISK5 / DOS_50 / PVIC.ZIP / PVIC.H < prev    next >
C/C++ Source or Header  |  1993-04-21  |  11KB  |  582 lines

  1. /*
  2. * Version.
  3. */
  4.  
  5. #define VERSION_STRING  "PVIC 1.0"
  6.  
  7.  
  8.  
  9.  
  10.  
  11. /* 
  12. * Declarations of standard library functions.
  13. */
  14.  
  15. char *malloc();
  16. char *strncpy();
  17. char *getenv();
  18. char *strcpy();
  19.  
  20.  
  21.  
  22.  
  23. /*
  24. *  Definitions for all control characters.
  25. */
  26.  
  27. #define CTRL_A          '\001'
  28. #define CTRL_B           '\002'
  29. #define CTRL_C           '\003'
  30. #define CTRL_D           '\004'
  31. #define CTRL_E           '\005'
  32. #define CTRL_F           '\006'
  33. #define CTRL_G           '\007'
  34. #define CTRL_H           '\010'
  35. #define CTRL_I           '\011'
  36. #define CTRL_J           '\012'
  37. #define CTRL_K           '\013'
  38. #define CTRL_L           '\014'
  39. #define CTRL_M           '\015'
  40. #define CTRL_N           '\016'
  41. #define CTRL_O           '\017'
  42. #define CTRL_P           '\020'
  43. #define CTRL_Q           '\021'
  44. #define CTRL_R           '\022'
  45. #define CTRL_S           '\023'
  46. #define CTRL_T           '\024'
  47. #define CTRL_U           '\025'
  48. #define CTRL_V           '\026'
  49. #define CTRL_W           '\027'
  50. #define CTRL_X           '\030'
  51. #define CTRL_Y           '\031'
  52. #define CTRL_Z           '\032'
  53. #define ESC                 '\033'
  54. #define CTRL_BACKSLASH         '\034'
  55. #define CTRL_RIGHT_BRACKET     '\035'
  56. #define CTRL_CIRCUMFLEX      '\036'
  57. #define CTRL_UNDERSCORE       '\037'
  58. #define DEL                '\177'
  59.  
  60.  
  61.  
  62.  
  63.  
  64. /*
  65. * General type and structure definitions.
  66. */
  67.  
  68. typedef struct line {
  69.     struct line *prev;    /* Previous line. */
  70.     struct line *next;     /* Next line. */
  71.     char *s;        /* Text for this line. */
  72.     int size;         /* Actual size of space at 's'. */
  73.     unsigned long num;     /* Line number. */
  74. } LINE;
  75.  
  76. typedef struct param {
  77.     char *fullname;     /* Full parameter name. */
  78.     char *shortname;    /* Permissible abbreviation. */
  79.     int value;          /* Parameter value. */
  80.     int flags;
  81. } PARAM;
  82.  
  83. typedef struct lptr {
  84.     struct line *linep;     /* Line we're referencing. */
  85.     int index;         /* Position within that line. */
  86. } LPTR;
  87.  
  88. typedef struct charinfo {
  89.     char ch_size;
  90.     char *ch_str;
  91. } CHARINFO;
  92.  
  93.  
  94.  
  95.  
  96.  
  97. /* 
  98. * General defines.
  99. */
  100.  
  101. #define STATUS_NORMAL         0
  102. #define STATUS_INSERT         1
  103. #define STATUS_REPLACE         2
  104. #define STATUS_CMDLINE         3
  105.  
  106. #define SEARCH_FORWARD         4
  107. #define SEARCH_BACKWARD     5
  108.  
  109. #define CHANGED          (changed=1)
  110. #define UNCHANGED         (changed=0)
  111.  
  112. /* SLOP is the amount of extra space we get for text on a line during
  113. editing operations that need more space. This keeps us from calling
  114. malloc every time we get a character during insert mode. No extra
  115. space is allocated when the file is initially read. */
  116. #define SLOP             10
  117.  
  118. /* LINEINC is the gap we leave between the artificial line numbers. This
  119. helps to avoid renumbering all the lines every time a new line is
  120. inserted. */
  121. #define LINEINC         10
  122.  
  123. #define LINEOF(x)         ((x)->linep->num)
  124.  
  125. /* Operators. */
  126. #define NOP         0      /* No pending operation. */
  127. #define DELETE         1
  128. #define YANK         2
  129. #define CHANGE         3
  130. #define LSHIFT         4
  131. #define RSHIFT         5
  132. #define FILTER         6
  133. #define TILDE         7
  134.  
  135. /* When a cursor motion command is made, it is marked as being a character
  136. or line oriented motion. Then, if an operator is in effect, the operation
  137. becomes character or line oriented accordingly.
  138. Character motions are marked as being inclusive or not. Most char.
  139. motions are inclusive, but some (e.g. 'w') are not. */
  140. #define MBAD         (-1)      /* Bad motion type marks unusable yank buf. */
  141. #define MCHAR         0
  142. #define MLINE         1
  143.  
  144. /* Macro to get current character from a LPTR * value. */
  145. #define CHAR(lpp)    lpp->linep->s[lpp->index]
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157. /*
  158. * alloc.c
  159. */
  160.  
  161. char *alloc();
  162. char *strsave();
  163. char *mkstr();
  164. int alloc_screen();
  165. void file_alloc();
  166. void freeall();
  167. LINE *newline();
  168. int buffer_empty();
  169. int buf1line();
  170. int line_empty();
  171. int end_of_line();
  172. int can_increase();
  173.  
  174.  
  175.  
  176.  
  177. /*
  178. * cmdline.c
  179. */
  180.  
  181. void do_command_line();
  182. void msg();
  183. void error_message();
  184. void show_message();
  185. void goto_command();
  186. void wait_return();
  187. void bad_command();
  188. int do_e_command();
  189. char *getcmdln();
  190.  
  191.  
  192.  
  193.  
  194. /*
  195. * edit.c
  196. */
  197.  
  198. void edit();
  199. void insert_char();
  200. void get_out();
  201. void scroll_up();
  202. void scroll_down();
  203. void begin_line();
  204. int one_right();
  205. int one_left();
  206. int one_up();
  207. int one_down();
  208.  
  209.  
  210.  
  211.  
  212. /*
  213. * fileio.c
  214. */
  215.  
  216. void file_message();
  217. void renum();
  218. int read_file();
  219. int write_it();
  220.  
  221.  
  222. /*
  223. * general.c
  224. */
  225.  
  226. void beep();
  227. void loop_n_seconds();
  228. void pvic_init();
  229. void pvic_exit();
  230. char to_lower();
  231. char to_upper();
  232. int is_upper();
  233. int is_lower();
  234. int is_alpha();
  235. int is_space();
  236. int is_digit();
  237. void rename_file();
  238.  
  239.  
  240. /*
  241. * help.c
  242. */
  243.  
  244. int help();
  245.  
  246.  
  247.  
  248.  
  249. /*
  250. * linefunc.c
  251. */
  252.  
  253. LPTR *next_line();
  254. LPTR *previous_line();
  255. LPTR *advance_column();
  256. LPTR *next_char();
  257. LPTR *previous_char();
  258.  
  259.  
  260.  
  261.  
  262. /*
  263. * main.c
  264. */
  265.  
  266. void put_string_into_input_buffer();
  267. void put_int_into_input_buffer();
  268. void do_mlines();
  269. int  get_char_from_input_buffer();
  270. int is_input_pending();
  271.  
  272. extern char **files;                /* used for "n" and "rew" */
  273. extern int number_of_files;
  274. extern int current_file;
  275. extern int need_redraw;
  276. extern int did_ai;
  277. extern int number_of_files;
  278. extern int current_file;
  279. extern int interactive;
  280. extern char **files;
  281. extern int current_file;
  282. extern struct param params[];
  283. extern CHARINFO chars[];
  284. extern int current_status;
  285. extern int current_lines;
  286. extern int current_columns;
  287. extern char *real_screen;
  288. extern char *next_screen;
  289. extern char *file_name;
  290. extern LPTR *file_memory;
  291. extern LPTR *top_of_file;
  292. extern LPTR *end_of_file;
  293. extern LPTR *top_char;
  294. extern LPTR *bottom_char;
  295. extern LPTR *cursor_char;
  296. extern LPTR *start_insert;
  297. extern int cursor_row;
  298. extern int cursor_column;
  299. extern int cursor_virtual_column;
  300. extern int wanted_cursor_column;
  301. extern int set_wanted_cursor_column;
  302. extern int prenum;
  303. extern int changed;
  304. extern char redo_buffer[];
  305. extern char insert_buffer[];
  306. extern char *insert_pointer;
  307. extern int insert_n;
  308.  
  309.  
  310.  
  311.  
  312. /*
  313. * mark.c
  314. */
  315.  
  316. void set_pc_mark();
  317. void clear_all();
  318. void clear_mark();
  319. int set_mark();
  320. LPTR *get_mark();
  321.  
  322.  
  323.  
  324.  
  325. /*
  326. * misccmds.c
  327. */
  328.  
  329. void open_command();
  330. void file_info();
  331. void inschar();
  332. void delete_line();
  333. int delete_char();
  334. int  cntllines();
  335. int plines();
  336. LPTR *goto_line();
  337.  
  338.  
  339.  
  340.  
  341. /*
  342. * normal.c
  343. */
  344.  
  345. void normal();
  346.  
  347. extern int operator;          /* Current pending operator. */
  348.  
  349. extern int mtype;           /* type of the current cursor motion */
  350. extern int mincl;           /* true if char motion is inclusive */
  351.  
  352. extern LPTR startop;          /* cursor pos. at start of operator */
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360. /*
  361. *  param.c
  362. */
  363.  
  364. /* Flags used for the parameters in the params array. */
  365. #define BOOLEAN_PARAMETER      0x01     /* The parameter is boolean. */
  366. #define NUMERIC_PARAMETER      0x02     /* The parameter is numeric. */
  367. #define PARAMETER_HAS_CHANGED      0x04     /* The parameter has been changed. */
  368.  
  369. /* The following are the indices for the numeric parameters 
  370. in the params array for each parameter.  */
  371. #define PARAMETER_LINES      0    /* Lines. */
  372. #define PARAMETER_REPORT     1    /* Report. */
  373. #define PARAMETER_SCROLL     2    /* Scroll size. */
  374. #define PARAMETER_TABSTOP     3    /* Tab size. */
  375.  
  376. /* The following are the indices for the boolean parameters 
  377. in the params array for each parameter. */
  378. #define PARAMETER_AUTOINDENT     4     /* auto-indent */
  379. #define PARAMETER_BACKUP     5    /* make backups when 
  380.                     writing out files */
  381. #define PARAMETER_ERRORBELLS     6    /* error bells */
  382. #define PARAMETER_IGNORECASE     7    /* ignore case in searches */
  383. #define PARAMETER_LIST       8    /* show tabs and newlines 
  384.                           graphically */
  385. #define PARAMETER_MODELINES     9    /* enables mode-lines processing */
  386. #define PARAMETER_NUMBER     10    /* number lines on the screen */
  387. #define PARAMETER_SHOWMATCH     11    /* show_match */
  388. #define PARAMETER_SHOWMODE     12    /* show mode */
  389. #define PARAMETER_VBELL      13    /* visual bell */
  390. #define PARAMETER_WRAPSCAN     14    /* wrap scan */
  391.  
  392. /* Macro to get the value of a parameter.  */
  393. #define PARAMETER_VALUE(n) (params[n].value)
  394.  
  395. void do_set();
  396.  
  397.  
  398.  
  399. /*
  400. * ptrfunc.c
  401. */
  402.  
  403. int inc();
  404. int dec();
  405. int gchar();
  406. void pchar();
  407. void pswap();
  408. int lt();
  409. int equal();
  410. int ltoreq();
  411.  
  412.  
  413.  
  414.  
  415. /*
  416. * screen.c
  417. */
  418.  
  419. void update_screen();
  420. void update_line();
  421. void clear_screen();
  422. void update_cursor();
  423. void prt_line();
  424. extern int need_redraw;
  425.  
  426.  
  427.  
  428.  
  429. /*
  430. * search.c
  431. */
  432.  
  433. void do_sub();
  434. void do_glob();
  435. int search_char();
  436. int crep_search();
  437. int find_function();
  438. int do_search();
  439. int rep_search();
  440. LPTR *show_match();
  441. LPTR *forward_word();
  442. LPTR *back_word();
  443. LPTR *end_word();
  444.  
  445.  
  446.  
  447.  
  448. /*
  449. * tagcmd.c
  450. */
  451.  
  452. void do_tag();
  453. void do_untag();
  454.  
  455.  
  456.  
  457.  
  458.  
  459. /* 
  460. * termin.c 
  461. */
  462.  
  463. void init_translate_table();
  464. void read_input();
  465. void put_char_into_input_buffer();
  466. void put_string_into_input_buffer();
  467. void put_int_into_input_buffer();
  468. int is_input_pending();
  469. void test_n_seconds_for_input();
  470.  
  471.  
  472.  
  473.  
  474. /*  
  475. * termcap.c 
  476. */
  477.  
  478. void init_termcap();
  479. char *read_termcap_entry();
  480. char *get_termcap_string();
  481. int get_termcap_number();
  482.  
  483. extern int termcap_lines;
  484. extern int termcap_columns;
  485. extern char *termcap_init_terminal;
  486. extern char *termcap_deinit_terminal;
  487. extern char *termcap_clr_eol;  /* Erase the entire current line. */
  488. extern char *termcap_save_cursor; /* Save the cursor position. */
  489. extern char *termcap_clear_screen; /* Erase display (may optionally 
  490.      home cursor). */
  491. extern char *termcap_restore_cursor; /* Restore the cursor position. */
  492. extern char *termcap_cursor_invisible; /* Invisible cursor (very optional). */
  493. extern char *termcap_cursor_visible; /* Visible cursor (very optional). */
  494. extern char *termcap_cursor_address; /* Cursor motion string. */
  495. extern char *termcap_bell;  /* Audible bell. */
  496. extern char *termcap_key_f1;
  497. extern char *termcap_key_f2;
  498. extern char *termcap_key_ic;
  499. extern char *termcap_key_dc;
  500. extern char *termcap_key_home;
  501. extern char *termcap_key_eol;
  502. extern char *termcap_key_ppage;
  503. extern char *termcap_key_npage;
  504. extern char *termcap_key_up;
  505. extern char *termcap_key_down;
  506. extern char *termcap_key_left;
  507. extern char *termcap_key_right;
  508. extern char *termcap_key_backspace;
  509.  
  510.  
  511.  
  512. /*
  513.  * undo.c
  514.  */
  515.  
  516. void u_save();
  517. void u_save_line();
  518. void u_clear();
  519. void u_l_check();
  520. void u_l_undo();
  521. void u_undo();
  522. int inchar();
  523. void flushbuf();
  524. void outchar();
  525. void outstr();
  526. void beep();
  527. char *fixname();
  528. void pvic_init();
  529. void pvic_exit();
  530. void goto_screen_pos();
  531. void pause();
  532. void do_shell();
  533. char *get_pointer_to_chr_in_string();
  534. int get_offset_of_chr_in_s1_matching_chr_in_s2();
  535.  
  536.  
  537.  
  538.  
  539.  
  540. /*
  541. * ops.c
  542. */
  543.  
  544. void do_shift();
  545. void do_delete();
  546. void do_put();
  547. void do_change();
  548. void do_filter();
  549. void dotilde();
  550. int do_join();
  551. int do_yank();
  552. void do_start_insert();
  553.  
  554.  
  555.  
  556. /* 
  557. * regexp.c 
  558. */
  559.  
  560. #define MAGIC             0234
  561.  
  562. #define NSUBEXP          10
  563.  
  564. typedef struct regexp {
  565.     char *startp[NSUBEXP];
  566.     char *endp[NSUBEXP];
  567.     char regstart;        /* Internal use only. */
  568.     char reganch;        /* Internal use only. */
  569.     char *regmust;        /* Internal use only. */
  570.     int regmlen;        /* Internal use only. */
  571.     char program[1];    /* Unwarranted chumminess with compiler. */
  572. } regexp;
  573.  
  574. extern regexp *reg_comp();
  575. extern int reg_exec();
  576. extern void reg_sub();
  577. extern void reg_error();
  578. char *cstrchr();
  579.  
  580. extern int reg_ic;
  581.  
  582.