PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/amunits/src/otherlibs/identify.pas

https://github.com/slibre/freepascal
Pascal | 726 lines | 473 code | 107 blank | 146 comment | 6 complexity | 6e50367514cf27aeb9ec4e534e9bd382 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1{
  2    This file is part of the Free Pascal run time library.
  3
  4    A file in Amiga system run time library.
  5    Copyright (c) 2001-2003 by Nils Sjoholm
  6    member of the Amiga RTL development team.
  7
  8    See the file COPYING.FPC, included in this distribution,
  9    for details about the copyright.
 10
 11    This program is distributed in the hope that it will be useful,
 12    but WITHOUT ANY WARRANTY; without even the implied warranty of
 13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 14
 15 **********************************************************************}
 16
 17{
 18    History:
 19
 20    First version of this unit.
 21    13 Mar 2001.
 22
 23    Updated to use fpc 1.0.7
 24    Added array of const and some
 25    overlay functions.
 26    08 Jan 2003
 27
 28    Added the defines use_amiga_smartlink and
 29    use_auto_openlib.
 30    12 Jan 2003.
 31
 32    Changed cardinal > longword.
 33    Changed startcode for unit.
 34    11 Feb 2003.
 35
 36    nils.sjoholm@mailbox.swipnet.se
 37}
 38
 39{$mode objfpc}
 40
 41{$I useamigasmartlink.inc}
 42{$ifdef use_amiga_smartlink}
 43    {$smartlink on}
 44{$endif use_amiga_smartlink}
 45
 46UNIT IDENTIFY;
 47
 48INTERFACE
 49USES Exec, utility;
 50
 51{
 52** $VER: identify.h 13.0 (11.09.2001)
 53**
 54** identify.library definitions
 55**
 56** (C) Copyright 1996-2000 Richard Koerber
 57** All Rights Reserved.
 58}
 59
 60CONST  _IDTAGS      = $CD450000;
 61
 62{ --------------------------------------------------------------------------}
 63{ Generic library informations }
 64
 65CONST  IDENTIFYVERSION = 13;
 66       IDENTIFYNAME    : PChar = 'identify.library';
 67
 68TYPE   pIdentifyBase = ^tIdentifyBase;
 69       TIdentifyBase  = Record
 70          ifyb_LibNode  :tLibrary;
 71       End;
 72
 73CONST  IDENTIFYBUFLEN = 50;  { default buffer length }
 74
 75{ --------------------------------------------------------------------------}
 76{ Expansion() tags }
 77
 78       IDTAG_ConfigDev   = _IDTAGS+$00; { "p_ConfigDev" ConfigDev }
 79                                        { structure to be evaluated }
 80       IDTAG_ManufID     = _IDTAGS+$01; { UWORD manufacturer ID if no }
 81                                        { ConfigDev is available }
 82       IDTAG_ProdID      = _IDTAGS+$02; { UBYTE product ID if no }
 83                                        { ConfigDev is available }
 84       IDTAG_StrLength   = _IDTAGS+$03; { UWORD of maximum buffer length, }
 85                                        { including termination. Default }
 86                                        { is 50. }
 87       IDTAG_ManufStr    = _IDTAGS+$04; { STRPTR of manufacturer name }
 88                                        { puffer, or NULL }
 89       IDTAG_ProdStr     = _IDTAGS+$05; { STRPTR of product name }
 90                                        { puffer, or NULL }
 91       IDTAG_ClassStr    = _IDTAGS+$06; { STRPTR of product class }
 92                                        { puffer, or NULL }
 93       IDTAG_DeadStr     = _IDTAGS+$07; { STRPTR deadend or recoverable alert? }
 94       IDTAG_SubsysStr   = _IDTAGS+$08; { STRPTR alert subsystem }
 95       IDTAG_GeneralStr  = _IDTAGS+$09; { STRPTR alert general cause }
 96       IDTAG_SpecStr     = _IDTAGS+$0A; { STRPTR alert specific cause }
 97       IDTAG_FuncNameStr = _IDTAGS+$0B; { STRPTR function name }
 98       IDTAG_Expansion   = _IDTAGS+$0C; { "pp_ConfigDev" ConfigDev for a }
 99                                        { complete expansion check. Init }
