User:RhoSigma/Test: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 2: Line 2:
'''Keep Out''' - This is my all things MediaWiki '''Nuke Test Site''' ...
'''Keep Out''' - This is my all things MediaWiki '''Nuke Test Site''' ...


<h2>SeekBuf <em>(function)</em></h2>
<span id="seekbuf-function"></span>
<p>This function will set the current buffer position in the specified buffer
== SeekBuf ''(function)'' ==
using the given placement details. That position is important, as it is
 
used as starting point for most buffer operations, which in any way read,
This function will set the current buffer position in the specified buffer using the given placement details. That position is important, as it is used as starting point for most buffer operations, which in any way read, write, copy or search data. The result of this function is the old position in the buffer, or negative if an error occurs. You specify the relative start position (origin) and a displacement, which may be positive or negative and which will be added to the origin. Eg. 20 from current is a position 20 bytes forward from current, -20 is 20 bytes back from current. You'll get an error, if you try to seek beyond the lower or upper bounds of the buffer data range.
write, copy or search data. The result of this function is the old position
 
in the buffer, or negative if an error occurs. You specify the relative
 
start position (origin) and a displacement, which may be positive or negative
-----
and which will be added to the origin. Eg. 20 from current is a position
 
20 bytes forward from current, -20 is 20 bytes back from current. You'll
<blockquote><blockquote><blockquote><blockquote><blockquote>'''''SYNTAX:'''''
get an error, if you try to seek beyond the lower or upper bounds of the
</blockquote></blockquote></blockquote></blockquote>
buffer data range.</p>
<pre>oldPos&amp; = SeekBuf&amp; (handle%, displace&amp;, mode%)</pre></blockquote>
<hr />
 
<blockquote>
-----
<blockquote>
 
<blockquote>
<blockquote><blockquote><blockquote><blockquote><blockquote>'''''INPUTS:'''''
<blockquote>
</blockquote></blockquote></blockquote></blockquote>
<blockquote>
<span id="handle-integer"></span>
<p><strong><em>SYNTAX:</em></strong></p>
==== handle% ''(INTEGER)'' ====
 
* This is the handle of any valid buffer, for which you wanna set the new position.
 
<span id="displace-long"></span>
==== displace&amp; ''(LONG)'' ====
 
* This is any value which is added to the start position (origin) designated by the given seek mode, it may be negative, zero or positive.
 
<span id="mode-integer"></span>
==== mode% ''(INTEGER)'' ====
 
* This is the desired seek mode, which designates the origin for the new position, it may be a regular seek mode as defined in the '''simplebuffer.bi''' file (see also below) or the ID number of any set bookmark, which its position shall be used as origin.
</blockquote>
</blockquote>
-----
<blockquote><blockquote><blockquote><blockquote><blockquote>'''''RESULT:'''''
</blockquote></blockquote></blockquote></blockquote>
<span id="oldpos-long"></span>
==== oldPos&amp; ''(LONG)'' ====
* On success (positive value) this is the old position in the buffer.
* On failure (negative value) it is any of the error numbers defined in the '''simplebuffer.bi''' file (see [[Simplebuffer-Common.html|Common-Info]]), the old position remains unchanged in this case.
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre><code>oldPos&amp; = SeekBuf&amp; (handle%, displace&amp;, mode%)
</code></pre>


</blockquote>
-----
<hr />
 
<blockquote>
<blockquote><blockquote><blockquote><blockquote><blockquote>'''''SEEK MODES:'''''
<blockquote>
</blockquote></blockquote></blockquote></blockquote>
<blockquote>
<span id="sbm_posrestore"></span>
<blockquote>
==== SBM_PosRestore ====
<blockquote>
 
<p><strong><em>INPUTS:</em></strong></p>
* If you know the exact position, then this is the easiest mode, it will set any absolute position given in the displacement argument (valid values range from 1 to [[GetBufLen.html|GetBufLen()]] + 1).
</blockquote>
 
</blockquote>
<span id="sbm_bufstart"></span>
</blockquote>
==== SBM_BufStart ====
</blockquote>
 
<h4>handle% <em>(INTEGER)</em></h4>
* Set a position relative to the buffer start (ie. 1 + displacement).
<ul>
 
<li>This is the handle of any valid buffer, for which you wanna set the
<span id="sbm_bufcurrent"></span>
new position.</li>
==== SBM_BufCurrent ====
</ul>
 
<h4>displace&amp; <em>(LONG)</em></h4>
* Set a position relative to the current position (ie. [[GetBufPos.html|GetBufPos()]] + displacement).
<ul>
 
<li>This is any value which is added to the start position (origin) designated
<span id="sbm_bufend"></span>
by the given seek mode, it may be negative, zero or positive.</li>
==== SBM_BufEnd ====
</ul>
 
<h4>mode% <em>(INTEGER)</em></h4>
* Set a position relative to the buffer end (ie. ([[GetBufLen.html|GetBufLen()]] + 1) + displacement).
<ul>
 
<li>This is the desired seek mode, which designates the origin for the new
<span id="sbm_linestart"></span>
position, it may be a regular seek mode as defined in the <strong>simplebuffer.bi</strong>
==== SBM_LineStart ====
file (see also below) or the ID number of any set bookmark, which its
 
position shall be used as origin.</li>
* Set a position relative to the start of the current line, ie. the line where the current buffer position is right now.
</ul>
** Start of line = first char of the line.
</blockquote>
** Ie. the set position is 1st char of line + displacement.
<hr />
 
<blockquote>
<span id="sbm_lineend"></span>
<blockquote>
==== SBM_LineEnd ====
<blockquote>
 
<blockquote>
* Set a position relative to the end of the current line, ie. the line where the current buffer position is right now.
<blockquote>
** End of line = last char of the line + 1 (ie. the 1st line break char, which is CHR$(13) for Windows or CHR$(10) for Linux/MacOSX).
<p><strong><em>RESULT:</em></strong></p>
** Ie. the set position is current line's 1st line break char + displacement.
</blockquote>
 
</blockquote>
<span id="any-bookmark-id"></span>
</blockquote>
==== any Bookmark ID ====
</blockquote>
 
<h4>oldPos&amp; <em>(LONG)</em></h4>
* Set a position relative to the bookmark position (ie. [[GetBufMark.html|GetBufMark()]] + displacement).
<ul>
** If the displacement is zero, then this is equal to [[GotoBufMark.html|GotoBufMark()]].
<li>On success (positive value) this is the old position in the buffer.</li>
<li>On failure (negative value) it is any of the error numbers defined in
the <strong>simplebuffer.bi</strong> file (see <a href="Simplebuffer-Common.html">Common-Info</a>),
the old position remains unchanged in this case.</li>
</ul>
</blockquote>
<hr />
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<p><strong><em>SEEK MODES:</em></strong></p>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<h4>SBM_PosRestore</h4>
<ul>
<li>If you know the exact position, then this is the easiest mode, it will set
any absolute position given in the displacement argument (valid values range
from 1 to <a href="GetBufLen.html">GetBufLen()</a> + 1).</li>
</ul>
<h4>SBM_BufStart</h4>
<ul>
<li>Set a position relative to the buffer start (ie. 1 + displacement).</li>
</ul>
<h4>SBM_BufCurrent</h4>
<ul>
<li>Set a position relative to the current position (ie. <a href="GetBufPos.html">GetBufPos()</a> +
displacement).</li>
</ul>
<h4>SBM_BufEnd</h4>
<ul>
<li>Set a position relative to the buffer end (ie. (<a href="GetBufLen.html">GetBufLen()</a> + 1) +
displacement).</li>
</ul>
<h4>SBM_LineStart</h4>
<ul>
<li>
Set a position relative to the start of the current line, ie. the line
where the current buffer position is right now.
<ul>
<li>Start of line = first char of the line.</li>
<li>Ie. the set position is 1st char of line + displacement.</li>
</ul>
</li>
</ul>
<h4>SBM_LineEnd</h4>
<ul>
<li>
Set a position relative to the end of the current line, ie. the line
where the current buffer position is right now.
<ul>
<li>End of line = last char of the line + 1 (ie. the 1st line break char,
which is CHR$(13) for Windows or CHR$(10) for Linux/MacOSX).</li>
<li>Ie. the set position is current line's 1st line break char + displacement.</li>
</ul>
</li>
</ul>
<h4>any Bookmark ID</h4>
<ul>
<li>
Set a position relative to the bookmark position (ie. <a href="GetBufMark.html">GetBufMark()</a> +
displacement).
<ul>
<li>If the displacement is zero, then this is equal to <a href="GotoBufMark.html">GotoBufMark()</a>.</li>
</ul>
</li>
</ul>
</blockquote>
</blockquote>

Revision as of 18:40, 22 May 2025

ATTENTION

Keep Out - This is my all things MediaWiki Nuke Test Site ...

SeekBuf (function)

This function will set the current buffer position in the specified buffer using the given placement details. That position is important, as it is used as starting point for most buffer operations, which in any way read, write, copy or search data. The result of this function is the old position in the buffer, or negative if an error occurs. You specify the relative start position (origin) and a displacement, which may be positive or negative and which will be added to the origin. Eg. 20 from current is a position 20 bytes forward from current, -20 is 20 bytes back from current. You'll get an error, if you try to seek beyond the lower or upper bounds of the buffer data range.



SYNTAX:

oldPos& = SeekBuf& (handle%, displace&, mode%)

INPUTS:

handle% (INTEGER)

  • This is the handle of any valid buffer, for which you wanna set the new position.

displace& (LONG)

  • This is any value which is added to the start position (origin) designated by the given seek mode, it may be negative, zero or positive.

mode% (INTEGER)

  • This is the desired seek mode, which designates the origin for the new position, it may be a regular seek mode as defined in the simplebuffer.bi file (see also below) or the ID number of any set bookmark, which its position shall be used as origin.

RESULT:

oldPos& (LONG)

  • On success (positive value) this is the old position in the buffer.
  • On failure (negative value) it is any of the error numbers defined in the simplebuffer.bi file (see Common-Info), the old position remains unchanged in this case.

SEEK MODES:

SBM_PosRestore

  • If you know the exact position, then this is the easiest mode, it will set any absolute position given in the displacement argument (valid values range from 1 to GetBufLen() + 1).

SBM_BufStart

  • Set a position relative to the buffer start (ie. 1 + displacement).

SBM_BufCurrent

  • Set a position relative to the current position (ie. GetBufPos() + displacement).

SBM_BufEnd

  • Set a position relative to the buffer end (ie. (GetBufLen() + 1) + displacement).

SBM_LineStart

  • Set a position relative to the start of the current line, ie. the line where the current buffer position is right now.
    • Start of line = first char of the line.
    • Ie. the set position is 1st char of line + displacement.

SBM_LineEnd

  • Set a position relative to the end of the current line, ie. the line where the current buffer position is right now.
    • End of line = last char of the line + 1 (ie. the 1st line break char, which is CHR$(13) for Windows or CHR$(10) for Linux/MacOSX).
    • Ie. the set position is current line's 1st line break char + displacement.

any Bookmark ID

  • Set a position relative to the bookmark position (ie. GetBufMark() + displacement).
    • If the displacement is zero, then this is equal to GotoBufMark().