home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / thesrc15.zip / default.c < prev    next >
C/C++ Source or Header  |  1993-11-17  |  24KB  |  686 lines

  1. /***********************************************************************/
  2. /* DEFAULT.C - Default settings and profile processing                 */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991-1993 Mark Hessling
  7.  *
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License as
  10.  * published by the Free Software Foundation; either version 2 of
  11.  * the License, or any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to:
  20.  *
  21.  *    The Free Software Foundation, Inc.
  22.  *    675 Mass Ave,
  23.  *    Cambridge, MA 02139 USA.
  24.  *
  25.  *
  26.  * If you make modifications to this software that you feel increases
  27.  * it usefulness for the rest of the community, please email the
  28.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  29.  * This software is going to be maintained and enhanced as deemed
  30.  * necessary by the community.
  31.  *
  32.  * Mark Hessling                     email: M.Hessling@gu.edu.au
  33.  * 36 David Road                     Phone: +61 7 849 7731
  34.  * Holland Park                      Fax:   +61 7 875 5314
  35.  * QLD 4121
  36.  * Australia
  37.  */
  38.  
  39. /*
  40. $Header: C:\THE\RCS\default.c 1.4 1993/09/01 16:26:04 MH Interim MH $
  41. */
  42.  
  43. #include <stdio.h>
  44.  
  45. #include "the.h"
  46. #include "proto.h"
  47.  
  48. /*#define DEBUG 1*/
  49.  
  50. /*--------------------------- extern data -----------------------------*/
  51. extern WINDOW *foot;
  52. extern VIEW_DETAILS *vd_current,*vd_first;
  53. extern char current_screen;
  54. extern SCREEN_DETAILS screen[MAX_SCREENS];        /* screen structures */
  55. extern char display_screens;                      /* number of screens */
  56. extern bool horizontal;
  57. extern char current_file;                   /* pointer to current file */
  58. extern LINE *next_line,*curr_line;
  59. extern char *rec;
  60. extern char in_profile;    /* indicates if processing profile */
  61. extern char number_of_views;                        /* number of files */
  62. extern char number_of_files;                   /* number of open files */
  63.  
  64. /*--------------------------- global data -----------------------------*/
  65.  
  66.  char CMD_LINEx;
  67.  char ERROR_ROWx;
  68.  char TAB_ROWx;
  69.  char TAB_ONx;
  70.  char SCALE_ROWx;
  71.  char SCALE_ONx;
  72.  char PREFIXx;
  73.  char CURRENT_ROW_POSx;
  74.  char STAYx;
  75.  char HEXx;
  76.  char NEWLx;
  77.  char MSGMx;
  78.  char CASE_Ex;
  79.  char CASE_Lx;
  80.  char CASE_Cx;
  81.  char CASE_Sx;
  82.  char TABI_ONx;
  83.  char TABI_Nx;
  84.  char TABO_ONx;
  85.  char TABO_Nx;
  86.  char TABSx;
  87.  char CMDARROWSTABCMDx;
  88.  char CMDARROWSTABTXTx;
  89.  char CMDARROWSTABLRx;
  90.  char AUSx;
  91.  char EOLx;
  92.  unsigned short VER_STAx;
  93.  unsigned short VER_ENDx;
  94.  unsigned short VER_COLx;
  95.  unsigned short ZON_STAx;
  96.  unsigned short ZON_ENDx;
  97.  char  ARB_STSx;
  98.  char  ARB_CHRx;
  99.  char  DISPLAY_LOWx;
  100.  char  DISPLAY_HIGHx;
  101.  bool LINEND_STATUSx;
  102.  char  LINEND_VALUEx;
  103.  char NONDISPx;
  104.  bool REPROFILEx;
  105.  bool CLEARSCREENx;
  106.  bool IMPMACROx;
  107.  bool IMPOSx;
  108.  bool NUMBERx;
  109.  bool BACKUPx;
  110.  bool BEEPx;
  111.  bool CLOCKx;
  112.  bool HEXDISPLAYx;
  113.  bool CAPREXXOUTx;
  114.  long CAPREXXMAXx;
  115.  
  116. /***********************************************************************/
  117. #ifdef PROTO
  118. void set_defaults(void)
  119. #else
  120. void set_defaults()
  121. #endif
  122. /***********************************************************************/
  123. {
  124. /*--------------------------- local data ------------------------------*/
  125. /*--------------------------- processing ------------------------------*/
  126. #ifdef TRACE
  127.  trace_function("default.c: set_defaults");
  128. #endif
  129.  CMD_LINEx = 'B';
  130.  ERROR_ROWx = 1;
  131.  TAB_ROWx = 6;
  132.  TAB_ONx = FALSE;
  133.  SCALE_ROWx = 6;
  134.  SCALE_ONx = FALSE;
  135.  PREFIXx = PREFIX_LEFT;
  136.  CURRENT_ROW_POSx = 0;
  137.  STAYx = ON;
  138.  HEXx = OFF;
  139.  NEWLx = TRUE;
  140.  MSGMx = TRUE;
  141.  
  142.  CASE_Ex = CASE_MIXED;
  143.  CASE_Lx = CASE_IGNORE;
  144.  CASE_Cx = CASE_RESPECT;
  145.  CASE_Sx = CASE_RESPECT;
  146.  
  147.  LINEND_STATUSx = FALSE;
  148.  LINEND_VALUEx = '#';
  149.  
  150.  NONDISPx = '#';
  151.  
  152.  TABI_ONx = FALSE;
  153.  TABI_Nx = 8;
  154.  TABO_ONx = FALSE;
  155.  TABO_Nx = 8;
  156.  TABSx = 8;
  157.  CMDARROWSTABCMDx = FALSE;
  158.  CMDARROWSTABTXTx = FALSE;
  159.  CMDARROWSTABLRx = FALSE;
  160.  BACKUPx = TRUE;
  161.  BEEPx = FALSE;
  162.  CLOCKx = TRUE;
  163.  HEXDISPLAYx = TRUE;
  164.  IMPMACROx = TRUE;
  165.  IMPOSx = TRUE;
  166.  NUMBERx = TRUE;
  167.  CAPREXXOUTx = FALSE;
  168.  CAPREXXMAXx = 1000L;
  169.  
  170.  VER_STAx = 1;
  171.  VER_ENDx = max_line_length;
  172.  VER_COLx = 1;
  173.  ZON_STAx = 1;
  174.  ZON_ENDx = max_line_length;
  175.  DISPLAY_LOWx = DISPLAY_HIGHx = 0;
  176.  CLEARSCREENx = FALSE;
  177.  REPROFILEx = FALSE;
  178.  
  179.  AUSx = 0;
  180.  ARB_CHRx = '?';
  181.  ARB_STSx = OFF;
  182. #ifdef UNIX
  183.  EOLx = EOLOUT_LF;
  184. #endif
  185. #if defined(DOS) || defined(OS2)
  186.  EOLx = EOLOUT_CRLF;
  187. #endif
  188. #ifdef TRACE
  189.  trace_return();
  190. #endif
  191.  return;
  192. }
  193. /***********************************************************************/
  194. #ifdef PROTO
  195. void set_default_colours(void)
  196. #else
  197. void set_default_colours()
  198. #endif
  199. /***********************************************************************/
  200. {
  201. /*------------------------- external data -----------------------------*/
  202. extern bool colour_support;
  203. /*--------------------------- local data ------------------------------*/
  204.  chtype dflt_colour[ATTR_MAX];
  205.  register int i;
  206. /*--------------------------- processing ------------------------------*/
  207. #ifdef TRACE
  208.  trace_function("default.c: set_default_colours");
  209. #endif
  210. /*---------------------------------------------------------------------*/
  211. /* Set up default colours.                                             */
  212. /*---------------------------------------------------------------------*/
  213. #ifdef A_COLOR
  214.  if (colour_support)
  215.    {
  216.     init_pair(1,COLOR_WHITE,COLOR_BLUE);
  217.     init_pair(2,COLOR_WHITE,COLOR_BLUE);
  218.     init_pair(3,COLOR_BLUE,COLOR_WHITE);
  219.     init_pair(4,COLOR_RED,COLOR_WHITE);
  220.     init_pair(5,COLOR_BLACK,COLOR_CYAN);
  221.     init_pair(6,COLOR_BLUE,COLOR_WHITE);
  222.     init_pair(7,COLOR_RED,COLOR_WHITE);
  223.     init_pair(8,COLOR_BLACK,COLOR_CYAN);
  224.     init_pair(9,COLOR_BLACK,COLOR_CYAN);
  225.     init_pair(10,COLOR_RED,COLOR_WHITE);
  226.     init_pair(11,COLOR_RED,COLOR_WHITE);
  227.     init_pair(12,COLOR_WHITE,COLOR_BLUE);
  228.     init_pair(13,COLOR_WHITE,COLOR_BLUE);
  229.     init_pair(14,COLOR_RED,COLOR_WHITE);
  230.     init_pair(15,COLOR_RED,COLOR_WHITE);
  231.     init_pair(16,COLOR_BLUE,COLOR_WHITE);
  232.     init_pair(17,COLOR_RED,COLOR_WHITE);
  233.     for (i=0;i<ATTR_MAX;i++)
  234.         dflt_colour[i] = COLOR_PAIR(i+1);
  235.     dflt_colour[ATTR_CURLINE] |= A_BOLD;
  236.     dflt_colour[ATTR_TOFEOF] |= A_BOLD;
  237.     dflt_colour[ATTR_CTOFEOF] |= A_BOLD;
  238.     for (i=0;i<ATTR_MAX;i++)
  239.       if (colour[i])            /* a colour has been set up in profile */
  240.          set_colour(i,save_fg[i],save_bg[i],save_mod[i]);
  241.       else
  242.          colour[i] = dflt_colour[i];
  243.    }
  244.  else
  245.    {
  246.     dflt_colour[ATTR_FILEAREA] = A_NORMAL;           /* main window text lines */
  247.     dflt_colour[ATTR_CURLINE]  = A_BOLD;                       /* current line */
  248.     dflt_colour[ATTR_BLOCK]    = A_REVERSE;           /* text in markded block */
  249.     dflt_colour[ATTR_CBLOCK]   = A_BOLD | A_REVERSE;
  250.                                        /* current line if in marked block */
  251.     dflt_colour[ATTR_CMDLINE]  = A_BOLD;                       /* command line */
  252.     dflt_colour[ATTR_IDLINE]   = A_REVERSE;                    /* id line (top)*/
  253.     dflt_colour[ATTR_MSGLINE]  = A_BLINK;                      /* message line */
  254.     dflt_colour[ATTR_ARROW]    = A_BOLD;                       /* arrow prompt */
  255.     dflt_colour[ATTR_PREFIX]   = A_BOLD;                        /* prefix area */
  256.     dflt_colour[ATTR_PENDING]  = A_BOLD;            /* pending prefix commands */
  257.     dflt_colour[ATTR_SCALE]    = A_BOLD;                         /* scale line */
  258.     dflt_colour[ATTR_TOFEOF]   = A_BOLD;                      /* tof eof lines */
  259.     dflt_colour[ATTR_CTOFEOF]  = A_BOLD;     /* current line if on t/eof lines */
  260.     dflt_colour[ATTR_TABLINE]  = A_BOLD;                           /* tab line */
  261.     dflt_colour[ATTR_SHADOW]   = A_BOLD;                       /* shadow lines */
  262.     dflt_colour[ATTR_STATAREA] = A_REVERSE;             /* status line (bottom)*/
  263.     dflt_colour[ATTR_DIVIDER]  = A_BOLD;                            /* divider */
  264.     for (i=0;i<ATTR_MAX;i++)
  265.       if (colour[i])            /* a colour has been set up in profile */
  266.          set_colour(i,save_fg[i],save_bg[i],save_mod[i]);
  267.       else
  268.          colour[i] = dflt_colour[i];
  269.    }
  270. #else
  271.  dflt_colour[ATTR_FILEAREA] = A_NORMAL;           /* main window text lines */
  272.  dflt_colour[ATTR_CURLINE]  = A_BOLD;                       /* current line */
  273.  dflt_colour[ATTR_BLOCK]    = A_REVERSE;           /* text in markded block */
  274.  dflt_colour[ATTR_CBLOCK]   = A_BOLD | A_REVERSE;
  275.                                     /* current line if in marked block */
  276.  dflt_colour[ATTR_CMDLINE]  = A_BOLD;                       /* command line */
  277.  dflt_colour[ATTR_IDLINE]   = A_REVERSE;                    /* id line (top)*/
  278.  dflt_colour[ATTR_MSGLINE]  = A_BLINK;                      /* message line */
  279.  dflt_colour[ATTR_ARROW]    = A_BOLD;                       /* arrow prompt */
  280.  dflt_colour[ATTR_PREFIX]   = A_REVERSE;                        /* prefix area */
  281.  dflt_colour[ATTR_PENDING]  = A_BOLD;            /* pending prefix commands */
  282.  dflt_colour[ATTR_SCALE]    = A_BOLD;                         /* scale line */
  283.  dflt_colour[ATTR_TOFEOF]   = A_BOLD;                      /* tof eof lines */
  284.  dflt_colour[ATTR_CTOFEOF]  = A_BOLD | A_REVERSE;     /* current line if on t/eof lines */
  285.  dflt_colour[ATTR_TABLINE]  = A_BOLD;                           /* tab line */
  286.  dflt_colour[ATTR_SHADOW]   = A_BOLD;                       /* shadow lines */
  287.  dflt_colour[ATTR_STATAREA] = A_REVERSE;             /* status line (bottom)*/
  288.  dflt_colour[ATTR_DIVIDER]  = A_BOLD;                            /* divider */
  289.  for (i=0;i<ATTR_MAX;i++)
  290.       if (colour[i])            /* a colour has been set up in profile */
  291.          set_colour(i,save_fg[i],save_bg[i],save_mod[i]);
  292.       else
  293.          colour[i] = dflt_colour[i];
  294. #endif
  295.  
  296. #ifdef TRACE
  297.  trace_return();
  298. #endif
  299.  return;
  300. }
  301. /***********************************************************************/
  302. #ifdef PROTO
  303. short get_profile(char *prf_arg)
  304. #else
  305. short get_profile(prf_arg)
  306. char *prf_arg;
  307. #endif
  308. /***********************************************************************/
  309. {
  310. /*------------------------- external data -----------------------------*/
  311.  extern char in_macro;
  312.  extern char the_profile_file[MAX_FILE_NAME+1];
  313.  extern bool profile_specified;
  314. /*--------------------------- local data ------------------------------*/
  315.  FILE *fp;
  316.  short rc=RC_OK;
  317. /*--------------------------- processing ------------------------------*/
  318. #ifdef TRACE
  319.  trace_function("default.c: get_profile");
  320. #endif
  321. /*---------------------------------------------------------------------*/
  322. /* Check to see if the profile file exists and is readable. If the file*/
  323. /* does not exists or is not readable, return. If a profile file was   */
  324. /* explicitly specified, display an error if it doesn't exist. If the  */
  325. /* file is not readable, whether we specified it or not, display error.*/
  326. /*---------------------------------------------------------------------*/
  327.  if (!file_exists(the_profile_file))
  328.    {
  329.     if (profile_specified)
  330.        display_error(9,the_profile_file);
  331. #ifdef TRACE
  332.     trace_return();
  333. #endif
  334.     return(RC_FILE_NOT_FOUND);
  335.    }
  336. /*---------------------------------------------------------------------*/
  337. /* If the file is not readable, error.                                 */
  338. /*---------------------------------------------------------------------*/
  339.  if (!file_readable(the_profile_file))
  340.    {
  341.     display_error(8,the_profile_file);
  342. #ifdef TRACE
  343.     trace_return();
  344. #endif
  345.     return(RC_ACCESS_DENIED);
  346.    }
  347. /*---------------------------------------------------------------------*/
  348. /* To get here, we either have a specified a valid profile name or we  */
  349. /* haven't specified a profile file at all.                            */
  350. /*---------------------------------------------------------------------*/
  351.  in_macro = TRUE;
  352. #if !defined(NOREXX)
  353.  if (!in_profile)
  354.     post_process_line(CURRENT_VIEW->focus_line);
  355.  rc = execute_macro_file(the_profile_file,prf_arg);
  356.  if (rc != RC_OK)
  357.    {
  358.     display_error(54,(char *)"");
  359.     in_macro = FALSE;
  360. #ifdef TRACE
  361.     trace_return();
  362. #endif
  363.     return(RC_SYSTEM_ERROR);
  364.    }
  365. #else
  366.  if ((fp = fopen(the_profile_file,"r")) == NULL)
  367.    {
  368.     in_macro = FALSE;
  369. #ifdef TRACE
  370.     trace_return();
  371. #endif
  372.     return(RC_ACCESS_DENIED);
  373.    }
  374.  if (!in_profile)
  375.     post_process_line(CURRENT_VIEW->focus_line);
  376.  rc = execute_command_file(fp);
  377.  fclose(fp);
  378. #endif
  379.  in_macro = FALSE;
  380.  
  381. #ifdef TRACE
  382.  trace_return();
  383. #endif
  384.  return(rc);
  385. }
  386. /***********************************************************************/
  387. #ifdef PROTO
  388. short defaults_for_first_file(void)
  389. #else
  390. short defaults_for_first_file()
  391. #endif
  392. /***********************************************************************/
  393. {
  394. /*--------------------------- local data ------------------------------*/
  395.  register int i;
  396. /*--------------------------- processing ------------------------------*/
  397. #ifdef TRACE
  398.  trace_function("default.c: defaults_for_first_file");
  399. #endif
  400. /*---------------------------------------------------------------------*/
  401. /* Add to view linked list.                                            */
  402. /*---------------------------------------------------------------------*/
  403. #ifdef USE_VOID
  404.  if ((CURRENT_VIEW = (VIEW_DETAILS *)ll_add((void *)vd_first,(void *)vd_current,sizeof(VIEW_DETAILS)))
  405. #else
  406.  if ((CURRENT_VIEW = vll_add(vd_first,vd_current,sizeof(VIEW_DETAILS)))
  407. #endif
  408.                    == (VIEW_DETAILS *)NULL)
  409.    {
  410. #ifdef TRACE
  411.     trace_return();
  412. #endif
  413.     return(RC_OUT_OF_MEMORY);
  414.    }
  415.  if (vd_first == (VIEW_DETAILS *)NULL)
  416.     vd_first = CURRENT_VIEW;
  417.  
  418.  CURRENT_VIEW->current_row = 6;
  419.  CURRENT_VIEW->current_base = CURLINE_TOP;
  420.  CURRENT_VIEW->current_off = CURRENT_VIEW->current_row;
  421.  CURRENT_VIEW->cmd_line = CMD_LINEx;
  422.  CURRENT_VIEW->error_row = ERROR_ROWx;
  423.  CURRENT_VIEW->tab_row = TAB_ROWx;
  424.  CURRENT_VIEW->tab_on = TAB_ONx;
  425.  CURRENT_VIEW->scale_row = SCALE_ROWx;
  426.  CURRENT_VIEW->scale_on = SCALE_ONx;
  427.  CURRENT_VIEW->focus_line = CURRENT_ROW_POSx;
  428.  CURRENT_VIEW->current_line = CURRENT_ROW_POSx;
  429.  CURRENT_VIEW->stay = STAYx;
  430.  CURRENT_VIEW->hex = HEXx;
  431.  CURRENT_VIEW->arbchar_status = ARB_STSx;
  432.  CURRENT_VIEW->arbchar_char = ARB_CHRx;
  433.  CURRENT_VIEW->tabs = TABSx;
  434.  CURRENT_VIEW->linend_status = LINEND_STATUSx;
  435.  CURRENT_VIEW->linend_value = LINEND_VALUEx;
  436.  CURRENT_VIEW->case_enter = CASE_Ex;
  437.  CURRENT_VIEW->case_locate = CASE_Lx;
  438.  CURRENT_VIEW->case_change = CASE_Cx;
  439.  CURRENT_VIEW->case_sort = CASE_Sx;
  440.  CURRENT_VIEW->prefix = PREFIXx;
  441.  CURRENT_VIEW->message_mode = MSGMx;
  442.  CURRENT_VIEW->verify_start = VER_STAx;
  443.  CURRENT_VIEW->verify_col = VER_COLx;
  444.  CURRENT_VIEW->verify_end = VER_ENDx;
  445.  CURRENT_VIEW->zone_start = ZON_STAx;
  446.  CURRENT_VIEW->zone_end = ZON_ENDx;
  447.  CURRENT_VIEW->mark_type = 0;
  448.  CURRENT_VIEW->mark_start_line = (-1L);
  449.  CURRENT_VIEW->mark_end_line = (-1L);
  450.  CURRENT_VIEW->mark_start_col = (-1);
  451.  CURRENT_VIEW->mark_end_col = (-1);
  452.  CURRENT_VIEW->display_high = DISPLAY_HIGHx;
  453.  CURRENT_VIEW->display_low = DISPLAY_LOWx;
  454.  CURRENT_VIEW->scope = 'D';
  455.  CURRENT_VIEW->newline_aligned = NEWLx;
  456.  CURRENT_VIEW->imp_macro = IMPMACROx;
  457.  CURRENT_VIEW->imp_os = IMPOSx;
  458.  CURRENT_VIEW->number = NUMBERx;
  459.  CURRENT_VIEW->margin_left = 1;
  460.  CURRENT_VIEW->margin_right = 72;
  461.  CURRENT_VIEW->margin_indent = 0;
  462.  CURRENT_VIEW->margin_indent_offset = TRUE;
  463.  CURRENT_VIEW->wordwrap = FALSE;
  464.  
  465.  CURRENT_VIEW->current_window = WINDOW_COMMAND;
  466.  CURRENT_VIEW->previous_window = WINDOW_COMMAND;
  467.  
  468.  for (i=0;i<VIEW_WINDOWS;i++)
  469.      CURRENT_VIEW->win[i] = (WINDOW *)NULL;
  470.  
  471.  CURRENT_FILE = (FILE_DETAILS *)NULL;
  472.  
  473.  CURRENT_SCREEN.screen_view = CURRENT_VIEW;
  474.  
  475.  number_of_views++;
  476. /*---------------------------------------------------------------------*/
  477. /* Initialise pending prefix command array.                            */
  478. /*---------------------------------------------------------------------*/
  479.  for (i=0;i<MAX_PENDING_PREFIX_COMMANDS;i++)
  480.     {
  481.      strcpy(CURRENT_VIEW->ppc[i].ppc_command,"");
  482.      CURRENT_VIEW->ppc[i].ppc_line_number = (-1L);
  483.      CURRENT_VIEW->ppc[i].ppc_cmd_idx = (-1L);
  484.     }
  485.  CURRENT_VIEW->prefix_command_index = 0;
  486. #ifdef TRACE
  487.  trace_return();
  488. #endif
  489.  return(RC_OK);
  490. }
  491. /***********************************************************************/
  492. #ifdef PROTO
  493. short defaults_for_other_files(void)
  494. #else
  495. short defaults_for_other_files()
  496. #endif
  497. /***********************************************************************/
  498. {
  499. /*--------------------------- local data ------------------------------*/
  500.  register int i;
  501. /*--------------------------- processing ------------------------------*/
  502. #ifdef TRACE
  503.  trace_function("default.c: defaults_for_other_files");
  504. #endif
  505. #ifdef USE_VOID
  506.  if ((CURRENT_VIEW = (VIEW_DETAILS *)ll_add((void *)vd_first,(void *)vd_current,sizeof(VIEW_DETAILS)))
  507. #else
  508.  if ((CURRENT_VIEW = vll_add(vd_first,vd_current,sizeof(VIEW_DETAILS)))
  509. #endif
  510.                    == (VIEW_DETAILS *)NULL)
  511.    {
  512. #ifdef TRACE
  513.     trace_return();
  514. #endif
  515.     return(RC_OUT_OF_MEMORY);
  516.    }
  517.  if (vd_first == (VIEW_DETAILS *)NULL)
  518.     vd_first = CURRENT_VIEW;
  519.  
  520.  CURRENT_VIEW->command_row =     PREVIOUS_VIEW->command_row;
  521.  CURRENT_VIEW->cmd_line =        PREVIOUS_VIEW->cmd_line;
  522.  CURRENT_VIEW->error_row =       PREVIOUS_VIEW->error_row;
  523.  CURRENT_VIEW->tab_row =         PREVIOUS_VIEW->tab_row;
  524.  CURRENT_VIEW->tab_on =          PREVIOUS_VIEW->tab_on;
  525.  CURRENT_VIEW->scale_row =       PREVIOUS_VIEW->scale_row;
  526.  CURRENT_VIEW->scale_on =        PREVIOUS_VIEW->scale_on;
  527.  CURRENT_VIEW->current_row =     PREVIOUS_VIEW->current_row;
  528.  CURRENT_VIEW->current_base =    PREVIOUS_VIEW->current_base;
  529.  CURRENT_VIEW->current_off =     PREVIOUS_VIEW->current_off;
  530.  CURRENT_VIEW->current_line =    CURRENT_ROW_POSx;
  531.  CURRENT_VIEW->focus_line =      CURRENT_ROW_POSx;
  532.  CURRENT_VIEW->tabs =            TABSx;
  533.  CURRENT_VIEW->stay =            STAYx;
  534.  CURRENT_VIEW->hex =             HEXx;
  535.  CURRENT_VIEW->arbchar_status =  PREVIOUS_VIEW->arbchar_status;
  536.  CURRENT_VIEW->arbchar_char =    PREVIOUS_VIEW->arbchar_char;
  537.  CURRENT_VIEW->linend_status =   PREVIOUS_VIEW->linend_status;
  538.  CURRENT_VIEW->linend_value =    PREVIOUS_VIEW->linend_value;
  539.  CURRENT_VIEW->case_enter =      PREVIOUS_VIEW->case_enter;
  540.  CURRENT_VIEW->case_locate =     PREVIOUS_VIEW->case_locate;
  541.  CURRENT_VIEW->case_change =     PREVIOUS_VIEW->case_change;
  542.  CURRENT_VIEW->case_sort =       PREVIOUS_VIEW->case_sort;
  543.  CURRENT_VIEW->message_mode =    PREVIOUS_VIEW->message_mode;
  544.  CURRENT_VIEW->prefix =          PREVIOUS_VIEW->prefix;
  545.  CURRENT_VIEW->verify_start =    VER_STAx;
  546.  CURRENT_VIEW->verify_col =      VER_COLx;
  547.  CURRENT_VIEW->verify_end =      VER_ENDx;
  548.  CURRENT_VIEW->zone_start =      ZON_STAx;
  549.  CURRENT_VIEW->zone_end =        ZON_ENDx;
  550.  CURRENT_VIEW->mark_type =       0;
  551.  CURRENT_VIEW->mark_start_line = (-1L);
  552.  CURRENT_VIEW->mark_end_line =   (-1L);
  553.  CURRENT_VIEW->mark_start_col =  (-1);
  554.  CURRENT_VIEW->mark_end_col =    (-1);
  555.  CURRENT_VIEW->display_high =    DISPLAY_HIGHx;
  556.  CURRENT_VIEW->display_low =     DISPLAY_LOWx;
  557.  CURRENT_VIEW->scope =           'D';
  558.  CURRENT_VIEW->newline_aligned = NEWLx;
  559.  CURRENT_VIEW->imp_macro =       PREVIOUS_VIEW->imp_macro;
  560.  CURRENT_VIEW->imp_os =          PREVIOUS_VIEW->imp_os;
  561.  CURRENT_VIEW->number =          PREVIOUS_VIEW->number;
  562.  CURRENT_VIEW->margin_left =     PREVIOUS_VIEW->margin_left;
  563.  CURRENT_VIEW->margin_right =    PREVIOUS_VIEW->margin_right;
  564.  CURRENT_VIEW->margin_indent =   PREVIOUS_VIEW->margin_indent;
  565.  CURRENT_VIEW->margin_indent_offset = PREVIOUS_VIEW->margin_indent_offset;
  566.  CURRENT_VIEW->wordwrap =        PREVIOUS_VIEW->wordwrap;
  567.  
  568.  CURRENT_VIEW->current_window =  WINDOW_COMMAND;
  569.  CURRENT_VIEW->previous_window =    WINDOW_COMMAND;
  570.  
  571.  for (i=0;i<VIEW_WINDOWS;i++)
  572.      CURRENT_VIEW->win[i] = (WINDOW *)NULL;
  573.  
  574.  CURRENT_FILE = (FILE_DETAILS *)NULL;
  575.  
  576.  CURRENT_SCREEN.screen_view = CURRENT_VIEW;
  577.  
  578.  number_of_views++;
  579. /*---------------------------------------------------------------------*/
  580. /* Initialise pending prefix command array.                            */
  581. /*---------------------------------------------------------------------*/
  582.  for (i=0;i<MAX_PENDING_PREFIX_COMMANDS;i++)
  583.     {
  584.      strcpy(CURRENT_VIEW->ppc[i].ppc_command,"");
  585.      CURRENT_VIEW->ppc[i].ppc_line_number = (-1L);
  586.      CURRENT_VIEW->ppc[i].ppc_cmd_idx = (-1L);
  587.     }
  588.  CURRENT_VIEW->prefix_command_index = 0;
  589.  
  590. #ifdef TRACE
  591.  trace_return();
  592. #endif
  593.  return(RC_OK);
  594. }
  595. /***********************************************************************/
  596. #ifdef PROTO
  597. short default_file_attributes(void)
  598. #else
  599. short default_file_attributes()
  600. #endif
  601. /***********************************************************************/
  602. {
  603. /*--------------------------- local data ------------------------------*/
  604. /*--------------------------- processing ------------------------------*/
  605. #ifdef TRACE
  606.  trace_function("default.c: default_file_attributes");
  607. #endif
  608.  
  609.  CURRENT_FILE->fmode =           FMODE;
  610.  CURRENT_FILE->file_views =      1;
  611.  CURRENT_FILE->first_line  =     NULL;
  612.  CURRENT_FILE->autosave_alt =    0;
  613.  CURRENT_FILE->autosave =        AUSx;
  614.  CURRENT_FILE->backup =          BACKUPx;
  615.  CURRENT_FILE->save_alt =        0;
  616.  CURRENT_FILE->eolout =          EOLx;
  617.  CURRENT_FILE->tabsout_on =      TABO_ONx;
  618.  CURRENT_FILE->tabsout_num =     TABO_Nx;
  619.  CURRENT_FILE->pseudo_file =     PSEUDO_REAL;
  620.  
  621.  CURRENT_FILE->fname =           (char *)NULL;
  622.  CURRENT_FILE->fpath =           (char *)NULL;
  623.  
  624. #ifdef TRACE
  625.  trace_return();
  626. #endif
  627.  return(RC_OK);
  628. }
  629. /***********************************************************************/
  630. #ifdef PROTO
  631. void set_screen_defaults(void)
  632. #else
  633. void set_screen_defaults()
  634. #endif
  635. /***********************************************************************/
  636. {
  637.  extern int reserved_top,reserved_bottom;
  638. /*--------------------------- local data ------------------------------*/
  639. /*--------------------------- processing ------------------------------*/
  640. #ifdef TRACE
  641.  trace_function("default.c: set_screen_defaults");
  642. #endif
  643.  
  644.  CURRENT_SCREEN.origin_x =         0;
  645.  CURRENT_SCREEN.origin_y =         reserved_top;
  646.  if (horizontal)
  647.    {
  648.     CURRENT_SCREEN.screen_rows =   (LINES - 1 - reserved_top + reserved_bottom ) / display_screens;
  649.     CURRENT_SCREEN.screen_cols =   COLS;
  650.    }
  651.  else
  652.    {
  653.     CURRENT_SCREEN.screen_rows =   LINES - 1 - reserved_top + reserved_bottom;
  654.     CURRENT_SCREEN.screen_cols =   (COLS / display_screens)-((display_screens == 1) ? 0 : 1); /**/
  655.    }
  656.  if (display_screens == 1)
  657.    {
  658.     OTHER_SCREEN.origin_x =        0;
  659.     OTHER_SCREEN.origin_y =        reserved_top;
  660.     OTHER_SCREEN.screen_rows =     LINES - 1 - reserved_top + reserved_bottom;
  661.     OTHER_SCREEN.screen_cols =     COLS;
  662.    }
  663.  else
  664.    {
  665.     if (horizontal)
  666.       {
  667.        OTHER_SCREEN.origin_x =     0;
  668.        OTHER_SCREEN.origin_y =     CURRENT_SCREEN.screen_rows + reserved_top;
  669.        OTHER_SCREEN.screen_rows =  LINES - 1 - CURRENT_SCREEN.screen_rows - reserved_top + reserved_bottom;
  670.        OTHER_SCREEN.screen_cols =  COLS;
  671.       }
  672.     else
  673.       {
  674.        OTHER_SCREEN.origin_x =     CURRENT_SCREEN.screen_cols+((display_screens == 1) ? 0 : 2); /**/
  675.        OTHER_SCREEN.origin_y =     reserved_top;
  676.        OTHER_SCREEN.screen_rows =  LINES - 1 - reserved_top + reserved_bottom;
  677.        OTHER_SCREEN.screen_cols =  COLS - CURRENT_SCREEN.screen_cols-((display_screens == 1) ? 0 : 2);/**/
  678.       }
  679.    }
  680.  
  681. #ifdef TRACE
  682.  trace_return();
  683. #endif
  684.  return;
  685. }
  686.