You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
such feature should be included in hsl, there's already builtin function to achieve this when using builtin resources : \ftell() and \fseek().
simplest implementation :
enum SeekWhence
/** * Specifies how the cursor position will be calculated * based on the seek offset.*/enumSeekWhence: int {
/** * Set position equal to offset bytes.*/SET=\SEEK_SET;
/** * Set position to current location plus offset.*/CURRENT=\SEEK_CUR;
/** * Set position to end-of-file plus offset.*/END=\SEEK_END;
}
SeekableHandle :
<<__Sealed(
SeekableWriteHandle::class,
SekkableReadHandle::claas,
)>>
interfaceSeekableHandle {
/** * Seek to a position in the stream.*/publicfunctionseek(
int$offset,
SeekWhence$whence=SeekWhence::SET,
): void;
/** * Seek to the beginning of the stream. * * If the stream is not seekable, this method will raise an exception; * otherwise, it will perform a seek(0).*/publicfunctionrewind(): void;
/** * Returns the current position of the file read/write pointer * * @return int Position of the file pointer*/publicfunctiontell(): int;
}
interfaceSeekableReadHandleextendsReadHandle, SeekableHandle {}
interfaceSeekableWriteHandleextendsWriteHandle, SeekableHandle {}
interfaceDisposableSeekableWriteHandleextendsSeekableWriteHandle, DisposableWriteHandle {}
interfaceDisposableSeekableReadHandleextendsSeekableReadHandle, DisposableReadHandle {}
We also currently have a separation between seeking for read and seeking for write. We're going to have to investigate portability of unifying them (we were hoping to implement them using fdup, but the result is non-portable). That includes testing the C behavior on platforms we don't currently support.
such feature should be included in hsl, there's already builtin function to achieve this when using builtin resources :
\ftell()
and\fseek()
.simplest implementation :
enum SeekWhence
SeekableHandle
:Hanlde::seek(int $offset, SeekWhence $whence = SeekWhence::SET): void
:Handle::rewind(): void
Handle::tell(): int
:The text was updated successfully, but these errors were encountered: