Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Book-reader
Copy link
Contributor

  • fixed some constants using C octal literals that had incorrect values in C3 (eg: all the Speed constants and many of the Tcflags)
  • Moved all Tcflags to bitstructs
  • moved some other constants to const enums
  • changed the naming of termios methods to be snake_case

after doing some testing with the termios flags things seem to work fine.

@lerno
Copy link
Collaborator

lerno commented Aug 5, 2025

We need to retain the old names for backwards compatibility, but please annotate them with @deprecated and move them to the end of the file.

@Book-reader
Copy link
Contributor Author

Book-reader commented Aug 6, 2025

I've added operator overloads that depend on #2374 with the old constants to have almost full backwards compatibility (it won't work if someone stored the flags in a Tcflags variable and assigned it directly, but it should work everywhere else. let me know if I should change it to use bitstruct constants instead), and I have changed the constants to be octal literals so they have the correct value.

something like this (example from my old project):

term.c_lflag &= ~(termios::ECHO | termios::ICANON | termios::ISIG | termios::IEXTEN);
term.c_iflag &= ~(termios::IXON | termios::ICRNL | termios::BRKINT | termios::INPCK | termios::ISTRIP);
term.c_oflag &= ~(termios::OPOST);
term.c_cflag |= (termios::CS8);

will work properly (after the operator overload bug is fixed), and behave exactly the same as this:

term.c_lflag &= ~(Tc_lflags){.echo, .icanon, .isig, .iexten};
term.c_iflag &= ~(Tc_iflags){.ixon, .icrnl, .brkint, .inpck, .istrip};
term.c_oflag.opost = false;
term.c_cflag.csize = CS8;

@Book-reader
Copy link
Contributor Author

Book-reader commented Aug 6, 2025

I've changed it so the deprecated constants use bitstructs instead of relying on operator overloading that shouldn't work.
the example I gave in the above comment still works

@lerno
Copy link
Collaborator

lerno commented Aug 13, 2025

Thank you!

@lerno lerno merged commit 076ef18 into c3lang:master Aug 13, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants