| 1 | pub const AutoHashMap = hash_map.AutoHashMap; |
| 2 | pub const AutoHashMapUnmanaged = hash_map.AutoHashMapUnmanaged; |
| 3 | pub const BitStack = @import("BitStack.zig"); |
| 4 | pub const Build = @import("Build.zig"); |
| 5 | pub const BufMap = @import("buf_map.zig").BufMap; |
| 6 | pub const BufSet = @import("buf_set.zig").BufSet; |
| 7 | pub const StaticStringMap = static_string_map.StaticStringMap; |
| 8 | pub const StaticStringMapWithEql = static_string_map.StaticStringMapWithEql; |
| 9 | pub const Deque = @import("deque.zig").Deque; |
| 10 | pub const DoublyLinkedList = @import("DoublyLinkedList.zig"); |
| 11 | pub const DynLib = @import("dynamic_library.zig").DynLib; |
| 12 | /// Deprecated: use `bit_set.DynamicManaged`. |
| 13 | pub const DynamicBitSet = bit_set.DynamicBitSet; |
| 14 | /// Deprecated: use `bit_set.Dynamic`. |
| 15 | pub const DynamicBitSetUnmanaged = bit_set.DynamicBitSetUnmanaged; |
| 16 | pub const EnumArray = enums.EnumArray; |
| 17 | pub const EnumMap = enums.EnumMap; |
| 18 | pub const EnumSet = enums.EnumSet; |
| 19 | pub const HashMap = hash_map.HashMap; |
| 20 | pub const HashMapUnmanaged = hash_map.HashMapUnmanaged; |
| 21 | pub const Io = @import("Io.zig"); |
| 22 | pub const MultiArrayList = @import("multi_array_list.zig").MultiArrayList; |
| 23 | pub const PriorityQueue = @import("priority_queue.zig").PriorityQueue; |
| 24 | pub const PriorityDequeue = @import("priority_dequeue.zig").PriorityDequeue; |
| 25 | pub const Progress = @import("Progress.zig"); |
| 26 | pub const Random = @import("Random.zig"); |
| 27 | pub const SemanticVersion = @import("SemanticVersion.zig"); |
| 28 | pub const SinglyLinkedList = @import("SinglyLinkedList.zig"); |
| 29 | /// Deprecated: use `bit_set.Static`. |
| 30 | pub const StaticBitSet = bit_set.StaticBitSet; |
| 31 | pub const StringHashMap = hash_map.StringHashMap; |
| 32 | pub const StringHashMapUnmanaged = hash_map.StringHashMapUnmanaged; |
| 33 | pub const Target = @import("Target.zig"); |
| 34 | pub const Thread = @import("Thread.zig"); |
| 35 | pub const Treap = @import("treap.zig").Treap; |
| 36 | pub const Tz = tz.Tz; |
| 37 | pub const Uri = @import("Uri.zig"); |
| 38 | |
| 39 | /// Deprecated; use `array_hash_map.Custom`. |
| 40 | pub const ArrayHashMapUnmanaged = array_hash_map.Custom; |
| 41 | /// Deprecated; use `array_hash_map.Auto`. |
| 42 | pub const AutoArrayHashMapUnmanaged = array_hash_map.Auto; |
| 43 | /// Deprecated; use `array_hash_map.String`. |
| 44 | pub const StringArrayHashMapUnmanaged = array_hash_map.String; |
| 45 | |
| 46 | /// A contiguous, growable list of items in memory. This is a wrapper around a |
| 47 | /// slice of `T` values. |
| 48 | /// |
| 49 | /// The same allocator must be used throughout its entire lifetime. Initialize |
| 50 | /// directly with `empty` or `initCapacity`, and deinitialize with `deinit` or |
| 51 | /// `toOwnedSlice`. |
| 52 | pub fn ArrayList(comptime T: type) type { |
| 53 | return array_list.Aligned(T, null); |
| 54 | } |
| 55 | pub const array_list = @import("array_list.zig"); |
| 56 | |
| 57 | /// Deprecated; use `array_list.Aligned`. |
| 58 | pub const ArrayListAligned = array_list.Aligned; |
| 59 | /// Deprecated; use `array_list.Aligned`. |
| 60 | pub const ArrayListAlignedUnmanaged = array_list.Aligned; |
| 61 | /// Deprecated; use `ArrayList`. |
| 62 | pub const ArrayListUnmanaged = ArrayList; |
| 63 | |
| 64 | pub const array_hash_map = @import("array_hash_map.zig"); |
| 65 | pub const atomic = @import("atomic.zig"); |
| 66 | pub const base64 = @import("base64.zig"); |
| 67 | pub const bit_set = @import("bit_set.zig"); |
| 68 | /// Deprecated; use `lang`. |
| 69 | /// |
| 70 | /// To be removed after Zig 0.17.0. |
| 71 | pub const builtin = lang; |
| 72 | pub const lang = @import("lang.zig"); |
| 73 | pub const c = @import("c.zig"); |
| 74 | pub const coff = @import("coff.zig"); |
| 75 | pub const compress = @import("compress.zig"); |
| 76 | pub const static_string_map = @import("static_string_map.zig"); |
| 77 | pub const crypto = @import("crypto.zig"); |
| 78 | pub const debug = @import("debug.zig"); |
| 79 | pub const dwarf = @import("dwarf.zig"); |
| 80 | pub const elf = @import("elf.zig"); |
| 81 | pub const enums = @import("enums.zig"); |
| 82 | pub const fmt = @import("fmt.zig"); |
| 83 | pub const fs = @import("fs.zig"); |
| 84 | pub const spirv = @import("spirv.zig"); |
| 85 | pub const hash = @import("hash.zig"); |
| 86 | pub const hash_map = @import("hash_map.zig"); |
| 87 | pub const heap = @import("heap.zig"); |
| 88 | pub const http = @import("http.zig"); |
| 89 | pub const json = @import("json.zig"); |
| 90 | pub const leb = @import("leb128.zig"); |
| 91 | pub const log = @import("log.zig"); |
| 92 | pub const macho = @import("macho.zig"); |
| 93 | pub const math = @import("math.zig"); |
| 94 | pub const mem = @import("mem.zig"); |
| 95 | pub const meta = @import("meta.zig"); |
| 96 | pub const os = @import("os.zig"); |
| 97 | pub const pdb = @import("pdb.zig"); |
| 98 | pub const pie = @import("pie.zig"); |
| 99 | pub const posix = @import("posix.zig"); |
| 100 | pub const process = @import("process.zig"); |
| 101 | pub const sort = @import("sort.zig"); |
| 102 | pub const simd = @import("simd.zig"); |
| 103 | pub const ascii = @import("ascii.zig"); |
| 104 | pub const tar = @import("tar.zig"); |
| 105 | pub const testing = @import("testing.zig"); |
| 106 | pub const time = @import("time.zig"); |
| 107 | pub const tz = @import("tz.zig"); |
| 108 | pub const unicode = @import("unicode.zig"); |
| 109 | pub const valgrind = @import("valgrind.zig"); |
| 110 | pub const wasm = @import("wasm.zig"); |
| 111 | pub const zig = @import("zig.zig"); |
| 112 | pub const zip = @import("zip.zig"); |
| 113 | pub const zon = @import("zon.zig"); |
| 114 | pub const start = @import("start.zig"); |
| 115 | |
| 116 | const root = @import("root"); |
| 117 | |
| 118 | /// Compile-time known settings overridable by the root source file. |
| 119 | pub const options: Options = if (@hasDecl(root, "std_options")) root.std_options else .{}; |
| 120 | |
| 121 | pub const Options = struct { |
| 122 | enable_segfault_handler: bool = debug.default_enable_segfault_handler, |
| 123 | |
| 124 | /// If set, `std.start` and `std.Thread` will configure an per-thread alternative signal stack |
| 125 | /// of this size. Importantly, if `enable_segfault_handler` is set, the segfault handler will |
| 126 | /// use this alternative stack, meaning it can still print stack traces even if a segmentation |
| 127 | /// fault is caused by a stack overflow. |
| 128 | /// |
| 129 | /// On POSIX targets, the signal stack is configured using 'sigaltstack(2)'. |
| 130 | /// |
| 131 | /// On Windows, this value is currently ignored. |
| 132 | signal_stack_size: ?u64 = 1 << 18, // 1<<17 observed to be sufficient for stack tracing with self-hosted x86_64 backend |
| 133 | |
| 134 | /// The current log level. |
| 135 | log_level: log.Level = log.default_level, |
| 136 | |
| 137 | log_scope_levels: []const log.ScopeLevel = &.{}, |
| 138 | |
| 139 | logFn: fn ( |
| 140 | comptime message_level: log.Level, |
| 141 | comptime scope: @EnumLiteral(), |
| 142 | comptime format: []const u8, |
| 143 | args: anytype, |
| 144 | ) void = log.defaultLog, |
| 145 | |
| 146 | /// Overrides `std.heap.page_size_min`. |
| 147 | page_size_min: ?usize = null, |
| 148 | /// Overrides `std.heap.page_size_max`. |
| 149 | page_size_max: ?usize = null, |
| 150 | /// Overrides default implementation for determining OS page size at runtime. |
| 151 | queryPageSize: fn () usize = heap.defaultQueryPageSize, |
| 152 | |
| 153 | fmt_max_depth: usize = fmt.default_max_depth, |
| 154 | |
| 155 | /// By default, std.http.Client will support HTTPS connections. Set this option to `true` to |
| 156 | /// disable TLS support. |
| 157 | /// |
| 158 | /// This will likely reduce the size of the binary, but it will also make it impossible to |
| 159 | /// make a HTTPS connection. |
| 160 | http_disable_tls: bool = false, |
| 161 | |
| 162 | /// This enables `std.http.Client` to log ssl secrets to the file specified by the SSLKEYLOGFILE |
| 163 | /// env var. Creating such a log file allows other programs with access to that file to decrypt |
| 164 | /// all `std.http.Client` traffic made by this program. |
| 165 | http_enable_ssl_key_log_file: bool = @import("builtin").mode == .debug, |
| 166 | |
| 167 | side_channels_mitigations: crypto.SideChannelsMitigations = crypto.default_side_channels_mitigations, |
| 168 | |
| 169 | /// Whether to allow capturing and writing stack traces. This affects the following functions: |
| 170 | /// * `debug.captureCurrentStackTrace` |
| 171 | /// * `debug.writeCurrentStackTrace` |
| 172 | /// * `debug.dumpCurrentStackTrace` |
| 173 | /// * `debug.writeStackTrace` |
| 174 | /// * `debug.dumpStackTrace` |
| 175 | /// * `debug.writeErrorReturnTrace` |
| 176 | /// * `debug.dumpErrorReturnTrace` |
| 177 | /// |
| 178 | /// Stack traces can generally be collected and printed when debug info is stripped, but are |
| 179 | /// often less useful since they usually cannot be mapped to source locations and/or have bad |
| 180 | /// source locations. The stack tracing logic can also be quite large, which may be undesirable, |
| 181 | /// particularly in ReleaseSmall. |
| 182 | /// |
| 183 | /// If this is `false`, then captured stack traces will always be empty, and attempts to write |
| 184 | /// stack traces will just print an error to the relevant `Io.Writer` and return. |
| 185 | allow_stack_tracing: bool = !@import("builtin").strip_debug_info, |
| 186 | |
| 187 | /// Allows disabling networking in std.Io implementations. |
| 188 | networking: bool = true, |
| 189 | |
| 190 | /// Whether or not `error.Unexpected` will print its value and a stack trace. |
| 191 | /// |
| 192 | /// If this happens the fix is to add the error code to the corresponding |
| 193 | /// switch expression, possibly introduce a new error in the error set, and |
| 194 | /// send a patch to Zig. |
| 195 | unexpected_error_tracing: bool = @import("builtin").mode == .debug and switch (@import("builtin").zig_backend) { |
| 196 | .stage2_llvm, .stage2_x86_64 => true, |
| 197 | else => false, |
| 198 | }, |
| 199 | |
| 200 | /// TODO This is a separate decl instead of a field as a workaround around |
| 201 | /// compilation errors due to zig not being lazy enough. |
| 202 | pub const logTerminalMode: fn () Io.Terminal.Mode = log.defaultTerminalMode; |
| 203 | |
| 204 | /// TODO This is a separate decl instead of a field as a workaround around |
| 205 | /// compilation errors due to zig not being lazy enough. |
| 206 | pub const elf_debug_info_search_paths: ?fn (exe_path: []const u8) switch (@import("builtin").object_format) { |
| 207 | .elf => debug.ElfFile.DebugInfoSearchPaths, |
| 208 | else => void, |
| 209 | } = if (@hasDecl(root, "std_options_elf_debug_info_search_paths")) |
| 210 | root.std_options_elf_debug_info_search_paths |
| 211 | else |
| 212 | null; |
| 213 | |
| 214 | pub const debug_threaded_io: ?*Io.Threaded = if (@hasDecl(root, "std_options_debug_threaded_io")) |
| 215 | root.std_options_debug_threaded_io |
| 216 | else |
| 217 | Io.Threaded.global_single_threaded; |
| 218 | |
| 219 | /// The `Io` instance that `std.debug` uses for `std.debug.print`, |
| 220 | /// capturing stack traces, loading debug info, finding the executable's |
| 221 | /// own path, and environment variables that affect terminal mode |
| 222 | /// detection. The default is to use statically initialized singleton that |
| 223 | /// is independent from the application's `Io` instance in order to make |
| 224 | /// debugging more straightforward. For example, while debugging an `Io` |
| 225 | /// implementation based on coroutines, one likely wants `std.debug.print` |
| 226 | /// to directly write to stderr without trying to interact with the code |
| 227 | /// being debugged. |
| 228 | pub const debug_io: Io = if (@hasDecl(root, "std_options_debug_io")) root.std_options_debug_io else debug_threaded_io.?.io(); |
| 229 | |
| 230 | /// Overrides `std.Io.File.Permissions`. |
| 231 | pub const FilePermissions: ?type = if (@hasDecl(root, "std_options_FilePermissions")) root.std_options_FilePermissions else null; |
| 232 | |
| 233 | /// Overrides `std.Io.Dir.cwd`. |
| 234 | pub const cwd: ?fn () Io.Dir = if (@hasDecl(root, "std_options_cwd")) root.std_options_cwd else null; |
| 235 | }; |
| 236 | |
| 237 | // This forces the start.zig file to be imported, and the comptime logic inside that |
| 238 | // file decides whether to export any appropriate start symbols, and call main. |
| 239 | comptime { |
| 240 | _ = start; |
| 241 | } |
| 242 | |
| 243 | test { |
| 244 | testing.refAllDecls(@This()); |
| 245 | } |
| 246 | |
| 247 | comptime { |
| 248 | debug.assert(@import("std") == @This()); // std lib tests require --zig-lib-dir |
| 249 | } |