From 3285b6d80e9f46e61e65e6927dc60df1b8d4798f Mon Sep 17 00:00:00 2001 From: Francis Bouvier Date: Wed, 19 Jun 2024 23:14:12 +0200 Subject: [PATCH 1/2] Save linenoise header zig translation Signed-off-by: Francis Bouvier --- src/linenoise.zig | 525 ++++++++++++++++++++++++++++++++++++++++++++++ src/shell.zig | 4 +- 2 files changed, 526 insertions(+), 3 deletions(-) create mode 100644 src/linenoise.zig diff --git a/src/linenoise.zig b/src/linenoise.zig new file mode 100644 index 0000000..9a75591 --- /dev/null +++ b/src/linenoise.zig @@ -0,0 +1,525 @@ +pub const __builtin_bswap16 = @import("std").zig.c_builtins.__builtin_bswap16; +pub const __builtin_bswap32 = @import("std").zig.c_builtins.__builtin_bswap32; +pub const __builtin_bswap64 = @import("std").zig.c_builtins.__builtin_bswap64; +pub const __builtin_signbit = @import("std").zig.c_builtins.__builtin_signbit; +pub const __builtin_signbitf = @import("std").zig.c_builtins.__builtin_signbitf; +pub const __builtin_popcount = @import("std").zig.c_builtins.__builtin_popcount; +pub const __builtin_ctz = @import("std").zig.c_builtins.__builtin_ctz; +pub const __builtin_clz = @import("std").zig.c_builtins.__builtin_clz; +pub const __builtin_sqrt = @import("std").zig.c_builtins.__builtin_sqrt; +pub const __builtin_sqrtf = @import("std").zig.c_builtins.__builtin_sqrtf; +pub const __builtin_sin = @import("std").zig.c_builtins.__builtin_sin; +pub const __builtin_sinf = @import("std").zig.c_builtins.__builtin_sinf; +pub const __builtin_cos = @import("std").zig.c_builtins.__builtin_cos; +pub const __builtin_cosf = @import("std").zig.c_builtins.__builtin_cosf; +pub const __builtin_exp = @import("std").zig.c_builtins.__builtin_exp; +pub const __builtin_expf = @import("std").zig.c_builtins.__builtin_expf; +pub const __builtin_exp2 = @import("std").zig.c_builtins.__builtin_exp2; +pub const __builtin_exp2f = @import("std").zig.c_builtins.__builtin_exp2f; +pub const __builtin_log = @import("std").zig.c_builtins.__builtin_log; +pub const __builtin_logf = @import("std").zig.c_builtins.__builtin_logf; +pub const __builtin_log2 = @import("std").zig.c_builtins.__builtin_log2; +pub const __builtin_log2f = @import("std").zig.c_builtins.__builtin_log2f; +pub const __builtin_log10 = @import("std").zig.c_builtins.__builtin_log10; +pub const __builtin_log10f = @import("std").zig.c_builtins.__builtin_log10f; +pub const __builtin_abs = @import("std").zig.c_builtins.__builtin_abs; +pub const __builtin_labs = @import("std").zig.c_builtins.__builtin_labs; +pub const __builtin_llabs = @import("std").zig.c_builtins.__builtin_llabs; +pub const __builtin_fabs = @import("std").zig.c_builtins.__builtin_fabs; +pub const __builtin_fabsf = @import("std").zig.c_builtins.__builtin_fabsf; +pub const __builtin_floor = @import("std").zig.c_builtins.__builtin_floor; +pub const __builtin_floorf = @import("std").zig.c_builtins.__builtin_floorf; +pub const __builtin_ceil = @import("std").zig.c_builtins.__builtin_ceil; +pub const __builtin_ceilf = @import("std").zig.c_builtins.__builtin_ceilf; +pub const __builtin_trunc = @import("std").zig.c_builtins.__builtin_trunc; +pub const __builtin_truncf = @import("std").zig.c_builtins.__builtin_truncf; +pub const __builtin_round = @import("std").zig.c_builtins.__builtin_round; +pub const __builtin_roundf = @import("std").zig.c_builtins.__builtin_roundf; +pub const __builtin_strlen = @import("std").zig.c_builtins.__builtin_strlen; +pub const __builtin_strcmp = @import("std").zig.c_builtins.__builtin_strcmp; +pub const __builtin_object_size = @import("std").zig.c_builtins.__builtin_object_size; +pub const __builtin___memset_chk = @import("std").zig.c_builtins.__builtin___memset_chk; +pub const __builtin_memset = @import("std").zig.c_builtins.__builtin_memset; +pub const __builtin___memcpy_chk = @import("std").zig.c_builtins.__builtin___memcpy_chk; +pub const __builtin_memcpy = @import("std").zig.c_builtins.__builtin_memcpy; +pub const __builtin_expect = @import("std").zig.c_builtins.__builtin_expect; +pub const __builtin_nanf = @import("std").zig.c_builtins.__builtin_nanf; +pub const __builtin_huge_valf = @import("std").zig.c_builtins.__builtin_huge_valf; +pub const __builtin_inff = @import("std").zig.c_builtins.__builtin_inff; +pub const __builtin_isnan = @import("std").zig.c_builtins.__builtin_isnan; +pub const __builtin_isinf = @import("std").zig.c_builtins.__builtin_isinf; +pub const __builtin_isinf_sign = @import("std").zig.c_builtins.__builtin_isinf_sign; +pub const __has_builtin = @import("std").zig.c_builtins.__has_builtin; +pub const __builtin_assume = @import("std").zig.c_builtins.__builtin_assume; +pub const __builtin_unreachable = @import("std").zig.c_builtins.__builtin_unreachable; +pub const __builtin_constant_p = @import("std").zig.c_builtins.__builtin_constant_p; +pub const __builtin_mul_overflow = @import("std").zig.c_builtins.__builtin_mul_overflow; +pub const ptrdiff_t = c_long; +pub const wchar_t = c_int; +pub const max_align_t = c_longdouble; +pub const struct_linenoiseCompletions = extern struct { + len: usize = @import("std").mem.zeroes(usize), + cvec: [*c][*c]u8 = @import("std").mem.zeroes([*c][*c]u8), +}; +pub const linenoiseCompletions = struct_linenoiseCompletions; +pub const linenoiseCompletionCallback = fn ([*c]const u8, [*c]linenoiseCompletions) callconv(.C) void; +pub const linenoiseHintsCallback = fn ([*c]const u8, [*c]c_int, [*c]c_int) callconv(.C) [*c]u8; +pub const linenoiseFreeHintsCallback = fn (?*anyopaque) callconv(.C) void; +pub extern fn linenoiseSetCompletionCallback(?*const linenoiseCompletionCallback) void; +pub extern fn linenoiseSetHintsCallback(?*const linenoiseHintsCallback) void; +pub extern fn linenoiseSetFreeHintsCallback(?*const linenoiseFreeHintsCallback) void; +pub extern fn linenoiseAddCompletion([*c]linenoiseCompletions, [*c]const u8) void; +pub extern fn linenoiseAddHistoryCompletions([*c]const u8, [*c]linenoiseCompletions) void; +pub extern fn linenoise(prompt: [*c]const u8) [*c]u8; +pub extern fn linenoiseFree(ptr: ?*anyopaque) void; +pub extern fn linenoiseHistoryAdd(line: [*c]const u8) c_int; +pub extern fn linenoiseHistorySetMaxLen(len: c_int) c_int; +pub extern fn linenoiseHistoryGetMaxLen() c_int; +pub extern fn linenoiseHistorySave(filename: [*c]const u8) c_int; +pub extern fn linenoiseHistoryLoad(filename: [*c]const u8) c_int; +pub extern fn linenoiseHistoryCopy(dest: [*c][*c]u8, destlen: c_int) c_int; +pub extern fn linenoiseClearScreen() void; +pub extern fn linenoiseSetMultiLine(ml: c_int) void; +pub extern fn linenoisePrintKeyCodes() void; +pub const linenoisePrevCharLen = fn ([*c]const u8, usize, usize, [*c]usize) callconv(.C) usize; +pub const linenoiseNextCharLen = fn ([*c]const u8, usize, usize, [*c]usize) callconv(.C) usize; +pub const linenoiseReadCode = fn (c_int, [*c]u8, usize, [*c]c_int) callconv(.C) usize; +pub extern fn linenoiseSetEncodingFunctions(prevCharLenFunc: ?*const linenoisePrevCharLen, nextCharLenFunc: ?*const linenoiseNextCharLen, readCodeFunc: ?*const linenoiseReadCode) void; +pub const __block = @compileError("unable to translate macro: undefined identifier `__blocks__`"); // (no file):37:9 +pub const __INTMAX_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `L`"); // (no file):92:9 +pub const __UINTMAX_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `UL`"); // (no file):98:9 +pub const __INT64_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `LL`"); // (no file):194:9 +pub const __UINT32_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `U`"); // (no file):216:9 +pub const __UINT64_C_SUFFIX__ = @compileError("unable to translate macro: undefined identifier `ULL`"); // (no file):224:9 +pub const __USER_LABEL_PREFIX__ = @compileError("unable to translate macro: undefined identifier `_`"); // (no file):315:9 +pub const __nonnull = @compileError("unable to translate macro: undefined identifier `_Nonnull`"); // (no file):346:9 +pub const __null_unspecified = @compileError("unable to translate macro: undefined identifier `_Null_unspecified`"); // (no file):347:9 +pub const __nullable = @compileError("unable to translate macro: undefined identifier `_Nullable`"); // (no file):348:9 +pub const __weak = @compileError("unable to translate macro: undefined identifier `objc_gc`"); // (no file):414:9 +pub const offsetof = @compileError("unable to translate C expr: unexpected token 'an identifier'"); // /Users/francis/zig/zig-macos-aarch64-0.12.1/lib/include/stddef.h:116:9 +pub const __llvm__ = @as(c_int, 1); +pub const __clang__ = @as(c_int, 1); +pub const __clang_major__ = @as(c_int, 17); +pub const __clang_minor__ = @as(c_int, 0); +pub const __clang_patchlevel__ = @as(c_int, 6); +pub const __clang_version__ = "17.0.6 (https://github.com/ziglang/zig-bootstrap 4a292e8ac57c58f7a011cbf10602a86180771683)"; +pub const __GNUC__ = @as(c_int, 4); +pub const __GNUC_MINOR__ = @as(c_int, 2); +pub const __GNUC_PATCHLEVEL__ = @as(c_int, 1); +pub const __GXX_ABI_VERSION = @as(c_int, 1002); +pub const __ATOMIC_RELAXED = @as(c_int, 0); +pub const __ATOMIC_CONSUME = @as(c_int, 1); +pub const __ATOMIC_ACQUIRE = @as(c_int, 2); +pub const __ATOMIC_RELEASE = @as(c_int, 3); +pub const __ATOMIC_ACQ_REL = @as(c_int, 4); +pub const __ATOMIC_SEQ_CST = @as(c_int, 5); +pub const __OPENCL_MEMORY_SCOPE_WORK_ITEM = @as(c_int, 0); +pub const __OPENCL_MEMORY_SCOPE_WORK_GROUP = @as(c_int, 1); +pub const __OPENCL_MEMORY_SCOPE_DEVICE = @as(c_int, 2); +pub const __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES = @as(c_int, 3); +pub const __OPENCL_MEMORY_SCOPE_SUB_GROUP = @as(c_int, 4); +pub const __FPCLASS_SNAN = @as(c_int, 0x0001); +pub const __FPCLASS_QNAN = @as(c_int, 0x0002); +pub const __FPCLASS_NEGINF = @as(c_int, 0x0004); +pub const __FPCLASS_NEGNORMAL = @as(c_int, 0x0008); +pub const __FPCLASS_NEGSUBNORMAL = @as(c_int, 0x0010); +pub const __FPCLASS_NEGZERO = @as(c_int, 0x0020); +pub const __FPCLASS_POSZERO = @as(c_int, 0x0040); +pub const __FPCLASS_POSSUBNORMAL = @as(c_int, 0x0080); +pub const __FPCLASS_POSNORMAL = @as(c_int, 0x0100); +pub const __FPCLASS_POSINF = @as(c_int, 0x0200); +pub const __PRAGMA_REDEFINE_EXTNAME = @as(c_int, 1); +pub const __VERSION__ = "Clang 17.0.6 (https://github.com/ziglang/zig-bootstrap 4a292e8ac57c58f7a011cbf10602a86180771683)"; +pub const __OBJC_BOOL_IS_BOOL = @as(c_int, 1); +pub const __CONSTANT_CFSTRINGS__ = @as(c_int, 1); +pub const __BLOCKS__ = @as(c_int, 1); +pub const __clang_literal_encoding__ = "UTF-8"; +pub const __clang_wide_literal_encoding__ = "UTF-32"; +pub const __ORDER_LITTLE_ENDIAN__ = @as(c_int, 1234); +pub const __ORDER_BIG_ENDIAN__ = @as(c_int, 4321); +pub const __ORDER_PDP_ENDIAN__ = @as(c_int, 3412); +pub const __BYTE_ORDER__ = __ORDER_LITTLE_ENDIAN__; +pub const __LITTLE_ENDIAN__ = @as(c_int, 1); +pub const _LP64 = @as(c_int, 1); +pub const __LP64__ = @as(c_int, 1); +pub const __CHAR_BIT__ = @as(c_int, 8); +pub const __BOOL_WIDTH__ = @as(c_int, 8); +pub const __SHRT_WIDTH__ = @as(c_int, 16); +pub const __INT_WIDTH__ = @as(c_int, 32); +pub const __LONG_WIDTH__ = @as(c_int, 64); +pub const __LLONG_WIDTH__ = @as(c_int, 64); +pub const __BITINT_MAXWIDTH__ = @as(c_int, 128); +pub const __SCHAR_MAX__ = @as(c_int, 127); +pub const __SHRT_MAX__ = @as(c_int, 32767); +pub const __INT_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __LONG_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); +pub const __LONG_LONG_MAX__ = @as(c_longlong, 9223372036854775807); +pub const __WCHAR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __WCHAR_WIDTH__ = @as(c_int, 32); +pub const __WINT_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __WINT_WIDTH__ = @as(c_int, 32); +pub const __INTMAX_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); +pub const __INTMAX_WIDTH__ = @as(c_int, 64); +pub const __SIZE_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); +pub const __SIZE_WIDTH__ = @as(c_int, 64); +pub const __UINTMAX_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); +pub const __UINTMAX_WIDTH__ = @as(c_int, 64); +pub const __PTRDIFF_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); +pub const __PTRDIFF_WIDTH__ = @as(c_int, 64); +pub const __INTPTR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_long, 9223372036854775807, .decimal); +pub const __INTPTR_WIDTH__ = @as(c_int, 64); +pub const __UINTPTR_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_ulong, 18446744073709551615, .decimal); +pub const __UINTPTR_WIDTH__ = @as(c_int, 64); +pub const __SIZEOF_DOUBLE__ = @as(c_int, 8); +pub const __SIZEOF_FLOAT__ = @as(c_int, 4); +pub const __SIZEOF_INT__ = @as(c_int, 4); +pub const __SIZEOF_LONG__ = @as(c_int, 8); +pub const __SIZEOF_LONG_DOUBLE__ = @as(c_int, 8); +pub const __SIZEOF_LONG_LONG__ = @as(c_int, 8); +pub const __SIZEOF_POINTER__ = @as(c_int, 8); +pub const __SIZEOF_SHORT__ = @as(c_int, 2); +pub const __SIZEOF_PTRDIFF_T__ = @as(c_int, 8); +pub const __SIZEOF_SIZE_T__ = @as(c_int, 8); +pub const __SIZEOF_WCHAR_T__ = @as(c_int, 4); +pub const __SIZEOF_WINT_T__ = @as(c_int, 4); +pub const __SIZEOF_INT128__ = @as(c_int, 16); +pub const __INTMAX_TYPE__ = c_long; +pub const __INTMAX_FMTd__ = "ld"; +pub const __INTMAX_FMTi__ = "li"; +pub const __UINTMAX_TYPE__ = c_ulong; +pub const __UINTMAX_FMTo__ = "lo"; +pub const __UINTMAX_FMTu__ = "lu"; +pub const __UINTMAX_FMTx__ = "lx"; +pub const __UINTMAX_FMTX__ = "lX"; +pub const __PTRDIFF_TYPE__ = c_long; +pub const __PTRDIFF_FMTd__ = "ld"; +pub const __PTRDIFF_FMTi__ = "li"; +pub const __INTPTR_TYPE__ = c_long; +pub const __INTPTR_FMTd__ = "ld"; +pub const __INTPTR_FMTi__ = "li"; +pub const __SIZE_TYPE__ = c_ulong; +pub const __SIZE_FMTo__ = "lo"; +pub const __SIZE_FMTu__ = "lu"; +pub const __SIZE_FMTx__ = "lx"; +pub const __SIZE_FMTX__ = "lX"; +pub const __WCHAR_TYPE__ = c_int; +pub const __WINT_TYPE__ = c_int; +pub const __SIG_ATOMIC_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __SIG_ATOMIC_WIDTH__ = @as(c_int, 32); +pub const __CHAR16_TYPE__ = c_ushort; +pub const __CHAR32_TYPE__ = c_uint; +pub const __UINTPTR_TYPE__ = c_ulong; +pub const __UINTPTR_FMTo__ = "lo"; +pub const __UINTPTR_FMTu__ = "lu"; +pub const __UINTPTR_FMTx__ = "lx"; +pub const __UINTPTR_FMTX__ = "lX"; +pub const __FLT16_DENORM_MIN__ = @as(f16, 5.9604644775390625e-8); +pub const __FLT16_HAS_DENORM__ = @as(c_int, 1); +pub const __FLT16_DIG__ = @as(c_int, 3); +pub const __FLT16_DECIMAL_DIG__ = @as(c_int, 5); +pub const __FLT16_EPSILON__ = @as(f16, 9.765625e-4); +pub const __FLT16_HAS_INFINITY__ = @as(c_int, 1); +pub const __FLT16_HAS_QUIET_NAN__ = @as(c_int, 1); +pub const __FLT16_MANT_DIG__ = @as(c_int, 11); +pub const __FLT16_MAX_10_EXP__ = @as(c_int, 4); +pub const __FLT16_MAX_EXP__ = @as(c_int, 16); +pub const __FLT16_MAX__ = @as(f16, 6.5504e+4); +pub const __FLT16_MIN_10_EXP__ = -@as(c_int, 4); +pub const __FLT16_MIN_EXP__ = -@as(c_int, 13); +pub const __FLT16_MIN__ = @as(f16, 6.103515625e-5); +pub const __FLT_DENORM_MIN__ = @as(f32, 1.40129846e-45); +pub const __FLT_HAS_DENORM__ = @as(c_int, 1); +pub const __FLT_DIG__ = @as(c_int, 6); +pub const __FLT_DECIMAL_DIG__ = @as(c_int, 9); +pub const __FLT_EPSILON__ = @as(f32, 1.19209290e-7); +pub const __FLT_HAS_INFINITY__ = @as(c_int, 1); +pub const __FLT_HAS_QUIET_NAN__ = @as(c_int, 1); +pub const __FLT_MANT_DIG__ = @as(c_int, 24); +pub const __FLT_MAX_10_EXP__ = @as(c_int, 38); +pub const __FLT_MAX_EXP__ = @as(c_int, 128); +pub const __FLT_MAX__ = @as(f32, 3.40282347e+38); +pub const __FLT_MIN_10_EXP__ = -@as(c_int, 37); +pub const __FLT_MIN_EXP__ = -@as(c_int, 125); +pub const __FLT_MIN__ = @as(f32, 1.17549435e-38); +pub const __DBL_DENORM_MIN__ = @as(f64, 4.9406564584124654e-324); +pub const __DBL_HAS_DENORM__ = @as(c_int, 1); +pub const __DBL_DIG__ = @as(c_int, 15); +pub const __DBL_DECIMAL_DIG__ = @as(c_int, 17); +pub const __DBL_EPSILON__ = @as(f64, 2.2204460492503131e-16); +pub const __DBL_HAS_INFINITY__ = @as(c_int, 1); +pub const __DBL_HAS_QUIET_NAN__ = @as(c_int, 1); +pub const __DBL_MANT_DIG__ = @as(c_int, 53); +pub const __DBL_MAX_10_EXP__ = @as(c_int, 308); +pub const __DBL_MAX_EXP__ = @as(c_int, 1024); +pub const __DBL_MAX__ = @as(f64, 1.7976931348623157e+308); +pub const __DBL_MIN_10_EXP__ = -@as(c_int, 307); +pub const __DBL_MIN_EXP__ = -@as(c_int, 1021); +pub const __DBL_MIN__ = @as(f64, 2.2250738585072014e-308); +pub const __LDBL_DENORM_MIN__ = @as(c_longdouble, 4.9406564584124654e-324); +pub const __LDBL_HAS_DENORM__ = @as(c_int, 1); +pub const __LDBL_DIG__ = @as(c_int, 15); +pub const __LDBL_DECIMAL_DIG__ = @as(c_int, 17); +pub const __LDBL_EPSILON__ = @as(c_longdouble, 2.2204460492503131e-16); +pub const __LDBL_HAS_INFINITY__ = @as(c_int, 1); +pub const __LDBL_HAS_QUIET_NAN__ = @as(c_int, 1); +pub const __LDBL_MANT_DIG__ = @as(c_int, 53); +pub const __LDBL_MAX_10_EXP__ = @as(c_int, 308); +pub const __LDBL_MAX_EXP__ = @as(c_int, 1024); +pub const __LDBL_MAX__ = @as(c_longdouble, 1.7976931348623157e+308); +pub const __LDBL_MIN_10_EXP__ = -@as(c_int, 307); +pub const __LDBL_MIN_EXP__ = -@as(c_int, 1021); +pub const __LDBL_MIN__ = @as(c_longdouble, 2.2250738585072014e-308); +pub const __POINTER_WIDTH__ = @as(c_int, 64); +pub const __BIGGEST_ALIGNMENT__ = @as(c_int, 8); +pub const __INT8_TYPE__ = i8; +pub const __INT8_FMTd__ = "hhd"; +pub const __INT8_FMTi__ = "hhi"; +pub const __INT8_C_SUFFIX__ = ""; +pub const __INT16_TYPE__ = c_short; +pub const __INT16_FMTd__ = "hd"; +pub const __INT16_FMTi__ = "hi"; +pub const __INT16_C_SUFFIX__ = ""; +pub const __INT32_TYPE__ = c_int; +pub const __INT32_FMTd__ = "d"; +pub const __INT32_FMTi__ = "i"; +pub const __INT32_C_SUFFIX__ = ""; +pub const __INT64_TYPE__ = c_longlong; +pub const __INT64_FMTd__ = "lld"; +pub const __INT64_FMTi__ = "lli"; +pub const __UINT8_TYPE__ = u8; +pub const __UINT8_FMTo__ = "hho"; +pub const __UINT8_FMTu__ = "hhu"; +pub const __UINT8_FMTx__ = "hhx"; +pub const __UINT8_FMTX__ = "hhX"; +pub const __UINT8_C_SUFFIX__ = ""; +pub const __UINT8_MAX__ = @as(c_int, 255); +pub const __INT8_MAX__ = @as(c_int, 127); +pub const __UINT16_TYPE__ = c_ushort; +pub const __UINT16_FMTo__ = "ho"; +pub const __UINT16_FMTu__ = "hu"; +pub const __UINT16_FMTx__ = "hx"; +pub const __UINT16_FMTX__ = "hX"; +pub const __UINT16_C_SUFFIX__ = ""; +pub const __UINT16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); +pub const __INT16_MAX__ = @as(c_int, 32767); +pub const __UINT32_TYPE__ = c_uint; +pub const __UINT32_FMTo__ = "o"; +pub const __UINT32_FMTu__ = "u"; +pub const __UINT32_FMTx__ = "x"; +pub const __UINT32_FMTX__ = "X"; +pub const __UINT32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); +pub const __INT32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __UINT64_TYPE__ = c_ulonglong; +pub const __UINT64_FMTo__ = "llo"; +pub const __UINT64_FMTu__ = "llu"; +pub const __UINT64_FMTx__ = "llx"; +pub const __UINT64_FMTX__ = "llX"; +pub const __UINT64_MAX__ = @as(c_ulonglong, 18446744073709551615); +pub const __INT64_MAX__ = @as(c_longlong, 9223372036854775807); +pub const __INT_LEAST8_TYPE__ = i8; +pub const __INT_LEAST8_MAX__ = @as(c_int, 127); +pub const __INT_LEAST8_WIDTH__ = @as(c_int, 8); +pub const __INT_LEAST8_FMTd__ = "hhd"; +pub const __INT_LEAST8_FMTi__ = "hhi"; +pub const __UINT_LEAST8_TYPE__ = u8; +pub const __UINT_LEAST8_MAX__ = @as(c_int, 255); +pub const __UINT_LEAST8_FMTo__ = "hho"; +pub const __UINT_LEAST8_FMTu__ = "hhu"; +pub const __UINT_LEAST8_FMTx__ = "hhx"; +pub const __UINT_LEAST8_FMTX__ = "hhX"; +pub const __INT_LEAST16_TYPE__ = c_short; +pub const __INT_LEAST16_MAX__ = @as(c_int, 32767); +pub const __INT_LEAST16_WIDTH__ = @as(c_int, 16); +pub const __INT_LEAST16_FMTd__ = "hd"; +pub const __INT_LEAST16_FMTi__ = "hi"; +pub const __UINT_LEAST16_TYPE__ = c_ushort; +pub const __UINT_LEAST16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); +pub const __UINT_LEAST16_FMTo__ = "ho"; +pub const __UINT_LEAST16_FMTu__ = "hu"; +pub const __UINT_LEAST16_FMTx__ = "hx"; +pub const __UINT_LEAST16_FMTX__ = "hX"; +pub const __INT_LEAST32_TYPE__ = c_int; +pub const __INT_LEAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __INT_LEAST32_WIDTH__ = @as(c_int, 32); +pub const __INT_LEAST32_FMTd__ = "d"; +pub const __INT_LEAST32_FMTi__ = "i"; +pub const __UINT_LEAST32_TYPE__ = c_uint; +pub const __UINT_LEAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); +pub const __UINT_LEAST32_FMTo__ = "o"; +pub const __UINT_LEAST32_FMTu__ = "u"; +pub const __UINT_LEAST32_FMTx__ = "x"; +pub const __UINT_LEAST32_FMTX__ = "X"; +pub const __INT_LEAST64_TYPE__ = c_longlong; +pub const __INT_LEAST64_MAX__ = @as(c_longlong, 9223372036854775807); +pub const __INT_LEAST64_WIDTH__ = @as(c_int, 64); +pub const __INT_LEAST64_FMTd__ = "lld"; +pub const __INT_LEAST64_FMTi__ = "lli"; +pub const __UINT_LEAST64_TYPE__ = c_ulonglong; +pub const __UINT_LEAST64_MAX__ = @as(c_ulonglong, 18446744073709551615); +pub const __UINT_LEAST64_FMTo__ = "llo"; +pub const __UINT_LEAST64_FMTu__ = "llu"; +pub const __UINT_LEAST64_FMTx__ = "llx"; +pub const __UINT_LEAST64_FMTX__ = "llX"; +pub const __INT_FAST8_TYPE__ = i8; +pub const __INT_FAST8_MAX__ = @as(c_int, 127); +pub const __INT_FAST8_WIDTH__ = @as(c_int, 8); +pub const __INT_FAST8_FMTd__ = "hhd"; +pub const __INT_FAST8_FMTi__ = "hhi"; +pub const __UINT_FAST8_TYPE__ = u8; +pub const __UINT_FAST8_MAX__ = @as(c_int, 255); +pub const __UINT_FAST8_FMTo__ = "hho"; +pub const __UINT_FAST8_FMTu__ = "hhu"; +pub const __UINT_FAST8_FMTx__ = "hhx"; +pub const __UINT_FAST8_FMTX__ = "hhX"; +pub const __INT_FAST16_TYPE__ = c_short; +pub const __INT_FAST16_MAX__ = @as(c_int, 32767); +pub const __INT_FAST16_WIDTH__ = @as(c_int, 16); +pub const __INT_FAST16_FMTd__ = "hd"; +pub const __INT_FAST16_FMTi__ = "hi"; +pub const __UINT_FAST16_TYPE__ = c_ushort; +pub const __UINT_FAST16_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 65535, .decimal); +pub const __UINT_FAST16_FMTo__ = "ho"; +pub const __UINT_FAST16_FMTu__ = "hu"; +pub const __UINT_FAST16_FMTx__ = "hx"; +pub const __UINT_FAST16_FMTX__ = "hX"; +pub const __INT_FAST32_TYPE__ = c_int; +pub const __INT_FAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 2147483647, .decimal); +pub const __INT_FAST32_WIDTH__ = @as(c_int, 32); +pub const __INT_FAST32_FMTd__ = "d"; +pub const __INT_FAST32_FMTi__ = "i"; +pub const __UINT_FAST32_TYPE__ = c_uint; +pub const __UINT_FAST32_MAX__ = @import("std").zig.c_translation.promoteIntLiteral(c_uint, 4294967295, .decimal); +pub const __UINT_FAST32_FMTo__ = "o"; +pub const __UINT_FAST32_FMTu__ = "u"; +pub const __UINT_FAST32_FMTx__ = "x"; +pub const __UINT_FAST32_FMTX__ = "X"; +pub const __INT_FAST64_TYPE__ = c_longlong; +pub const __INT_FAST64_MAX__ = @as(c_longlong, 9223372036854775807); +pub const __INT_FAST64_WIDTH__ = @as(c_int, 64); +pub const __INT_FAST64_FMTd__ = "lld"; +pub const __INT_FAST64_FMTi__ = "lli"; +pub const __UINT_FAST64_TYPE__ = c_ulonglong; +pub const __UINT_FAST64_MAX__ = @as(c_ulonglong, 18446744073709551615); +pub const __UINT_FAST64_FMTo__ = "llo"; +pub const __UINT_FAST64_FMTu__ = "llu"; +pub const __UINT_FAST64_FMTx__ = "llx"; +pub const __UINT_FAST64_FMTX__ = "llX"; +pub const __NO_MATH_ERRNO__ = @as(c_int, 1); +pub const __FINITE_MATH_ONLY__ = @as(c_int, 0); +pub const __GNUC_STDC_INLINE__ = @as(c_int, 1); +pub const __GCC_ATOMIC_TEST_AND_SET_TRUEVAL = @as(c_int, 1); +pub const __CLANG_ATOMIC_BOOL_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_CHAR_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_CHAR16_T_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_CHAR32_T_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_WCHAR_T_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_SHORT_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_INT_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_LONG_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_LLONG_LOCK_FREE = @as(c_int, 2); +pub const __CLANG_ATOMIC_POINTER_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_BOOL_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_CHAR_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_CHAR16_T_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_CHAR32_T_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_WCHAR_T_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_SHORT_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_INT_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_LONG_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_LLONG_LOCK_FREE = @as(c_int, 2); +pub const __GCC_ATOMIC_POINTER_LOCK_FREE = @as(c_int, 2); +pub const __NO_INLINE__ = @as(c_int, 1); +pub const __PIC__ = @as(c_int, 2); +pub const __pic__ = @as(c_int, 2); +pub const __FLT_RADIX__ = @as(c_int, 2); +pub const __DECIMAL_DIG__ = __LDBL_DECIMAL_DIG__; +pub const __SSP_STRONG__ = @as(c_int, 2); +pub const __AARCH64EL__ = @as(c_int, 1); +pub const __aarch64__ = @as(c_int, 1); +pub const __GCC_ASM_FLAG_OUTPUTS__ = @as(c_int, 1); +pub const __AARCH64_CMODEL_SMALL__ = @as(c_int, 1); +pub const __ARM_ACLE = @as(c_int, 200); +pub const __ARM_ARCH = @as(c_int, 8); +pub const __ARM_ARCH_PROFILE = 'A'; +pub const __ARM_64BIT_STATE = @as(c_int, 1); +pub const __ARM_PCS_AAPCS64 = @as(c_int, 1); +pub const __ARM_ARCH_ISA_A64 = @as(c_int, 1); +pub const __ARM_FEATURE_CLZ = @as(c_int, 1); +pub const __ARM_FEATURE_FMA = @as(c_int, 1); +pub const __ARM_FEATURE_LDREX = @as(c_int, 0xF); +pub const __ARM_FEATURE_IDIV = @as(c_int, 1); +pub const __ARM_FEATURE_DIV = @as(c_int, 1); +pub const __ARM_FEATURE_NUMERIC_MAXMIN = @as(c_int, 1); +pub const __ARM_FEATURE_DIRECTED_ROUNDING = @as(c_int, 1); +pub const __ARM_ALIGN_MAX_STACK_PWR = @as(c_int, 4); +pub const __ARM_FP = @as(c_int, 0xE); +pub const __ARM_FP16_FORMAT_IEEE = @as(c_int, 1); +pub const __ARM_FP16_ARGS = @as(c_int, 1); +pub const __ARM_SIZEOF_WCHAR_T = @as(c_int, 4); +pub const __ARM_SIZEOF_MINIMAL_ENUM = @as(c_int, 4); +pub const __ARM_NEON = @as(c_int, 1); +pub const __ARM_NEON_FP = @as(c_int, 0xE); +pub const __ARM_FEATURE_CRC32 = @as(c_int, 1); +pub const __ARM_FEATURE_RCPC = @as(c_int, 1); +pub const __ARM_FEATURE_CRYPTO = @as(c_int, 1); +pub const __ARM_FEATURE_AES = @as(c_int, 1); +pub const __ARM_FEATURE_SHA2 = @as(c_int, 1); +pub const __ARM_FEATURE_SHA3 = @as(c_int, 1); +pub const __ARM_FEATURE_SHA512 = @as(c_int, 1); +pub const __ARM_FEATURE_PAUTH = @as(c_int, 1); +pub const __ARM_FEATURE_UNALIGNED = @as(c_int, 1); +pub const __ARM_FEATURE_FP16_VECTOR_ARITHMETIC = @as(c_int, 1); +pub const __ARM_FEATURE_FP16_SCALAR_ARITHMETIC = @as(c_int, 1); +pub const __ARM_FEATURE_DOTPROD = @as(c_int, 1); +pub const __ARM_FEATURE_MATMUL_INT8 = @as(c_int, 1); +pub const __ARM_FEATURE_ATOMICS = @as(c_int, 1); +pub const __ARM_FEATURE_BF16 = @as(c_int, 1); +pub const __ARM_FEATURE_BF16_VECTOR_ARITHMETIC = @as(c_int, 1); +pub const __ARM_BF16_FORMAT_ALTERNATIVE = @as(c_int, 1); +pub const __ARM_FEATURE_BF16_SCALAR_ARITHMETIC = @as(c_int, 1); +pub const __ARM_FEATURE_FP16_FML = @as(c_int, 1); +pub const __ARM_FEATURE_FRINT = @as(c_int, 1); +pub const __ARM_FEATURE_BTI = @as(c_int, 1); +pub const __ARM_FEATURE_COMPLEX = @as(c_int, 1); +pub const __ARM_FEATURE_JCVT = @as(c_int, 1); +pub const __ARM_FEATURE_QRDMX = @as(c_int, 1); +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = @as(c_int, 1); +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = @as(c_int, 1); +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = @as(c_int, 1); +pub const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = @as(c_int, 1); +pub const __FP_FAST_FMA = @as(c_int, 1); +pub const __FP_FAST_FMAF = @as(c_int, 1); +pub const __AARCH64_SIMD__ = @as(c_int, 1); +pub const __ARM64_ARCH_8__ = @as(c_int, 1); +pub const __ARM_NEON__ = @as(c_int, 1); +pub const __REGISTER_PREFIX__ = ""; +pub const __arm64 = @as(c_int, 1); +pub const __arm64__ = @as(c_int, 1); +pub const __APPLE_CC__ = @as(c_int, 6000); +pub const __APPLE__ = @as(c_int, 1); +pub const __STDC_NO_THREADS__ = @as(c_int, 1); +pub const __strong = ""; +pub const __unsafe_unretained = ""; +pub const __DYNAMIC__ = @as(c_int, 1); +pub const __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 140500, .decimal); +pub const __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ = @import("std").zig.c_translation.promoteIntLiteral(c_int, 140500, .decimal); +pub const __MACH__ = @as(c_int, 1); +pub const __STDC__ = @as(c_int, 1); +pub const __STDC_HOSTED__ = @as(c_int, 1); +pub const __STDC_VERSION__ = @as(c_long, 201710); +pub const __STDC_UTF_16__ = @as(c_int, 1); +pub const __STDC_UTF_32__ = @as(c_int, 1); +pub const _DEBUG = @as(c_int, 1); +pub const __GCC_HAVE_DWARF2_CFI_ASM = @as(c_int, 1); +pub const __LINENOISE_H = ""; +pub const __STDDEF_H = ""; +pub const __need_ptrdiff_t = ""; +pub const __need_size_t = ""; +pub const __need_wchar_t = ""; +pub const __need_NULL = ""; +pub const __need_STDDEF_H_misc = ""; +pub const _PTRDIFF_T = ""; +pub const _SIZE_T = ""; +pub const _WCHAR_T = ""; +pub const NULL = @import("std").zig.c_translation.cast(?*anyopaque, @as(c_int, 0)); +pub const __CLANG_MAX_ALIGN_T_DEFINED = ""; diff --git a/src/shell.zig b/src/shell.zig index a38bca8..ca3c9ba 100644 --- a/src/shell.zig +++ b/src/shell.zig @@ -15,9 +15,7 @@ const std = @import("std"); const builtin = @import("builtin"); -const c = @cImport({ - @cInclude("linenoise.h"); -}); +const c = @import("linenoise.zig"); const public = @import("api.zig"); From 11d7a68036045720532abe63731276f933b78dd2 Mon Sep 17 00:00:00 2001 From: Francis Bouvier Date: Mon, 8 Jul 2024 17:51:09 +0200 Subject: [PATCH 2/2] Remove unecessary include path for linenoise header Now that lineoise zig translate-c is saved in the repo. Signed-off-by: Francis Bouvier --- build.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/build.zig b/build.zig index d39db3c..e965c5f 100644 --- a/build.zig +++ b/build.zig @@ -217,7 +217,6 @@ pub fn packages(comptime vendor_path: []const u8) type { } pub fn add_shell(step: *std.Build.Step.Compile) !void { - step.addIncludePath(step.root_module.owner.path(vendor ++ "/linenoise-mob")); const lib = step.step.owner.addStaticLibrary(.{ .name = "linenoise", .target = step.root_module.resolved_target.?,