home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Environments / AllegroCL11 / ccl-doc / format.text < prev    next >
Encoding:
Text File  |  1987-08-07  |  4.1 KB  |  81 lines  |  [TEXT/CCL ]

  1. A Format call takes the
  2. following arguments:
  3.  
  4. destination control-string &rest arguments
  5.  
  6. Format directives can
  7. be classified by what
  8. they process:
  9.  
  10. Text
  11. ~A ~S ~P ~C ~% ~& ~| ~~ ~T 
  12.  
  13. Integers
  14. ~D ~B ~O ~X ~R
  15.  
  16. Floating Point Numbers
  17. ~F ~E ~G ~$  
  18.  
  19. Flow of Control
  20. ~* ~? ~(str~)
  21. ~[str0;...] ~; ~{sr}
  22. ~<> ~^ ~<newline>
  23.  
  24. Each format directive
  25. may take the modifiers
  26.  : and/or @
  27.  
  28. Examples:
  29.  (format nil "Hi ~5,,,'*:A." "foo") => "Hi **foo."
  30.  (format nil "Hi ~,,#,'*S." "foo") => "Hi \"foo\"*."
  31.  (format nil "~D Bobb~:@P." 7) => "7 Bobbies."
  32.  (format nil "~:B" 8) => "1,000"
  33.  The first arg is the destination, a stream, or when nil, a string.
  34.  The number 5 is considered a parameter to ~A in the first example.
  35.  The colon is considered a modifier to ~A in the first example.
  36.  
  37. One can put V or # in
  38. place of any parameter:
  39. V=get parm from arg-list
  40. #=parm is number of args
  41.   left to be processed.
  42.  
  43. What follows is a table
  44. composed of items containing:
  45.  format directive
  46.  mnemonic aid
  47.  parameters
  48.  modifiers
  49.  
  50. ~A Ascii        mincol,colinc,minpad,padchar  :@ :makes nil be ()  @ makes pad be printed on the Right hand side instead of the default left hand side.
  51. ~S S-epression  mincol,colinc,minpad,padchar  :@ : and @ are same as in ~A
  52. ~P Plural                                     :@ : makes it go back one arg @ deals with y-cases instead of s cases
  53. ~C Character                                  :@ : spells name of control bits. @ prints characters LISP READably. :@ has unclear semantics in CCL.
  54. ~% Newline      howmany                       
  55. ~& Freshline    howmany                       
  56. ~| Page         howmany                       
  57. ~~ Tilde        howmany                       
  58. ~T Tabulate     colnum,colinc                  @ @ does relative tabulation.
  59. ~<str~> Justify mincol,colinc,minpad,padchar  :@ : makes spaces come before first element. @ makes spaces come after last element. :@ centers the text.
  60.  
  61. ~D Decimal      mincol,padchar,commachar      :@ :puts commas every third digit. @ makes the sign be always printed.
  62. ~B Binary       mincol,padchar,commachar      :@ : and @ same as ~D
  63. ~O Octal        mincol,padchar,commachar      :@ : and @ same as ~D
  64. ~X Hexadecimal  mincol,padchar,commachar      :@ : and @ same as ~D
  65. ~R Radix        radix,mincol,padchar,commachar:@ If there is a parameter : and @ act same as in ~D.
  66.    English-number                                If no parameters, ~R prints its arg as a cardinal English number (four) : puts out number ordinaly (fourth). @ puts out number in Roman numerals (IV).  :@ puts out number in OLD Roman numerals (IIII).
  67.  
  68. ~F Fixed-fp     w,d,k,overflow,padchar         @ @ makes sign be always printed.
  69. ~E Exponential-fp w,d,e,k,overflowchar,padchar,exponentchar @ @ same as in ~F
  70. ~G General-fp     w,d,e,k,overflowchar,padchar,exponentchar @ @ same as in ~F
  71. ~$ Dollars-fp   d,n,w,padchar                 :@ @ same as in ~F
  72.  
  73. ~<newline>  Ignore-the-inputed-newline        :@ : leaves whitespace following <newline> intact. @ leaves <newline> intact but ignores the following whitespace.
  74. ~* Skip-args    howmany                       :@ : ignores backwards and reuses those args. @ performs absolute goto in arg number to go to.
  75. ~? Indirection                                 @ @ makes only one arg be directly consumed.
  76. ~(str~) Case-Conversion                       :@ : capitalizes all words. @ capitalized the first word and FORCES the rest to lower case. :@ converts every lowrecase to corresponding uppercase character.
  77. ~[str0~;str1~;...strn~] Conditional-expression  which-string? :@ : does a [false~;true~] conditionalization. @ tests the argument if it is non nil it is not used up by ~[ and the clause true is processed. If the arg is nil it is used up but the clause true is not executed.
  78. ~; Clause-separator-in-~[-and-~<-constructs
  79. ~{str~} Iteration                             :@ normally the arg should be a list that is used over and over in the repetition. With a : arg should be a list of sublists. on each iteration, a different sublist is used. @ makes the remaining arguments be used as args in the repetition of the string str.
  80. ~^ Escape                  1-arg,2-arg,3-arg  :  : terminates entire iteration process not just the current iteration. 
  81.