Skip to content
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

Rename hal.h to unistd.h? #45

Open
mlund opened this issue Aug 2, 2023 · 3 comments
Open

Rename hal.h to unistd.h? #45

mlund opened this issue Aug 2, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@mlund
Copy link
Collaborator

mlund commented Aug 2, 2023

The usleep() function is usually found in unistd.h. Is there a reason it's in hal.h?

usleep(3)               Library Functions Manual               usleep(3)
NAME         [top](https://www.man7.org/linux/man-pages/man3/usleep.3.html#top_of_page)
       usleep - suspend execution for microsecond intervals
LIBRARY         [top](https://www.man7.org/linux/man-pages/man3/usleep.3.html#top_of_page)
       Standard C library (libc, -lc)
SYNOPSIS         [top](https://www.man7.org/linux/man-pages/man3/usleep.3.html#top_of_page)
       #include <unistd.h>

       int usleep(useconds_t usec);
@mlund mlund added the enhancement New feature or request label Aug 2, 2023
@lydon42
Copy link
Member

lydon42 commented Aug 2, 2023

Because we have no unistd.h? Perhaps because it depends on counting rasters (this is because it should also work when in HYPPO mode, where stuff like CIA does not work as one would expect)?

@mlund
Copy link
Collaborator Author

mlund commented Aug 2, 2023

My thinking is that the library tries to mimick libc and I'd like the interface to follow a path of least surprises. I guess HAL is short for hardware-abstraction-layer(?) and is probably not the first place one would look for usleep(). Not having a unistd.h is quickly fixed but if so, we should probably keep a working hal.h around and emit a deprecation warning if someone tries to use it. In any case, this is likely not a high priority.

@lydon42
Copy link
Member

lydon42 commented Aug 2, 2023

usleep is used a lot in the core utilities of MEGA65, but it is an easy change to switch to unistd.h. And it won't hurt the current state, as I pinned all of them to v0.2.0 because of the other changes.

So feel free to make it more compatible to the standard and we will switch the core when everything is in a stable state again.

And for compatibility we can keep a hal.h that include unistd.h and emits a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants