home *** CD-ROM | disk | FTP | other *** search
- { Global variable declarations for SORT }
-
- var
- { Booleans for handling option switches, etc. }
- ancase, { if true, ignore non-alphanumerics }
- earlyout, { set to true if insufficient memory for sort }
- helponly, { set to true if user was help message only }
- ignoreblanks, { set to true on "/b" option }
- isfirst,
- islast,
- keysonly, { if true, write only the key fields on output }
- linefound, { an identical data line has already been entered }
- reversed, { reverse the sense of the sort "/r" }
- sensecase, { if true, "a"="A"; if false, "a">"A" }
- sorterror, { set to true if sort integrity is in question }
- sortnumeric, { set to true on "/n" option }
- unique, { set to true on "/u" option }
- usefields { set to true on "/f" option }
- : boolean;
-
- delimset : set of char;
-
- i, { generic counter }
- keycol,
- keycol2,
- parmcount { paramcount of first filename }
- :integer;
-
- nlks, { actual key column and length for new line }
- nlkl
- :byte;
-
- fe, { text file for error messages }
- fi { text file for reading lines to be sorted }
- :text;
-
- key,
- pname, { Name of the program ("SORT" by default ) }
- s:string;
-
- kn:real; { Numeric key }
-
- { Btree record pointers }
- root,
- firstnode,
- lastnode,
- current
- :lp;
-
- nodecount:longint;
-
- { variables to handle fsplit and findfirst/findnext file searches }
- fstr:pathstr;
- d:dirstr;
- n:namestr;
- x:extstr;
- sr:searchrec;
-
- { Global variable initialization }
- procedure sortinit; begin
-
- freemin:=16000; sorterror:=false; earlyout:=false; root:=nil;
- firstnode:=nil; lastnode:=nil; nodecount:=0; ignoreblanks:=false;
- reversed:=false; sortnumeric:=false; sensecase:=defaultcase; keycol:=0;
- keycol2:=0; unique:=false; helponly:=false; usefields:=false;
- ancase:=false; delimset:=[]; keysonly:=false;
-
- fsplit(paramstr(0),d,pname,x); if pname='' then pname:='SORT';
-
- end;