mirror of
https://github.com/PDP-10/its.git
synced 2026-01-19 09:29:15 +00:00
204 lines
6.2 KiB
Plaintext
204 lines
6.2 KiB
Plaintext
'<PCODE "3FORMAT">
|
||
|
||
<PACKAGE "FORMAT">
|
||
|
||
<ENTRY FORMAT FORMAT-SPACES>
|
||
|
||
<SETG FORMAT-SPACES " ">
|
||
|
||
<GDECL (FORMAT-SPACES) STRING>
|
||
|
||
"Macro for printing or creating nicely formatted strings.
|
||
|
||
Table of Format mode characters:
|
||
|
||
@ - modifier `
|
||
! A - princ
|
||
\" B
|
||
# - gobble arg C - character
|
||
$ D - fix
|
||
% - crlfs E - (exponent)
|
||
& - newline F - float
|
||
' G
|
||
( H - headed info
|
||
) I
|
||
* - ignore J
|
||
+ K
|
||
, - arg L
|
||
- M
|
||
. - set N
|
||
/ O - (octal)
|
||
0 - arg P - plural
|
||
1 - arg Q - quote
|
||
2 - arg R - cardinals, etc.
|
||
3 - arg S - prin1
|
||
4 - arg T - tabs
|
||
5 - arg U
|
||
6 - arg V
|
||
7 - arg W
|
||
8 - arg X - spaces
|
||
9 - arg Y
|
||
: - modifier Z
|
||
; lsb lcb
|
||
lab | - form feed
|
||
= - set rsb rcb
|
||
rab ^ ~ - tildes
|
||
? _ ^?
|
||
|
||
"
|
||
|
||
\
|
||
|
||
"~nD Takes any number and prints as a decimal integer. If no arg, print
|
||
without leading spaces. If arg and it fits in, put in leading
|
||
spaces; if it doesnt fit just print it. If second arg, use that
|
||
(or first char of STRING of it if not a number) instead of space as
|
||
a pad char."
|
||
|
||
"~nO Like D but octal"
|
||
|
||
<SETG PFIX %<RSUBR!- '[ %<PCODE!- "3FORMAT" 0> PFIX #DECL ("VALUE" FIX FIX
|
||
"OPTIONAL" FIX <OR STRING CHARACTER>) INDENT-TO T OUTCHAN %<RGLOC FORMAT-SPACES
|
||
T> "IVXLCDM//" "???" ["thousand" "million" "billion" "trillion" "quadrillion"
|
||
"quintillion" "sextillion" "septillion"] "th" " hundred" ["teen" "twenty"
|
||
"thirty" "forty" "fifty" "sixty" "seventy" "eighty" "ninety"] ["teenth"
|
||
"twentieth" "thirtieth" "fortieth" "fiftieth" "sixtieth" "seventieth"
|
||
"eightieth" "ninetieth"] ["first" "second" "third" "fourth" "fifth" "sixth"
|
||
"seventh" "eighth" "ninth"] ["one" "two" "three" "four" "five" "six" "seven"
|
||
"eight" "nine" "ten" "eleven" "twelve" "thirteen" "fourteen" "fifteen" "sixteen"
|
||
"seventeen" "eighteen" "nineteen"] "^?" PRINC NO-CONTROL-ARGUMENT? SET <14 .
|
||
OUTCHAN> PFIX PFLOAT POBJ PHSTR1 PHSTR POBJ1 PCHAR PROMAN PCARDINAL PCRLFS "|X~"
|
||
PCHARS PFRESH-LINE PCOLUMN PLURAL COLUMN-MARKER-NOT-ATOM FORMAT FIX NO-COMMAND
|
||
QUOTED-ARG-NOT-FOUND TOO-FEW-ARGS]>>
|
||
<AND <ASSIGNED? GLUE> .GLUE <PUT ,PFIX PGLUE ![805306367 -1 -16777216!]>>
|
||
|
||
|
||
"~n,mF Floating point. Prints the number in a column n wide, with a
|
||
fractional part m digits wide."
|
||
|
||
<SETG PFLOAT %<RSUBR-ENTRY '[PFIX PFLOAT #DECL ("VALUE" FIX FLOAT "OPTIONAL" FIX
|
||
FIX <OR STRING CHARACTER>)] 107>>
|
||
|
||
"~nE Exponential notation"
|
||
|
||
"~R cardinal/ordinal and Roman notation"
|
||
|
||
<SETG PROMAN %<RSUBR-ENTRY '[PFIX PROMAN #DECL ("VALUE" FIX FIX "OPTIONAL" <OR
|
||
ATOM FALSE>)] 316>>
|
||
|
||
<SETG ROMAN %<RSUBR-ENTRY '[PFIX ROMAN #DECL ("VALUE" <OR ATOM CHARACTER FALSE>
|
||
FIX STRING ANY)] 427>>
|
||
|
||
<SETG PCARDINAL %<RSUBR-ENTRY '[PFIX PCARDINAL #DECL ("VALUE" FIX FIX "OPTIONAL"
|
||
<OR ATOM FALSE>)] 520>>
|
||
|
||
<SETG CARDINAL %<RSUBR-ENTRY '[PFIX CARDINAL #DECL ("VALUE" ANY ANY ANY ANY ANY)
|
||
] 575>>
|
||
|
||
\
|
||
|
||
"~nA Character string. If there is an n then pad the string with spaces
|
||
on the right to make it n long. If it doesn't fit, ignore n.
|
||
(A m n minpad padchar) as a control list element means pad to occupy at least
|
||
m columns, or if longer than that to begin with, pad to occupy
|
||
m+p*n columns for some nonnegative integer p.
|
||
at least minpad pad characters are produced in any case
|
||
(default if not supplied = 1).
|
||
padchar is used for padding purposes (default if not supplied = space).
|
||
if padchar is not a number, the first character in STRING of it is used.
|
||
A mode can actually be used to PRINC anything, not just a string."
|
||
|
||
<SETG POBJ %<RSUBR-ENTRY '[PFIX POBJ #DECL ("VALUE" FIX ANY "OPTIONAL" FIX FIX
|
||
FIX CHARACTER)] 880>>
|
||
|
||
"~m,nH Princ string under a header"
|
||
|
||
<SETG PHSTR %<RSUBR-ENTRY '[PFIX PHSTR #DECL ("VALUE" FIX STRING "OPTIONAL" FIX
|
||
FIX CHARACTER)] 962>>
|
||
|
||
"same as above, but right justify string"
|
||
|
||
<SETG PHSTR1 %<RSUBR-ENTRY '[PFIX PHSTR1 #DECL ("VALUE" FIX STRING "OPTIONAL"
|
||
FIX FIX CHARACTER)] 1033>>
|
||
|
||
"~S Prin1 an object. Just like ~A (including parameters) but uses PRIN1."
|
||
|
||
<SETG POBJ1 %<RSUBR-ENTRY '[PFIX POBJ1 #DECL ("VALUE" FIX ANY "OPTIONAL" FIX FIX
|
||
FIX CHARACTER)] 1099>>
|
||
|
||
"~C One character, in any acceptable form.
|
||
Control and meta bits print as alpha, beta, epsilon."
|
||
|
||
<SETG PCHAR %<RSUBR-ENTRY '[PFIX PCHAR #DECL ("VALUE" FIX <PRIMTYPE WORD>)] 1181
|
||
>>
|
||
|
||
"~n* Ignore the next n args. n defaults to 1."
|
||
|
||
"~n% Insert n newlines. n defaults to 1."
|
||
|
||
<SETG PCRLFS %<RSUBR-ENTRY '[PFIX PCRLFS #DECL ("VALUE" FIX "OPTIONAL" FIX)]
|
||
1230>>
|
||
|
||
"~n| Insert n formfeeds. n defaults to 1."
|
||
|
||
"~nX Insert n spaces. n defaults to 1."
|
||
|
||
"~n~ Insert n tildes. n defaults to 1."
|
||
|
||
<SETG PCHARS %<RSUBR-ENTRY '[PFIX PCHARS #DECL ("VALUE" ATOM CHARACTER
|
||
"OPTIONAL" FIX)] 1266>>
|
||
|
||
"~& Perform the FRESH-LINE operation on the stream."
|
||
|
||
<SETG PFRESH-LINE %<RSUBR-ENTRY '[PFIX PFRESH-LINE #DECL ("VALUE" FIX)] 1302>>
|
||
|
||
"~n,mT Tab to column n+pm, for p an integer >= 0."
|
||
|
||
<SETG PCOLUMN %<RSUBR-ENTRY '[PFIX PCOLUMN #DECL ("VALUE" FIX FIX "OPTIONAL" FIX
|
||
FIX)] 1322>>
|
||
|
||
"~Q Apply the next arg to no arguments.
|
||
(Q ...) Apply the next arg to the (unevaluated) parameters following the Q."
|
||
|
||
"~P Insert an 's', unless the next arg is 1."
|
||
|
||
<SETG PLURAL %<RSUBR-ENTRY '[PFIX PLURAL #DECL ("VALUE" <OR ATOM CHARACTER FALSE
|
||
> <OR FIX FLOAT>)] 1357>>
|
||
|
||
\
|
||
|
||
"Here is where the format macro is actually expanded, and what follows is all
|
||
useless once you are compiled."
|
||
|
||
"<FORMAT channel control-arg \"TUPLE\" args>
|
||
If channel is false, cons up and return a string.
|
||
If channel is T, use .OUTCHAN"
|
||
|
||
<SETG FORMAT #MACRO ( %<RSUBR!- '[ %<PCODE!- "3FORMAT" 2348> FORMAT #DECL (
|
||
"VALUE" FORM "ARGS" LIST) FSTRING TOO-FEW-ARGS FORMAT T .OUTCHAN PROG OUTCHAN #
|
||
DECL ((OUTCHAN) <SPECIAL CHANNEL>)]>)>
|
||
<AND <ASSIGNED? GLUE> .GLUE <PUT ,FORMAT PGLUE ![805289984!]>>
|
||
|
||
"This function is for a string format control arg"
|
||
|
||
<SETG FSTRING %<RSUBR-ENTRY '[PFIX FSTRING #DECL ("VALUE" ATOM STRING LIST LIST
|
||
FORM)] 1396>>
|
||
|
||
"This function is for doing a single escape sequence"
|
||
|
||
<SETG FCALL %<RSUBR-ENTRY '[PFIX FCALL #DECL ("VALUE" STRING STRING LIST LIST
|
||
FORM)] 1526>>
|
||
|
||
<SETG FVAR %<RSUBR-ENTRY '[PFIX FVAR #DECL ("VALUE" ANY FORM ANY)] 1962>>
|
||
|
||
"Parses out the args for a escape sequence"
|
||
|
||
<SETG FARGS %<RSUBR-ENTRY '[PFIX FARGS #DECL ("VALUE" STRING STRING LIST LIST)]
|
||
2051>>
|
||
|
||
"Eats one argument from the call"
|
||
|
||
<SETG FNEXT %<RSUBR-ENTRY '[PFIX FNEXT #DECL ("VALUE" ANY LIST)] 2222>>
|
||
|
||
<ENDPACKAGE>
|