Skip to content

Commit 8b134f3

Browse files
committed
moved global types, variables and data into separate unit
1 parent 99e9e67 commit 8b134f3

4 files changed

Lines changed: 307 additions & 227 deletions

File tree

utilities/makelist/cfgopts.pas

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,7 @@ interface
1818
{$ENDIF}
1919
SysUtils,
2020
{ you can add units after this }
21-
Version, PasExt;
22-
23-
const
24-
{$IFDEF Windows}
25-
DirSource : String = '..\..\source\';
26-
DirOutput : String = '..\..\TheList\';
27-
{$ELSE}
28-
DirSource : String = '../../source/';
29-
DirOutput : String = '../../TheList/';
30-
{$ENDIF}
31-
32-
// When enabled, program will use older methods for a couple LST files for
33-
// better compatibility with older parsers.
34-
LegacyMode : boolean = False;
35-
36-
// Maximum bytes allowed in LST file. use -1 for no restriction.
37-
MaxFileSize : integer = 360 * 1024;
38-
39-
// Enable more strict verification for use with CI/CD
40-
CICD : boolean = false;
41-
42-
// Filename to write file list of problem files.
43-
Issues : String = '';
44-
21+
Version, PasExt, GloDat;
4522

4623
{ Display Program Banner and Version }
4724
procedure Banner;
@@ -178,7 +155,7 @@ procedure Options;
178155
'--cicd' : CICD:=True;
179156
'--modern' : LegacyMode:=False;
180157
'--legacy' : LegacyMode:=True;
181-
'--issues' : Issues:=Trim(NextOpt);
158+
'--issues' : IssueFileName:=Trim(NextOpt);
182159
'-s', '--source' : DirSource:=IncludeTrailingPathDelimiter(Trim(NextOpt));
183160
'-o', '--output' : DirOutput:=IncludeTrailingPathDelimiter(Trim(NextOpt));
184161
'-m', '--maximum' : begin

