1
0
Fork 0
cl-sites/novaspec.org/cl/f_break.html

345 lines
7.2 KiB
HTML
Raw Normal View History

2025-02-05 18:52:26 +01:00
<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>break | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_break.html"
><LINK REL="next" HREF="v_debugger-hook.html" TYPE="text/html" TITLE="*debugger-hook*"
><LINK REL="prev" HREF="f_invoke-debugger.html" TYPE="text/html" TITLE="invoke-debugger"
><LINK REL="up" HREF="9_2_Conditions_Dictionary.html" TYPE="text/html" TITLE="9.2 Conditions 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="9_Conditions.html"
>9. Conditions</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="9_2_Conditions_Dictionary.html"
>9.2 Conditions Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_break.html"
>break</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="f_invoke-debugger.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="v_debugger-hook.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="break"
></SPAN
><B
>break</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
>break</B
> <SPAN CLASS="cmtt"
>&amp;optional</SPAN
> <SPAN CLASS="cmssi"
>format-control</SPAN
> <SPAN CLASS="cmtt"
>&amp;rest</SPAN
> <SPAN CLASS="cmssi"
>format-arguments</SPAN
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="misc"
><B
>nil</B
></SPAN
></P
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>format-control</VAR
> &#8212; a <A HREF="26_1_Glossary.html#format_control"
><EM CLASS="term"
>format control</EM
></A
>. The default is <A HREF="26_1_Glossary.html#implementation-dependent"
><EM CLASS="term"
>implementation-dependent</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>format-arguments</VAR
> &#8212; <A HREF="26_1_Glossary.html#format_argument"
><EM CLASS="term"
>format arguments</EM
></A
> for the <VAR CLASS="param"
>format-control</VAR
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
><A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> <A HREF="26_1_Glossary.html#format"
><EM CLASS="term"
>formats</EM
></A
> <VAR CLASS="param"
>format-control</VAR
> and <VAR CLASS="param"
>format-arguments</VAR
> and then goes directly into the debugger without allowing any possibility of interception by programmed error-handling facilities. </P
><P CLASS="j"
>If the <SPAN CLASS="misc"
><B
>continue</B
></SPAN
> <A HREF="26_1_Glossary.html#restart"
><EM CLASS="term"
>restart</EM
></A
> is used while in the debugger, <A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> immediately returns <SPAN CLASS="misc"
><B
>nil</B
></SPAN
> without taking any unusual recovery action. </P
><P CLASS="j"
><A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> binds <A HREF="v_debugger-hook.html" CLASS="varref"
><B
>*debugger-hook*</B
></A
> to <SPAN CLASS="misc"
><B
>nil</B
></SPAN
> before attempting to enter the debugger.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
> (break "You got here with arguments: ~:S." '(FOO 37 A))
<SPAN CLASS="cmr"
>&#8883;</SPAN
> BREAK: You got here with these arguments: FOO, 37, A.
<SPAN CLASS="cmr"
>&#8883;</SPAN
> To continue, type :CONTINUE followed by an option number:
<SPAN CLASS="cmr"
>&#8883;</SPAN
> 1: Return from BREAK.
<SPAN CLASS="cmr"
>&#8883;</SPAN
> 2: Top level.
<SPAN CLASS="cmr"
>&#8883;</SPAN
> Debug&gt; :CONTINUE 1
<SPAN CLASS="cmr"
>&#8883;</SPAN
> Return from BREAK.
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL</PRE
></DD
><DT
><B
>Side Effects</B
></DT
><DD
><P CLASS="j"
>The debugger is entered.</P
></DD
><DT
><B
>Affected By</B
></DT
><DD
><P CLASS="j"
><A HREF="v_debug-io.html" CLASS="varref"
><B
>*debug-io*</B
></A
>.</P
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_error.html" CLASS="funref"
><B
>error</B
></A
>, <A HREF="f_invoke-debugger.html" CLASS="funref"
><B
>invoke-debugger</B
></A
>.</P
></DD
><DT
><B
>Notes</B
></DT
><DD
><P CLASS="j"
><A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> is used as a way of inserting temporary debugging &#8220;breakpoints&#8221; in a program, not as a way of signaling errors. For this reason, <A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> does not take the <VAR CLASS="param"
>continue-format-control</VAR
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> that <A HREF="f_cerror.html" CLASS="funref"
><B
>cerror</B
></A
> takes. This and the lack of any possibility of interception by <A HREF="26_1_Glossary.html#condition"
><EM CLASS="term"
>condition</EM
></A
> <A HREF="26_1_Glossary.html#handle"
><EM CLASS="term"
>handling</EM
></A
> are the only program-visible differences between <A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> and <A HREF="f_cerror.html" CLASS="funref"
><B
>cerror</B
></A
>. </P
><P CLASS="j"
>The user interface aspects of <A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> and <A HREF="f_cerror.html" CLASS="funref"
><B
>cerror</B
></A
> are permitted to vary more widely, in order to accomodate the interface needs of the <A HREF="26_1_Glossary.html#implementation"
><EM CLASS="term"
>implementation</EM
></A
>. For example, it is permissible for a <A HREF="26_1_Glossary.html#Lisp_read-eval-print_loop"
><EM CLASS="term"
>Lisp read-eval-print loop</EM
></A
> to be entered by <A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> rather than the conventional debugger. </P
><P CLASS="j"
><A HREF="f_break.html" CLASS="funref"
><B
>break</B
></A
> could be defined by:</P
><PRE CLASS="screen"
>(defun break (&amp;optional (format-control "Break") &amp;rest format-arguments)
(with-simple-restart (continue "Return from BREAK.")
(let ((*debugger-hook* nil))
(invoke-debugger
(make-condition 'simple-condition
:format-control format-control
:format-arguments format-arguments))))
nil)</PRE
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="f_invoke-debugger.html" CLASS="prev"
>&#8592;</A
><A HREF="v_debugger-hook.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
>