User:RhoSigma/Test: Difference between revisions
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''' ... | ||
< | <span id="seekbuf-function"></span> | ||
== 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.</ | <pre>oldPos& = SeekBuf& (handle%, displace&, mode%)</pre></blockquote> | ||
< | |||
<blockquote> | ----- | ||
<blockquote> | |||
<blockquote> | <blockquote><blockquote><blockquote><blockquote><blockquote>'''''INPUTS:''''' | ||
<blockquote> | </blockquote></blockquote></blockquote></blockquote> | ||
<blockquote> | <span id="handle-integer"></span> | ||
< | ==== handle% ''(INTEGER)'' ==== | ||
* This is the handle of any valid buffer, for which you wanna set the new position. | |||
<span id="displace-long"></span> | |||
==== 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. | |||
<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& ''(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><blockquote><blockquote><blockquote><blockquote>'''''SEEK MODES:''''' | ||
<blockquote> | </blockquote></blockquote></blockquote></blockquote> | ||
<blockquote> | <span id="sbm_posrestore"></span> | ||
<blockquote> | ==== SBM_PosRestore ==== | ||
<blockquote> | |||
* 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). | |||
<span id="sbm_bufstart"></span> | |||
==== SBM_BufStart ==== | |||
* Set a position relative to the buffer start (ie. 1 + displacement). | |||
<span id="sbm_bufcurrent"></span> | |||
==== SBM_BufCurrent ==== | |||
* Set a position relative to the current position (ie. [[GetBufPos.html|GetBufPos()]] + displacement). | |||
<span id="sbm_bufend"></span> | |||
==== SBM_BufEnd ==== | |||
* Set a position relative to the buffer end (ie. ([[GetBufLen.html|GetBufLen()]] + 1) + displacement). | |||
<span id="sbm_linestart"></span> | |||
==== 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. | |||
</blockquote> | ** Ie. the set position is 1st char of line + displacement. | ||
< | |||
<span id="sbm_lineend"></span> | |||
==== 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. | |||
</blockquote> | |||
</blockquote> | <span id="any-bookmark-id"></span> | ||
< | ==== any Bookmark ID ==== | ||
* Set a position relative to the bookmark position (ie. [[GetBufMark.html|GetBufMark()]] + displacement). | |||
** If the displacement is zero, then this is equal to [[GotoBufMark.html|GotoBufMark()]]. | |||
any absolute position given in the displacement argument (valid values range | |||
from 1 to | |||
</ | |||
</ | |||
displacement).< | |||
</ | |||
displacement). | |||
< | |||
Set a position relative to the start of the current line, ie. the line | |||
where the current buffer position is right now. | |||
< | |||
</ | |||
Set a position relative to the end of the current line, ie. the line | |||
where the current buffer position is right now. | |||
which is CHR$(13) for Windows or CHR$(10) for Linux/MacOSX). | |||
< | |||
</ | |||
Set a position relative to the bookmark position (ie. | |||
displacement). | |||
</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().