-
Notifications
You must be signed in to change notification settings - Fork 18
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
libec (mini-libc) #35
Comments
networking: UDP? |
open/send/recv/... I thought something like reduced Berkeley sockets... so that we use the same interface to multiple protocols... UDP/TCP/RCP whatever is implemented... see my edit |
We should leave out the broken string-handling functions that don't require you to consider the length limit:
It might also make more sense to use Pascal strings with an explicit length byte at Apple compilers at least used to support a hybrid where you'd start the string with |
The current string format draft also proposes pstrings, so we can also
|
I just wanna ask if #39 has any impact on this regarding the possiblity of a RFC. |
Probably add some stuff to calculate with bigger numbers? 32-bit ints/uints, maybe even 64-bit ints? That could make writing programs much easier and reduce code repetition across programs and it's neither hard to implement nor large. |
Strlen for pstrings would be better off as an inline macro than an actual function... would save a lot of cycles :) I would strongly advise for strtok to be implemented in a re-entrant fashion (I have a religion against non-re-entrant standard functions) and any others like that which I am forgetting at the moment The network as implemented may or may not map to the sockets concept - we'll have to wait and see. We should have screen routines, like ncurses lite. |
Problem with (inline) macros is, that they're language dependent, while functions are not. But as the implementation of strlen is really a one-liner, we could recommend implementing it as a macro. Regarding re-entrantiness: As we don't have to implement this, I would propose, that all obligatory functions must be re-entrant. Screen routines should be non-obligatory; not everyone needs them and getc(), puts() provides a basic interface to this. Probably something like this?
|
That won't go into libc, as its the compilers responsibility to provide this. (Yes, I am aware that I wrote that)
|
I call this libec know, to have a more google-able name |
https://github.com/enkore/0x10c-Standards/blob/wip/LIB/Draft_libec.xml Small update, so that ppl. can use intrinsic functions for this. |
Maybe I should start in one some of these when I have some more free time. |
I don't think that the streams IO pattern is a good fit with any of the statements Notch has made on memory mapped/DMA IO. One of the irc logs, he even implied that floppies might be accessed through bank switch! In such a world, it makes more sense to work in terms of loading blocks of data. I'm just throwing this api off the cuff, but maybe something like: // Open a file, returning a struct.
file_struct *open_file(/*path spec, or id, or whatever*/);
// Read the next block of the file, putting a pointer to it in block_ptr.
bool read_next_block(file_struct *file, OUT word **block_ptr);
// Read the given block.
bool read(file_struct *file, int block_offset);
// After making changes to the buffer in memory, you flush to disk
bool write(file_struct *file, word *block_ptr);
// Invalidates the backing buffer, cleans up
bool close(file_struct);
// Convenience functions, inlined
// Given a word offset from start of file, finds appropriate block
int block_from_word(int word_offset);
// Given a word offset from start of file, finds what offset it is
// from start of its block.
int word_in_block(int file_word_offset); I think it's silly to talk about IO in depth before we see real IO specs. But, if IO is all memory-mapped, then stdlib needs to provide convenience on top of those facilities, not simply ape 40 year old irrelevant standards. |
Dito on that. That's why I more or less said "for now we just assume C90" :) Lets see what the future brings in this regard. Besides that I uploaded a new revision, mainly concerning memory management (+memmove), and strings (+sprintf). Also made some formal changes... |
|
Just a scrapbook
Obligatory functions
Memory managment
Strings
IO
Networking
Additional functions
Screen management
Security Considerations
The text was updated successfully, but these errors were encountered: