// M A P A C T E M P (PREPRESS) // catalog number ??? // //Modified by September 25, 1980 1:49 PM, PARC: // Find the font segment by following the pointer in the IX, not // by just assuming that the data starts right after the endIX. // Used to do all ACtemp re-formatting (Grow, Rotate, Orbit, Sample) // MapACtemp(ixfn, charfn, arg) // Applies ixfn(ix, arg) to ix entry in ACtemp // Applies charfn(p, si, so, arg) to each character in ACtemp // p => CharWidth entry // si = input stream, positioned at character // so = output stream, positioned to receive character get "ix.dfs" // outgoing procedures external [ MapACtemp ] // outgoing statics //external // [ // ] //static // [ // ] // incoming procedures external [ //WINDOW WindowRead WindowReadBlock WindowWrite WindowWriteBlock WindowGetPosition WindowSetPosition WindowCopy WindowClose //PREPRESS ReadIXTempFile WriteIXTempFile SetPosRelative GetPosRelative PrePressWindowInit //UTIL CheckAC IXLength TypeChar TypeForm FSGetX FSPut Zero MoveBlock ] // incoming statics //external // [ // ] // internal statics //static // [ // ] // File-wide structure and manifest declarations. // Procedures let MapACtemp(ixfn, charfn, arg, inputName, outputName) be [ let DPzero=table [ 0;0 ] let si=PrePressWindowInit(inputName) //Read ACtemp //you ought to check to see if inputName=outputName //if not, don't bother with the scratch file let so=PrePressWindowInit(0) //Write scratch. let fn=vec IXLName let ix=vec IXLMax ReadIXTempFile(si, fn, ix) let sai=vec 1 MoveBlock(sai, lv ix>>IX.sa, 2) WindowSetPosition(si,sai) ixfn(ix, arg) WriteIXTempFile(so, fn, ix) let sao=vec 1 sao!0=0; sao!1=IXLName+IXLEnd+IXLength(ix>>IX.Type) let bc=ix>>IX.bc let ec=ix>>IX.ec let nc=ec-bc+1 let AC=FSGetX(nc*2) let WD=FSGetX(nc*CharWidthsize) WindowReadBlock(si, WD, nc*CharWidthsize) WindowWriteBlock(so, WD, nc*CharWidthsize) let offi,offo=vec 1, vec 1 WindowGetPosition(si,offi) WindowGetPosition(so,offo) WindowReadBlock(si, AC, nc*2) WindowWriteBlock(so, AC, nc*2) for c=0 to nc-1 do [ let cdp=AC+c*2 if cdp!0 ne -1 then [ SetPosRelative(si, offi, cdp) //Get to char coding. GetPosRelative(so, offo, cdp) let cp=c*CharWidthsize+WD //Pointer to CharWidth entry TypeChar(c+bc) charfn(cp, si, so, arg) CheckAC(cp) if cp>>CharWidth.H eq HNonExCode then [ cdp!0=-1; cdp!1=-1 Zero(cp, CharWidthsize) //Sanitize missing char cp>>CharWidth.H=HNonExCode ] TypeForm(0) ] ] let tl=vec 1 WindowGetPosition(so, tl) //Total length GetPosRelative(so, sao, lv ix>>IX.len) //get length WindowSetPosition(so, DPzero) WriteIXTempFile(so, fn, ix) WindowWriteBlock(so, WD, nc*CharWidthsize) WindowWriteBlock(so, AC, nc*2) FSPut(AC); FSPut(WD) WindowClose(si) si= PrePressWindowInit(outputName) WindowSetPosition(so, DPzero) WindowSetPosition(si, DPzero) WindowCopy(so, si, tl) //Copy scratch file to ACtemp file. WindowClose(si, -1) WindowClose(so) ]