unit formats;
// Copyright © 1999 by Semaphore Corporation. All rights reserved.
// This code, including modified or derived versions, may not be
// distributed, sold, or incorporated in a product or service for sale,
// without permission from Semaphore Corporation.
interface
type // allows manipulating fields as strings in assignments
char2type = packed array[1..2] of char;
char3type = packed array[1..3] of char;
char4type = packed array[1..4] of char;
char5type = packed array[1..5] of char;
char6type = packed array[1..6] of char;
char8type = packed array[1..8] of char;
char10type = packed array[1..10] of char;
char28type = packed array[1..28] of char;
char50type = packed array[1..50] of char;
char60type = packed array[1..60] of char;
platformtype = packed array[1..18] of char;
detailrecordtype = packed record // sent to black box
id: char;
platform: platformtype;
recid: char8type;
filler1: array[1..41] of char;
oldhouse: char10type;
oldpre: char2type;
oldstreet: char28type;
oldsuffix: char4type;
oldpost: char2type;
oldunit: char4type;
oldapt: char8type;
filler2: char8type;
oldzip5: char5type;
oldplus4: char4type;
name, comp: char60type;
filler3: array[1..249] of char;
end;
ffoutputrecordtype = packed record // output by black box
id: char;
platform: platformtype;
shutdown: char;
recid: char8type;
response: char;
unparsed: char50type;
newzip5: char5type;
newplus4: char4type;
newdlvpt: char2type;
newdpchk: char;
newhouse: char10type;
newpre: char2type;
newstreet: char28type;
newsuffix: char4type;
newpost: char2type;
newunit: char4type;
newapt: char8type;
movetype: char;
newcity: char28type;
newstate: char2type;
matchflag: char;
newroute: char4type;
movedate: char6type;
urb: char28type;
dma: char;
filler: array[1..36] of char;
end;
var
ackrecord: packed record // for black box exchanges
id: char;
platform: platformtype;
filler1: array[1..9] of char;
error: char3type;
acktype: char;
password: char28type;
filler2: array[1..196] of char;
end;
customerid: string; // 'AAANNNNN' form
procedure copyfixed(dest: pchar; s: string; size: longint);
implementation
uses sysutils;
procedure copyfixed(dest: pchar; s: string; size: longint);
begin // pad or truncate s and save at dest
if length(s) > size then s := copy(s, 1, size) else while length(s) < size do s := s + ' ';
strmove(dest, pchar(s), size);
end;
end.