utilities/makelist/glodat.pas

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
// Copyright 2026, Jerome Shidel
2+
// The Clear BSD License
3+
// All rights reserved.
4+
5+
unit GloDat;
6+
7+
{$mode objfpc}{$H+}
8+
9+
{$I patches.pp} // Various compiler directives to "fix" things.
10+
{$I version.def} // Version information defines
11+
12+
interface
13+
14+
uses
15+
{$IFDEF USES_CWString} cwstring, {$ENDIF}
16+
{$IFDEF UNIX}
17+
cthreads,
18+
{$ENDIF}
19+
Classes, SysUtils,
20+
{ you can add units after this }
21+
Version, // Program version information, generated by version.sh
22+
PasExt, BinTree; // A couple basic MPLA units.
23+
24+
type
25+
// Types of Sections in a LST file
26+
TSectionKind = (
27+
skNone, // Simply copied files or is not broken into multiple files
28+
skInterrupt, skCMOS, skFarCall, skI2C, skMemory, skMSR, skPort,
29+
skStandard, // All the same
30+
skGlossary, // Just glued together
31+
skTable, // Just glued together in an empty comment section
32+
skSMM, // Just glued together in separate "other" sections
33+
skLink, // Just glued together in LINK comment sections
34+
skFAQ // Just glued together in FAQ comment sections
35+
);
36+
37+
const
38+
{$IFDEF Windows}
39+
// Default output path for the compiled list release
40+
DirSource : String = '..\..\source\';
41+
// Default output path for the compiled list release
42+
DirOutput : String = '..\..\TheList\';
43+
{$ELSE}
44+
// Default output path for the compiled list release
45+
DirSource : String = '../../source/';
46+
// Default output path for the compiled list release
47+
DirOutput : String = '../../TheList/';
48+
{$ENDIF}
49+
50+
// When enabled, program will use older methods for a couple LST files for
51+
// better compatibility with older parsers.
52+
LegacyMode : boolean = False;
53+
54+
// Maximum bytes allowed in LST file. use -1 for no restriction.
55+
MaxFileSize : integer = 360 * 1024;
56+
57+
// Enable more strict verification for use with CI/CD
58+
CICD : boolean = false;
59+
60+
// File extension for all source files
61+
SrcExt = '.txt';
62+
// Directory Mapping file
63+
MapFile = '_Mapping' + SrcExt;
64+
// LST Header Data file
65+
HeaderFile = '_Header' + SrcExt;
66+
// TheList Release version, fairly static.
67+
ReleaseFile = '_Release' + SrcExt;
68+
// Leading characters for all section breaks
69+
SectionLead = '--------';
70+
// Number of charcters in a section break
71+
SectionWidth = 45;
72+
// The Interrup.1st default source directory subpath, may be different.
73+
// see the _MapFile
74+
IntFirstDir : String = 'Interrupt First';
75+
// Dir with Miscellaneous files that are just copied
76+
MiscFileDir : String = 'Miscellaneous';
77+
78+
// That pesky non-interrupt list interrupt file :-)
79+
FILE_1ST = 'INTERRUP.1ST';
80+
81+
// Maximum Length of Link Section ID in the LINKS.LST
82+
MaxLinkID : integer = 19;
83+
84+
// Default conversion information of Long File Names to DOS versions
85+
DOSNAMES : array of record
86+
Name, // Long file name of File or Group Path.
87+
DOS : String; // DOS file name for output file.
88+
Kind : TSectionKind; // Type of sections used by that file.
89+
end = (
90+
// Miscellaneous files
91+
(Name:'Advertisement'+SrcExt; DOS:'_ADVERT.TXT'; Kind:skNone),
92+
(Name:'Interrupt Primer'+SrcExt; DOS:'INTERRUP.PRI'; Kind:skNone),
93+
(Name:'Need Help'+SrcExt; DOS:'NEEDHELP.TXT'; Kind:skNone),
94+
(Name:'Ralf Brown'+SrcExt; DOS:'RBROWN.TXT'; Kind:skNone),
95+
(Name:'Read Me Now'+SrcExt; DOS:'README.NOW'; Kind:skNone),
96+
// List Files
97+
(Name:'Frequently-Asked Questions';DOS:'FAQ.LST'; Kind:skFAQ),
98+
(Name:'Bibliography'; DOS:'BIBLIO.LST'; Kind:skNone),
99+
(Name:'Category'; DOS:'CATEGORY.KEY'; Kind:skNone),
100+
(Name:'Cmos-Memory Map'; DOS:'CMOS.LST'; Kind:skCMOS),
101+
(Name:'Far Call Interface'; DOS:'FARCALL.LST'; Kind:skFarCall),
102+
(Name:'Glossary'; DOS:'GLOSSARY.LST'; Kind:skGlossary),
103+
(Name:'I2C-Bus Devices'; DOS:'I2C.LST'; Kind:skI2C),
104+
(Name:'Interrupt First'; DOS:FILE_1ST; Kind:skNone),
105+
(Name:'Interrupt List'; DOS:'INTERRUP.LST'; Kind:skInterrupt),
106+
(Name:'Links'; DOS:'LINKS.LST'; Kind:skLink),
107+
(Name:'Memory Map'; DOS:'MEMORY.LST'; Kind:skMemory),
108+
(Name:'Model-Specific Registers'; DOS:'MSR.LST'; Kind:skMSR),
109+
(Name:'Overview'; DOS:'OVERVIEW.LST'; Kind:skNone),
110+
(Name:'Ports List'; DOS:'PORTS.LST'; Kind:skPort),
111+
(Name:'Selected Tables'; DOS:'TABLES.LST'; Kind:skTable),
112+
(Name:'System-Management Mode'; DOS:'SMM.LST'; Kind:skSMM)
113+
);
114+
115+
// Sections to include in the INTERRUP.1ST file
116+
INTERRUPT_1ST : TArrayOfString = (
117+
'Filelist',
118+
'Copyright',
119+
'Disclaimer',
120+
'Availability',
121+
'Abbreviations',
122+
'Credits',
123+
'Addresses',
124+
'Trademarks',
125+
'Quotes',
126+
'Contact Info'
127+
);
128+
129+
// General order of sections for all LST files (excluding INTERRUP.1ST).
130+
SECTION_ORDER : TArrayOfString = (
131+
'Introduction',
132+
'Disclaimer',
133+
'Note',
134+
'Flags',
135+
'Categories',
136+
'Category Keys',
137+
'Titles',
138+
'*',
139+
'Bibliography',
140+
'Undone',
141+
'History',
142+
'Contributors',
143+
'Credits',
144+
'Contact Info',
145+
'Admin'
146+
);
147+
148+
// Default file information for INTERRUP.1ST's FILELIST section.
149+
DOSINFO : array of record
150+
Name, Text : String;
151+
end = (
152+
(Name:FILE_1ST; Text:'this file'),
153+
(Name:'INTERRUP.LST'; Text:'Interrupts'),
154+
(Name:'PORTS.LST'; Text:'listing of I/O Ports'),
155+
(Name:'INTERRUP.PRI'; Text:'a brief primer on interrupts'),
156+
(Name:'OVERVIEW.LST'; Text:'brief listing of major uses of each interrupt'),
157+
(Name:'BIBLIO.LST'; Text:'bibliography of information sources for the list'),
158+
(Name:'CMOS.LST'; Text:'a description of the CMOS RAM data bytes'),
159+
(Name:'FARCALL.LST'; Text:'APIs available through FAR CALLs'),
160+
(Name:'GLOSSARY.LST'; Text:'a glossary of terms, abbreviations, and acronyms'),
161+
(Name:'MEMORY.LST'; Text:'format of the BIOS data area and other memory regions'),
162+
(Name:'MSR.LST'; Text:'a listing of Model-Specific Registers'),
163+
(Name:'CATEGORY.KEY'; Text:'descriptions of divider-line category letters'),
164+
(Name:'TABLES.LST'; Text:'a list of selected tables'),
165+
(Name:'LINKS.LST'; Text:'a list of links to reference and sites in the docs'),
166+
(Name:'FAQ.LST'; Text:'a list of frequently asked questions'),
167+
(Name:'README.NOW'; Text:'a read me document')
168+
);
169+
170+
{ ---------------------------------------------------------------------------- }
171+
// Global processing variables
172+
var
173+
// LST file source base directory
174+
BaseDir : String;
175+
// LST Output FileName
176+
OutName : String;
177+
// Maximum LST file title width (+1)
178+
TitleWidth : integer;
179+
// Header for LST file
180+
Header : String;
181+
// Text from _Header file when present
182+
HeaderData : RawByteString;
183+
// Release Build Date/Time
184+
BuildTime : TDateTime;
185+
// LST file release time stamp
186+
LastChange : String;
187+
// Current List Type
188+
SectionKind : TSectionKind;
189+
190+
// For LST file headers, probably not used
191+
ReleaseVersion : RawByteString;
192+
// Working output data for LST file
193+
WorkingData : RawByteString;
194+
// For verification all section comment files were used.
195+
CommentFiles : TStringList;
196+
// For assembling the section file data
197+
SectionTree : TBinaryTree;
198+
// 80-chars, but well will just test it is at least 70
199+
HeaderBar : String;
200+
// For verification, table numbers are unique
201+
TableTree : TBinaryTree;
202+
// Table Letter Code
203+
TableCode : String;
204+
// Highest Table Number
205+
TableHigh : integer;
206+
// Number of tables in LST
207+
TableCount : integer;
208+
209+
// total of all entries in all sections
210+
TotalEntries : integer;
211+
// total of all tables in all sections
212+
TotalTables : integer;
213+
// total number of actual errors
214+
TotalErrors : integer;
215+
// Number of non-errors that will be problems for parsers
216+
TotalProblems : integer;
217+
// Less Severe problems that should be fixed at some point
218+
TotalWarnings : integer;
219+
// Number of entries with duplicate IDs
220+
TotalDuplicates : integer;
221+
// File Info for the FILELIST Section
222+
FileInfo : TBinaryTree;
223+
224+
{ ---------------------------------------------------------------------------- }
225+
const
226+
// Filename to write file list of problem files.
227+
IssueFileName : String = '';
228+
// Tracks if the Issues file has been opened.
229+
IssueFileOpen : boolean = false;
230+
231+
var
232+
// The current working Entry file name for Issues.
233+
LastFileName: String;
234+
// The Issues text file handle.
235+
IssueFileHandle : Text;
236+
237+
implementation
238+
239+
240+
end.

0 commit comments

Comments
 (0)