zig/std/std.zig

103 lines
3.9 KiB
Zig
Raw Normal View History

pub const AlignedArrayList = @import("array_list.zig").AlignedArrayList;
pub const ArrayList = @import("array_list.zig").ArrayList;
pub const AutoHashMap = @import("hash_map.zig").AutoHashMap;
pub const BufMap = @import("buf_map.zig").BufMap;
pub const BufSet = @import("buf_set.zig").BufSet;
pub const Buffer = @import("buffer.zig").Buffer;
pub const BufferOutStream = @import("io.zig").BufferOutStream;
pub const DynLib = @import("dynamic_library.zig").DynLib;
pub const HashMap = @import("hash_map.zig").HashMap;
pub const LinkedList = @import("linked_list.zig").LinkedList;
pub const Mutex = @import("mutex.zig").Mutex;
pub const PackedIntArrayEndian = @import("packed_int_array.zig").PackedIntArrayEndian;
pub const PackedIntArray = @import("packed_int_array.zig").PackedIntArray;
pub const PackedIntSliceEndian = @import("packed_int_array.zig").PackedIntSliceEndian;
pub const PackedIntSlice = @import("packed_int_array.zig").PackedIntSlice;
2019-02-25 11:25:21 -08:00
pub const PriorityQueue = @import("priority_queue.zig").PriorityQueue;
2019-02-01 09:22:21 -08:00
pub const StaticallyInitializedMutex = @import("statically_initialized_mutex.zig").StaticallyInitializedMutex;
pub const SegmentedList = @import("segmented_list.zig").SegmentedList;
pub const SpinLock = @import("spinlock.zig").SpinLock;
2019-03-02 13:46:04 -08:00
pub const atomic = @import("atomic.zig");
pub const base64 = @import("base64.zig");
pub const build = @import("build.zig");
2019-03-02 13:46:04 -08:00
pub const c = @import("c.zig");
pub const coff = @import("coff.zig");
2019-03-02 13:46:04 -08:00
pub const crypto = @import("crypto.zig");
2016-05-07 10:52:52 -07:00
pub const cstr = @import("cstr.zig");
2019-03-02 13:46:04 -08:00
pub const debug = @import("debug.zig");
pub const dwarf = @import("dwarf.zig");
pub const elf = @import("elf.zig");
2018-03-07 00:55:52 -08:00
pub const event = @import("event.zig");
2019-03-02 13:46:04 -08:00
pub const fmt = @import("fmt.zig");
pub const hash = @import("hash.zig");
pub const hash_map = @import("hash_map.zig");
pub const heap = @import("heap.zig");
pub const io = @import("io.zig");
pub const json = @import("json.zig");
pub const lazyInit = @import("lazy_init.zig").lazyInit;
pub const macho = @import("macho.zig");
2019-03-02 13:46:04 -08:00
pub const math = @import("math.zig");
pub const mem = @import("mem.zig");
2019-03-02 13:46:04 -08:00
pub const meta = @import("meta.zig");
pub const net = @import("net.zig");
2019-03-02 13:46:04 -08:00
pub const os = @import("os.zig");
pub const pdb = @import("pdb.zig");
2019-03-02 13:46:04 -08:00
pub const rand = @import("rand.zig");
pub const rb = @import("rb.zig");
pub const sort = @import("sort.zig");
std: add ascii with C ASCII character classes 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; }
2019-03-21 19:33:37 -07:00
pub const ascii = @import("ascii.zig");
pub const testing = @import("testing.zig");
pub const unicode = @import("unicode.zig");
pub const valgrind = @import("valgrind.zig");
2019-03-02 13:46:04 -08:00
pub const zig = @import("zig.zig");
test "std" {
// run tests from these
_ = @import("array_list.zig");
2019-03-02 13:46:04 -08:00
_ = @import("atomic.zig");
_ = @import("buf_map.zig");
_ = @import("buf_set.zig");
_ = @import("buffer.zig");
_ = @import("hash_map.zig");
_ = @import("linked_list.zig");
_ = @import("mutex.zig");
2019-02-01 09:22:21 -08:00
_ = @import("statically_initialized_mutex.zig");
_ = @import("segmented_list.zig");
_ = @import("spinlock.zig");
2019-02-25 11:25:21 -08:00
2019-03-29 04:04:26 -07:00
_ = @import("ascii.zig");
_ = @import("base64.zig");
_ = @import("build.zig");
2019-03-02 13:46:04 -08:00
_ = @import("c.zig");
_ = @import("coff.zig");
2019-03-02 13:46:04 -08:00
_ = @import("crypto.zig");
_ = @import("cstr.zig");
2019-03-02 13:46:04 -08:00
_ = @import("debug.zig");
_ = @import("dwarf.zig");
_ = @import("dynamic_library.zig");
_ = @import("elf.zig");
2018-04-08 21:52:45 -07:00
_ = @import("event.zig");
2019-03-02 13:46:04 -08:00
_ = @import("fmt.zig");
_ = @import("hash.zig");
_ = @import("heap.zig");
_ = @import("io.zig");
_ = @import("json.zig");
_ = @import("lazy_init.zig");
_ = @import("macho.zig");
2019-03-02 13:46:04 -08:00
_ = @import("math.zig");
_ = @import("mem.zig");
2019-03-02 13:46:04 -08:00
_ = @import("meta.zig");
2018-03-07 00:55:52 -08:00
_ = @import("net.zig");
2019-03-02 13:46:04 -08:00
_ = @import("os.zig");
_ = @import("pdb.zig");
_ = @import("packed_int_array.zig");
2019-02-25 11:25:21 -08:00
_ = @import("priority_queue.zig");
2019-03-02 13:46:04 -08:00
_ = @import("rand.zig");
_ = @import("sort.zig");
_ = @import("testing.zig");
_ = @import("unicode.zig");
_ = @import("valgrind.zig");
2019-03-02 13:46:04 -08:00
_ = @import("zig.zig");
}