home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / apps / spread / opusprg / opussrc / gctv.inc < prev    next >
Text File  |  1988-04-19  |  20KB  |  516 lines

  1.  
  2. {$P-}
  3.  
  4. CONST
  5.         max_winds      = 2;
  6.         n_rows         = 999;
  7.         n_cols         = 255;
  8.         n_functions    = 44;
  9.  
  10.         float_len      = 17; { for window_input call }
  11.         string_len     = 60;
  12.         inp_mask       = $13; { E_Message | E_Keyboard | E_Button }
  13.  
  14.         e              = 2.7182818285;
  15.         Ln2            = 0.69314718056;
  16.         Ln10           = 2.3025850930;
  17.         HalfPi         = 1.5707963268;
  18.         Pi             = 3.1415926536;
  19.         TwoPi          = 6.2831853072;
  20.         DegPerRad      = 57.295779513;
  21.         MaxSquare      = 9E18;
  22.         MinSquare      = 9E-18;
  23.  
  24.         Desk           = 3; { index of Desk menu item }
  25.         cell_size      = 26;
  26.         str_size       = 62;
  27.         dep_size       = 8;
  28.         
  29.         just_mask      = $0030;
  30.         no_just_mask   = $FFCF;
  31.         dollar_mask    = $0080;
  32.         no_dollar_mask = $FF7F;
  33.         perc_mask      = $0040;
  34.         no_perc_mask   = $FFBF;
  35.         
  36.         sci_mask       = $0008;
  37.         no_sci_mask    = $FFF7;
  38.         prec_mask      = $0007;
  39.         no_prec_mask   = $FFF8;
  40.         
  41.         style_mask     = $0700;
  42.         no_style_mask  = $F8FF;
  43.         bold_mask      = $0100;
  44.         italic_mask    = $0200;
  45.         under_mask     = $0400;
  46.         
  47.         recalc_mask      = $8000;
  48.         no_recalc_mask   = $7FFF;
  49.         pending_mask     = $4000;
  50.         not_pending_mask = $BFFF;
  51.  
  52.         RS232        = 2;
  53.         Centronics   = 3;
  54.         
  55.         add          = 1; { refers to action done on dependency lists }
  56.         remove       = 2; { that reference a given cell }
  57.         adj_refs     = 3; { distinguish from 2 above in proc adjust_expr }
  58.         
  59.         RecalcMsg        = $1000;
  60.         RecalcReply      = $1080;
  61.         StringaCellMsg   = $2000;
  62.         StringaCellReply = $2080;
  63.         TranslateMsg     = $3000;
  64.         TranslateReply   = $3080;
  65.         RealToStrMsg     = $4000;
  66.         RealToStrReply   = $4080;
  67.         StrToRealMsg     = $5000;
  68.         StrToRealReply   = $5080;
  69.         AssignedMsg      = $6000;
  70.         AssignedReply    = $6080; 
  71.         PresentMsg       = $7000;
  72.         PresentReply     = $7080;
  73.         RedrawMsg        = $8000;
  74.         RedrawReply      = $8080;
  75.         MfdbAddrMsg      = $9000;
  76.         MfdbAddrReply    = $9080;
  77.         DataMsg          = $A000;
  78.         DataReply        = $A080;
  79.         DefRangeMsg      = $B000;
  80.         DefRangeReply    = $B080;
  81.         GetRangeMsg      = $C000;
  82.         GetRangeReply    = $C080;
  83.         LocateMsg        = $D000;
  84.         LocateReply      = $D080;
  85.         DeleteMsg        = $E000;
  86.         DeleteReply      = $E080;
  87.         NewMsg           = $F000;
  88.         NewReply         = $F080;
  89.  
  90. { gemconst.pas - Personal Pascal GEM library constant definitions. }
  91.  
  92.     No_Window  = -1;
  93.  
  94.     Root       = 0 ;           { Index of root w/in object tree }
  95.     Null_Index = -1 ;          { Index of a non-existent item }
  96.     Max_Tree   = 100 ;
  97.     Max_Depth  = 8 ;           { for dialogs }
  98.  
  99.     White     = 0;
  100.     Black     = 1;
  101.     Red       = 2;
  102.     LightBlue = 3;
  103.  
  104.   { Line styles: }
  105.     Solid      = 1 ;
  106.     LongDash   = 2 ;
  107.     Dotted     = 3 ;
  108.     DashDot    = 4 ;
  109.     Dashed     = 5 ;
  110.     DashDotDot = 6 ;
  111.  
  112.   { Event values: }
  113.     E_Keyboard = $01 ;
  114.     E_Button   = $02 ;
  115.     E_MRect_1  = $04 ;
  116.     E_MRect_2  = $08 ;
  117.     E_Message  = $10 ;
  118.     E_Timer    = $20 ;
  119.     E_All      = $3F ;
  120.  
  121.     No_Flags   = 0;
  122.     Hide_Tree  = $80;
  123.  
  124.   { Graphics command constants: }
  125.     { Drawing modes: }
  126.     Replace_Mode   = 1 ;
  127.     Trans_Mode     = 2 ;
  128.     XOR_Mode       = 3 ;
  129.     Rev_Trans_Mode = 4 ;
  130.  
  131.   { Text effects: }
  132.     Normal     = 0 ;
  133.     Bold       = 1 ;
  134.     Italics    = 4 ;
  135.     Underlined = 8 ;
  136.  
  137.   { Font types: }
  138.     System_Font = 3 ;
  139.     Small_Font  = 5 ;
  140.  
  141.   { Object states }
  142.  
  143.     { Use Normal for no special state }
  144.     Selected    = $01 ;
  145.     Crossed     = $02 ;
  146.     Checked     = $04 ;
  147.     Disabled    = $08 ;
  148.     { Outlined and Shadowed are defined under text effects }
  149.  
  150.   { Window elements: }
  151.     G_All     = $0FEF ;          { All elements, excluding info line }
  152.  
  153.   { Predefined GEM messages: }
  154.     MN_Selected         = 10 ;
  155.     WM_Redraw           = 20 ;
  156.     WM_Topped           = 21 ;
  157.     WM_Closed           = 22 ;
  158.     WM_Fulled           = 23 ;
  159.     WM_Arrowed          = 24 ;
  160.     WM_HSlid            = 25 ;
  161.     WM_VSlid            = 26 ;
  162.     WM_Sized            = 27 ;
  163.     WM_Moved            = 28 ;
  164.  
  165.   { Wind_Get/Set field values: }
  166.     WF_PrevXYWH         = 6 ;
  167.     WF_FullXYWH         = 7 ;
  168.     WF_HSlide           = 8 ;
  169.     WF_VSlide           = 9 ;
  170.     WF_NewDesk          = 14 ;
  171.     WF_HSlSize          = 15 ;
  172.     WF_VSlSize          = 16 ;
  173.  
  174.   { VDI graphics text justification }
  175.     VDI_Left            = 0;
  176.     VDI_Center          = 1;
  177.     VDI_Right           = 2;
  178.  
  179. { End of gemconst.pas }
  180.  
  181.   TYPE
  182.    { gemtype.pas - Common GEM type definitions for Personal Pascal library. }
  183.  
  184.     Color_Reg = 0..15 ;
  185.     Draw_Modes = Replace_Mode..Rev_Trans_Mode ;
  186.     Line_Types = Solid..DashDotDot ;
  187.  
  188.     Mouse_Type = ( M_Arrow, M_Text_Curs, M_Bee, M_Point_Hand, M_Flat_Hand,
  189.                    M_Thin_Cross, M_Thick_Cross, M_Outln_Cross ) ;
  190.  
  191.     Dialog_Ptr      = ^char ;
  192.     Menu_Ptr        = ^char ;
  193.     Generic_Ptr     = ^CHAR; { can pass either of the above to this type var }
  194.     Word16 = ARRAY [ 0..15 ] OF integer ;
  195.     Mouse_Form = RECORD
  196.                    hot_x : integer ;
  197.                    hot_y : integer ;
  198.                    res : integer ;
  199.                    mask_color : integer ;
  200.                    data_color : integer ;
  201.                    mask : Word16 ;
  202.                    data : Word16 ;
  203.                  END ;
  204.  
  205.     File_Name    = STRING[12] ;
  206.     Path_Name    = STRING;
  207.     Window_Title = STRING;
  208.  
  209.     Message_Buffer = ARRAY [ 0..15 ] OF INTEGER;
  210.  
  211.     STR255   = STRING [ 255 ] ;
  212.     C_STRING = PACKED ARRAY [ 1..81 ] OF CHAR;
  213.     C_STR255 = PACKED ARRAY [ 1..256 ] OF CHAR;
  214.  
  215.     Palette_Buffer = ARRAY [ 0..15 ] OF INTEGER;
  216.  
  217.   { Editable text justification: }
  218.     TE_Just = ( TE_Left, TE_Right, TE_Center ) ;
  219.  
  220.   { Possible indices into a tree: }
  221.     Tree_Range = Root..Max_Tree ;
  222.     Tree_Index = Null_Index..Max_Tree ;
  223.  
  224.   { VDI graphic text justification }
  225.  
  226.     VDI_Just   = VDI_Left..VDI_Right;
  227.  
  228.   { AES and VDI parameter types; max definitions }
  229.  
  230.     Control_Parms  = ARRAY [ 0..11 ] OF INTEGER;
  231.     Int_In_Parms   = ARRAY [ 0..127 ] OF INTEGER;
  232.     Int_Out_Parms  = ARRAY [ 0..127 ] OF INTEGER;
  233.     Addr_In_Parms  = ARRAY [ 0..1  ] OF LONG_INTEGER;
  234.     Addr_Out_Parms = ARRAY [ 0..0  ] OF LONG_INTEGER;
  235.     Pts_In_Parms   = ARRAY [ 0..127 ] OF INTEGER;
  236.     Pts_Out_Parms  = ARRAY [ 0..127 ] OF INTEGER;
  237.  
  238.   { End of gemtype.pas }
  239.  
  240.         ClassType         = ( Val,Labl,Expr );
  241.         AssignedStatus    = ( Value,NonValue,Error,Desolate,Void );
  242.         StatusType        = ( GenError,SyntaxErr,OutOfRange,BadRef,Overflow,
  243.                               DivBy0,Undefined,BadReal,OK,Full,Empty );
  244.  
  245.         InpType           = ( FloatingPoint,AlphaNumeric,AnInteger );  
  246.         ControlCodes =
  247.            ( w_right_arrow,w_left_arrow,w_up_arrow,w_down_arrow,w_return,
  248.              w_page_right,w_page_left,w_page_up,w_page_down,w_cntl_a,w_cntl_z,
  249.              w_cntl_t,w_cntl_b,w_f1,w_f2,w_f3,w_f4,w_f5,w_f8,w_f9,w_f10,
  250.              w_sf2,w_sf3,w_sort,w_percent,w_style,alt_1,alt_2,alt_3,alt_4,
  251.              c_1,c_2,c_3,c_4,alt_x,alt_b,alt_m,alt_c,f6,f7,sf6,sf7,
  252.              c_f,c_l,alt_h,alt_i,alt_k,alt_f,alt_l,alt_t,
  253.              w_column,w_justify,w_precision,w_start_block,w_end_block,
  254.              w_deselect,w_replicate,w_goto,w_home,w_view,w_esc,
  255.              w_message,w_mouse,w_null,w_f,NoCode );
  256.  
  257.         AllFunctions      = (
  258.                               LogOp,ExpOp,LnOp,SqrOp,SqrtOp,SinOp,CosOp,TanOp,
  259.          { set names: }       AsinOp,AcosOp,AtanOp,RadOp,DegOp,FacOp,
  260.          { Single }           AbsOp,PiOp,NotOp, { (<expr>) }
  261.  
  262.          { Double }           DivOp,ModOp,RandOp,RoundOp,TruncOp,
  263.                               { (<expr>,<expr>) }
  264.  
  265.          { Multiple }         AndOp,OrOp,
  266.  
  267.                               CountOp,SumOp,ProdOp,MeanOp,VarOp,SdevOp,SerrOp,
  268.          { Aggregate }        MaxOp,MinOp,   { (<range>) }
  269.                               LinrOp,CorrOp, { (<range>,<range>) }
  270.                               PredvOp,       { (<range>,<range>,<expr>) }
  271.  
  272.          { Financial }        PvOp,FvOp,
  273.                               PmtOp,NperOp, { (<expr>,<expr>,<expr>)  }
  274.  
  275.          { LookUp }           VlookupOp,HlookupOp, { (<range>,<expr>,<expr>) }
  276.                               IndexOp,
  277.  
  278.          { None }             IfOp                 { (<expr>,<expr>,<expr>) }
  279.                              );
  280.  
  281.         BoolOps           = ( Equal,NotEqual,Greater,GreaterOrEqual,Lesser,
  282.                               LesserOrEqual );
  283.  
  284.         PosAttr           = ( w_hdl,first_row,first_col,last_row,last_col,
  285.                               hot_row,hot_col );
  286.         WidthFields       = ( spaces,pixels );
  287.  
  288.         SumSqrProd        = ( Sum,SumSquares,Product );
  289.  
  290.         ReqType           = ( ACell,AString );
  291.         
  292.         ExpandDirection   = ( ExRight,ExLeft );
  293.         MapAction         = ( ClearSelected,ReturnSelected );
  294.         CursorDirection   = ( CursorDown,CursorRight );
  295.         HomeType          = ( R,C,Both,Origin );
  296.         BlitDirection     = ( None,Left,Right,Up,Down );
  297.         FormatCall        = ( CWCall,DollarCall,JustCall,PrecCall,PercCall,
  298.                               StyleCall,GlobalCall );
  299.         ExtentType        = ( NoRowNames,NoColNames,WholeSheet,JustData );
  300.  
  301.         DiskIoOps         = ( LoadFile,SaveFile,LoadBlock,SaveBlock,
  302.                               SaveText );
  303.         PrinterSpecial    = ( Init,LineTerm,PageTerm,Draft,Final,Condensed,
  304.                               BoldOn,BoldOff,ItalicOn,ItalicOff,
  305.                               UnderOn,UnderOff );
  306.         PortType          = RS232..Centronics;
  307.         PrinterLineOps    = ( LfOp,FFOp,RowColOp,Title1Op,Title2Op,HeaderOp,
  308.                               DataOp,FooterOp ); 
  309.  
  310.         STR1              = STRING[1];
  311.         STR2              = STRING[2];
  312.         STR5              = STRING[5];
  313.         STR10             = STRING[10];
  314.         STR30             = STRING[30];
  315.         STR40             = STRING[40];
  316.         STR60             = STRING[60];
  317.         LorFstr           = STR60;
  318.         Len61             = PACKED ARRAY [1..61] OF CHAR;
  319.         P_EdText          = LorFstr; { buffer type for text fields in forms }
  320.         C_EdText          = Len61;
  321.         PtrToReal         = ^REAL;
  322.         PtrToString       = ^STRING;
  323.         BlitArray         = PACKED ARRAY [1..32000] OF BYTE;
  324.  
  325.         ESquares          = ARRAY [1..7] OF REAL;
  326.  
  327.         Letters           = SET OF CHAR;
  328.  
  329.         FunctionDef       = RECORD
  330.                                  func_name : STR10;
  331.                                  func_type : AllFunctions;
  332.                             END;
  333.         CellCoordinates   = RECORD
  334.                                  row,
  335.                                  col : INTEGER;
  336.                             END;
  337.         Mfdb              = RECORD
  338.                                  address : LONG_INTEGER;
  339.                                  wid_pix : INTEGER; { define all these   }
  340.                                  ht_pix  : INTEGER; { separately else    }
  341.                                  wid_wds : INTEGER; { the compiler will  }
  342.                                  format  : INTEGER; { store them in the  }
  343.                                  planes  : INTEGER; { REVERSE order, and }
  344.                                  res1    : INTEGER; { GEM will misunder- }
  345.                                  res2    : INTEGER; { stand...           }
  346.                                  res3    : INTEGER
  347.                             END;
  348.  
  349.         ThreeHundredBytes = PACKED ARRAY [1..300] OF BYTE;
  350.         PrinterCodes      = ARRAY [Init..UnderOff] OF STR10;
  351.         TypeWidth         = ARRAY [1..n_cols,WidthFields] OF BYTE;
  352.         ColDividerPos     = ARRAY [1..20] OF INTEGER;  { 20 case expanded rez }
  353.         HundredInts       = ARRAY [1..100] OF INTEGER; { ever available, 8 is }
  354.         TypeName          = ARRAY [1..n_cols] OF STR2; { max needed at present}
  355.         ErrorStrings      = ARRAY [GenError..BadReal] OF STR10;
  356.         LineOpArray       = ARRAY [1..66] OF PrinterLineOps;
  357.         FunctionArray     = ARRAY [1..n_functions] OF FunctionDef;
  358.         MarkArray         = ARRAY [1..6] OF CellCoordinates;
  359.         MonthArray        = ARRAY [1..12] OF STR10;
  360.         DayArray         = ARRAY [1..7] OF STR10;
  361.         
  362.         Switcheroo        = RECORD
  363.                                  CASE BYTE OF
  364.                                     1 : ( c        : INTEGER );
  365.                                     2 : ( format   : INTEGER );
  366.                                     3 : ( class    : ClassType );
  367.                                     4 : ( status   : StatusType );
  368.                                     5 : ( number   : REAL );
  369.                                     6 : ( str      : STRING );
  370.                                     7 : ( switched : ThreeHundredBytes );
  371.                                  END;
  372.  
  373.         DepPtr            = ^DependentCells;
  374.         DependentCells    = PACKED RECORD
  375.                                  r,
  376.                                  c    : INTEGER;
  377.                                  next : DepPtr;
  378.                             END;
  379.         CellPtr           = ^CellType;
  380.         CellType          = PACKED RECORD
  381.                                  c         : INTEGER;
  382.                                  format    : INTEGER;
  383.                                  class     : ClassType;
  384.                                  status    : StatusType;
  385.                                  num       : REAL;
  386.                                  str       : ^LorFstr;
  387.                                  sub       : DepPtr;
  388.                                  next      : CellPtr;
  389.                             END;
  390.         DataTable         = ARRAY [0..n_rows] OF CellPtr; { the zero'th row }
  391.                                                           { is for a scratch}
  392.   VAR ap_id,x_1,y_1,w_1,h_1,hdl,hdl_1,hdl_2,              { list }
  393.       act_hdl,n_hdls,i,j,h_entry,v_entry,o_x,
  394.       o_y,max_w,max_h,start_row,start_col,
  395.       finish_row,finish_col,o_s_col,o_f_col,
  396.       o_s_row,o_f_row,o_scr_row,o_scr_col,
  397.       data_row,data_col,kbd_state,
  398.       scr_row,scr_col,o_data_row,
  399.       o_data_col,x_pos,y_pos,mx,my,
  400.       two_cell_h,three_cell_h,event,b_cnt,
  401.       key,fo_x,fo_y,fo_w,fo_h,
  402.       rez,total,alert,n_ops,
  403.       screen_height,b_s_row,b_s_col,
  404.       b_e_row,b_e_col,cell_height,
  405.       redraw_x,redraw_y,redraw_w,redraw_h,
  406.       clip_x,clip_y,clip_w,clip_h,
  407.       w_idx,drive,screen_width,default_format,
  408.       max_screen_cols,half_scr_width,
  409.       half_scr_height,
  410.       column,char_count,x_pix,btn_state,
  411.       blit_x,blit_y,blit_w,blit_h,
  412.       pos_in_str,nl_chr_line,con_chr_line,
  413.       v_slider_pos,h_slider_pos,message_type,
  414.       x_margin,y_margin,freeze_row,freeze_col,
  415.       logical_row_1,logical_col_1,
  416.       virtual_f_row,virtual_f_col,
  417.       virtual_h_entry,virtual_v_entry,
  418.       edit_x,edit_y,
  419.       con_x,con_y,con_w,con_h,area_x,area_y,
  420.       area_w,area_h                             : INTEGER;
  421.       long_key,original_memory,working_memory,
  422.       data_addr                                 : LONG_INTEGER;
  423.       v_slide_inc,h_slide_inc                   : REAL;
  424.       temp_char,char1,char2                     : CHAR;
  425.       null_str                                  : STR1;
  426.       col_row                                   : STR10;
  427.       temp_1                                    : STR30;
  428.       directory                                 : C_STRING;
  429.       full_path,current_file                    : STRING;
  430.       temp,too_long,old_form,float_over         : STR255;
  431.       p_title_1,p_title_2,header,footer         : P_EdText;
  432.       p_row_col,print_formulas,draft_final,
  433.       condensed_print,
  434.       null_input,full_redraw,
  435.       global_extent,block_set,block_st_set,
  436.       block_end_set,
  437.       need_to_redraw,
  438.       redraw_flag,grid_flag,auto_cursor,
  439.       form_flag,user_quit,auto_recalc,
  440.       did_recalc,m1s,m2s,m3s,m4s,
  441.       small_text,bad_str,natural                : BOOLEAN;
  442.       extent                                    : ExtentType;
  443.       default_path                              : ARRAY [1..2] OF STRING;
  444.       w_pos                                     : ARRAY [1..max_winds,PosAttr]
  445.                                                     OF INTEGER;
  446.       w_vert_grid                               : ARRAY [1..2] OF ColDividerPos;
  447.  
  448.       Single,Double,Multiple,                                
  449.       Aggregate,Financial,LookUp                : SET OF AllFunctions;
  450.  
  451.       blit_buffer                               : BlitArray;
  452.       days                                      : DayArray;
  453.       months                                    : MonthArray;
  454.       e_table                                   : ESquares;
  455.       cursor_direction                          : CursorDirection;
  456.       up_case,low_case,float,digits             : Letters;
  457.       port                                      : PortType;
  458.       printer_codes                             : PrinterCodes;
  459.       inp_code                                  : ControlCodes;
  460.       error_msg                                 : ErrorStrings;     
  461.       screen_mfdb,mem_mfdb                      : Mfdb;
  462.       marks                                     : MarkArray;
  463.       num_str                                   : LorFstr;
  464.       s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,
  465.       s12,s13                                   : C_EdText;
  466.       old_vert_grid,vert_grid                   : ColDividerPos;
  467.       col_width                                 : TypeWidth;
  468.       col_name                                  : TypeName;
  469.       functions                                 : FunctionArray;
  470.       ptr                                       : CellPtr;
  471.       data                                      : DataTable;
  472.  
  473.       { GEM-related stuff }
  474.  
  475.       control                                   : Control_Parms;
  476.       int_in                                    : Int_In_Parms;
  477.       int_out                                   : Int_Out_Parms;
  478.       addr_in                                   : Addr_In_Parms;
  479.       addr_out                                  : Addr_Out_Parms;
  480.       pts_in                                    : Pts_In_Parms;
  481.       pts_out                                   : Pts_Out_Parms;
  482.       palette                                   : Palette_Buffer;
  483.       main_menu                                 : Menu_Ptr;
  484.       info_ptr,goto_ptr,fmat_ptr,
  485.       rep_ptr,vfrm_ptr,sort_ptr,
  486.       print_ptr,key_ptr,form_ptr,
  487.       rang_ptr,err_ptr,stat_ptr,prhelp_ptr,
  488.       mhelp_ptr,crefhelp_ptr,rechelp_ptr,
  489.       page_ptr,data_fill_ptr,freeze_ptr,
  490.       action_ptr,new_desk_ptr                   : Dialog_Ptr;
  491.       indx                                      : Tree_Index;
  492.       t_1,t_2,dummy_title                       : Window_Title;
  493.       msg_area,msg                              : Message_Buffer;
  494.  
  495.       { declarations for string_to_real and real_to_string }
  496.       
  497.       exp_val,
  498.       sign_exp,
  499.       sign_num,
  500.       lfactor,
  501.       places,
  502.       str_pos,
  503.       str_len,
  504.       dec_pos,
  505.       comma_pos,
  506.       n_digits   : INTEGER;
  507.       real_num,
  508.       mag_num,
  509.       lpower     : REAL;
  510.       lquit,
  511.       loverflow,
  512.       found      : BOOLEAN;
  513.       last       : PACKED ARRAY [1..15] OF CHAR;
  514.  
  515.  
  516.