Skip to content

[Repo Assist] improve: add l_isblank, l_iscntrl, l_isgraph, l_ispunct, l_isascii#163

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/improve-missing-ctype-functions-34a3ec11cc29c9c6
Draft

[Repo Assist] improve: add l_isblank, l_iscntrl, l_isgraph, l_ispunct, l_isascii#163
github-actions[bot] wants to merge 1 commit into
mainfrom
repo-assist/improve-missing-ctype-functions-34a3ec11cc29c9c6

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 1, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Adds five missing <ctype.h>-equivalent functions to l_os.h, completing the character classification API:

Function Behaviour
l_isblank(c) Non-zero if c is space or tab
l_iscntrl(c) Non-zero if c is a control character (0x00–0x1F or 0x7F)
l_isgraph(c) Non-zero if c is a printable non-space character (0x21–0x7E)
l_ispunct(c) Non-zero if c is a printable non-space non-alphanumeric character
l_isascii(c) Non-zero if c is a 7-bit ASCII character (0x00–0x7F)

Without L_DONTOVERRIDE, each is macro-aliased to its standard name (isblank, iscntrl, isgraph, ispunct, isascii).

Rationale

l_os.h covered isalpha, isalnum, isdigit, isspace, isupper, islower, toupper, tolower, isprint, and isxdigit — but the five functions above were missing. Any code that includes the header without L_DONTOVERRIDE and calls ispunct, isgraph, iscntrl, isblank, or isascii would fail to compile (undeclared identifier). This PR closes that gap.

Implementation Details

  • l_isblank, l_iscntrl, l_isgraph, and l_isascii are one-liners in the early "platform-independent" block alongside l_isprint/l_isxdigit (no dependencies on other l_* functions).
  • l_ispunct is placed after l_isalnum (which it calls) to respect the top-to-bottom ordering convention.
  • All five forward declarations are added alongside the existing ctype declarations.
  • Without L_DONTOVERRIDE: #define isblank l_isblank etc. added to the macro-alias block.

Test Status

Linux gcc: 1550 assertions passed
Linux clang: 1548 assertions passed
⏭️ ARM/AArch64: cross-compilers not available in this environment (SKIP)
⏭️ Windows: not available in this environment (SKIP)

New test function test_ctype_extended() in tests/test_strings.c covers all five functions with boundary and edge cases.

Generated by 🌈 Repo Assist at {run-started}. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@1f672aef974f4246124860fc532f82fe8a93a57e

Complete the ctype-equivalent function set. Five standard character
classification functions were missing from l_os.h:

  l_isblank  - blank characters (space and tab)
  l_iscntrl  - control characters (0x00-0x1F and 0x7F)
  l_isgraph  - printable non-space characters (0x21-0x7E)
  l_ispunct  - printable non-space non-alphanumeric characters
  l_isascii  - 7-bit ASCII characters (0x00-0x7F)

Without L_DONTOVERRIDE each is also macro-aliased to its standard name
(isblank, iscntrl, isgraph, ispunct, isascii).

l_isblank, l_iscntrl, l_isgraph, l_isascii are implemented as one-liners
early in the file alongside l_isprint/l_isxdigit. l_ispunct is placed
after l_isalnum (on which it depends).

Tests added in tests/test_strings.c::test_ctype_extended().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants