zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

blob ef4a6831 (9117B) - Raw


      1 pub const ArrayHashMap = array_hash_map.ArrayHashMap;
      2 pub const ArrayHashMapUnmanaged = array_hash_map.ArrayHashMapUnmanaged;
      3 pub const ArrayList = @import("array_list.zig").ArrayList;
      4 pub const ArrayListAligned = @import("array_list.zig").ArrayListAligned;
      5 pub const ArrayListAlignedUnmanaged = @import("array_list.zig").ArrayListAlignedUnmanaged;
      6 pub const ArrayListUnmanaged = @import("array_list.zig").ArrayListUnmanaged;
      7 pub const AutoArrayHashMap = array_hash_map.AutoArrayHashMap;
      8 pub const AutoArrayHashMapUnmanaged = array_hash_map.AutoArrayHashMapUnmanaged;
      9 pub const AutoHashMap = hash_map.AutoHashMap;
     10 pub const AutoHashMapUnmanaged = hash_map.AutoHashMapUnmanaged;
     11 pub const BoundedArray = @import("bounded_array.zig").BoundedArray;
     12 pub const BoundedArrayAligned = @import("bounded_array.zig").BoundedArrayAligned;
     13 pub const Build = @import("Build.zig");
     14 pub const BufMap = @import("buf_map.zig").BufMap;
     15 pub const BufSet = @import("buf_set.zig").BufSet;
     16 /// Deprecated: use `process.Child`.
     17 pub const ChildProcess = @import("child_process.zig").ChildProcess;
     18 pub const ComptimeStringMap = @import("comptime_string_map.zig").ComptimeStringMap;
     19 pub const DynLib = @import("dynamic_library.zig").DynLib;
     20 pub const DynamicBitSet = bit_set.DynamicBitSet;
     21 pub const DynamicBitSetUnmanaged = bit_set.DynamicBitSetUnmanaged;
     22 pub const EnumArray = enums.EnumArray;
     23 pub const EnumMap = enums.EnumMap;
     24 pub const EnumSet = enums.EnumSet;
     25 pub const HashMap = hash_map.HashMap;
     26 pub const HashMapUnmanaged = hash_map.HashMapUnmanaged;
     27 pub const Ini = @import("Ini.zig");
     28 pub const MultiArrayList = @import("multi_array_list.zig").MultiArrayList;
     29 pub const PackedIntArray = @import("packed_int_array.zig").PackedIntArray;
     30 pub const PackedIntArrayEndian = @import("packed_int_array.zig").PackedIntArrayEndian;
     31 pub const PackedIntSlice = @import("packed_int_array.zig").PackedIntSlice;
     32 pub const PackedIntSliceEndian = @import("packed_int_array.zig").PackedIntSliceEndian;
     33 pub const PriorityQueue = @import("priority_queue.zig").PriorityQueue;
     34 pub const PriorityDequeue = @import("priority_dequeue.zig").PriorityDequeue;
     35 pub const Progress = @import("Progress.zig");
     36 pub const RingBuffer = @import("RingBuffer.zig");
     37 pub const SegmentedList = @import("segmented_list.zig").SegmentedList;
     38 pub const SemanticVersion = @import("SemanticVersion.zig");
     39 pub const SinglyLinkedList = @import("linked_list.zig").SinglyLinkedList;
     40 pub const StaticBitSet = bit_set.StaticBitSet;
     41 pub const StringHashMap = hash_map.StringHashMap;
     42 pub const StringHashMapUnmanaged = hash_map.StringHashMapUnmanaged;
     43 pub const StringArrayHashMap = array_hash_map.StringArrayHashMap;
     44 pub const StringArrayHashMapUnmanaged = array_hash_map.StringArrayHashMapUnmanaged;
     45 pub const TailQueue = @import("linked_list.zig").TailQueue;
     46 pub const Target = @import("target.zig").Target;
     47 pub const Thread = @import("Thread.zig");
     48 pub const Treap = @import("treap.zig").Treap;
     49 pub const Tz = tz.Tz;
     50 pub const Uri = @import("Uri.zig");
     51 
     52 pub const array_hash_map = @import("array_hash_map.zig");
     53 pub const atomic = @import("atomic.zig");
     54 pub const base64 = @import("base64.zig");
     55 pub const bit_set = @import("bit_set.zig");
     56 pub const builtin = @import("builtin.zig");
     57 pub const c = @import("c.zig");
     58 pub const coff = @import("coff.zig");
     59 pub const compress = @import("compress.zig");
     60 pub const crypto = @import("crypto.zig");
     61 pub const cstr = @import("cstr.zig");
     62 pub const debug = @import("debug.zig");
     63 pub const dwarf = @import("dwarf.zig");
     64 pub const elf = @import("elf.zig");
     65 pub const enums = @import("enums.zig");
     66 pub const event = @import("event.zig");
     67 pub const fifo = @import("fifo.zig");
     68 pub const fmt = @import("fmt.zig");
     69 pub const fs = @import("fs.zig");
     70 pub const hash = @import("hash.zig");
     71 pub const hash_map = @import("hash_map.zig");
     72 pub const heap = @import("heap.zig");
     73 pub const http = @import("http.zig");
     74 pub const io = @import("io.zig");
     75 pub const json = @import("json.zig");
     76 pub const leb = @import("leb128.zig");
     77 pub const log = @import("log.zig");
     78 pub const macho = @import("macho.zig");
     79 pub const math = @import("math.zig");
     80 pub const mem = @import("mem.zig");
     81 pub const meta = @import("meta.zig");
     82 pub const net = @import("net.zig");
     83 pub const os = @import("os.zig");
     84 pub const once = @import("once.zig").once;
     85 pub const packed_int_array = @import("packed_int_array.zig");
     86 pub const pdb = @import("pdb.zig");
     87 pub const process = @import("process.zig");
     88 pub const rand = @import("rand.zig");
     89 pub const sort = @import("sort.zig");
     90 pub const simd = @import("simd.zig");
     91 pub const ascii = @import("ascii.zig");
     92 pub const tar = @import("tar.zig");
     93 pub const testing = @import("testing.zig");
     94 pub const time = @import("time.zig");
     95 pub const tz = @import("tz.zig");
     96 pub const unicode = @import("unicode.zig");
     97 pub const valgrind = @import("valgrind.zig");
     98 pub const wasm = @import("wasm.zig");
     99 pub const zig = @import("zig.zig");
    100 pub const start = @import("start.zig");
    101 
    102 /// deprecated: use `Build`.
    103 pub const build = Build;
    104 
    105 const root = @import("root");
    106 const options_override = if (@hasDecl(root, "std_options")) root.std_options else struct {};
    107 
    108 pub const options = struct {
    109     pub const enable_segfault_handler: bool = if (@hasDecl(options_override, "enable_segfault_handler"))
    110         options_override.enable_segfault_handler
    111     else
    112         debug.default_enable_segfault_handler;
    113 
    114     /// Function used to implement std.fs.cwd for wasi.
    115     pub const wasiCwd: fn () fs.Dir = if (@hasDecl(options_override, "wasiCwd"))
    116         options_override.wasiCwd
    117     else
    118         fs.defaultWasiCwd;
    119 
    120     /// The application's chosen I/O mode.
    121     pub const io_mode: io.Mode = if (@hasDecl(options_override, "io_mode"))
    122         options_override.io_mode
    123     else if (@hasDecl(options_override, "event_loop"))
    124         .evented
    125     else
    126         .blocking;
    127 
    128     pub const event_loop: event.Loop.Instance = if (@hasDecl(options_override, "event_loop"))
    129         options_override.event_loop
    130     else
    131         event.Loop.default_instance;
    132 
    133     pub const event_loop_mode: event.Loop.Mode = if (@hasDecl(options_override, "event_loop_mode"))
    134         options_override.event_loop_mode
    135     else
    136         event.Loop.default_mode;
    137 
    138     /// The current log level.
    139     pub const log_level: log.Level = if (@hasDecl(options_override, "log_level"))
    140         options_override.log_level
    141     else
    142         log.default_level;
    143 
    144     pub const log_scope_levels: []const log.ScopeLevel = if (@hasDecl(options_override, "log_scope_levels"))
    145         options_override.log_scope_levels
    146     else
    147         &.{};
    148 
    149     pub const logFn: fn (
    150         comptime message_level: log.Level,
    151         comptime scope: @TypeOf(.enum_literal),
    152         comptime format: []const u8,
    153         args: anytype,
    154     ) void = if (@hasDecl(options_override, "logFn"))
    155         options_override.logFn
    156     else
    157         log.defaultLog;
    158 
    159     pub const fmt_max_depth = if (@hasDecl(options_override, "fmt_max_depth"))
    160         options_override.fmt_max_depth
    161     else
    162         fmt.default_max_depth;
    163 
    164     pub const cryptoRandomSeed: fn (buffer: []u8) void = if (@hasDecl(options_override, "cryptoRandomSeed"))
    165         options_override.cryptoRandomSeed
    166     else
    167         @import("crypto/tlcsprng.zig").defaultRandomSeed;
    168 
    169     pub const crypto_always_getrandom: bool = if (@hasDecl(options_override, "crypto_always_getrandom"))
    170         options_override.crypto_always_getrandom
    171     else
    172         false;
    173 
    174     /// By default Zig disables SIGPIPE by setting a "no-op" handler for it.  Set this option
    175     /// to `true` to prevent that.
    176     ///
    177     /// Note that we use a "no-op" handler instead of SIG_IGN because it will not be inherited by
    178     /// any child process.
    179     ///
    180     /// SIGPIPE is triggered when a process attempts to write to a broken pipe. By default, SIGPIPE
    181     /// will terminate the process instead of exiting.  It doesn't trigger the panic handler so in many
    182     /// cases it's unclear why the process was terminated.  By capturing SIGPIPE instead, functions that
    183     /// write to broken pipes will return the EPIPE error (error.BrokenPipe) and the program can handle
    184     /// it like any other error.
    185     pub const keep_sigpipe: bool = if (@hasDecl(options_override, "keep_sigpipe"))
    186         options_override.keep_sigpipe
    187     else
    188         false;
    189 
    190     pub const http_connection_pool_size = if (@hasDecl(options_override, "http_connection_pool_size"))
    191         options_override.http_connection_pool_size
    192     else
    193         http.Client.default_connection_pool_size;
    194 
    195     pub const side_channels_mitigations: crypto.SideChannelsMitigations = if (@hasDecl(options_override, "side_channels_mitigations"))
    196         options_override.side_channels_mitigations
    197     else
    198         crypto.default_side_channels_mitigations;
    199 };
    200 
    201 // This forces the start.zig file to be imported, and the comptime logic inside that
    202 // file decides whether to export any appropriate start symbols, and call main.
    203 comptime {
    204     _ = start;
    205 
    206     for (@typeInfo(options_override).Struct.decls) |decl| {
    207         if (!@hasDecl(options, decl.name)) @compileError("no option named " ++ decl.name);
    208     }
    209 }
    210 
    211 test {
    212     testing.refAllDecls(@This());
    213 }