1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/v_pr_cas.htm
2024-04-01 10:24:07 +02:00

69 lines
6.3 KiB
HTML

<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: Variable *PRINT-CASE*</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="v_pr_bas.htm">
<LINK REL=UP HREF="c_printe.htm">
<LINK REL=NEXT HREF="v_pr_cir.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="v_pr_bas.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_printe.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="v_pr_cir.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<A NAME="STprint-caseST"><I>Variable</I> <B>*PRINT-CASE*</B></A> <P>
<P><B>Value Type:</B><P>
<P>
One of the <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbols</I></A> <TT>:upcase</TT>, <TT>:downcase</TT>, or <TT>:capitalize</TT>. <P>
<P><B>Initial Value:</B><P>
<P>
The <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> <TT>:upcase</TT>. <P>
<P><B>Description:</B><P>
<P>
The <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="#STprint-caseST"><B>*print-case*</B></A> controls the case (upper, lower, or mixed) in which to print any uppercase characters in the names of <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbols</I></A> when vertical-bar syntax is not used. <P>
<A REL=DEFINITION HREF="#STprint-caseST"><B>*print-case*</B></A> has an effect at all times when the <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="v_pr_esc.htm#STprint-escapeST"><B>*print-escape*</B></A> is <A REL=DEFINITION HREF="26_glo_f.htm#false"><I>false</I></A>. <A REL=DEFINITION HREF="#STprint-caseST"><B>*print-case*</B></A> also has an effect when the <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="v_pr_esc.htm#STprint-escapeST"><B>*print-escape*</B></A> is <A REL=DEFINITION HREF="26_glo_t.htm#true"><I>true</I></A> unless inside an escape context (i.e., unless between <A REL=DEFINITION HREF="26_glo_v.htm#vertical-bar"><I>vertical-bars</I></A> or after a <A REL=DEFINITION HREF="26_glo_s.htm#slash"><I>slash</I></A>). <P>
<P><B>Examples:</B><P>
<P>
<PRE>
(defun test-print-case ()
(dolist (*print-case* '(:upcase :downcase :capitalize))
(format t &quot;~&amp;~S ~S~%&quot; 'this-and-that '|And-something-elSE|)))
=&gt; TEST-PC
;; Although the choice of which characters to escape is specified by
;; *PRINT-CASE*, the choice of how to escape those characters
;; (i.e., whether single escapes or multiple escapes are used)
;; is implementation-dependent. The examples here show two of the
;; many valid ways in which escaping might appear.
(test-print-case) ;Implementation A
&gt;&gt; THIS-AND-THAT |And-something-elSE|
&gt;&gt; this-and-that a\n\d-\s\o\m\e\t\h\i\n\g-\e\lse
&gt;&gt; This-And-That A\n\d-\s\o\m\e\t\h\i\n\g-\e\lse
=&gt; NIL
(test-print-case) ;Implementation B
&gt;&gt; THIS-AND-THAT |And-something-elSE|
&gt;&gt; this-and-that a|nd-something-el|se
&gt;&gt; This-And-That A|nd-something-el|se
=&gt; NIL
</PRE>
</TT> <P>
<P><B>Affected By:</B> None.
<P>
<P><B>See Also:</B><P>
<P>
<A REL=DEFINITION HREF="f_wr_pr.htm#write"><B>write</B></A> <P>
<P><B>Notes:</B><P>
<P>
<A REL=DEFINITION HREF="f_rd_rd.htm#read"><B>read</B></A> normally converts lowercase characters appearing in <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbols</I></A> to corresponding uppercase characters, so that internally print names normally contain only uppercase characters. <P>
If <A REL=DEFINITION HREF="v_pr_esc.htm#STprint-escapeST"><B>*print-escape*</B></A> is <A REL=DEFINITION HREF="26_glo_t.htm#true"><I>true</I></A>, lowercase characters in the <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> of a <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> are always printed in lowercase, and are preceded by a single escape character or enclosed by multiple escape characters; uppercase characters in the <A REL=DEFINITION HREF="26_glo_n.htm#name"><I>name</I></A> of a <A REL=DEFINITION HREF="26_glo_s.htm#symbol"><I>symbol</I></A> are printed in upper case, in lower case, or in mixed case so as to capitalize words, according to the value of <A REL=DEFINITION HREF="#STprint-caseST"><B>*print-case*</B></A>. The convention for what constitutes a ``word'' is the same as for <A REL=DEFINITION HREF="f_stg_up.htm#string-capitalize"><B>string-capitalize</B></A>. <P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issues</A>, <I>not part of the specification</I>, apply to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss272.htm">PRINT-CASE-BEHAVIOR:CLARIFY</A><LI> <A REL=CHILD HREF="../Issues/iss204.htm">JUN90-TRIVIAL-ISSUES:3</A><LI> <A REL=CHILD HREF="../Issues/iss273.htm">PRINT-CASE-PRINT-ESCAPE-INTERACTION:VERTICAL-BAR-RULE-NO-UPCASE</A><P></UL><HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>