1
0
Fork 0
cl-sites/novaspec.org/cl/f_copy-readtable.html
2025-02-05 18:52:26 +01:00

303 lines
No EOL
6.4 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>copy-readtable | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_copy-readtable.html"
><LINK REL="next" HREF="f_make-dispatch-macro-character.html" TYPE="text/html" TITLE="make-dispatch-macro-character"
><LINK REL="prev" HREF="t_readtable.html" TYPE="text/html" TITLE="readtable"
><LINK REL="up" HREF="23_2_Reader_Dictionary.html" TYPE="text/html" TITLE="23.2 Reader Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="23_Reader.html"
>23. Reader</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="23_2_Reader_Dictionary.html"
>23.2 Reader Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_copy-readtable.html"
>copy-readtable</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="t_readtable.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="f_make-dispatch-macro-character.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="copy-readtable"
></SPAN
><B
>copy-readtable</B
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Function</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Syntax</B
></DT
><DD
><P CLASS="j"
><B
>copy-readtable</B
> <SPAN CLASS="cmtt"
>&amp;optional</SPAN
> <SPAN CLASS="cmssi"
>from-readtable</SPAN
> <SPAN CLASS="cmssi"
>to-readtable</SPAN
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="cmssi"
>readtable</SPAN
></P
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>from-readtable</VAR
> &#8212; a <A HREF="26_1_Glossary.html#readtable_designator"
><EM CLASS="term"
>readtable designator</EM
></A
>. The default is the <A HREF="26_1_Glossary.html#current_readtable"
><EM CLASS="term"
>current readtable</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>to-readtable</VAR
> &#8212; a <A HREF="26_1_Glossary.html#readtable"
><EM CLASS="term"
>readtable</EM
></A
> or <SPAN CLASS="misc"
><B
>nil</B
></SPAN
>. The default is <SPAN CLASS="misc"
><B
>nil</B
></SPAN
>. </P
><P CLASS="j"
><VAR CLASS="param"
>readtable</VAR
> &#8212; the <VAR CLASS="param"
>to-readtable</VAR
> if it is <A HREF="26_1_Glossary.html#non-nil"
><EM CLASS="term"
>non-nil</EM
></A
>, or else a <A HREF="26_1_Glossary.html#fresh"
><EM CLASS="term"
>fresh</EM
></A
> <A HREF="26_1_Glossary.html#readtable"
><EM CLASS="term"
>readtable</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
><A HREF="f_copy-readtable.html" CLASS="funref"
><B
>copy-readtable</B
></A
> copies <VAR CLASS="param"
>from-readtable</VAR
>. </P
><P CLASS="j"
>If <VAR CLASS="param"
>to-readtable</VAR
> is <SPAN CLASS="misc"
><B
>nil</B
></SPAN
>, a new <A HREF="26_1_Glossary.html#readtable"
><EM CLASS="term"
>readtable</EM
></A
> is created and returned. Otherwise the <A HREF="26_1_Glossary.html#readtable"
><EM CLASS="term"
>readtable</EM
></A
> specified by <VAR CLASS="param"
>to-readtable</VAR
> is modified and returned. </P
><P CLASS="j"
><A HREF="f_copy-readtable.html" CLASS="funref"
><B
>copy-readtable</B
></A
> copies the setting of <A HREF="f_readtable-case.html" CLASS="funref"
><B
>readtable-case</B
></A
>.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
>(setq zvar 123) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 123
(set-syntax-from-char #\z #\' (setq table2 (copy-readtable))) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> T
zvar <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 123
(copy-readtable table2 *readtable*) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> #&lt;READTABLE 614000277&gt;
zvar <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> VAR
(setq *readtable* (copy-readtable)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> #&lt;READTABLE 46210223&gt;
zvar <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> VAR
(setq *readtable* (copy-readtable nil)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> #&lt;READTABLE 46302670&gt;
zvar <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 123</PRE
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="t_readtable.html" CLASS="typeref"
><B
>readtable</B
></A
>, <A HREF="v_readtable.html" CLASS="varref"
><B
>*readtable*</B
></A
></P
></DD
><DT
><B
>Notes</B
></DT
><DD
><PRE CLASS="screen"
>(setq *readtable* (copy-readtable nil))</PRE
><P CLASS="j"
>restores the input syntax to standard Common Lisp syntax, even if the <A HREF="26_1_Glossary.html#initial_readtable"
><EM CLASS="term"
>initial readtable</EM
></A
> has been clobbered (assuming it is not so badly clobbered that you cannot type in the above expression). </P
><P CLASS="j"
>On the other hand,</P
><PRE CLASS="screen"
>(setq *readtable* (copy-readtable))</PRE
><P CLASS="j"
>replaces the current <A HREF="26_1_Glossary.html#readtable"
><EM CLASS="term"
>readtable</EM
></A
> with a copy of itself. This is useful if you want to save a copy of a readtable for later use, protected from alteration in the meantime. It is also useful if you want to locally bind the readtable to a copy of itself, as in:</P
><PRE CLASS="screen"
>(let ((*readtable* (copy-readtable))) ...)</PRE
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="t_readtable.html" CLASS="prev"
>&#8592;</A
><A HREF="f_make-dispatch-macro-character.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>