-- PressDefs.mesa
-- Written by Joe Maleson
-- Last changed by Doug Wyatt, April 9, 1981 4:40 PM
-- Last changed by Schmidt (conversion to Pilot), 1-Jul-81 16:05:38
DIRECTORY
File USING [Capability],
Stream USING [Handle -- , DiskHandle -- ]; -- ,
--DiscoDefs USING [DiskPosition];
PressDefs: DEFINITIONS = {
-- standard press file procedural interface
InitPressFileDescriptor: PUBLIC PROC [
p: LONG POINTER TO PressFileDescriptor, filename: LONG STRING];
SetSpaceX: PROC [p: LONG POINTER TO PressFileDescriptor, micaX: CARDINAL];
SetSpaceY: PROC [p: LONG POINTER TO PressFileDescriptor, micaY: CARDINAL];
ResetSpace: PROC [p: LONG POINTER TO PressFileDescriptor];
PutSpace: PROC [p: LONG POINTER TO PressFileDescriptor];
SetColor: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
hue,sat,bright: [0..256)];
SetHue: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,hue: [0..256)];
SetSaturation: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,sat: [0..256)];
SetBrightness: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
bright: [0..256)];
SetFont: PUBLIC PROC [p: LONG POINTER TO PressDefs.PressFileDescriptor,
Name: LONG STRING,PointSize: CARDINAL,Face: CARDINAL ← 0,
Rotation: CARDINAL ← 0];
PutText: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,str: LONG STRING,
xleft,ybase: CARDINAL];
PutRectangle: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
xstart,ystart,xlen,ylen: CARDINAL];
PutTextHere: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
str: LONG STRING];
PutRectangleHere: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
xlen,ylen: CARDINAL];
StartOutline: PUBLIC PROC[p: LONG POINTER TO PressFileDescriptor,x0,y0: CARDINAL];
PutMoveTo: PUBLIC PROC[p: LONG POINTER TO PressFileDescriptor,
xend,yend: CARDINAL];
PutDrawTo: PUBLIC PROC[p: LONG POINTER TO PressFileDescriptor,
xend,yend: CARDINAL];
PutCubic: PUBLIC PROC[p: LONG POINTER TO PressFileDescriptor,
x1,y1,x2,y2,x3,y3: REAL];
--Extend outline by cubic relative to current position
--xi is x coefficient of t↑i, etc.
EndOutline: PUBLIC PROC[p: LONG POINTER TO PressFileDescriptor];
PutAltoDots: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
x,y,nDots,nScanLines: CARDINAL,dots: LONG POINTER];
PutPressDotsData: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
x,y: CARDINAL,dotsData: LONG POINTER TO PressDotsData,
nextScanLine: PROC RETURNS [LONG POINTER]];
PutDots: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
x,y,nPixels,nScanLines,bitsPerPixel,width,height: CARDINAL,dots: LONG POINTER,
screenFrequency: CARDINAL ← 0,screenAngle: CARDINAL ← 45];
PutComputedDots: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
x,y,nPixels,nScanLines,bitsPerPixel,width,height: CARDINAL,
nextScanLine: PROC RETURNS [LONG POINTER],
screenFrequency: CARDINAL ← 0, screenAngle: CARDINAL ← 45,
min,max: CARDINAL ← 0];
PutDotsFromFile: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
x,y,nPixels,nScanLines,bitsPerPixel,width,height: CARDINAL,dots: LONG STRING,
screenFrequency: CARDINAL ← 0,screenAngle: CARDINAL ← 45,
min,max: CARDINAL ← 0];
WritePage: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor];
ClosePressFile: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor];
--low level utility functions
MulDiv: PUBLIC PROC [a,b,c:CARDINAL] RETURNS [CARDINAL];
SignedMulDiv: PUBLIC PROC [a,b,c:INTEGER] RETURNS [INTEGER];
SetBlock: PUBLIC PROC [buf: LONG POINTER TO ARRAY [0..0) OF INTEGER,
val,len: INTEGER];
WriteCommand: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor,
Command: CARDINAL, Param: POINTER TO ARRAY [0..6) OF CARDINAL];
WriteDirectory: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor];
WritePartDirectory: PUBLIC PROC [p: LONG POINTER TO PressFileDescriptor];
--font operations (from FontWidth)
EncodeFace: PUBLIC PROC [weight,slope,expansion: CHARACTER] RETURNS [INTEGER];
LookupFontName: PROC [s: Stream.Handle,famstr: LONG STRING,
face,siz,rot: INTEGER,
bufx,bufy: LONG POINTER TO ARRAY [0..256) OF INTEGER,
boundbox: LONG POINTER TO ARRAY [0..4) OF INTEGER] RETURNS[BOOLEAN];
missingWidth: INTEGER = LOOPHOLE[100000B]; -- width for missing character
--press object functions and data structures
OpenPressFile: PUBLIC PROC [fileName: LONG STRING,
pfp: LONG POINTER TO PressFilePointers] RETURNS [nPages: CARDINAL];
OpenPressFileFromCap: PUBLIC PROC [cap: File.Capability,
pfp: LONG POINTER TO PressFilePointers] RETURNS [nPages: CARDINAL];
--userProc is really PROC[p: LONG POINTER TO PressPage];
-- it is called once for each object on the page
GetPressPageFromCap: PUBLIC PROC[cap: File.Capability,
pageNumber: CARDINAL,p: LONG POINTER TO PressPage,userProc: UNSPECIFIED ← 0];
ReadPressPage: PROC [pfp: LONG POINTER TO PressFilePointers,
pageNumber: CARDINAL,p: LONG POINTER TO PressPage,
userProc: UNSPECIFIED ← 0];
ReleasePressFilePointers: PUBLIC PROC [pfp: LONG POINTER TO PressFilePointers];
GetPressPage: PROC[fileName: LONG STRING,pageNumber: CARDINAL,
p: LONG POINTER TO PressPage];
GetPressDotsData: PROC [obj: LONG POINTER TO PressObject,
dots: LONG POINTER TO PressDotsData];
ReleasePressPage: PROC[p: LONG POINTER TO PressPage];
PutPressPage: PROC[pfd: LONG POINTER TO PressFileDescriptor,
p: LONG POINTER TO PressPage,dx: CARDINAL ← 0,dy: CARDINAL ← 0];
PressObject: TYPE = RECORD
[ link: LONG POINTER TO PressObject,
micaX,micaY: CARDINAL,
command: PressDefs.ELCommand,
--to keep this data type autonomous, include all global state
hue,sat,br: [0..377B],
spaceX,spaceY: CARDINAL,
font: [0..17B],
--and stuff to get data from input stream
nDataBytes: [0..7777B] --,
-- diskPosition: DiscoDefs.DiskPosition
];
PressDotsData: TYPE = RECORD
[ nBitsPerPixel,nPixels,nLines: CARDINAL,
passPixels,displayPixels,passLines,displayLines: CARDINAL,
micaWidth,micaHeight: CARDINAL,
min,max: CARDINAL,
angle,frequency: CARDINAL,
opaque: BOOLEAN,
haveDot: BOOLEAN, --whether dotPosition is relevant
mode: [0..15],
fileName: LONG STRING, --in case GetDotsFromFile
dotPosition,diskPosition: CARDINAL -- DiscoDefs.DiskPosition
];
PressFont: TYPE = RECORD
[ Family: LONG STRING,
PointSize,Face,Rotation: CARDINAL,
Widths: LONG POINTER TO ARRAY CHARACTER [0C..377C] OF INTEGER
];
PressPage: TYPE = RECORD
[ leftX,bottomY,rightX,topY: CARDINAL, --bounding box in micas for page
ObjectList: LONG POINTER TO PressObject, --linked list
FontDir: ARRAY[0..16] OF LONG POINTER TO PressFont --allows 16 fonts+NIL trailer
];
PressFilePointers: TYPE = RECORD
[ FontDir: LONG POINTER TO ARRAY [0..0) OF PressFontEntry,
PartDir: LONG POINTER TO ARRAY [0..0) OF PartEntry --,
-- vDAs: LONG POINTER TO ARRAY [0..0) OF AltoFileDefs.vDA,
-- fontWidthsStream: StreamDefs.DiskHandle
];
--data structures and constants
EntityDef: TYPE = RECORD
[ trailer: LONG POINTER TO EntityCommandTrailer,
commands: LONG POINTER TO PACKED ARRAY [0..0) OF ELCommand
];
Byte: TYPE = [0..377B];
PressPassword: CARDINAL = 27183;
PressFileDescriptor: TYPE = RECORD
[ outStream: Stream.Handle,
fontDir: LONG POINTER TO FontDir,
partDir: LONG POINTER TO PartDir,
EntityCommandLen: CARDINAL,
EntityCommandMaxLen: CARDINAL,
EntityCommands: POINTER TO PACKED ARRAY [0..2048) OF [0..256),
RecordStart: CARDINAL,
fontLen: CARDINAL,
partLen: CARDINAL,
numParts: CARDINAL,
numFonts: CARDINAL,
FirstCopy: CARDINAL,
LastCopy: CARDINAL,
solidCode: CHARACTER,
PressFileName: LONG STRING,
UserName: LONG STRING,
DateString: LONG STRING,
--general page params
TopMarg,BottomMarg,LeftMarg,RightMarg: INTEGER,
--some stuff to do with current font etc.
CurSpaceX,CurSpaceY: CARDINAL,
CurHue,CurSat,CurBright: [0..256)
];
FontDir: TYPE = ARRAY [0..128) OF LONG POINTER; -- to FontEntry or FontCharacter
PartDir: TYPE = ARRAY [0..128) OF PartEntry;
DocDir: TYPE = MACHINE DEPENDENT RECORD
[ Password: CARDINAL,
nRecs: CARDINAL,
nParts: CARDINAL,
partDirStart: CARDINAL,
partLength: CARDINAL,
spare1: CARDINAL,
date: LONG INTEGER,
firstCopy: INTEGER,
lastCopy: INTEGER,
firstPage: INTEGER,
lastPage: INTEGER,
spare2: Byte,
solidCode: CHARACTER,
spare3: ARRAY [13D..177B] OF CARDINAL,
fileName: PACKED ARRAY [ 0..51] OF CHARACTER,
userName: PACKED ARRAY [0..31] OF CHARACTER,
dateString: PACKED ARRAY [0..39] OF CHARACTER,
spare4: ARRAY [276B..377B] OF CARDINAL
];
PartType: TYPE = CARDINAL;
Page: PartType = 0;
Font: PartType = 1;
ExternalFileDirectory: PartType = 2;
PartEntry: TYPE = MACHINE DEPENDENT RECORD
[ Type: PartType,
RecordStart: CARDINAL,
RecordLength: CARDINAL,
PaddingLength: CARDINAL
];
PressFontEntry: TYPE = MACHINE DEPENDENT RECORD
[ EntryLength: CARDINAL,
FontSet: Byte,
Font: Byte,
M: Byte,
N: Byte,
Family: PACKED ARRAY [0..20) OF CHARACTER,
Face: Byte,
Source: Byte,
Size: CARDINAL,
Rotation: CARDINAL
];
FontEntry: TYPE = RECORD
[ EntryLength: CARDINAL,
FontSet: Byte,
Font: Byte,
M: Byte,
N: Byte,
Family: LONG STRING,
Face: Byte,
Source: Byte,
Size: CARDINAL,
Rotation: CARDINAL
];
FontCharacter: TYPE = MACHINE DEPENDENT RECORD
[ EntryLength: CARDINAL,
FontSet: Byte,
Font: Byte,
M: Byte,
AllOnes: Byte,
Zero: CARDINAL,
ObjectList: LONG POINTER
];
MRR: Byte = 0;
MIR: Byte = 1;
BRR: Byte = 2;
BIR: Byte = 3;
EntityCommandTrailer: TYPE = MACHINE DEPENDENT RECORD
[
Type: Byte,
FontSet: Byte,
BeginByte,ByteLen: ARRAY[0..1] OF CARDINAL,
Xe,Ye,Left,Bottom,Width,Height,EntityLen: CARDINAL
];
--General constants
MicasPerInch: INTEGER=2540;
PointsPerInch: INTEGER=72;
MicaHeight: INTEGER = MicasPerInch*11;
MicaWidth: INTEGER = (MicasPerInch/2)*17;
maxFonts: CARDINAL = 16;
--Entity list commands;
ELCommand: TYPE = [0..377B];
ELShowCharactersShort: ELCommand = 0;
ELSkipCharactersShort: ELCommand = 40B;
ELShowCharactersAndSkip: ELCommand = 100B;
ELSetSpaceXShort: ELCommand = 140B;
ELSetSpaceYShort: ELCommand = 150B;
ELFont: ELCommand = 160B;
ELSkipControlBytesImmediate: ELCommand = 353B;
ELAlternative: ELCommand = 354B;
ELOnlyOnCopy: ELCommand = 355B;
ELSetX: ELCommand = 356B;
ELSetY: ELCommand = 357B;
ELShowCharacters: ELCommand = 360B;
ELSkipCharacters: ELCommand = 361B;
ELSkipControlBytes: ELCommand = 362B;
ELShowCharacterImmediate: ELCommand = 363B;
ELSetSpaceX: ELCommand = 364B;
ELSetSpaceY: ELCommand = 365B;
ELResetSpace: ELCommand = 366B;
ELSpace: ELCommand = 367B;
ELSetBrightness: ELCommand = 370B;
ELSetHue: ELCommand = 371B;
ELSetSaturation: ELCommand = 372B;
ELShowObject: ELCommand = 373B;
ELShowDots: ELCommand = 374B;
ELShowDotsOpaque: ELCommand = 375B;
ELShowRectangle: ELCommand = 376B;
ELNop: ELCommand = 377B;
--Data list commands;
DLMoveTo: CARDINAL = 0;
DLDrawTo: CARDINAL = 1;
DLDrawCurve: CARDINAL = 2;
DLSetCoding: CARDINAL = 1; --byte
DLSetWindow: CARDINAL = 1; --word
DLSetMode: CARDINAL = 2; --byte
DLSetSize: CARDINAL = 2; --word
DLDotsFollow: CARDINAL = 3; --word
DLGetDotsFromFile: CARDINAL = 4; --word
DLGetDotsFromPressFile: CARDINAL = 5; --word
DLSetSamplingProperties: CARDINAL = 6; --word
DLSSPInputIntensity: CARDINAL = 0; --word
DLSSPOutputIntensity: CARDINAL = 1; --word
DLSSPScreen: CARDINAL = 2; --word
DLSSPDot: CARDINAL = 3; --word
}.