100                                        { the variable with NULL and pass }
101                                        { a pointer to it using this tag. }
102       IDTAG_Secondary   = _IDTAGS+$0D; { BOOL warn for secondary expansion }
103                                        { boards (defaults to FALSE) }
104       IDTAG_ClassID     = _IDTAGS+$0E; { ULONG * class ID of the provided }
105                                        { expansion board (see below) [V8] }
106       IDTAG_Localize    = _IDTAGS+$0F; { BOOL return localized strings }
107                                        { (defaults to TRUE) [V8] }
108       IDTAG_NULL4NA     = _IDTAGS+$10; { BOOL return NULL for not available, }
109                                        { else return a string (defaults to }
110                                        { FALSE) [V8] }
111
112{ --------------------------------------------------------------------------}
113{ Hardware description types }
114
115       IDHW_SYSTEM      = 0;   { System (Amiga,DraCo,...)            [V2] }
116       IDHW_CPU         = 1;   { CPU (68000,68010,...,68060) }
117       IDHW_FPU         = 2;   { FPU (---,68881,68882,68040,68060) }
118       IDHW_MMU         = 3;   { MMU (---,68852,68030,68040,68060) }
119       IDHW_OSVER       = 4;   { OS Version (Vx.x) }
120       IDHW_EXECVER     = 5;   { Exec Version (Vx.x) }
121       IDHW_WBVER       = 6;   { Workbench Version (---,Vx.x) }
122       IDHW_ROMSIZE     = 7;   { OS ROM Size (xKB, xMB) }
123       IDHW_CHIPSET     = 8;   { Chipset (OCS,ECS,AGA,DraCo) }
124       IDHW_GFXSYS      = 9;   { Graphic OS (AmigaOS, CyberGraphX, ...) }
125       IDHW_CHIPRAM     = 10;  { Chip RAM (xKB, xMB, xGB) }
126       IDHW_FASTRAM     = 11;  { Fast RAM (xKB, xMB, xGB) }
127       IDHW_RAM         = 12;  { Total RAM (xKB, xMB, xGB) }
128       IDHW_SETPATCHVER = 13;  { SetPatch Version (---,Vx.x)         [V4] }
129       IDHW_AUDIOSYS    = 14;  { Audio OS (AmigaOS, AHI, ...)        [V5] }
130       IDHW_OSNR        = 15;  { AmigaOS (2.04, 3.1, ...) }
131       IDHW_VMMCHIPRAM  = 16;  { VMM Chip RAM ( *KB, *MB, *GB) }
132       IDHW_VMMFASTRAM  = 17;  { VMM Fast RAM ( *KB, *MB, *GB) }
133       IDHW_VMMRAM      = 18;  { VMM Total RAM ( *KB, *MB, *GB) }
134       IDHW_PLNCHIPRAM  = 19;  { Plain Chip RAM ( *KB, *MB, *GB) }
135       IDHW_PLNFASTRAM  = 20;  { Plain Fast RAM ( *KB, *MB, *GB) }
136       IDHW_PLNRAM      = 21;  { Plain Total RAM (*KB, *MB, *GB) }
137       IDHW_VBR         = 22;  { Vector Base Register                [V6] }
138       IDHW_LASTALERT   = 23;  { Last Alert code }
139       IDHW_VBLANKFREQ  = 24;  { VBlank Frequency }
140       IDHW_POWERFREQ   = 25;  { Power Frequency }
141       IDHW_ECLOCK      = 26;  { EClock }
142       IDHW_SLOWRAM     = 27;  { Plain Slow RAM ( *KB, *MB, *GB) }
143       IDHW_GARY        = 28;  { Gary (---,Normal,...) }
144       IDHW_RAMSEY      = 29;  { RAMSEY (---,D,F) }
145       IDHW_BATTCLOCK   = 30;  { Battery Backed Up Clock (---,Found) }
146       IDHW_CHUNKYPLANAR = 31; { Chunky To Planar Hardware (---,Found) [V7] }
147       IDHW_POWERPC     = 32;  { PowerPC present? (---,Found) }
148       IDHW_PPCCLOCK    = 33;  { PowerPC clock (unit MHz) }
149       IDHW_CPUREV      = 34;  { CPU revision                          [V8] }
150       IDHW_CPUCLOCK    = 35;  { CPU clock (unit MHz) }
151       IDHW_FPUCLOCK    = 36;  { FPU clock (unit MHz) }
152       IDHW_RAMACCESS   = 37;  { Main board RAM access time (unit ns) }
153       IDHW_RAMWIDTH    = 38;  { Main board RAM width (bit) }
154       IDHW_RAMCAS      = 39;  { Main board RAM CAS mode }
155       IDHW_RAMBANDWIDTH = 40; { Main board RAM bandwidth }
156       IDHW_TCPIP       = 41;  { TCP/IP stack                          [V9] }
157       IDHW_PPCOS       = 42;  { PowerPC OS }
158       IDHW_AGNUS       = 43;  { Agnus chip revision }
159       IDHW_AGNUSMODE   = 44;  { Agnus chip mode }
160       IDHW_DENISE      = 45;  { Denise chip version                   [V10] }
161       IDHW_DENISEREV   = 46;  { Denise chip revision }
162       IDHW_BOINGBAG    = 47;  { BoingBag number                       [V12] }
163       IDHW_NUMBEROF    = 48;  { Number of types, PRIVATE! }
164
165{ --------------------------------------------------------------------------}
166{ IDHW_SYSTEM numerical result codes }
167
168       IDSYS_AMIGA1000  = 0;    { Amiga 1000 }
169       IDSYS_AMIGAOCS   = 1;    { OCS Amiga 500/2000 }
170       IDSYS_AMIGAECS   = 2;    { ECS Amiga 500/2000 }
171       IDSYS_AMIGA500   = 3;    { Amiga 500 }
172       IDSYS_AMIGA2000  = 4;    { Amiga 2000 }
173       IDSYS_AMIGA3000  = 5;    { Amiga 3000 }
174       IDSYS_CDTV       = 6;    { CDTV }
175       IDSYS_AMIGA600   = 7;    { Amiga 600 }
176       IDSYS_CD32       = 8;    { CD32 }
177       IDSYS_AMIGA1200  = 9;    { Amiga 1200 }
178       IDSYS_AMIGA4000  = 10;   { Amiga 4000 }
179       IDSYS_DRACO      = 11;   { DraCo }
180       IDSYS_UAE        = 12;   { Ubiquitous Amiga Emulator }
181       IDSYS_AMIGA4000T = 13;   { Amiga 4000 Tower }
182
183{ --------------------------------------------------------------------------}
184{ IDHW_CPU numerical result codes }
185
186       IDCPU_68000     = 0;     { 68000 }
187       IDCPU_68010     = 1;     { 68010 }
188       IDCPU_68020     = 2;     { 68020 }
189       IDCPU_68030     = 3;     { 68030 }
190       IDCPU_68EC030   = 4;     { 68EC030 (without MMU) }
191       IDCPU_68040     = 5;     { 68040 }
192       IDCPU_68LC040   = 6;     { 68LC040 (without FPU) }
193       IDCPU_68060     = 7;     { 68060 }
194       IDCPU_68LC060   = 8;     { 68LC060 (without FPU) }
195
196{ --------------------------------------------------------------------------}
197{ IDHW_FPU numerical result codes }
198
199       IDFPU_NONE      = 0;     { no FPU }
200       IDFPU_68881     = 1;     { 68881 }
201       IDFPU_68882     = 2;     { 68882 }
202       IDFPU_68040     = 3;     { 68040 }
203       IDFPU_68060     = 4;     { 68060 }
204
205{ --------------------------------------------------------------------------}
206{ IDHW_MMU numerical result codes }
207
208       IDMMU_NONE      = 0;     { no MMU }
209       IDMMU_68851     = 1;     { 68851 }
210       IDMMU_68030     = 2;     { 68030 }
211       IDMMU_68040     = 3;     { 68040 }
212       IDMMU_68060     = 4;     { 68060 }
213
214{ --------------------------------------------------------------------------}
215{ IDHW_OSNR numerical result codes }
216
217       IDOS_UNKNOWN    = 0;     { <V36 or >V40 }
218       IDOS_2_0        = 1;     { OS2.0  (V36) }
219       IDOS_2_04       = 2;     { OS2.04 (V37) }
220       IDOS_2_1        = 3;     { OS2.1  (V38) }
221       IDOS_3_0        = 4;     { OS3.0  (V39) }
222       IDOS_3_1        = 5;     { OS3.1  (V40) }
223       IDOS_3_5        = 6;     { OS3.5  (V44) }
224       IDOS_3_9        = 7;     { OS3.9  (V45) }
225
226{ --------------------------------------------------------------------------}
227{ IDHW_CHIPSET numerical result codes }
228
229       IDCS_OCS        = 0;     { OCS }
230       IDCS_ECS        = 1;     { ECS }
231       IDCS_AGA        = 2;     { AGA }
232       IDCS_ALTAIS     = 3;     { DraCo Altais }
233       IDCS_NECS       = 4;     { Nearly ECS (no HR-Agnus or HR-Denise) }
234
235{ --------------------------------------------------------------------------}
236{ IDHW_GFXSYS numerical result codes }
237
238       IDGOS_AMIGAOS   = 0;     { Plain AmigaOS }
239       IDGOS_EGS       = 1;     { EGS }
240       IDGOS_RETINA    = 2;     { Retina }
241       IDGOS_GRAFFITI  = 3;     { Graffiti }
242       IDGOS_TIGA      = 4;     { TIGA }
243       IDGOS_PROBENCH  = 5;     { Merlin ProBench }
244       IDGOS_PICASSO   = 6;     { Picasso }
245       IDGOS_CGX       = 7;     { CyberGraphX }
246       IDGOS_CGX3      = 8;     { CyberGraphX 3D }
247       IDGOS_PICASSO96 = 9;     { Picasso96 }
248       IDGOS_CGX4      = 10;    { CyberGraphX V4 }
249
250{ --------------------------------------------------------------------------}
251{ IDHW_AUDIOSYS numerical result codes }
252
253       IDAOS_AMIGAOS   = 0;     { Plain AmigaOS }
254       IDAOS_MAESTIX   = 1;     { MaestroPro driver }
255       IDAOS_TOCCATA   = 2;     { Toccata driver }
256       IDAOS_PRELUDE   = 3;     { Prelude driver }
257       IDAOS_AHI       = 4;     { AHI }
258       IDAOS_MACROAUDIO = 5;    { MacroAudio }
259
260{ --------------------------------------------------------------------------}
261{ IDHW_GARY numerical result codes }
262
263       IDGRY_NONE      = 0;     { No Gary available }
264       IDGRY_NORMAL    = 1;     { Normal Gary }
265       IDGRY_ENHANCED  = 2;     { Enhanced Gary }
266
267{ --------------------------------------------------------------------------}
268{ IDHW_RAMSEY numerical result codes }
269
270       IDRSY_NONE      = 0;     { No RamSey available }
271       IDRSY_REVD      = 1;     { RamSey Revision D }
272       IDRSY_REVF      = 2;     { RamSey Revision F }
273
274{ --------------------------------------------------------------------------}
275{ IDHW_POWERPC numerical result codes }
276
277       IDPPC_NONE      = 0;     {  No PowerPC implemented }
278       IDPPC_OTHER     = 1;     {  Another PowerPC }
279       IDPPC_602       = 2;     {  602 }
280       IDPPC_603       = 3;     {  603 }
281       IDPPC_603E      = 4;     {  603e }
282       IDPPC_603P      = 5;     {  603p }
283       IDPPC_604       = 6;     {  604 }
284       IDPPC_604E      = 7;     {  604e }
285       IDPPC_620       = 8;     {  620 }
286
287{ --------------------------------------------------------------------------}
288{ IDHW_RAMCAS numerical result codes }
289
290       IDCAS_NONE      = 0;     {  Not available }
291       IDCAS_NORMAL    = 1;     {  Normal access }
292       IDCAS_DOUBLE    = 2;     {  Double access }
293
294{ --------------------------------------------------------------------------}
295{ IDHW_TCPIP numerical result codes }
296
297       IDTCP_NONE      = 0;     {  Not available }
298       IDTCP_AMITCP    = 1;     {  AmiTCP }
299       IDTCP_MIAMI     = 2;     {  Miami }
300       IDTCP_TERMITE   = 3;     {  TermiteTCP }
301       IDTCP_GENESIS   = 4;     {  GENESiS }
302       IDTCP_MIAMIDX   = 5;     {  MiamiDx }
303
304{ --------------------------------------------------------------------------}
305{ IDHW_PPCOS numerical result codes }
306
307       IDPOS_NONE      = 0;     {  None }
308       IDPOS_POWERUP   = 1;     {  PowerUP (Phase 5) }
309       IDPOS_WARPOS    = 2;     {  WarpOS (Haage&Partner) }
310
311{ --------------------------------------------------------------------------}
312{ IDHW_AGNUS numerical result codes }
313
314       IDAG_NONE       = 0;     {  None }
315       IDAG_UNKNOWN    = 1;     {  Unknown Agnus }
316       IDAG_8361       = 2;     {  Agnus 8361 }
317       IDAG_8367       = 3;     {  Agnus 8367 }
318       IDAG_8370       = 4;     {  Agnus 8370 }
319       IDAG_8371       = 5;     {  Agnus 8371 }
320       IDAG_8372_R4    = 6;     {  Agnus 8372 Rev. 1-4 }
321       IDAG_8372_R5    = 7;     {  Agnus 8372 Rev. 5 }
322       IDAG_8374_R2    = 8;     {  Alice 8374 Rev. 1-2 }
323       IDAG_8374_R3    = 9;     {  Alice 8374 Rev. 3-4 }
324
325{ --------------------------------------------------------------------------}
326{ IDHW_DENISE numerical result codes }
327
328       IDDN_NONE       = 0;     {  None }
329       IDDN_UNKNOWN    = 1;     {  Unknown Denise (new model?! :-) }
330       IDDN_8362       = 2;     {  Denise 8362 }
331       IDDN_8373       = 3;     {  Denise 8373 }
332       IDDN_8364       = 4;     {  Lisa 8364 }
333
334{ --------------------------------------------------------------------------}
335{ IDHW_AGNUSMODE numerical result codes }
336
337       IDAM_NONE       = 0;     {  None }
338       IDAM_NTSC       = 1;     {  NTSC Agnus }
339       IDAM_PAL        = 2;     {  PAL Agnus }
340
341{ --------------------------------------------------------------------------}
342{ IDTAG_ClassID numerical result codes }
343
344       IDCID_UNKNOWN     = 0;   {  unknown functionality }
345       IDCID_MISC        = 1;   {  miscellaneous expansion }
346       IDCID_TURBO       = 2;   {  accelerator }
347       IDCID_TURBORAM    = 3;   {  accelerator RAM }
348       IDCID_TURBOHD     = 4;   {  accelerator + some HD controller }
349       IDCID_TURBOIDE    = 5;   {  accelerator + AT-IDE controller }
350       IDCID_TURBOSCSIHD = 6;   {  accelerator + SCSI host adapter }
351       IDCID_NET         = 7;   {  some network }
352       IDCID_ARCNET      = 8;   {  ArcNet }
353       IDCID_ETHERNET    = 9;   {  Ethernet }
354       IDCID_AUDIO       = 10;  {  audio }
355       IDCID_VIDEO       = 11;  {  video (video digitizer etc) }
356       IDCID_MULTIMEDIA  = 12;  {  multimedia (audio, video, etc) }
357       IDCID_DSP         = 13;  {  multi purpose DSP }
358       IDCID_BUSBRIDGE   = 14;  {  ISA bus bridge }
359       IDCID_BRIDGE      = 15;  {  PC bridge }
360       IDCID_EMULATOR    = 16;  {  some Emulator hardware }
361       IDCID_MACEMU      = 17;  {  Macintosh emulator hardware }
362       IDCID_ATARIEMU    = 18;  {  Atari emulator hardware }
363       IDCID_GFX         = 19;  {  graphics (register) }
364       IDCID_GFXRAM      = 20;  {  graphics (video RAM) }
365       IDCID_HD          = 21;  {  some HD controller }
366       IDCID_HDRAM       = 22;  {  some HD controller + RAM }
367       IDCID_IDEHD       = 23;  {  IDE controller }
368       IDCID_IDEHDRAM    = 24;  {  IDE controller + RAM }
369       IDCID_SCSIHD      = 25;  {  SCSI host adapter }
370       IDCID_RAMSCSIHD   = 26;  {  SCSI host adapter + RAM }
371       IDCID_CDROM       = 27;  {  CD-ROM interface }
372       IDCID_MODEM       = 28;  {  internal modem }
373       IDCID_ISDN        = 29;  {  internal ISDN terminal adapter }
374       IDCID_MULTIIO     = 30;  {  multi I/O (serial + parallel) }
375       IDCID_SERIAL      = 31;  {  multi serial (no parallel) }
376       IDCID_PARALLEL    = 32;  {  multi parallel (no serial) }
377       IDCID_SCANIF      = 33;  {  scanner interface }
378       IDCID_TABLET      = 34;  {  drawing tablet interface }
379       IDCID_RAM         = 35;  {  plain RAM expansion }
380       IDCID_FLASHROM    = 36;  {  Flash ROM }
381       IDCID_SCSIIDE     = 37;  {  combined SCSI/IDE controller }
382       IDCID_RAMFPU      = 38;  {  RAM expansion + FPU }
383       IDCID_GUESS       = 39;  {  name was unknown but guessed }
384       IDCID_KICKSTART   = 40;  {  KickStart }
385       IDCID_RAM32       = 41;  {  32bit RAM expansion }
386       IDCID_TURBOANDRAM = 42;  {  accelerator + RAM expansion }
387       IDCID_ACCESS      = 43;  {  access control }
388       IDCID_INTERFACE   = 44;  {  some interface }
389       IDCID_MFMHD       = 45;  {  MFM HD controller }
390       IDCID_FLOPPY      = 46;  {  floppy disk controller }
391        { Be prepared to get other numbers as well. In this case you }
392        { should assume IDCID_MISC. }
393
394{ --------------------------------------------------------------------------}
395{ Error codes }
396
397{ Positive error codes are DOS errors! }
398       IDERR_OKAY = 0;       { No error }
399       IDERR_NOLENGTH = -1;  { Buffer length is 0 ?? }
400       IDERR_BADID = -2;     { Missing or bad board ID }
401       IDERR_NOMEM = -3;     { Not enough memory }
402       IDERR_NOFD = -4;      { No fitting FD file found }
403       IDERR_OFFSET = -5;    { Function offset not found }
404       IDERR_DONE = -6;      { Done with traversing (not an error) }
405       IDERR_SECONDARY = -7; { Secondary expansion board (not an error) }
406
407{ --------------------------------------------------------------------------}
408{ That's all... }
409
410
411
412
413VAR IdentifyBase : pLibrary;
414
415FUNCTION IdExpansion(TagList : pTagItem) : LONGINT;
416FUNCTION IdHardware(Type_ : Ulong; TagList : pTagItem) : pCHAR;
417FUNCTION IdAlert(ID : Ulong; TagList : pTagItem) : LONGINT;
418FUNCTION IdFunction(LibName : pCHAR; Offset : LONGINT; TagList : pTagItem) : LONGINT;
419FUNCTION IdHardwareNum(Type_ : Ulong; TagList : pTagItem) : Ulong;
420PROCEDURE IdHardwareUpdate;
421FUNCTION IdFormatString(String_ : pCHAR; Buffer : pCHAR; Length : Ulong; Tags : pTagItem) : Ulong;
422FUNCTION IdEstimateFormatSize(String_ : pCHAR; Tags : pTagItem) : Ulong;
423
424{
425     This is functions and procedures with array of const.
426     For use with fpc 1.0 and above.
427}
428
429FUNCTION IdExpansionTags(const TagList : Array Of Const) : LONGINT;
430FUNCTION IdHardwareTags(Type_ : longword; const TagList : Array Of Const) : pCHAR;
431FUNCTION IdAlertTags(ID : longword; const TagList : Array Of Const) : LONGINT;
432FUNCTION IdFunctionTags(LibName : pCHAR; Offset : LONGINT; const TagList : Array Of Const) : LONGINT;
433FUNCTION IdHardwareNumTags(Type_ : longword; const TagList : Array Of Const) : longword;
434FUNCTION IdFormatStringTags(String_ : pCHAR; Buffer : pCHAR; Length : longword; const Tags : Array Of Const) : longword;
435FUNCTION IdEstimateFormatSizeTags(String_ : pCHAR; const Tags : Array Of Const) : longword;
436
437{
438     Overlay functions
439}
440
441FUNCTION IdFunction(LibName : string; Offset : LONGINT; TagList : pTagItem) : LONGINT;
442FUNCTION IdFormatString(String_ : string; Buffer : pCHAR; Length : Ulong; Tags : pTagItem) : Ulong;
443FUNCTION IdEstimateFormatSize(String_ : string; Tags : pTagItem) : Ulong;
444FUNCTION IdFunctionTags(LibName : string; Offset : LONGINT; const TagList : Array Of Const) : LONGINT;
445FUNCTION IdFormatStringTags(String_ : string; Buffer : pCHAR; Length : longword; const Tags : Array Of Const) : longword;
446FUNCTION IdEstimateFormatSizeTags(String_ : string; const Tags : Array Of Const) : longword;
447
448{You can remove this include and use a define instead}
449{$I useautoopenlib.inc}
450{$ifdef use_init_openlib}
451procedure InitIDENTIFYLibrary;
452{$endif use_init_openlib}
453
454{This is a variable that knows how the unit is compiled}
455var
456    IDENTIFYIsCompiledHow : longint;
457
458IMPLEMENTATION
459
460uses
461{$ifndef dont_use_openlib}
462msgbox,
463{$endif dont_use_openlib}
464tagsarray,pastoc;
465
466FUNCTION IdExpansion(TagList : pTagItem) : LONGINT;
467BEGIN
468  ASM
469        MOVE.L  A6,-(A7)
470        MOVEA.L TagList,A0
471        MOVEA.L IdentifyBase,A6
472        JSR     -030(A6)
473        MOVEA.L (A7)+,A6
474        MOVE.L  D0,@RESULT
475  END;
476END;
477
478FUNCTION IdHardware(Type_ : Ulong; TagList : pTagItem) : pCHAR;
479BEGIN
480  ASM
481        MOVE.L  A6,-(A7)
482        MOVE.L  Type_,D0
483        MOVEA.L TagList,A0
484        MOVEA.L IdentifyBase,A6
485        JSR     -036(A6)
486        MOVEA.L (A7)+,A6
487        MOVE.L  D0,@RESULT
488  END;
489END;
490
491FUNCTION IdAlert(ID : Ulong; TagList : pTagItem) : LONGINT;
492BEGIN
493  ASM
494        MOVE.L  A6,-(A7)
495        MOVE.L  ID,D0
496        MOVEA.L TagList,A0
497        MOVEA.L IdentifyBase,A6
498        JSR     -042(A6)
499        MOVEA.L (A7)+,A6
500        MOVE.L  D0,@RESULT
501  END;
502END;
503
504FUNCTION IdFunction(LibName : pCHAR; Offset : LONGINT; TagList : pTagItem) : LONGINT;
505BEGIN
506  ASM
507        MOVE.L  A6,-(A7)
508        MOVEA.L LibName,A0
509        MOVE.L  Offset,D0
510        MOVEA.L TagList,A1
511        MOVEA.L IdentifyBase,A6
512        JSR     -048(A6)
513        MOVEA.L (A7)+,A6
514        MOVE.L  D0,@RESULT
515  END;
516END;
517
518FUNCTION IdHardwareNum(Type_ : Ulong; TagList : pTagItem) : Ulong;
519BEGIN
520  ASM
521        MOVE.L  A6,-(A7)
522        MOVE.L  Type_,D0
523        MOVEA.L TagList,A0
524        MOVEA.L IdentifyBase,A6
525        JSR     -054(A6)
526        MOVEA.L (A7)+,A6
527        MOVE.L  D0,@RESULT
528  END;
529END;
530
531PROCEDURE IdHardwareUpdate;
532BEGIN
533  ASM
534        MOVE.L  A6,-(A7)
535        MOVEA.L IdentifyBase,A6
536        JSR     -060(A6)
537        MOVEA.L (A7)+,A6
538  END;
539END;
540
541FUNCTION IdFormatString(String_ : pCHAR; Buffer : pCHAR; Length : Ulong; Tags : pTagItem) : Ulong;
542BEGIN
543  ASM
544        MOVE.L  A6,-(A7)
545        MOVEA.L String_,A0
546        MOVEA.L Buffer,A1
547        MOVE.L  Length,D0
548        MOVEA.L Tags,A2
549        MOVEA.L IdentifyBase,A6
550        JSR     -066(A6)
551        MOVEA.L (A7)+,A6
552        MOVE.L  D0,@RESULT
553  END;
554END;
555
556FUNCTION IdEstimateFormatSize(String_ : pCHAR; Tags : pTagItem) : Ulong;
557BEGIN
558  ASM
559        MOVE.L  A6,-(A7)
560        MOVEA.L String_,A0
561        MOVEA.L Tags,A1
562        MOVEA.L IdentifyBase,A6
563        JSR     -072(A6)
564        MOVEA.L (A7)+,A6
565        MOVE.L  D0,@RESULT
566  END;
567END;
568
569{
570 Functions and procedures with array of const go here
571}
572FUNCTION IdExpansionTags(const TagList : Array Of Const) : LONGINT;
573begin
574    IdExpansionTags := IdExpansion(readintags(TagList));
575end;
576
577FUNCTION IdHardwareTags(Type_ : longword; const TagList : Array Of Const) : pCHAR;
578begin
579    IdHardwareTags := IdHardware(Type_ , readintags(TagList));
580end;
581
582FUNCTION IdAlertTags(ID : longword; const TagList : Array Of Const) : LONGINT;
583begin
584    IdAlertTags := IdAlert(ID , readintags(TagList));
585end;
586
587FUNCTION IdFunctionTags(LibName : pCHAR; Offset : LONGINT; const TagList : Array Of Const) : LONGINT;
588begin
589    IdFunctionTags := IdFunction(LibName , Offset , readintags(TagList));
590end;
591
592FUNCTION IdHardwareNumTags(Type_ : longword; const TagList : Array Of Const) : longword;
593begin
594    IdHardwareNumTags := IdHardwareNum(Type_ , readintags(TagList));
595end;
596
597FUNCTION IdFormatStringTags(String_ : pCHAR; Buffer : pCHAR; Length : longword; const Tags : Array Of Const) : longword;
598begin
599    IdFormatStringTags := IdFormatString(String_ , Buffer , Length , readintags(Tags));
600end;
601
602FUNCTION IdEstimateFormatSizeTags(String_ : pCHAR; const Tags : Array Of Const) : longword;
603begin
604    IdEstimateFormatSizeTags := IdEstimateFormatSize(String_ , readintags(Tags));
605end;
606
607{
608     Overlay functions
609}
610
611FUNCTION IdFunction(LibName : string; Offset : LONGINT; TagList : pTagItem) : LONGINT;
612begin
613    IdFunction := IdFunction(pas2c(LibName),Offset,TagList);
614end;
615
616FUNCTION IdFormatString(String_ : string; Buffer : pCHAR; Length : Ulong; Tags : pTagItem) : Ulong;
617begin
618    IdFormatString := IdFormatString(pas2c(String_),Buffer,Length,Tags);
619end;
620
621FUNCTION IdEstimateFormatSize(String_ : string; Tags : pTagItem) : Ulong;
622begin
623    IdEstimateFormatSize := IdEstimateFormatSize(pas2c(String_),Tags);
624end;
625
626FUNCTION IdFunctionTags(LibName : string; Offset : LONGINT; const TagList : Array Of Const) : LONGINT;
627begin
628    IdFunctionTags := IdFunction(pas2c(LibName),Offset,readintags(TagList));
629end;
630
631FUNCTION IdFormatStringTags(String_ : string; Buffer : pCHAR; Length : longword; const Tags : Array Of Const) : longword;
632begin
633    IdFormatStringTags := IdFormatString(pas2c(String_),Buffer,Length,readintags(Tags));
634end;
635
636FUNCTION IdEstimateFormatSizeTags(String_ : string; const Tags : Array Of Const) : longword;
637begin
638    IdEstimateFormatSizeTags := IdEstimateFormatSize(pas2c(String_),readintags(Tags));
639end;
640
641const
642    { Change VERSION and LIBVERSION to proper values }
643
644    VERSION : string[2] = '0';
645    LIBVERSION : longword = 0;
646
647{$ifdef use_init_openlib}
648  {$Info Compiling initopening of identify.library}
649  {$Info don't forget to use InitIDENTIFYLibrary in the beginning of your program}
650
651var
652    identify_exit : Pointer;
653
654procedure CloseidentifyLibrary;
655begin
656    ExitProc := identify_exit;
657    if IdentifyBase <> nil then begin
658        CloseLibrary(IdentifyBase);
659        IdentifyBase := nil;
660    end;
661end;
662
663procedure InitIDENTIFYLibrary;
664begin
665    IdentifyBase := nil;
666    IdentifyBase := OpenLibrary(IDENTIFYNAME,LIBVERSION);
667    if IdentifyBase <> nil then begin
668        identify_exit := ExitProc;
669        ExitProc := @CloseidentifyLibrary;
670    end else begin
671        MessageBox('FPC Pascal Error',
672        'Can''t open identify.library version ' + VERSION + #10 +
673        'Deallocating resources and closing down',
674        'Oops');
675        halt(20);
676    end;
677end;
678
679begin
680    IDENTIFYIsCompiledHow := 2;
681{$endif use_init_openlib}
682
683{$ifdef use_auto_openlib}
684  {$Info Compiling autoopening of identify.library}
685
686var
687    identify_exit : Pointer;
688
689procedure CloseidentifyLibrary;
690begin
691    ExitProc := identify_exit;
692    if IdentifyBase <> nil then begin
693        CloseLibrary(IdentifyBase);
694        IdentifyBase := nil;
695    end;
696end;
697
698begin
699    IdentifyBase := nil;
700    IdentifyBase := OpenLibrary(IDENTIFYNAME,LIBVERSION);
701    if IdentifyBase <> nil then begin
702        identify_exit := ExitProc;
703        ExitProc := @CloseidentifyLibrary;
704        IDENTIFYIsCompiledHow := 1;
705    end else begin
706        MessageBox('FPC Pascal Error',
707        'Can''t open identify.library version ' + VERSION + #10 +
708        'Deallocating resources and closing down',
709        'Oops');
710        halt(20);
711    end;
712
713{$endif use_auto_openlib}
714
715{$ifdef dont_use_openlib}
716begin
717    IDENTIFYIsCompiledHow := 3;
718   {$Warning No autoopening of identify.library compiled}
719   {$Warning Make sure you open identify.library yourself}
720{$endif dont_use_openlib}
721
722
723END. (* UNIT IDENTIFY *)
724
725
726