60 lines
No EOL
31 KiB
HTML
60 lines
No EOL
31 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=0.8"/><title>13.1.4 Counting Positions, Lines, and Columns</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">The Racket Reference</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2 </td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3 </td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4 </td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5 </td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6 </td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7 </td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11 </td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12 </td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13 </td><td><a href="input-and-output.html" class="tocviewselflink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15 </td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16 </td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17 </td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18 </td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">Running Racket</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>13 </td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr></table><div class="tocviewsublist" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">13.1 </td><td><a href="ports.html" class="tocviewselflink" data-pltdoc="x">Ports</a></td></tr><tr><td align="right">13.2 </td><td><a href="Byte_and_String_Input.html" class="tocviewlink" data-pltdoc="x">Byte and String Input</a></td></tr><tr><td align="right">13.3 </td><td><a href="Byte_and_String_Output.html" class="tocviewlink" data-pltdoc="x">Byte and String Output</a></td></tr><tr><td align="right">13.4 </td><td><a href="Reading.html" class="tocviewlink" data-pltdoc="x">Reading</a></td></tr><tr><td align="right">13.5 </td><td><a href="Writing.html" class="tocviewlink" data-pltdoc="x">Writing</a></td></tr><tr><td align="right">13.6 </td><td><a href="pretty-print.html" class="tocviewlink" data-pltdoc="x">Pretty Printing</a></td></tr><tr><td align="right">13.7 </td><td><a href="Reader_Extension.html" class="tocviewlink" data-pltdoc="x">Reader Extension</a></td></tr><tr><td align="right">13.8 </td><td><a href="Printer_Extension.html" class="tocviewlink" data-pltdoc="x">Printer Extension</a></td></tr><tr><td align="right">13.9 </td><td><a href="serialization.html" class="tocviewlink" data-pltdoc="x">Serialization</a></td></tr><tr><td align="right">13.10 </td><td><a href="fasl.html" class="tocviewlink" data-pltdoc="x">Fast-<wbr></wbr>Load Serialization</a></td></tr><tr><td align="right">13.11 </td><td><a href="sha.html" class="tocviewlink" data-pltdoc="x">Cryptographic Hashing</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_2");">▼</a></td><td>13.1 </td><td><a href="ports.html" class="tocviewlink" data-pltdoc="x">Ports</a></td></tr></table><div class="tocviewsublistbottom" style="display: block;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">13.1.1 </td><td><a href="encodings.html" class="tocviewlink" data-pltdoc="x">Encodings and Locales</a></td></tr><tr><td align="right">13.1.2 </td><td><a href="port-ops.html" class="tocviewlink" data-pltdoc="x">Managing Ports</a></td></tr><tr><td align="right">13.1.3 </td><td><a href="port-buffers.html" class="tocviewlink" data-pltdoc="x">Port Buffers and Positions</a></td></tr><tr><td align="right">13.1.4 </td><td><a href="linecol.html" class="tocviewselflink" data-pltdoc="x">Counting Positions, Lines, and Columns</a></td></tr><tr><td align="right">13.1.5 </td><td><a href="file-ports.html" class="tocviewlink" data-pltdoc="x">File Ports</a></td></tr><tr><td align="right">13.1.6 </td><td><a href="stringport.html" class="tocviewlink" data-pltdoc="x">String Ports</a></td></tr><tr><td align="right">13.1.7 </td><td><a href="pipeports.html" class="tocviewlink" data-pltdoc="x">Pipes</a></td></tr><tr><td align="right">13.1.8 </td><td><a href="portstructs.html" class="tocviewlink" data-pltdoc="x">Structures as Ports</a></td></tr><tr><td align="right">13.1.9 </td><td><a href="customport.html" class="tocviewlink" data-pltdoc="x">Custom Ports</a></td></tr><tr><td align="right">13.1.10 </td><td><a href="port-lib.html" class="tocviewlink" data-pltdoc="x">More Port Constructors, Procedures, and Events</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines%21%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">port-<wbr></wbr>count-<wbr></wbr>lines!</span></span></a></td></tr><tr><td><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-counts-lines~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">port-<wbr></wbr>counts-<wbr></wbr>lines?</span></span></a></td></tr><tr><td><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-next-location%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">port-<wbr></wbr>next-<wbr></wbr>location</span></span></a></td></tr><tr><td><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._set-port-next-location%21%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">set-<wbr></wbr>port-<wbr></wbr>next-<wbr></wbr>location!</span></span></a></td></tr><tr><td><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines-enabled%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">port-<wbr></wbr>count-<wbr></wbr>lines-<wbr></wbr>enabled</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" id="searchbox" type="text" tabindex="1" placeholder="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "8.6", "../");"/></form> <a href="https://docs.racket-lang.org/index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("8.6");">top</a><span class="tocsettoggle"> <a href="javascript:void(0);" title="show/hide table of contents" onclick="TocsetToggle();">contents</a></span></span><span class="navright"> <a href="port-buffers.html" title="backward to "13.1.3 Port Buffers and Positions"" data-pltdoc="x">← prev</a> <a href="ports.html" title="up to "13.1 Ports"" data-pltdoc="x">up</a> <a href="file-ports.html" title="forward to "13.1.5 File Ports"" data-pltdoc="x">next →</a></span> </div><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""linecol"">13.1.4<tt> </tt><a name="(part._linecol)"></a><a name="(idx._(gentag._248._(lib._scribblings/reference/reference..scrbl)))"></a><a name="(idx._(gentag._249._(lib._scribblings/reference/reference..scrbl)))"></a><a name="(idx._(gentag._250._(lib._scribblings/reference/reference..scrbl)))"></a>Counting Positions, Lines, and Columns</h5><p>By default, Racket keeps track of the <a name="(tech._position)"></a><span style="font-style: italic">position</span> in a port as
|
|
the number of bytes that have been read from or written to any port
|
|
(independent of the read/write position, which is accessed or changed
|
|
with <span class="RktSym"><a href="port-buffers.html#%28def._%28%28quote._~23~25kernel%29._file-position%29%29" class="RktValLink" data-pltdoc="x">file-position</a></span>). Optionally, however, Racket can track
|
|
the position in terms of characters (after UTF-8 decoding), instead of
|
|
bytes, and it can track <a name="(tech._line._location)"></a><span style="font-style: italic">line locations</span> and <a name="(tech._column._location)"></a><span style="font-style: italic">column
|
|
locations</span>; this optional tracking must be specifically enabled for a
|
|
port via <span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines%21%29%29" class="RktValLink" data-pltdoc="x">port-count-lines!</a></span> or the
|
|
<span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines-enabled%29%29" class="RktValLink" data-pltdoc="x">port-count-lines-enabled</a></span> parameter. Position, line, and
|
|
column locations for a port are used by <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read-syntax%29%29" class="RktValLink" data-pltdoc="x">read-syntax</a></span>.
|
|
Position and line locations are numbered
|
|
from <span style="font-style: italic"></span>1<span style="font-style: italic"></span>; column locations are numbered from <span style="font-style: italic"></span>0<span style="font-style: italic"></span>.</p><p>When counting lines, Racket treats linefeed, return, and
|
|
return-linefeed combinations as a line terminator and as a single
|
|
position (on all platforms). Each tab advances the column count to one
|
|
before the next multiple of <span style="font-style: italic"></span>8<span style="font-style: italic"></span>. When a sequence of bytes in the
|
|
range 128 to 253 forms a UTF-8 encoding of a character, the
|
|
position/column is incremented once for each byte, and
|
|
then decremented appropriately when a complete encoding sequence is
|
|
discovered. See also <a href="ports.html" data-pltdoc="x">Ports</a> for more information on UTF-8
|
|
decoding for ports.</p><p>A position is known for any port as long as its value can be expressed
|
|
as a fixnum (which is more than enough tracking for realistic
|
|
applications in, say, syntax-error reporting). If the position for a
|
|
port exceeds the value of the largest fixnum, then the position for
|
|
the port becomes unknown, and line and column tacking is disabled.
|
|
Return-linefeed combinations are treated as a single character
|
|
position only when line and column counting is enabled.</p><p><a href="customport.html#%28tech._custom._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">Custom ports</span></a> can define their own counting functions, which are
|
|
not subject to the rules above, except that the counting functions are
|
|
invoked only when tracking is specifically enabled with
|
|
<span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines%21%29%29" class="RktValLink" data-pltdoc="x">port-count-lines!</a></span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._port-count-lines!))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">port-count-lines!</a></span></span><span class="hspace"> </span><span class="RktVar">port</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._port~3f%29%29" class="RktValLink" data-pltdoc="x">port?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Turns on <a href="linecol.html#%28tech._line._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">line location</span></a> and <a href="linecol.html#%28tech._column._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">column location</span></a> counting
|
|
for a port. Counting can be turned
|
|
on at any time, though generally it is turned on before any data is
|
|
read from or written to a port. At the point that line counting is
|
|
turned on, <span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-next-location%29%29" class="RktValLink" data-pltdoc="x">port-next-location</a></span> typically starts reporting as
|
|
its last result (one more than) the number of characters read since
|
|
line counting was enabled, instead of (one more than) bytes read since
|
|
the port was opened.</div></p><p>When a port is created, if the value of the
|
|
<span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines-enabled%29%29" class="RktValLink" data-pltdoc="x">port-count-lines-enabled</a></span> parameter is true, then line
|
|
counting is automatically enabled for the port. Line counting cannot
|
|
be disabled for a port after it is enabled.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._port-counts-lines~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-counts-lines~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">port-counts-lines?</a></span></span><span class="hspace"> </span><span class="RktVar">port</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._port~3f%29%29" class="RktValLink" data-pltdoc="x">port?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <a href="linecol.html#%28tech._line._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">line location</span></a> and <a href="linecol.html#%28tech._column._location%29" class="techoutside" data-pltdoc="x"><span class="techinside">column location</span></a>
|
|
counting has been enabled for
|
|
<span class="RktVar">port</span>, <span class="RktVal">#f</span> otherwise.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._port-next-location))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-next-location%29%29" class="RktValDef RktValLink" data-pltdoc="x">port-next-location</a></span></span><span class="hspace"> </span><span class="RktVar">port</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="prototype"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><table cellspacing="0" cellpadding="0"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-positive-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-positive-integer?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-nonnegative-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-positive-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-positive-integer?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr></table></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._port~3f%29%29" class="RktValLink" data-pltdoc="x">port?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns three values: an integer or <span class="RktVal">#f</span> for the line number of
|
|
the next read/written item, an integer or <span class="RktVal">#f</span> for the next
|
|
item’s column, and an integer or <span class="RktVal">#f</span> for the next item’s
|
|
position. The next column and position normally increase as bytes are
|
|
read from or written to the port, but if line/character counting is
|
|
enabled for <span class="RktVar">port</span>, the column and position results can
|
|
decrease after reading or writing a byte that ends a UTF-8 encoding
|
|
sequence.</div></p><p>If line counting is not enabled for a port, than the first two results
|
|
are <span class="RktVal">#f</span>, and the last result is one more than the number of
|
|
bytes read so far. At the point when line counting is enabled, the
|
|
first two results typically become non-<span class="RktVal">#f</span>, and last result
|
|
starts reporting characters instead of bytes, typically starting from
|
|
the point when line counting is enabled.</p><p>Even with line counting enabled, a port may return <span class="RktVal">#f</span> values
|
|
if it somehow cannot keep track of lines, columns, or positions.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._set-port-next-location!))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._set-port-next-location%21%29%29" class="RktValDef RktValLink" data-pltdoc="x">set-port-next-location!</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">port</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">line</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">column</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">position</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._port~3f%29%29" class="RktValLink" data-pltdoc="x">port?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">line</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-positive-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-positive-integer?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">column</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-nonnegative-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">position</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-positive-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-positive-integer?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Sets the next line, column, and position for <span class="RktVar">port</span>. If line
|
|
counting has not been enabled for <span class="RktVar">port</span> or if <span class="RktVar">port</span> is
|
|
a <a href="customport.html#%28tech._custom._port%29" class="techoutside" data-pltdoc="x"><span class="techinside">custom port</span></a> that defines its own counting function, then
|
|
<span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._set-port-next-location%21%29%29" class="RktValLink" data-pltdoc="x">set-port-next-location!</a></span> has no effect.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>parameter</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._port-count-lines-enabled))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines-enabled%29%29" class="RktValDef RktValLink" data-pltdoc="x">port-count-lines-enabled</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="linecol.html#%28def._%28%28quote._~23~25kernel%29._port-count-lines-enabled%29%29" class="RktValDef RktValLink" data-pltdoc="x">port-count-lines-enabled</a></span></span><span class="hspace"> </span><span class="RktVar">on?</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">on?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="eval-model.html#%28tech._parameter%29" class="techoutside" data-pltdoc="x"><span class="techinside">parameter</span></a> that determines whether line counting is enabled
|
|
automatically for newly created ports. The default value is
|
|
<span class="RktVal">#f</span>.</div></p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" id="searchbox" type="text" tabindex="1" placeholder="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "8.6", "../");"/></form> <a href="https://docs.racket-lang.org/index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("8.6");">top</a><span class="tocsettoggle"> <a href="javascript:void(0);" title="show/hide table of contents" onclick="TocsetToggle();">contents</a></span></span><span class="navright"> <a href="port-buffers.html" title="backward to "13.1.3 Port Buffers and Positions"" data-pltdoc="x">← prev</a> <a href="ports.html" title="up to "13.1 Ports"" data-pltdoc="x">up</a> <a href="file-ports.html" title="forward to "13.1.5 File Ports"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html> |