-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement atari
fgetpos
and fsetpos
using NOTE
/POINT
#334
Comments
atari
fgetpos
and fsetpos
using NOTE/POINTatari
fgetpos
and fsetpos
using NOTE
/POINT
I'd like to implement this. |
How to handle I can only think of using |
|
I'm thinking of: typedef struct {
unsigned short sector; // at the beginning of the buffer
unsigned char offset_in_sector; // at the beginning of the buffer
size_t offset_in_buffer; // size_t because of setvbuf
} fpos_t; |
Providing a custom |
Another idea (in pseudocode): int fgetpos(FILE *stream, fpos_t *pos)
{
if (stream->bufidx == 0)
*pos = stream->position_at_last_fill_buffer;
else {
POINT(stream->position_at_last_fill_buffer);
SKIP(stream->bufidx); // implemented as READ to buffer
*pos = NOTE();
}
} This only needs 24-bit |
I started coding it. Shall I add a |
The Atari DOS
NOTE
/POINT
functionality isn't expressive enough to implementfseek
, since the former use sector/offset, while the latter uses byte offsets from start/end of file. It is expressive enough to implementfgetpos
andfsetpos
, since these operate on an opaquefpos_t
value, which could be interpreted as a sector/offset pair.The text was updated successfully, but these errors were encountered: