home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / GET10.ZIP / GETVARS.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-11-09  |  8.1 KB  |  221 lines

  1. {$B-,D-,F-,I-,L+,N-,R-,S-,T-,V+} {TP4 directives}
  2.  
  3. Unit Getvars;
  4.  
  5. Interface
  6.  
  7. Type
  8.  
  9.   DateType     = (American,European,Japanese);
  10.   YearType     = (NY,YY,YYYY); {NY = 19YY}
  11.   PlaceType    = 0..10;
  12.   plusbyte     = 1..255;
  13.   SymbolStr    = string[12]; {US$, Mb, milliseconds, kilometres etc.}
  14.   screen_text  = string[255];
  15.   numstring    = string[40];
  16.   ok_keys      = set of char;
  17.   CharsetName  = string[13]; {'alphanumeric ' is longest, 12 + space}
  18.  
  19.   UserFormatRec = record
  20.     UnitSymbol: SymbolStr;
  21.     places:     PlaceType;
  22.     UnitFormat: $00..$0F; {bit mapped array, see UserFormatArray below}
  23.   end;
  24.  
  25.  
  26.   CharacterSetType = (Alphabetic,Alphanumeric,Numeric,Printable,YesAndNo,
  27.                       TrueOrFalse,FieldMarkers,AnyCharacter);
  28.  
  29.   CharSetRec = record
  30.     CharacterSetName: CharSetName;
  31.     CharSet:          ok_keys;
  32.   end;
  33.  
  34.  
  35. Const
  36.  
  37.   CharacterSet: array[Alphabetic..FieldMarkers] of CharSetRec =
  38.   (
  39.   (CharacterSetName: 'Alphabetic';
  40.    CharSet:           ['A'..'Z','a'..'z']),
  41.   (CharacterSetName: 'Alphanumeric';
  42.    CharSet:           ['A'..'Z','a'..'z','0'..'9']),
  43.   (CharacterSetName: 'Numeric';
  44.    CharSet:           ['0'..'9']),
  45.   (CharacterSetName: 'Printable';
  46.    CharSet:           [' '..'~']),
  47.   (CharacterSetName: 'Y or N';
  48.    CharSet:           ['Y','y','N','n']),
  49.   (CharacterSetName: 'Boolean';
  50.    CharSet:          ['Y','y','N','n','+','-','T','F','t','f','1','0','√',' ']),
  51.   (CharacterSetName: ''; {Field markers, name not used}
  52.    CharSet:           ['!', {@,} '#', '$', '%', '^', '&', '*',
  53.                        '(', ')', '_', '+', '|', '-', '=', '`',
  54.                        '{', '}', '[', ']', ':', ';', '"', '/',
  55.                        '<', '>', '?','B'])
  56.   );
  57.  
  58. {
  59.   Note: DefaultAltSwitch, ShiftCharacter and RepeatCharacter should NOT be in
  60.   the set of field markers
  61. }
  62.  
  63.   TotalUserFormats = 6;
  64.  
  65.   Unformatted = $00;
  66.   SymbolFirst = $01;
  67.   Commas      = $02; {use ThousandsDelimiter, not necessarily a comma}
  68.   Parentheses = $04;
  69.   Financial   = $06;
  70.   SIdisplay   = $08; {Système International format}
  71.  
  72.   SymbolFirst_Commas      = $03;
  73.   SymbolFirst_Parentheses = $05;
  74.   SymbolFirst_Financial   = $07;
  75.  
  76.   SI_SymbolFirst             = $09;
  77.   SI_Commas                  = $0A;
  78.   SI_Parentheses             = $0C;
  79.   SI_Financial               = $0E;
  80.   SI_SymbolFirst_Commas      = $0B;
  81.   SI_SymbolFirst_Parentheses = $0D;
  82.   SI_SymbolFirst_Financial   = $0F;
  83.  
  84.  
  85.   UserFormatArray: array[1..TotalUserFormats] of UserFormatRec =
  86.  
  87.   (
  88.   (UnitSymbol: '$';           places: 2; UnitFormat: SymbolFirst_Commas),
  89.   (UnitSymbol: '£';           places: 2; UnitFormat: SymbolFirst_Financial),
  90.   (UnitSymbol: ' FFr';        places: 2; UnitFormat: SI_Financial),
  91.   (UnitSymbol: ' SFr';        places: 2; UnitFormat: SI_Financial),
  92.   (UnitSymbol: ' Km/sec';     places: 3; UnitFormat: unformatted),
  93.   (UnitSymbol: ' Megahertz';  places: 3; UnitFormat: unformatted)
  94.   );
  95. {
  96.   Note:
  97.  
  98.   UnitSymbol should not include a '+' or '-' sign (it will be set to '').
  99.  
  100.   You should set up a series of suitably named constants to use with the
  101.   getreal procedure so that you can pass the appropriate index value to
  102.   it to select the required UserFormatRec. E.g.
  103.  
  104.   Const
  105.  
  106.     dollars  = -1; sterling = -2; SwissFrancs = -3; etc.
  107.  
  108.   Simply substitute 'dollars' for -1 as a parameter where you would ordinarily
  109.   enter a value for decimal_points (the negative value indicates to getreal
  110.   that user formatting, using the appropriate entry in UserFormatArray, is
  111.   requested).
  112.  
  113. }
  114.  
  115.   Dollars      = -1;
  116.   Pounds       = -2;
  117.   FrenchFrancs = -3;
  118.   SwissFrancs  = -4;
  119.   Kmpersec     = -5;
  120.   MHz          = -6;
  121.  
  122.   YesLetter              = 'Y';
  123.   NoLetter               = 'N';
  124.   TrueChars              = 'YyTt+1'; {need not include BooleanTrueChar}
  125.   FalseChars             = 'NnFf-0';
  126.   BooleanTrueChar        = '√'; {what to display for true}
  127.   BooleanFalseChar       = ' '; { and false}
  128. {
  129.   Typed constants
  130. }
  131.   CheckBreak             : boolean = false; {true = allow ^Break}
  132.  
  133.   AutoTab                : boolean = true; {skip to next field when field full}
  134.   Escaped                : boolean = false;
  135.   FieldWrap              : boolean = false; {wrap from 1st to last and vv}
  136.   StringFieldWrap        : boolean = false; {<- & -> exits string fields}
  137.   ForceUppercase         : boolean = false;
  138.   Overwrite              : boolean = false;
  139.   PaintingFields         : boolean = true;
  140.   RightJustifyNumbers    : boolean = true;
  141.   SoundOn                : boolean = true; {user switchable}
  142.   Top_n_Tail             : boolean = true; {trim leading & trailing spaces}
  143.   ValidationOverride     : boolean = false;
  144.   ZeroAsBlank            : boolean = false;
  145.   ZeroFillNumbers        : boolean = false;
  146.   ErrorLineClear         : boolean = true;
  147.   Error2LineClear        : boolean = true; {error lines 1,2 are clear T/F}
  148.   PasswordField          : boolean = false;
  149.   RightJustifyNumberEntry: boolean = false;
  150.   DateZeroAsBlank        : boolean = true;
  151.   TimeZeroAsBlank        : boolean = true;  {display hh:mm = '  :  ' if 00:00}
  152.   InsLock                : boolean = false; {Insert mode locked off}
  153.   RedisplayPrompts       : boolean = false; {Don't redisplay when editing field}
  154.  
  155.   DateFormat             : DateType = European;
  156.   YearFormat             : YearType = NY; {19YY}
  157.  
  158.   DecimalDefault       : byte = 2;   {default no. of decimal places for reals}
  159.   BellTone             : integer = 500;
  160.   TabSize              : byte = 8;
  161.   ShiftCharacter       : char = '\';
  162.   RepeatCharacter      : char = '@';
  163.   DefaultAltSwitch     : char = '~';
  164.   DefaultDateSeparator : char = '/';
  165.   SI_ThousandsDelimiter: char = '.'; {standard values are ' ' and '.'}
  166.   PasswordChar         : char = ' '; {character echoed during password entry}
  167.   cp                   : byte = 1;   {def starting cursor pos for string edits}
  168. {
  169.   Video attributes, EGA colour assumed for default
  170. }
  171.   RedAttr             : byte = 79;  {attribute for displaying negative reals}
  172.   AttrNM              : byte = 2;   {normal video attribute}
  173.   AttrBO              : byte = 15;  {bold video attribute}
  174.   FieldCursor         : byte = 112; {> 0 to override field attr when editing}
  175.   PicCursor           : byte = 127; { as above }
  176.   Default_pattr       : byte = 2;
  177.   Default_dattr       : byte = 15;
  178.   Default_cursor_attr : byte = 32;
  179.  
  180. {
  181.   The following variables are to facilitate language independent error
  182.   messages. Variables rather than constants are used in order to save
  183.   code and stack space (constants are embedded in the code repeatedly if
  184.   used repeatedly, with variables only the address is used).
  185.  
  186.   Note: typed constants are placed in the code segment.
  187. }
  188.  
  189.   Invalid_no_of_days_in_month : string = 'Invalid number of days in month';
  190.   Invalid_month_number        : string = 'Invalid month number';
  191.   Press_a_numeric_key         : string = 'Press a numeric key';
  192.   No_privilege                : string = 'No privilege';
  193.   Default_is_invalid          : string = 'Default is invalid';
  194.   Invalid_key                 : string = 'Invalid key';
  195.   Enter_a_number_between      : string = 'Enter a number between ';
  196.   Enter_either                : string = 'Enter either ';
  197.   Null_input_not_allowed      : string = 'Null input not allowed';
  198.   Fixed_length_input_required : string = 'Fixed length input required';
  199.   Range_checking_suspended    : string = 'Range checking suspended';
  200.   Validation_suspended        : string = 'Validation suspended';
  201.   Number_must_be_in_range     : string = 'Number must be in range: ';
  202.   Outside_validation_range    : string = ' outside validation range ';
  203.   CharacterWord               : string = ' character ';
  204.   InputWord                   : string = ' input ';
  205.   RequiredWord                : string = 'required';
  206.   NumberWord                  : string = 'Number ';
  207.   AndWord                     : string = ' and ';
  208.   ToWord                      : string = ' to ';
  209.   OrWord                      : string = ' or ';
  210.   SureYN                      : string = 'Sure ~Y~/~N~? '; {NB use DefaultAltSwitch}
  211.   EnterYorN                   : string = 'Y or N ';
  212.  
  213.  
  214. Var
  215.  
  216.   LastVideoMode,
  217.   VideoModeNow:       byte;
  218.  
  219. Implementation
  220.  
  221. end.