Does NOT look at the locale the way the C functions do.
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int isascii(int c);
int isblank(int c);
int toupper(int c);
int tolower(int c);
Tested to match glibc (when using C locale) with this program:
const c = @cImport({
// See https://github.com/ziglang/zig/issues/515
@cDefine("_NO_CRT_STDIO_INLINE", "1");
@cInclude("stdio.h");
@cInclude("string.h");
@cInclude("ctype.h");
});
const std = @import("std");
const ascii = std.ascii;
const abort = std.os.abort;
export fn main(argc: c_int, argv: **u8) c_int {
var i: u8 = undefined;
i = 0;
while (true) {
if (ascii.isAlNum(i) != (c.isalnum(i) > 0)) { abort(); }
if (ascii.isAlpha(i) != (c.isalpha(i) > 0)) { abort(); }
if (ascii.isCtrl(i) != (c.iscntrl(i) > 0)) { abort(); }
if (ascii.isDigit(i) != (c.isdigit(i) > 0)) { abort(); }
if (ascii.isGraph(i) != (c.isgraph(i) > 0)) { abort(); }
if (ascii.isLower(i) != (c.islower(i) > 0)) { abort(); }
if (ascii.isPrint(i) != (c.isprint(i) > 0)) { abort(); }
if (ascii.isPunct(i) != (c.ispunct(i) > 0)) { abort(); }
if (ascii.isSpace(i) != (c.isspace(i) > 0)) { abort(); }
if (ascii.isUpper(i) != (c.isupper(i) > 0)) { abort(); }
if (ascii.isXDigit(i) != (c.isxdigit(i) > 0)) { abort(); }
if (i == 255) { break; }
i += 1;
}
_ = c.printf(c"Success!\n");
return 0;
}
* Introduce the concept of packages. Closes#3
* Add support for error notes.
* Introduce `@import` and `@c_import` builtin functions and
remove the `import` and `c_import` top level declarations.
* Introduce the `use` top level declaration.
* Add `--check-unused` parameter to perform semantic
analysis and codegen on all top level declarations, not
just exported ones and ones referenced by exported ones.
* Delete the root export node and add `--library` argument.