Artifact bea6641f893c8cf695d8432f0db6f4e73d735257117226910c7c11bc6467ff8e:
- File
psl-1983/3-1/kernel/explode-compress.red
— part of check-in
[eb17ceb7f6]
at
2020-04-21 19:40:01
on branch master
— Add Reduce 3.0 to the historical section of the archive, and some more
files relating to version sof PSL from the early 1980s. Thanks are due to
Paul McJones and Nelson Beebe for these, as well as to all the original
authors.git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/historical@5328 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 2675) [annotate] [blame] [check-ins using] [more...]
- File
psl-1983/kernel/explode-compress.red
— part of check-in
[eb17ceb7f6]
at
2020-04-21 19:40:01
on branch master
— Add Reduce 3.0 to the historical section of the archive, and some more
files relating to version sof PSL from the early 1980s. Thanks are due to
Paul McJones and Nelson Beebe for these, as well as to all the original
authors.git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/historical@5328 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 2675) [annotate] [blame] [check-ins using]
% % EXPLODE-COMPRESS.RED - Write to/read from a list; includes FlatSize % % Author: Eric Benson % Symbolic Computation Group % Computer Science Dept. % University of Utah % Date: 24 September 1981 % Copyright (c) 1981 University of Utah % % <PSL.KERNEL>EXPLODE-COMPRESS.RED.3, 12-Oct-82 16:49:54, Edit by BENSON % Changed CompressReadChar to use Lisp2Char, so ASCII characters are OK, % but digits 0..9 as !0..!9 are not. fluid '(ExplodeEndPointer!* % pointer used to RplacD new chars onto CompressList!* % list being compressed !*Compressing); % if T, don't intern IDs when read external WArray LinePosition,UnReadBuffer; on SysLisp; syslsp procedure ExplodeWriteChar(Channel, Ch); << RplacD(LispVar ExplodeEndPointer!*, list MkID Ch); LispVar ExplodeEndPointer!* := cdr LispVar ExplodeEndPointer!* >>; syslsp procedure Explode U; %. S-expr --> char-list begin scalar Result; Result := LispVar ExplodeEndPointer!* := NIL . NIL; LinePosition[3] := 0; ChannelPrin1('3, U); return cdr Result; end; syslsp procedure Explode2 U; %. Prin2 version of Explode begin scalar Result; Result := LispVar ExplodeEndPointer!* := NIL . NIL; LinePosition[3] := 0; ChannelPrin2('3, U); return cdr Result; end; internal WVar FlatSizeAccumulator; syslsp procedure FlatSizeWriteChar(Channel, Ch); FlatSizeAccumulator := FlatSizeAccumulator + 1; syslsp procedure FlatSize U; %. character length of S-expression << FlatSizeAccumulator := 0; LinePosition[4] := 0; ChannelPrin1('4, U); MkINT FlatSizeAccumulator >>; lisp procedure FlatSize2 U; %. Prin2 version of FlatSize << FlatSizeAccumulator := 0; LinePosition[4] := 0; ChannelPrin2('4, U); MkINT FlatSizeAccumulator >>; internal WVar AtEndOfList; syslsp procedure CompressReadChar Channel; begin scalar NextEntry; if AtEndOfList then return CompressError(); if not PairP LispVar CompressList!* then << AtEndOfList := 'T; return char BLANK >>; NextEntry := car LispVar CompressList!*; LispVar CompressList!* := cdr LispVar CompressList!*; return Lisp2Char NextEntry; end; syslsp procedure ClearCompressChannel(); << UnReadBuffer[3] := char NULL; AtEndOfList := 'NIL >>; off SysLisp; lisp procedure CompressError(); StdError "Poorly formed S-expression in COMPRESS"; lisp procedure Compress CompressList!*; %. Char-list --> S-expr begin scalar !*Compressing; !*Compressing := T; ClearCompressChannel(); return ChannelRead 3; end; lisp procedure Implode CompressList!*; %. Compress with IDs interned << ClearCompressChannel(); ChannelRead 3 >>; END;