From 85bc7b9b1072bacba424e2c56d6c135b5355399f Mon Sep 17 00:00:00 2001 From: Vaishnav Sabari Girish Date: Fri, 26 Jun 2026 22:52:22 +0530 Subject: [PATCH 1/5] feat(http): implement memory-safe synchronous HTTP client Introduces the `ns_http` module, wrapping Rust's `reqwest` crate to provide a modern, synchronous HTTP API to C without the complexity and callback management of `libcurl`. Key additions: - Implemented `ns_http_get` and `ns_http_post` for standard web requests. - Added `ns_http_response` struct to cleanly capture HTTP status codes and pack the response body directly into memory-safe SSO `ns_string` structs. - Introduced the `ns_autohttp` macro, leveraging the GCC/Clang cleanup attribute to provide RAII, automatically freeing HTTP response buffers when they fall out of scope. - Created `18_http.c` example demonstrating fetching data and pushing JSON payloads. - Registered `ns_http` crate in the workspace and added `reqwest` dependency. Signed-off-by: Vaishnav Sabari Girish --- ...b@clang@22@include@__stddef_header_macro.h | 12 + ...ng@22@include@__stddef_header_macro.h.blob | Bin 0 -> 1121 bytes ...ib@clang@22@include@__stddef_max_align_t.h | 27 + ...ang@22@include@__stddef_max_align_t.h.blob | Bin 0 -> 1651 bytes .../@usr@lib@clang@22@include@__stddef_null.h | 29 + ...@lib@clang@22@include@__stddef_null.h.blob | Bin 0 -> 1160 bytes ...@lib@clang@22@include@__stddef_nullptr_t.h | 29 + ...clang@22@include@__stddef_nullptr_t.h.blob | Bin 0 -> 969 bytes ...r@lib@clang@22@include@__stddef_offsetof.h | 17 + ...@clang@22@include@__stddef_offsetof.h.blob | Bin 0 -> 1208 bytes ...@lib@clang@22@include@__stddef_ptrdiff_t.h | 20 + ...clang@22@include@__stddef_ptrdiff_t.h.blob | Bin 0 -> 1267 bytes ...usr@lib@clang@22@include@__stddef_size_t.h | 20 + ...ib@clang@22@include@__stddef_size_t.h.blob | Bin 0 -> 1270 bytes ...sr@lib@clang@22@include@__stddef_wchar_t.h | 28 + ...b@clang@22@include@__stddef_wchar_t.h.blob | Bin 0 -> 1266 bytes .../@usr@lib@clang@22@include@stdbool.h | 39 + .../@usr@lib@clang@22@include@stdbool.h.blob | Bin 0 -> 1461 bytes .../@usr@lib@clang@22@include@stddef.h | 139 ++ .../@usr@lib@clang@22@include@stddef.h.blob | Bin 0 -> 1986 bytes .../examples@18_http.c | 46 + .../examples@18_http.c.blob | Bin 0 -> 6790 bytes .../include@ns.h | 8 + .../include@ns.h.blob | Bin 0 -> 1308 bytes .../include@ns_error.h | 40 + .../include@ns_error.h.blob | Bin 0 -> 2219 bytes .../include@ns_http.h | 47 + .../include@ns_http.h.blob | Bin 0 -> 3024 bytes .../include@ns_print.h | 145 ++ .../include@ns_print.h.blob | Bin 0 -> 11818 bytes .../include@ns_read.h | 33 + .../include@ns_read.h.blob | Bin 0 -> 2241 bytes .../include@ns_string.h | 51 + .../include@ns_string.h.blob | Bin 0 -> 3803 bytes Cargo.lock | 1755 ++++++++++++++++- Cargo.toml | 7 +- Makefile | 5 +- ROADMAP.md | 22 +- crates/ns_http/Cargo.toml | 13 + crates/ns_http/src/lib.rs | 120 ++ examples/18_http.c | 46 + include/ns_http.h | 47 + 42 files changed, 2690 insertions(+), 55 deletions(-) create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h.blob create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stddef.h create mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stddef.h.blob create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c.blob create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h.blob create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h.blob create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_http.h create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_http.h.blob create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h.blob create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h.blob create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h create mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h.blob create mode 100644 crates/ns_http/Cargo.toml create mode 100644 crates/ns_http/src/lib.rs create mode 100644 examples/18_http.c create mode 100644 include/ns_http.h diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h new file mode 100644 index 0000000..db5fb3c --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h @@ -0,0 +1,12 @@ +/*===---- __stddef_header_macro.h ------------------------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __STDDEF_H +#define __STDDEF_H +#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..3768c95aedbfafca7053fbb3b8c58652ed8b4878 GIT binary patch literal 1121 zcmb`G%}N6?5XZBMARfencNISlLOa-#7e%2;5fq``L%KV=8=EFel75LkfUi{W=o7Th z(1Qoho~+p|+FqoeIV3O)zxmHUGsoonvwGAc9)VcZ5E_h|Sh5Bb(NwKU;I>WgwR%L~ z8o0xjE!zO3dyRXs#cGK_11G06wl>N8WYrf;MoWU_no3u>jB)|jPJq(wvpH0fO{g0U zf>$6D2ZaJ~>5F=RK&k5^z>pgLgw*Eap&fHn`6Wt26U}9YTHkx=PEotYT9gSM$uR+w z6{|2bXjQlz&8W4~DeCJj>MqoN3c2aq#UNB83sTa>;ZznTRtG!`r!mldctt7kXWL|_ zWnGNYXWx>s$uQQ9MwFI5e~lM(C|fv3>hzy`{}0)4yk}^(>Bmfud?fC8gA%TN?7Vj_ iDJ?$~i&xjQx)u;0S literal 0 HcmV?d00001 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h new file mode 100644 index 0000000..512606a --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h @@ -0,0 +1,27 @@ +/*===---- __stddef_max_align_t.h - Definition of max_align_t ---------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __CLANG_MAX_ALIGN_T_DEFINED +#define __CLANG_MAX_ALIGN_T_DEFINED + +#if defined(_MSC_VER) +typedef double max_align_t; +#elif defined(__APPLE__) +typedef long double max_align_t; +#else +// Define 'max_align_t' to match the GCC definition. +typedef struct { + long long __clang_max_align_nonce1 + __attribute__((__aligned__(__alignof__(long long)))); + long double __clang_max_align_nonce2 + __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +#endif + +#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..d64aa69c9f3e53ed2605be012514e6738143f643 GIT binary patch literal 1651 zcmb`H&ubGw6vtX_KNy z6-ECV!Gk}JYCY(sy?bi#B%Y*)#yGoeekhHkN%t@hcHey7_kG{&#KG?$l?z)y0nlPq z3|BScSX5huS?p8g=P<5o$Bjbg*FN(NxErGwz~x-j_GWaJk=z z3%S)2lR*%d193?=&W~h9O>l#l=D;k5&RkBs#F*W)ZD?ZeaL~HlPoHSUj*vqxyQQx` zvnF)N`{N|(P3z&-@Z+*~z7Nstnr>;l?;}u-gHR9z+S>~F=TSNz!imTEtDoP3_QnBU zveUt<-Hd3ly&Zi)|ZbbUu8wJh9%?x z6@Mw3n>#&@qF5j{BNc(zjO$ge?_E!Wzvq|DXjwH_y=3FTs*8&Vc~_LYhq~rS$8?+m z)2WL9DACzyq3sJO(SVHG%2doP(rw#=dP{$|7>Zl~r;;u*G99_;A|nAAH};XwpIrL6 z8~?VBP^OSB=Fm#|K1vtzxgxrUvP;YP;!;*tzI@J`23G%@rUXO5WuLc#j_bo8V8u|y literal 0 HcmV?d00001 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h new file mode 100644 index 0000000..c10bd2d --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h @@ -0,0 +1,29 @@ +/*===---- __stddef_null.h - Definition of NULL -----------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#if !defined(NULL) || !__building_module(_Builtin_stddef) + +/* linux/stddef.h will define NULL to 0. glibc (and other) headers then define + * __need_NULL and rely on stddef.h to redefine NULL to the correct value again. + * Modules don't support redefining macros like that, but support that pattern + * in the non-modules case. + */ +#undef NULL + +#ifdef __cplusplus +#if !defined(__MINGW32__) && !defined(_MSC_VER) +#define NULL __null +#else +#define NULL 0 +#endif +#else +#define NULL ((void*)0) +#endif + +#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..6f520e6bf7d86576489aac7800911f3f4b4f13ed GIT binary patch literal 1160 zcmb_bzfS@&6z-uh;9!gsOk#`%NVqDK3x>hTAR#f1rYU#5yUNj?ZTV$%aP(jBPcbp> zCQdLpIWamoIf*@p;9@|aLtmTpef{3|zLx=C@73KdFaY#;jlc$`(qp&*kBF=)9>9|} zDhqx=EG1!ywA87xA=6RnNLsiS_(a0}1LP?cm=;*Fe9YVhfn}RqR4H?_HWiux7w!BE zEWsMAO96dafdg_dmxGj9e%&SzAzg<}9OMyf6M<^j65RBLqD+w{=@mh0l<4_AiAx`hcc23@5xlE!Ks}|@1+4S66=Y0B-~BV ZH}uo~+kN!;_VwjMpGV7xnXz)g_y!mIu#W%$ literal 0 HcmV?d00001 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h new file mode 100644 index 0000000..7f3fbe6 --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h @@ -0,0 +1,29 @@ +/*===---- __stddef_nullptr_t.h - Definition of nullptr_t -------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_NULLPTR_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _NULLPTR_T + +#ifdef __cplusplus +#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) +namespace std { +typedef decltype(nullptr) nullptr_t; +} +using ::std::nullptr_t; +#endif +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +typedef typeof(nullptr) nullptr_t; +#endif + +#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..e67756cf37c8ee4eac7692bca01aeda1bd33420e GIT binary patch literal 969 zcmb_aze@u#6wXx#(Q*|L6erQ*U^xTbl@_`PwN$Nh$lc}c(q5C2q`%x8-JApk7yl3c z0ilylPWlfxIJxMVws3XQ)|w&jk-RV8_q~^G@cCNXdISc50k0F-!c+zfw_t(Dn&J(3 z&_!jztHe0kjirGO!|;XpFXW@9@DX>%^|&`>t2V@GgpZqTVQV3M8^ zq$U8=aR=d$`fMT;_dH1y_hO={21tb9qW{$Uo&PX~$%Yax^}KNu>u%bdhq2Dz8_$~I zsC+70QVIQ6`qX>p!4JNM6Q4k0+X=83xd(|Qu##K_Ye@iRqO05d#?7U9fl4REV!3jJ zDgc1xP5q}RBkSK!jnrZ)ofzyOGIUk+d_8x6_SAdRdAtlWXWBUyJe literal 0 HcmV?d00001 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h new file mode 100644 index 0000000..84172c6 --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h @@ -0,0 +1,17 @@ +/*===---- __stddef_offsetof.h - Definition of offsetof ---------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(offsetof) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define offsetof(t, d) __builtin_offsetof(t, d) +#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..539aeaf963e164a5c9f41a6b64285931845cb45f GIT binary patch literal 1208 zcmb_byH3L}6m?)h3~9v|6!8!sz@ifis7Ndzfk5n7ZsH`St{vI#3(6NetyP39Q0}j}R2l+8 z*0zRV32azW5;B^HZE`T1g_Jw2BA)+3J7+IL`CdKu^#-2(#JDJ&k53<2ZKwP z5a9}ilJYjx)NH-gN9`i6BFw1I$3=ihDP-Ks=e^$=Lg;QUG06U#9t{LZ<4KH^Tj)!V zP)nD3-XAr3+HOqG3&A?R^}N`b4_;#3>m%8$wDH-GOK&%V5fy5GI)ilgcJb7EVtz+_ zfMzRBfMr)lVAf=Gbz8rAoKX$od5UP^nPhs-d>zV3Cdn=7)r`BGK`39MOjC~j9{^yb x(y7cuyq|)|G7!WhPuuf3>jxbD!l?iN literal 0 HcmV?d00001 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h new file mode 100644 index 0000000..fd3c893 --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h @@ -0,0 +1,20 @@ +/*===---- __stddef_ptrdiff_t.h - Definition of ptrdiff_t -------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_PTRDIFF_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _PTRDIFF_T + +typedef __PTRDIFF_TYPE__ ptrdiff_t; + +#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..32d638fc83518f98c8a26b3eeaaf128b2a6b5961 GIT binary patch literal 1267 zcmdO5`1dYb?Fs`UgMLPSZmND+VrFqhUSgTPOKNd;Nq&L8Z)JQyQGQlxa!IkiUus23 za7l`O9*`~u(y0}Rxdl0?#rlR8@fjs01$xO0%*i>4dFfO#Ot(D0C_6JRT{k7O2Usfj76Me(_b$wm2k z8IV9BLR)cWRcd?*Tm$Jr2y;kYaeP5hW**om4#nEbMA)61SP`F?lbN1}3)z##?7U!OR5FjC>A!NkDV60&^T6p8e~ID#yjA;=l+1 DOl!>O literal 0 HcmV?d00001 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h new file mode 100644 index 0000000..3dd7b1f --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h @@ -0,0 +1,20 @@ +/*===---- __stddef_size_t.h - Definition of size_t -------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_SIZE_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _SIZE_T + +typedef __SIZE_TYPE__ size_t; + +#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..08e0ce3739858fa0706a9f25f7d644e6a91f05a7 GIT binary patch literal 1270 zcmb_bzfT)66tc%D0Ue@%MW!rNK?13%0D-6&x>(Mg@6L&1pKJ$`svYRY zzrer1$Wm46KTtuJWa`u|j0{Lf3~jG=P=GEF2p;_8AMbnbeeZjD@b{$tvI`(UiEL1` zMVL+m*+Pp{*NsfkN*k{!S)+l`XqC3ih6$0dR$EJ3q>*x}(Od~9#-y_W7!5cP@dJU) zY)e&VBAyAEvI$7lp1((yz(Y-~5NB1?OAZx_h>3tVLy9oAb%Zp+2_+#_xIqFXXOjz3 z?h&hxD>P0O6UIS}z4+J}AcF>JVZvD~aL>ziWdJW3MVcBJJxtD2DXARP`PaBJRQV3% z&9NB{1S{JWhg6;(h{DvUkVVlT1lqP&rR0~i-L4SP_WfVO@?Hs zH+B~3%khUBbMI~2PeBt%{D2mpXt{&2s2_Pw}f+9|aolWPiX)k?!0mm3uV3&>BhUwa$$A3t8@l~bcAzV#&z^p&xl?~Zf5Oj~VfMPaJm2};-NYM}cT4!K zefB186eeiy@(PYmj6Wag?I3fQ+0VVPZ#zGZPWx!iLa*#qEn;n*FZ??CQ~Cexu{TwQ F{{Ysn&U63( literal 0 HcmV?d00001 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h new file mode 100644 index 0000000..bd69f63 --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h @@ -0,0 +1,28 @@ +/*===---- __stddef_wchar.h - Definition of wchar_t -------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#if !defined(__cplusplus) || (defined(_MSC_VER) && !_NATIVE_WCHAR_T_DEFINED) + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_WCHAR_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _WCHAR_T + +#ifdef _MSC_EXTENSIONS +#define _WCHAR_T_DEFINED +#endif + +typedef __WCHAR_TYPE__ wchar_t; + +#endif + +#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..2b0628590b8af3196e1ef75c8a23cc4dcb56eb9e GIT binary patch literal 1266 zcmb`GPfHvz7{(LzAVp+EWcIkC^&q-IPo-5^sRu16{wa72*_q5t+}UJEvbtLo^w_UZ z@Ei2lQ;T0f^rR5uEohvM??dtFVa>6)x5*zATE5s5X( zWV!)>ZqA)(gD!91S9ttq>z59m7XNFJtX@2~6c+Xuh#>c`pXW&GLf zI|GK!IL$V`!5*h4+g6)FYN_ezx6b{Ylf$bz&qnCvoq}PmEydGkhc|Oi_ue>zd3Xoj C!Oa~2 literal 0 HcmV?d00001 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h new file mode 100644 index 0000000..dfaad2b --- /dev/null +++ b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h @@ -0,0 +1,39 @@ +/*===---- stdbool.h - Standard header for booleans -------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __STDBOOL_H +#define __STDBOOL_H + +#define __bool_true_false_are_defined 1 + +#if defined(__MVS__) && __has_include_next() +#include_next +#else + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L +/* FIXME: We should be issuing a deprecation warning here, but cannot yet due + * to system headers which include this header file unconditionally. + */ +#elif !defined(__cplusplus) +#define bool _Bool +#define true 1 +#define false 0 +#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) +/* Define _Bool as a GNU extension. */ +#define _Bool bool +#if defined(__cplusplus) && __cplusplus < 201103L +/* For C++98, define bool, false, true as a GNU extension. */ +#define bool bool +#define false false +#define true true +#endif +#endif + +#endif /* __MVS__ */ +#endif /* __STDBOOL_H */ diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..bc6cdcffb16c80c5eb9f63cb80b5067d2806b58c GIT binary patch literal 1461 zcmb`G&ubGw6vt;1#Il62Mlfj+jl}jKwA1EP3Q7q*NYS*=g5YJG?9TpZHZx&n(x#;a zul}ImT@T_({0|f_^&p;G@gI;}1jU=Dt}~mT7j4>R4sU+&-sgSao0(hS_-A$M2p9nR ztVZA_4untfCR`$-Dp?)g-$tvPZ4g@uSSC%mCLKuCEYwVzxKWv6Cy~TJnpx(3-a3z58?b~Ni3DU43I1GadjK#rX5eC!_8xDa8sX83uBA;M~a8$!K zXET1gDMN&bV22>t3pjlXyF#cybso?dHFjg~aERPB+(bAGJUSrYZ}dB(%K-B15@E*$ZDkJUqUfRO{X_GNnvq(TMiHNA|*}N4De* zjT`IY^gchQXgMpFOK5wwLwnJBxAEZ8w_=5{a4) +#undef __need_ptrdiff_t +#undef __need_size_t +#undef __need_rsize_t +#undef __need_wchar_t +#undef __need_NULL +#undef __need_nullptr_t +#undef __need_unreachable +#undef __need_max_align_t +#undef __need_offsetof +#undef __need_wint_t +#include <__stddef_header_macro.h> +#include_next + +#else + +#if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \ + !defined(__need_rsize_t) && !defined(__need_wchar_t) && \ + !defined(__need_NULL) && !defined(__need_nullptr_t) && \ + !defined(__need_unreachable) && !defined(__need_max_align_t) && \ + !defined(__need_offsetof) && !defined(__need_wint_t) +#define __need_ptrdiff_t +#define __need_size_t +/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is + * enabled. */ +#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 +#define __need_rsize_t +#endif +#define __need_wchar_t +#if !defined(__STDDEF_H) || __has_feature(modules) +/* + * __stddef_null.h is special when building without modules: if __need_NULL is + * set, then it will unconditionally redefine NULL. To avoid stepping on client + * definitions of NULL, __need_NULL should only be set the first time this + * header is included, that is when __STDDEF_H is not defined. However, when + * building with modules, this header is a textual header and needs to + * unconditionally include __stdef_null.h to support multiple submodules + * exporting _Builtin_stddef.null. Take module SM with submodules A and B, whose + * headers both include stddef.h When SM.A builds, __STDDEF_H will be defined. + * When SM.B builds, the definition from SM.A will leak when building without + * local submodule visibility. stddef.h wouldn't include __stddef_null.h, and + * SM.B wouldn't import _Builtin_stddef.null, and SM.B's `export *` wouldn't + * export NULL as expected. When building with modules, always include + * __stddef_null.h so that everything works as expected. + */ +#define __need_NULL +#endif +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \ + defined(__cplusplus) +#define __need_nullptr_t +#endif +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +#define __need_unreachable +#endif +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) +#define __need_max_align_t +#endif +#define __need_offsetof +/* wint_t is provided by and not . It's here + * for compatibility, but must be explicitly requested. Therefore + * __need_wint_t is intentionally not defined here. */ +#include <__stddef_header_macro.h> +#endif + +#if defined(__need_ptrdiff_t) +#include <__stddef_ptrdiff_t.h> +#undef __need_ptrdiff_t +#endif /* defined(__need_ptrdiff_t) */ + +#if defined(__need_size_t) +#include <__stddef_size_t.h> +#undef __need_size_t +#endif /*defined(__need_size_t) */ + +#if defined(__need_rsize_t) +#include <__stddef_rsize_t.h> +#undef __need_rsize_t +#endif /* defined(__need_rsize_t) */ + +#if defined(__need_wchar_t) +#include <__stddef_wchar_t.h> +#undef __need_wchar_t +#endif /* defined(__need_wchar_t) */ + +#if defined(__need_NULL) +#include <__stddef_null.h> +#undef __need_NULL +#endif /* defined(__need_NULL) */ + +#if defined(__need_nullptr_t) +#include <__stddef_nullptr_t.h> +#undef __need_nullptr_t +#endif /* defined(__need_nullptr_t) */ + +#if defined(__need_unreachable) +#include <__stddef_unreachable.h> +#undef __need_unreachable +#endif /* defined(__need_unreachable) */ + +#if defined(__need_max_align_t) +#include <__stddef_max_align_t.h> +#undef __need_max_align_t +#endif /* defined(__need_max_align_t) */ + +#if defined(__need_offsetof) +#include <__stddef_offsetof.h> +#undef __need_offsetof +#endif /* defined(__need_offsetof) */ + +/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use +__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */ +#if defined(__need_wint_t) +#include <__stddef_wint_t.h> +#undef __need_wint_t +#endif /* __need_wint_t */ + +#endif /* __MVS__ */ diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stddef.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stddef.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..a95cd902fce90aa41843133c534c8b6afd360d18 GIT binary patch literal 1986 zcmb`H%}*0S6u@VSA85#?krbjaiUH9S=s+Qn#9%6EVg(9S&=3t7m)+^^!gi<5E?=Sv z7Zdg7#S>hKC(lMS@eh!A07>+s9OR~ni3cyVPItH4QV*=a9^Ov&z4v=>-p7VP?&oCl zI)DJFG(*s|sF|uEPNO(6CoP&q$vK>2bb?5hi3Z86HEhYq;BS+^$*h>k>cm7H-B`7( zY(xT8k}ev`0m0g4D4Wy_rA^itPk^$yo;_p<1Tn+9IlAn_r(&00`EV(3 z#A_e+-rjxiVO+Yyh7W7EZNGh(?%crb9Pr^&wtv+j(0Duo+H2zAT1^7<)!YM8f&w;R zftl1}@T3cXWBL1=Up_C=AM+R+gvhw)4gfgQ$bVd#K^p#1!J*(#Bw$OBhXB9@VWBk! z^WQpGZZ8Zc>RpGj^f|7n0=Gj8lfh(Hz?KeiUYL(^V*TMyD|d3WRovfus^amu9D|A8 z#CQz$$NTv?KUi10G@_j7aU&1j8W`aAbrm6<&#*Vx+Z?c^6H6ELCeE0+p2St`v5TDZ{N&xYtIIEowe|*_qZ%quWjYuRhT8+SbZDc(XoS<2 U7E{mUUuR|R?L9Em9vX?kzk0a5*8l(j literal 0 HcmV?d00001 diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c new file mode 100644 index 0000000..f3ae711 --- /dev/null +++ b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c @@ -0,0 +1,46 @@ +#include "../include/ns.h" +#include "../include/ns_string.h" +#include "../include/ns_http.h" + +int main(void) +{ + ns_println("=== NextStd HTTP GET and POST Demo ==="); + + ns_println("\n[1] Performing HTTP GET..."); + { + ns_autohttp ns_http_response out = {0}; + + ns_error_t err = ns_http_get("https://jsonplaceholder.typicode.com/posts/1", &out); + + if (err == 0) { + ns_println("GET Status: {}", out.status_code); + ns_println("Body: \n{}", out.body); + } else { + ns_println("Failed to GET data: {}", ns_error_message(err)); + } + } + + ns_println("\n[2]: Performing HTTP POST..."); + { + ns_autohttp ns_http_response out = {0}; + + const char* json_payload = "{\n" + " \"title\": \"NextStd HTTP\",\n" + " \"body\": \"Memory safe C is incredible!\",\n" + " \"userId\": 99\n" + "}"; + + ns_println("Sending Payload..."); + + ns_error_t err = ns_http_post("https://jsonplaceholder.typicode.com/posts", json_payload, &out); + + if (err == 0) { + ns_println("POST Status: {}", out.status_code); + ns_println("POSt Response: \n{}", out.body); + } else { + ns_println("POST request failed: {}", ns_error_message(err)); + } + } + + return 0; +} diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c.blob new file mode 100644 index 0000000000000000000000000000000000000000..f082bdfcd41869db79906fd12c90570f9e72f8f2 GIT binary patch literal 6790 zcmb_hZ)_Y#72iE?oa<#UWa!D-7%LM6+r^j+UjIo>ioBbWGN#4Ye43 za5gcasmJ7`p+^tOGsZ(kDyl%QLod%rg<@XTqdSKaS;Htsk_@u}F*zlfFQw$Dq9=-4 zPB9|cjYw%grX`t|l+61itpB*GP3M$Me=4VeHB@bO?*`_|v_(t07R~3TqJ&&@U?A$u zKal{VrsQ-YD@!R^OBAG}rh+k6-JLZ?0&|Q#b z5>h^wQCtMpo~W8m>$0Jy-yhDhrl}f=`u9&V%Ntl5I(-zf|Eh6oLJ}G*BT9;QH)X=2 zp`~)^bTbA7Kbcb1e8p^QTUsgQ>Fc-T8M*;6nnBg~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j6SscLrxQH&@e*}8F{eB$nT&=VXD zj(gakH+ZNL1*m6}__FxQ0^2>_eGskzppAQaCVCzQAAlBgZh7KUE8qO#wKB-2zE`Cs z7Q^ckX6vvQmj)Zozt4Y=XR!rohkK6lEVdxc@q=o!zNeva3s{GpqdURUj&1o)9&8J) z_PuJ`-r>IkY}-E5{)p8AGw0~;-qG9(1~)drcl#UISUfSQh(2NMpC|~EqLDN5@}wAp zNBchr!uX*>6O&?iJyOu@mXHVK0^Gg}x|EiMj|({+?ue3_oXSCwv}2t@OS-JxpF*)C zBh8YThdrO|5ITlEY=^h=0E2$Tir)}l;92vywk-8e95{vLZmoaDVz@(<^aO?q;|-I| zn>bM0!L}67VjK5#Pjshw7F$>*=kldil+a8F_(pvY0zR*=CIt9%{C5}FwtZ~}IMT*F z{(Jpn9E&aJeBrL&JbQdw`5|;~=jQ<_opB5&XwBjImsc+Rd~U({EA~D}z`-~RwKlYn hdWAR(DG6GrdZC4+3*&H3*iPzS7=h{+TBv=Y{Xb7Ej)(vN literal 0 HcmV?d00001 diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h new file mode 100644 index 0000000..31d0e26 --- /dev/null +++ b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h @@ -0,0 +1,8 @@ +#ifndef NS_H +#define NS_H + +#include "ns_string.h" +#include "ns_print.h" +#include "ns_read.h" + +#endif // !NS_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..d68f38a08f033141ecf57ca27d140bf270e7c779 GIT binary patch literal 1308 zcmb_byGjE=6rD{#f`wRGDiRAJ8BC*%Vqqadf{+gwCcCpcV|HhjJCm2_2lz{ZUtk%* zKS(LqStZVH%%d`!Y?`^u>)dnhx%U)}??z^b9E7=w817P`xujiu!*tuI7}p2n9@GPK zjm8buH%;SVX`{B0^=TA`Oyjc)!i|ZmE-JbqmBE(4Dm?{lA%lu1z!Fd}xZHpx+QS_U zI20|MlEbwc7Satn9>auK9Uk)uXVharBI<&way0&GpL}Haro|&8X8vLQ63&Q7O=1u- zg(@9A4>RPBXrItf1agVMYN5*aH8aZJ4rd0SAc6XM3x*qbvm_s^0}0Y~Ig|R>fG2!E zi*{>qOQ~?Kcy*CvCtN(wWvVvT)gVcI^}=&jC>=42^g4R_r#Gh!y@uGH%PB1CSlr3y z<6LnmAI@wXcJsmfwG~3hnb1Q0{ImT2-Dr|qdr&&IlP@GYobDZG-#I9xE1Ed={uiES B?WzC( literal 0 HcmV?d00001 diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h new file mode 100644 index 0000000..26ad053 --- /dev/null +++ b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h @@ -0,0 +1,40 @@ +#ifndef NS_ERROR_H +#define NS_ERROR_H + +#ifdef __cplusplus +extern "C" { +#endif + + typedef enum { + NS_SUCCESS = 0, + + // Catch all + NS_ERROR_ANY = 1, + + //ns_io errors + NS_ERROR_IO_READ = 10, + NS_ERROR_IO_WRITE = 11, + NS_ERROR_INVALID_INPUT = 12, + + // ns_string errors + NS_ERROR_STRING_ALLOC = 20, + NS_ERROR_STRING_UTF8 = 21, + + NS_ERROR_OUT_OF_BOUNDS = 22, + } ns_error_t; + + const char* ns_error_message(ns_error_t err); + +#define NS_TRY(err_var, expr) \ + if (((err_var) = (expr)) == NS_SUCCESS) + +#define NS_EXCEPT(err_var, err_type) \ + else if ((err_var) == (err_type) || (err_type) == NS_ERROR_ANY) + +#ifdef __cplusplus + +} + +#endif // __cplusplus + +#endif // !NS_ERROR_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..0abe7211e27bd8ec9cb328a6db4a2abe93f21555 GIT binary patch literal 2219 zcmb`GPi)&%9LJy2(pp{BMXXAjHQL;=Zf0VK2oXq7t=B%uiGHNvX{mlLM7^u<{euy z^f}2BC&gltZfeGSo=6yjk31>h5>fNS#uZhwt)nG$?@syfPrGPy^fw81S;K=zxGltV zaMjjL55@Psy}FCNE9xRv4ZUbK2)Msdt59%=YZV@gW(qlV+g*K#Q)w`6L-v&PLjSIO zS6w@=7Ye&^4Tn2tSqAfZ|9H%KqrUu+j?;1BJd1Se@%KxQn2>k5fb{k4<^P#Vf0Q4< z>{+d(+Vvb!pb0(E-i!L9TrGJ0`a93JF5J~D({Tm5PKd&c65F=mmJr8Li$r8ETme1| zpzdw~!5>$fiPfSi`;=-5^8-`U;1XzC{DAlqZ#O>qv#V8Z%@y!)3L|xX_H-7#3^7@ar7%i24 zd15k^z^U|fP66CV43-U2oNh5xkPnVh6x4BsYFjV<(59|^0VqYDfv)zaAU543g8xPY zA$UQx2L-ZNwFiVVZGxZ|1X0}nFaX<$-Z%I)M!T}Pcs!ZS4nQJ3!5#>=Cm4}Y%~O8i z^tW#%S6-W~E6?CpG;_uguM z(eg6H!dm=f{G*>p&(LfR1P}BD;Cb-eRyH4{kCZ=9TFx_9TQibVP8>U%>s?=TqbO5*`WH;SvSRuWXhK-?aFk3gHDimdtfQ@@=n^nI_f z=1fk(nG^WMOfH?sQY~!0c8qI?4|y{NwLW8W%Pq5?UP}N4UE*y1*o0)KR>2UlwAgA=o46+NsnB7vb2mHb?96oL z&L*pA39VSAw$RX5MWp&7Lah&qP_2sbslFsWh=}-LMGz^9BBaT9?(EL&<_DWLorjs( zn?2w8zH`oZHa%$d(_6Dk2qP(P7Kl_-G$(H;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sZ#J2ED-6)X<|D?XUfnnR46 LaU18~%LDfx49z8i literal 0 HcmV?d00001 diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h new file mode 100644 index 0000000..a227d46 --- /dev/null +++ b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h @@ -0,0 +1,145 @@ +#ifndef NS_PRINT_H +#define NS_PRINT_H + +#include +#include "ns_string.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Formatting & Interpolation Types + +// 1. The Tag: Identifies what type is stored in the union +typedef enum ns_type_tag { + NS_TYPE_INT, + NS_TYPE_FLOAT, + NS_TYPE_DOUBLE, + NS_TYPE_BOOL, + NS_TYPE_SIZE_T, + NS_TYPE_CSTR, + NS_TYPE_NS_STRING +} ns_type_tag; + +// 2. The Data: A union that is exactly as large as its largest member +typedef union ns_any_data { + int v_int; + float v_float; + double v_double; + _Bool v_bool; + size_t v_size_t; + const char* v_cstr; + ns_string v_ns_string; +} ns_any_data; + +// 3. The Package: A single struct we can pass to Rust safely +typedef struct ns_any_t { + ns_type_tag tag; + ns_any_data data; +} ns_any_t; + +// 4. Constructor Functions (Shields from strict _Generic type-checking and nested designator warnings) +static inline ns_any_t ns_any_from_int(int v) { ns_any_t a; a.tag = NS_TYPE_INT; a.data.v_int = v; return a; } +static inline ns_any_t ns_any_from_float(float v) { ns_any_t a; a.tag = NS_TYPE_FLOAT; a.data.v_float = v; return a; } +static inline ns_any_t ns_any_from_double(double v) { ns_any_t a; a.tag = NS_TYPE_DOUBLE; a.data.v_double = v; return a; } +static inline ns_any_t ns_any_from_bool(_Bool v) { ns_any_t a; a.tag = NS_TYPE_BOOL; a.data.v_bool = v; return a; } +static inline ns_any_t ns_any_from_size_t(size_t v) { ns_any_t a; a.tag = NS_TYPE_SIZE_T; a.data.v_size_t = v; return a; } +static inline ns_any_t ns_any_from_cstr(const char* v) { ns_any_t a; a.tag = NS_TYPE_CSTR; a.data.v_cstr = v; return a; } +static inline ns_any_t ns_any_from_ns_string(ns_string v) { ns_any_t a; a.tag = NS_TYPE_NS_STRING; a.data.v_ns_string = v; return a; } + +// 5. The Magic Converter: Selects the correct constructor function +#define ns_to_any(x) _Generic((x), \ + int: ns_any_from_int, \ + float: ns_any_from_float, \ + double: ns_any_from_double, \ + _Bool: ns_any_from_bool, \ + size_t: ns_any_from_size_t, \ + char*: ns_any_from_cstr, \ + const char*: ns_any_from_cstr, \ + ns_string: ns_any_from_ns_string \ +)(x) + +// Rust FFI Functions + +// Formatted printing (Our new Rust functions) +void ns_print_fmt_c(const char* fmt, ns_any_t* args, size_t num_args); +void ns_println_fmt_c(const char* fmt, ns_any_t* args, size_t num_args); + +// Single-variable printing (No Newline) +void ns_print_int(int val); +void ns_print_float(float val); +void ns_print_double(double val); +void ns_print_bool(_Bool val); +void ns_print_size_t(size_t val); +void ns_print_string(const char* val); +void ns_print_ns_string(ns_string val); + +// Single-variable printing (Newline) +void ns_println_int(int val); +void ns_println_float(float val); +void ns_println_double(double val); +void ns_println_bool(_Bool val); +void ns_println_size_t(size_t val); +void ns_println_string(const char* val); +void ns_println_ns_string(ns_string val); + +// The Macro Magic (Overloading by Argument Count) + +// 1. Single argument dispatcher (The original generic macros) +#define ns_print_1(x) _Generic((x), \ + int: ns_print_int, \ + float: ns_print_float, \ + double: ns_print_double, \ + _Bool: ns_print_bool, \ + size_t: ns_print_size_t, \ + char*: ns_print_string, \ + const char*: ns_print_string, \ + ns_string: ns_print_ns_string \ +)(x) + +#define ns_println_1(x) _Generic((x), \ + int: ns_println_int, \ + float: ns_println_float, \ + double: ns_println_double, \ + _Bool: ns_println_bool, \ + size_t: ns_println_size_t, \ + char*: ns_println_string, \ + const char*: ns_println_string, \ + ns_string: ns_println_ns_string \ +)(x) + +// 2. Formatted argument dispatchers (Supports up to 8 variables formatted at once) +// ns_print (No newline) +#define ns_print_2(fmt, a) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a)}, 1) +#define ns_print_3(fmt, a, b) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b)}, 2) +#define ns_print_4(fmt, a, b, c) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c)}, 3) +#define ns_print_5(fmt, a, b, c, d) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d)}, 4) +#define ns_print_6(fmt, a, b, c, d, e) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e)}, 5) +#define ns_print_7(fmt, a, b, c, d, e, f) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f)}, 6) +#define ns_print_8(fmt, a, b, c, d, e, f, g) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f), ns_to_any(g)}, 7) +#define ns_print_9(fmt, a, b, c, d, e, f, g, h) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f), ns_to_any(g), ns_to_any(h)}, 8) + +// ns_println (With newline) +#define ns_println_2(fmt, a) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a)}, 1) +#define ns_println_3(fmt, a, b) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b)}, 2) +#define ns_println_4(fmt, a, b, c) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c)}, 3) +#define ns_println_5(fmt, a, b, c, d) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d)}, 4) +#define ns_println_6(fmt, a, b, c, d, e) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e)}, 5) +#define ns_println_7(fmt, a, b, c, d, e, f) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f)}, 6) +#define ns_println_8(fmt, a, b, c, d, e, f, g) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f), ns_to_any(g)}, 7) +#define ns_println_9(fmt, a, b, c, d, e, f, g, h) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f), ns_to_any(g), ns_to_any(h)}, 8) + +// 3. The Router Macros +#define NS_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, NAME, ...) NAME + +#define ns_print(...) \ + NS_GET_MACRO(__VA_ARGS__, ns_print_9, ns_print_8, ns_print_7, ns_print_6, ns_print_5, ns_print_4, ns_print_3, ns_print_2, ns_print_1)(__VA_ARGS__) + +#define ns_println(...) \ + NS_GET_MACRO(__VA_ARGS__, ns_println_9, ns_println_8, ns_println_7, ns_println_6, ns_println_5, ns_println_4, ns_println_3, ns_println_2, ns_println_1)(__VA_ARGS__) + +#ifdef __cplusplus +} +#endif // !__cplusplus + +#endif // !NS_PRINT_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..14c832a60f82c33a06c0fa065f27d3df2f4ad9ff GIT binary patch literal 11818 zcmc&a3wRS%x@SVf7@ZCIY0?DJq$JZ)NdKFQxtm1QB*HxAa_+oju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vXux?Z7AitmLTh`^% z%geB=%bD^rRn|jhuZul4Dnrr;$Mr%g;b*B9eg^r8%=8|tlUgBaiUMn}#^Bf0N_%Qc rU%cVV%Rc!?qZJR9Q)xZ>Sos$wH<1-D?r-FwvS<>4cvxdOD)Ijh_YR77 literal 0 HcmV?d00001 diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h new file mode 100644 index 0000000..4d5357d --- /dev/null +++ b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h @@ -0,0 +1,33 @@ +#ifndef NS_READ_H +#define NS_READ_H + +#include +#include "ns_error.h" +#include "ns_string.h" + +// Check if we are in C++ +#ifdef __cplusplus +extern "C" { +#endif + + // ----Reading functions------ + ns_error_t ns_read_int(int* ptr); + ns_error_t ns_read_float(float* ptr); + ns_error_t ns_read_double(double* ptr); + ns_error_t ns_read_bool(_Bool* ptr); + ns_error_t ns_read_ns_string(ns_string* ptr); + + // Generic Read macro +#define ns_read(x) _Generic((x), \ + int*: ns_read_int, \ + float*: ns_read_float, \ + double*: ns_read_double, \ + _Bool*: ns_read_bool, \ + ns_string*: ns_read_ns_string \ +)(x) + +#ifdef __cplusplus +} +#endif // !__cplusplus + +#endif // !NS_READ_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..24ce8a1d3e5c513e74a43e05640e8533693b971e GIT binary patch literal 2241 zcmb_cO=#3W6rO3LE~}eOw3HI+x+=<6+(t{O9%{8~g<7@LA9|=iG0o2I#%7Zx$+lf- z@noThhJ8X`8-^A%`}g_iMXlmKCq6A32+h*eZR5GQ4ad7(fOLCuJv*ar#JU5tNxK$w(UQ&-@>lZi;Hy)2Qgvb@ROKuj)j>FM}n=QfaMI?e# zd>!bh0oB&7La?wi*}C^SbKwGqmcSb?@U0m041WkA=kSBa7gN=z&&+^J#g&j!U<0^1 z4{po(>(7Uu_R20CCvZ&|a}3u7aPdOSoVd!Lm;o+r6#F%j@U{T4-a~ABt1KQ-9*(<+ zQ6bubag>Sn0OF?AJ8|8~)7xi2%xH#eCtMrg2_D}0=5bPLytLfKV+FPuW0qle1Ky{B zcih4Dt;c4-gI`nvo&c*Bp(Lz*Fk}#WJX6#aTQzixeoQ9mT)!@R6n}J7x#p&c2$2mK zN0>+lLX5L>Z~dDaQyk+?}TEprRCrN z@H>2{FpBv$zK6li%UyR@u4%p}{hErtIi>1br^b$)`|PJ9dNEH^Ow&>MhyKyHic2no*=4f}>*=NS*6NSUnGtwGKQO`(IBvtlY z{Nky)=NnH2L9Y{3#jXZcRGs)Y4B~3InphQBA%q-E3-<+9QD3=mwu9}W8Q2!KtDJ%P j@T&Lq<@-0g_e=YBw0B6I0I<~0G3_JVBD|`~wO*E=YPR}` literal 0 HcmV?d00001 diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h new file mode 100644 index 0000000..9eeef4d --- /dev/null +++ b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h @@ -0,0 +1,51 @@ +#ifndef NS_STRING_H +#define NS_STRING_H + +#include +#include +#include "ns_error.h" // <-- Import your new error types! + +#ifdef __cplusplus +extern "C" { +#endif + + // Heap allocation details + typedef struct ns_string_heap { + char *ptr; + size_t capacity; + } ns_string_heap; + + // Union : 24 bytes of inline chars OR the heap struct + typedef union ns_string_data { + char inline_data[24]; + ns_string_heap heap; + } ns_string_data; + + // Final string struct + typedef struct ns_string { + size_t len; + bool is_heap; + ns_string_data data; + } ns_string; + + // ========================================== + // Core String Functions + // ========================================== + + // Safely creates a new string, returning an error if heap allocation fails. + // The result is written directly into the `dest` pointer. + ns_error_t ns_string_new(ns_string* dest, const char* c_str); + + // Safely concatenates two strings, returning an error if heap allocation fails. + // The result is written directly into the `dest` pointer. + ns_error_t ns_string_concat(ns_string* dest, ns_string s1, ns_string s2); + + // Safely frees heap memory if the string used it. + // Safe to call on inline strings (it just zeroes them out). + void ns_string_free(ns_string* s); + +#ifdef __cplusplus +} +#endif // !__cplusplus + +#endif // !NS_STRING_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h.blob new file mode 100644 index 0000000000000000000000000000000000000000..f00ded65f310028d8f5c881bc1cb5ec79b957b6a GIT binary patch literal 3803 zcmcguTWl0n7(TOIU|hFbXt$-^ZtzftX4ovdur$PMN<*OGD&^8Dh_S=4d$v0;JG0Kr zw%u|GCI$tG5%k3vUyLse5tIiAL}M^UViXfoqXvVw#2SJjh$4ni#{bN8W|x*rxx{&x z>DiwDKi~JA@BhzEh3 zjZPySSKzC|m-LIdyiD}?yeEXLVdP^eRFRTJrRO0fo71Oi+a#rDPFm6cfT|T2-Umt) zh!=D%E=ybD7PxpK5to#dTu76+AOMdv$p~2@rimux#FVDSvgpReZOz|IAWWAAh+wz@ z_b#CWMA3!3CMi}bcIM8Z39OwH`vp;!dXzE%cPFZ5GCDET%)`MiLs((M~8M=?X zDbc4%Rt_5vmPF8C8)>FRvnC{A-q6xgCNmKM!6#c(Rd!{&yV6QQE=_+RXIQlbtWFN^ zxPvKeC*K3WzEoD!O57_Z-`;d?ZuX9IMiufskP`&QRGum55q}KLjaHbQ8~W$(pZvVi zt4e7MwW1qPEImR-BZPN{IHJ!+K3^E2PBBB|BBuY=F_d;5=SU9P2bMC}$P#RaQhHq=~1i^qo64u5Ed0|Eli19IsiWvR+WHbMwDbd=Ia7IG@=(|14}yY z(o#Li!m4CS{R1&ayt-u)ck4HCo^ZYoEFfy$NZ=J z(hq+;=F1z!Jb~kf!Y`!C%uzA{nlYmqEtM2ec3f-EMNF6thdfNZHw>D9z$?~;e>-~P z(t+y?LX%4PZofyaZzpjJxaD4kZ{<7S-OcCWJ;3kxGSO(X&C9r%$AR3w69oddL08{Y z-va1@;mH85!u;ZwPd`trzP16G-@o5IukXVp7j~ONAIx2MO?v&U5x9L!2h>1f>5;2n zbNz>djxGg-I@PUkAuSrP-){ZWAqt1X=qYPn5+_>lmLhe9nsI8F8c4@$)>|gFYQPb& zmaXMHOtrU`v({d@C!X8)>zODOka58=jcg+aA`~l*zp|(M;1vfMQ3^SVq^zz-|3sls zkS2u3wZL^c@_;ewL0c~mZ_`=smJ~r*zyCgIRpaVbpcSm8%6rUg^N}}4y0{!N|870C zZyJ9>2Y=XVN4`8%yz*6It-}fW6kI2uC(0`H4*PC{qETpT_G7aMuz{eLXXiD~?;Gq8QfUJtG z0t@-QRknp3nzn@;y_p~z1PfKU1?R2+Cl>TH4?Q*(N83j{R>`%y-C=|(?{?X;DB6l4 zkcB{gJ->+tLiKJM6X@tV{g~BAK+$a%=ExqUAZ{i_`&zn(7*!W~*Uq<|1|yCH?L* z-WT6lGkB(>Q|RnkzoKKAupEA_dmI`xy$sy+Gs8?}nmyJVnbdS{b(NO4yj>d7W|d6Z zo@%387iJX+GLM(ibjSBCy)tgr? zPhz#r87&k;V{@a00lHkw?Y{N~9vD8fb;Gpp5c@t787>u"] diff --git a/Makefile b/Makefile index 6417847..b634e12 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,14 @@ LIBS_TO_INSTALL = $(RUST_DIR)/libns_data.a \ $(RUST_DIR)/libns_string.a \ $(RUST_DIR)/libns_error.a \ $(RUST_DIR)/libns_cmd.a \ - $(RUST_DIR)/libns_process.a + $(RUST_DIR)/libns_process.a \ + $(RUST_DIR)/libns_http.a # Flags # Added -Iinclude so C finds your new header folder locally INCLUDES = -I. -Iinclude # Added -lns_strings and -lns_data to link the Rust crates -LIBS = -L$(RUST_DIR) -lns_process -lns_cmd -lns_data -lns_io -lns_string -lns_error -lpthread -ldl -lm -Wl,-rpath=$(RUST_DIR) +LIBS = -L$(RUST_DIR) -lns_process -lns_cmd -lns_data -lns_io -lns_string -lns_error -lns_http -lpthread -ldl -lm -Wl,-rpath=$(RUST_DIR) EXAMPLES = $(patsubst $(EXAMPLE_DIR)/%.c,%,$(wildcard $(EXAMPLE_DIR)/*.c)) diff --git a/ROADMAP.md b/ROADMAP.md index 8e447cb..53ad246 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -51,7 +51,17 @@ calls with safe, memory-managed alternatives. * *Features:* Similar to `ns_cmd` but it is non-blocking and allows to run background processes. -## Phase 3: Safe File System (`ns_file`) +## Phase 3: Networking (`ns_http`) + +Bringing modern, memory-safe HTTPS requests to C without the massive boilerplate +of `libcurl`. + +* [ ] **Simple GET Requests:** Wrapper around Rust's `reqwest` to easily fetch + HTML or JSON APIs directly into dynamically sized `ns_string` structures. +* [ ] **Safe Error Propagation:** Catch dropped connections, 404s, or Cloudflare + blocks via `NS_TRY` blocks instead of crashing the program. + +## Phase 4: Safe File System (`ns_file`) Fixing the resource leaks and buffer overflow risks associated with standard C's `FILE*` API. @@ -63,16 +73,6 @@ Fixing the resource leaks and buffer overflow risks associated with standard C's Rust backend, allowing C to safely read large files in chunks without ever touching raw pointers or leaking descriptors. -## Phase 4: Networking (`ns_http`) - -Bringing modern, memory-safe HTTPS requests to C without the massive boilerplate -of `libcurl`. - -* [ ] **Simple GET Requests:** Wrapper around Rust's `reqwest` to easily fetch - HTML or JSON APIs directly into dynamically sized `ns_string` structures. -* [ ] **Safe Error Propagation:** Catch dropped connections, 404s, or Cloudflare - blocks via `NS_TRY` blocks instead of crashing the program. - ## Phase 5: C++ Integration * [ ] **C++ Support:** Ensure seamless compatibility for using NextStd macros diff --git a/crates/ns_http/Cargo.toml b/crates/ns_http/Cargo.toml new file mode 100644 index 0000000..9fca625 --- /dev/null +++ b/crates/ns_http/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "ns_http" +version.workspace = true +edition.workspace = true +authors.workspace = true + +[lib] +crate-type = ["staticlib"] + +[dependencies] +ns_error = { path = "../ns_error" } +ns_string = { path = "../ns_string" } +reqwest = { version = "0.13.4", features = ["blocking"] } diff --git a/crates/ns_http/src/lib.rs b/crates/ns_http/src/lib.rs new file mode 100644 index 0000000..de81bb4 --- /dev/null +++ b/crates/ns_http/src/lib.rs @@ -0,0 +1,120 @@ +use std::ffi::CStr; +use std::mem::ManuallyDrop; +use std::os::raw::{c_char, c_int}; + +use ns_error::NsError; +use ns_string::{NsString, NsStringData, NsStringHeap, ns_string_free}; +use reqwest::blocking::Client; + +#[repr(C)] +pub struct NsHttpResponse { + pub body: NsString, + pub status_code: c_int, +} + +fn rust_str_to_ns(s: String) -> NsString { + let bytes = s.into_bytes(); + let len = bytes.len(); + + if len < 24 { + let mut inline = [0; 24]; + inline[..len].copy_from_slice(&bytes); + NsString { + len, + is_heap: false, + data: NsStringData { + inline_data: inline, + }, + } + } else { + let mut vec = bytes; + vec.shrink_to_fit(); + let ptr = vec.as_mut_ptr(); + let capacity = vec.capacity(); + std::mem::forget(vec); + + NsString { + len, + is_heap: true, + data: NsStringData { + heap: ManuallyDrop::new(NsStringHeap { ptr, capacity }), + }, + } + } +} + +/// # Safety +/// * `url` must be a vald, null-terminated C string +/// * `output` must point to a valid, zero-initialized `NsHttpResponse` +#[unsafe(no_mangle)] +pub unsafe extern "C" fn ns_http_get(url: *const c_char, output: *mut NsHttpResponse) -> NsError { + if url.is_null() || output.is_null() { + return NsError::InvalidInput; + } + + let url_str = unsafe { CStr::from_ptr(url).to_string_lossy() }; + + match reqwest::blocking::get(url_str.as_ref()) { + Ok(resp) => { + let status = resp.status().as_u16() as c_int; + let body_text = resp.text().unwrap_or_default(); + + unsafe { + (*output).status_code = status; + (*output).body = rust_str_to_ns(body_text); + } + + NsError::Success + } + Err(_) => NsError::Any, + } +} + +/// # Safety +/// * `url` must be a vald, null-terminated C string +/// * `output` must point to a valid, zero-initialized `NsHttpResponse` +#[unsafe(no_mangle)] +pub unsafe extern "C" fn ns_http_post( + url: *const c_char, + body_data: *const c_char, + output: *mut NsHttpResponse, +) -> NsError { + if url.is_null() || body_data.is_null() || output.is_null() { + return NsError::Any; + } + + let url_str = unsafe { CStr::from_ptr(url).to_string_lossy() }; + let payload_str = unsafe { CStr::from_ptr(body_data).to_string_lossy() }; + + let client = Client::new(); + match client + .post(url_str.as_ref()) + .body(payload_str.into_owned()) + .send() + { + Ok(resp) => { + let status = resp.status().as_u16() as c_int; + let body_text = resp.text().unwrap_or_default(); + + unsafe { + (*output).status_code = status; + (*output).body = rust_str_to_ns(body_text); + } + NsError::Success + } + Err(_) => NsError::Any, + } +} + +/// # Safety +/// *`resp` must be a valid pointer to an initialized `NsHttpResponse` +#[unsafe(no_mangle)] +pub unsafe extern "C" fn ns_http_free(resp: *mut NsHttpResponse) { + if resp.is_null() { + return; + } + + unsafe { + ns_string_free(&mut (*resp).body); + } +} diff --git a/examples/18_http.c b/examples/18_http.c new file mode 100644 index 0000000..f3ae711 --- /dev/null +++ b/examples/18_http.c @@ -0,0 +1,46 @@ +#include "../include/ns.h" +#include "../include/ns_string.h" +#include "../include/ns_http.h" + +int main(void) +{ + ns_println("=== NextStd HTTP GET and POST Demo ==="); + + ns_println("\n[1] Performing HTTP GET..."); + { + ns_autohttp ns_http_response out = {0}; + + ns_error_t err = ns_http_get("https://jsonplaceholder.typicode.com/posts/1", &out); + + if (err == 0) { + ns_println("GET Status: {}", out.status_code); + ns_println("Body: \n{}", out.body); + } else { + ns_println("Failed to GET data: {}", ns_error_message(err)); + } + } + + ns_println("\n[2]: Performing HTTP POST..."); + { + ns_autohttp ns_http_response out = {0}; + + const char* json_payload = "{\n" + " \"title\": \"NextStd HTTP\",\n" + " \"body\": \"Memory safe C is incredible!\",\n" + " \"userId\": 99\n" + "}"; + + ns_println("Sending Payload..."); + + ns_error_t err = ns_http_post("https://jsonplaceholder.typicode.com/posts", json_payload, &out); + + if (err == 0) { + ns_println("POST Status: {}", out.status_code); + ns_println("POSt Response: \n{}", out.body); + } else { + ns_println("POST request failed: {}", ns_error_message(err)); + } + } + + return 0; +} diff --git a/include/ns_http.h b/include/ns_http.h new file mode 100644 index 0000000..57bac4b --- /dev/null +++ b/include/ns_http.h @@ -0,0 +1,47 @@ +#ifndef NS_HTTP_H +#define NS_HTTP_H + +#include "ns_string.h" +#include "ns_error.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +typedef struct ns_http_response { + ns_string body; + int status_code; +} ns_http_response; + +/* + * Performs an HTTP GET request +*/ +ns_error_t ns_http_get(const char* url, ns_http_response* output); + +/* + * Performs an HTTP POST request with a string payload +*/ +ns_error_t ns_http_post(const char* url, const char* body_data, ns_http_response* output); + +/** + * Memory cleanup +*/ +void ns_http_free(ns_http_response* resp); + +/** + * Auto memory cleanup for RAII +*/ +static inline void ns_http_cleanup_helper(ns_http_response* ptr) { + if (ptr) { + ns_http_free(ptr); + } +} + +// The RAII Macro! +#define ns_autohttp __attribute__((cleanup(ns_http_cleanup_helper))) + +#ifdef __cplusplus +} + +#endif +#endif From 466ce28958fbc67dbb388dde6eaa1df806b387c4 Mon Sep 17 00:00:00 2001 From: Vaishnav Sabari Girish Date: Fri, 26 Jun 2026 22:53:55 +0530 Subject: [PATCH 2/5] chore(ccls-cache): Removed ccls-cache Signed-off-by: Vaishnav Sabari Girish --- ...b@clang@22@include@__stddef_header_macro.h | 12 -- ...ng@22@include@__stddef_header_macro.h.blob | Bin 1121 -> 0 bytes ...ib@clang@22@include@__stddef_max_align_t.h | 27 ---- ...ang@22@include@__stddef_max_align_t.h.blob | Bin 1651 -> 0 bytes .../@usr@lib@clang@22@include@__stddef_null.h | 29 ---- ...@lib@clang@22@include@__stddef_null.h.blob | Bin 1160 -> 0 bytes ...@lib@clang@22@include@__stddef_nullptr_t.h | 29 ---- ...clang@22@include@__stddef_nullptr_t.h.blob | Bin 969 -> 0 bytes ...r@lib@clang@22@include@__stddef_offsetof.h | 17 -- ...@clang@22@include@__stddef_offsetof.h.blob | Bin 1208 -> 0 bytes ...@lib@clang@22@include@__stddef_ptrdiff_t.h | 20 --- ...clang@22@include@__stddef_ptrdiff_t.h.blob | Bin 1267 -> 0 bytes ...usr@lib@clang@22@include@__stddef_size_t.h | 20 --- ...ib@clang@22@include@__stddef_size_t.h.blob | Bin 1270 -> 0 bytes ...sr@lib@clang@22@include@__stddef_wchar_t.h | 28 ---- ...b@clang@22@include@__stddef_wchar_t.h.blob | Bin 1266 -> 0 bytes .../@usr@lib@clang@22@include@stdbool.h | 39 ----- .../@usr@lib@clang@22@include@stdbool.h.blob | Bin 1461 -> 0 bytes .../@usr@lib@clang@22@include@stddef.h | 139 ----------------- .../@usr@lib@clang@22@include@stddef.h.blob | Bin 1986 -> 0 bytes .../examples@18_http.c | 46 ------ .../examples@18_http.c.blob | Bin 6790 -> 0 bytes .../include@ns.h | 8 - .../include@ns.h.blob | Bin 1308 -> 0 bytes .../include@ns_error.h | 40 ----- .../include@ns_error.h.blob | Bin 2219 -> 0 bytes .../include@ns_http.h | 47 ------ .../include@ns_http.h.blob | Bin 3024 -> 0 bytes .../include@ns_print.h | 145 ------------------ .../include@ns_print.h.blob | Bin 11818 -> 0 bytes .../include@ns_read.h | 33 ---- .../include@ns_read.h.blob | Bin 2241 -> 0 bytes .../include@ns_string.h | 51 ------ .../include@ns_string.h.blob | Bin 3803 -> 0 bytes .gitignore | 1 + 35 files changed, 1 insertion(+), 730 deletions(-) delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h.blob delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stddef.h delete mode 100644 .ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stddef.h.blob delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c.blob delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h.blob delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h.blob delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_http.h delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_http.h.blob delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h.blob delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h.blob delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h delete mode 100644 .ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h.blob diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h deleted file mode 100644 index db5fb3c..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h +++ /dev/null @@ -1,12 +0,0 @@ -/*===---- __stddef_header_macro.h ------------------------------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -#ifndef __STDDEF_H -#define __STDDEF_H -#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_header_macro.h.blob deleted file mode 100644 index 3768c95aedbfafca7053fbb3b8c58652ed8b4878..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1121 zcmb`G%}N6?5XZBMARfencNISlLOa-#7e%2;5fq``L%KV=8=EFel75LkfUi{W=o7Th z(1Qoho~+p|+FqoeIV3O)zxmHUGsoonvwGAc9)VcZ5E_h|Sh5Bb(NwKU;I>WgwR%L~ z8o0xjE!zO3dyRXs#cGK_11G06wl>N8WYrf;MoWU_no3u>jB)|jPJq(wvpH0fO{g0U zf>$6D2ZaJ~>5F=RK&k5^z>pgLgw*Eap&fHn`6Wt26U}9YTHkx=PEotYT9gSM$uR+w z6{|2bXjQlz&8W4~DeCJj>MqoN3c2aq#UNB83sTa>;ZznTRtG!`r!mldctt7kXWL|_ zWnGNYXWx>s$uQQ9MwFI5e~lM(C|fv3>hzy`{}0)4yk}^(>Bmfud?fC8gA%TN?7Vj_ iDJ?$~i&xjQx)u;0S diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h deleted file mode 100644 index 512606a..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h +++ /dev/null @@ -1,27 +0,0 @@ -/*===---- __stddef_max_align_t.h - Definition of max_align_t ---------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -#ifndef __CLANG_MAX_ALIGN_T_DEFINED -#define __CLANG_MAX_ALIGN_T_DEFINED - -#if defined(_MSC_VER) -typedef double max_align_t; -#elif defined(__APPLE__) -typedef long double max_align_t; -#else -// Define 'max_align_t' to match the GCC definition. -typedef struct { - long long __clang_max_align_nonce1 - __attribute__((__aligned__(__alignof__(long long)))); - long double __clang_max_align_nonce2 - __attribute__((__aligned__(__alignof__(long double)))); -} max_align_t; -#endif - -#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_max_align_t.h.blob deleted file mode 100644 index d64aa69c9f3e53ed2605be012514e6738143f643..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1651 zcmb`H&ubGw6vtX_KNy z6-ECV!Gk}JYCY(sy?bi#B%Y*)#yGoeekhHkN%t@hcHey7_kG{&#KG?$l?z)y0nlPq z3|BScSX5huS?p8g=P<5o$Bjbg*FN(NxErGwz~x-j_GWaJk=z z3%S)2lR*%d193?=&W~h9O>l#l=D;k5&RkBs#F*W)ZD?ZeaL~HlPoHSUj*vqxyQQx` zvnF)N`{N|(P3z&-@Z+*~z7Nstnr>;l?;}u-gHR9z+S>~F=TSNz!imTEtDoP3_QnBU zveUt<-Hd3ly&Zi)|ZbbUu8wJh9%?x z6@Mw3n>#&@qF5j{BNc(zjO$ge?_E!Wzvq|DXjwH_y=3FTs*8&Vc~_LYhq~rS$8?+m z)2WL9DACzyq3sJO(SVHG%2doP(rw#=dP{$|7>Zl~r;;u*G99_;A|nAAH};XwpIrL6 z8~?VBP^OSB=Fm#|K1vtzxgxrUvP;YP;!;*tzI@J`23G%@rUXO5WuLc#j_bo8V8u|y diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h deleted file mode 100644 index c10bd2d..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h +++ /dev/null @@ -1,29 +0,0 @@ -/*===---- __stddef_null.h - Definition of NULL -----------------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -#if !defined(NULL) || !__building_module(_Builtin_stddef) - -/* linux/stddef.h will define NULL to 0. glibc (and other) headers then define - * __need_NULL and rely on stddef.h to redefine NULL to the correct value again. - * Modules don't support redefining macros like that, but support that pattern - * in the non-modules case. - */ -#undef NULL - -#ifdef __cplusplus -#if !defined(__MINGW32__) && !defined(_MSC_VER) -#define NULL __null -#else -#define NULL 0 -#endif -#else -#define NULL ((void*)0) -#endif - -#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_null.h.blob deleted file mode 100644 index 6f520e6bf7d86576489aac7800911f3f4b4f13ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1160 zcmb_bzfS@&6z-uh;9!gsOk#`%NVqDK3x>hTAR#f1rYU#5yUNj?ZTV$%aP(jBPcbp> zCQdLpIWamoIf*@p;9@|aLtmTpef{3|zLx=C@73KdFaY#;jlc$`(qp&*kBF=)9>9|} zDhqx=EG1!ywA87xA=6RnNLsiS_(a0}1LP?cm=;*Fe9YVhfn}RqR4H?_HWiux7w!BE zEWsMAO96dafdg_dmxGj9e%&SzAzg<}9OMyf6M<^j65RBLqD+w{=@mh0l<4_AiAx`hcc23@5xlE!Ks}|@1+4S66=Y0B-~BV ZH}uo~+kN!;_VwjMpGV7xnXz)g_y!mIu#W%$ diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h deleted file mode 100644 index 7f3fbe6..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h +++ /dev/null @@ -1,29 +0,0 @@ -/*===---- __stddef_nullptr_t.h - Definition of nullptr_t -------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -/* - * When -fbuiltin-headers-in-system-modules is set this is a non-modular header - * and needs to behave as if it was textual. - */ -#if !defined(_NULLPTR_T) || \ - (__has_feature(modules) && !__building_module(_Builtin_stddef)) -#define _NULLPTR_T - -#ifdef __cplusplus -#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) -namespace std { -typedef decltype(nullptr) nullptr_t; -} -using ::std::nullptr_t; -#endif -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -typedef typeof(nullptr) nullptr_t; -#endif - -#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_nullptr_t.h.blob deleted file mode 100644 index e67756cf37c8ee4eac7692bca01aeda1bd33420e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 969 zcmb_aze@u#6wXx#(Q*|L6erQ*U^xTbl@_`PwN$Nh$lc}c(q5C2q`%x8-JApk7yl3c z0ilylPWlfxIJxMVws3XQ)|w&jk-RV8_q~^G@cCNXdISc50k0F-!c+zfw_t(Dn&J(3 z&_!jztHe0kjirGO!|;XpFXW@9@DX>%^|&`>t2V@GgpZqTVQV3M8^ zq$U8=aR=d$`fMT;_dH1y_hO={21tb9qW{$Uo&PX~$%Yax^}KNu>u%bdhq2Dz8_$~I zsC+70QVIQ6`qX>p!4JNM6Q4k0+X=83xd(|Qu##K_Ye@iRqO05d#?7U9fl4REV!3jJ zDgc1xP5q}RBkSK!jnrZ)ofzyOGIUk+d_8x6_SAdRdAtlWXWBUyJe diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h deleted file mode 100644 index 84172c6..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h +++ /dev/null @@ -1,17 +0,0 @@ -/*===---- __stddef_offsetof.h - Definition of offsetof ---------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -/* - * When -fbuiltin-headers-in-system-modules is set this is a non-modular header - * and needs to behave as if it was textual. - */ -#if !defined(offsetof) || \ - (__has_feature(modules) && !__building_module(_Builtin_stddef)) -#define offsetof(t, d) __builtin_offsetof(t, d) -#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_offsetof.h.blob deleted file mode 100644 index 539aeaf963e164a5c9f41a6b64285931845cb45f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1208 zcmb_byH3L}6m?)h3~9v|6!8!sz@ifis7Ndzfk5n7ZsH`St{vI#3(6NetyP39Q0}j}R2l+8 z*0zRV32azW5;B^HZE`T1g_Jw2BA)+3J7+IL`CdKu^#-2(#JDJ&k53<2ZKwP z5a9}ilJYjx)NH-gN9`i6BFw1I$3=ihDP-Ks=e^$=Lg;QUG06U#9t{LZ<4KH^Tj)!V zP)nD3-XAr3+HOqG3&A?R^}N`b4_;#3>m%8$wDH-GOK&%V5fy5GI)ilgcJb7EVtz+_ zfMzRBfMr)lVAf=Gbz8rAoKX$od5UP^nPhs-d>zV3Cdn=7)r`BGK`39MOjC~j9{^yb x(y7cuyq|)|G7!WhPuuf3>jxbD!l?iN diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h deleted file mode 100644 index fd3c893..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h +++ /dev/null @@ -1,20 +0,0 @@ -/*===---- __stddef_ptrdiff_t.h - Definition of ptrdiff_t -------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -/* - * When -fbuiltin-headers-in-system-modules is set this is a non-modular header - * and needs to behave as if it was textual. - */ -#if !defined(_PTRDIFF_T) || \ - (__has_feature(modules) && !__building_module(_Builtin_stddef)) -#define _PTRDIFF_T - -typedef __PTRDIFF_TYPE__ ptrdiff_t; - -#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_ptrdiff_t.h.blob deleted file mode 100644 index 32d638fc83518f98c8a26b3eeaaf128b2a6b5961..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1267 zcmdO5`1dYb?Fs`UgMLPSZmND+VrFqhUSgTPOKNd;Nq&L8Z)JQyQGQlxa!IkiUus23 za7l`O9*`~u(y0}Rxdl0?#rlR8@fjs01$xO0%*i>4dFfO#Ot(D0C_6JRT{k7O2Usfj76Me(_b$wm2k z8IV9BLR)cWRcd?*Tm$Jr2y;kYaeP5hW**om4#nEbMA)61SP`F?lbN1}3)z##?7U!OR5FjC>A!NkDV60&^T6p8e~ID#yjA;=l+1 DOl!>O diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h deleted file mode 100644 index 3dd7b1f..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h +++ /dev/null @@ -1,20 +0,0 @@ -/*===---- __stddef_size_t.h - Definition of size_t -------------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -/* - * When -fbuiltin-headers-in-system-modules is set this is a non-modular header - * and needs to behave as if it was textual. - */ -#if !defined(_SIZE_T) || \ - (__has_feature(modules) && !__building_module(_Builtin_stddef)) -#define _SIZE_T - -typedef __SIZE_TYPE__ size_t; - -#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_size_t.h.blob deleted file mode 100644 index 08e0ce3739858fa0706a9f25f7d644e6a91f05a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1270 zcmb_bzfT)66tc%D0Ue@%MW!rNK?13%0D-6&x>(Mg@6L&1pKJ$`svYRY zzrer1$Wm46KTtuJWa`u|j0{Lf3~jG=P=GEF2p;_8AMbnbeeZjD@b{$tvI`(UiEL1` zMVL+m*+Pp{*NsfkN*k{!S)+l`XqC3ih6$0dR$EJ3q>*x}(Od~9#-y_W7!5cP@dJU) zY)e&VBAyAEvI$7lp1((yz(Y-~5NB1?OAZx_h>3tVLy9oAb%Zp+2_+#_xIqFXXOjz3 z?h&hxD>P0O6UIS}z4+J}AcF>JVZvD~aL>ziWdJW3MVcBJJxtD2DXARP`PaBJRQV3% z&9NB{1S{JWhg6;(h{DvUkVVlT1lqP&rR0~i-L4SP_WfVO@?Hs zH+B~3%khUBbMI~2PeBt%{D2mpXt{&2s2_Pw}f+9|aolWPiX)k?!0mm3uV3&>BhUwa$$A3t8@l~bcAzV#&z^p&xl?~Zf5Oj~VfMPaJm2};-NYM}cT4!K zefB186eeiy@(PYmj6Wag?I3fQ+0VVPZ#zGZPWx!iLa*#qEn;n*FZ??CQ~Cexu{TwQ F{{Ysn&U63( diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h deleted file mode 100644 index bd69f63..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h +++ /dev/null @@ -1,28 +0,0 @@ -/*===---- __stddef_wchar.h - Definition of wchar_t -------------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -#if !defined(__cplusplus) || (defined(_MSC_VER) && !_NATIVE_WCHAR_T_DEFINED) - -/* - * When -fbuiltin-headers-in-system-modules is set this is a non-modular header - * and needs to behave as if it was textual. - */ -#if !defined(_WCHAR_T) || \ - (__has_feature(modules) && !__building_module(_Builtin_stddef)) -#define _WCHAR_T - -#ifdef _MSC_EXTENSIONS -#define _WCHAR_T_DEFINED -#endif - -typedef __WCHAR_TYPE__ wchar_t; - -#endif - -#endif diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@__stddef_wchar_t.h.blob deleted file mode 100644 index 2b0628590b8af3196e1ef75c8a23cc4dcb56eb9e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1266 zcmb`GPfHvz7{(LzAVp+EWcIkC^&q-IPo-5^sRu16{wa72*_q5t+}UJEvbtLo^w_UZ z@Ei2lQ;T0f^rR5uEohvM??dtFVa>6)x5*zATE5s5X( zWV!)>ZqA)(gD!91S9ttq>z59m7XNFJtX@2~6c+Xuh#>c`pXW&GLf zI|GK!IL$V`!5*h4+g6)FYN_ezx6b{Ylf$bz&qnCvoq}PmEydGkhc|Oi_ue>zd3Xoj C!Oa~2 diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h deleted file mode 100644 index dfaad2b..0000000 --- a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h +++ /dev/null @@ -1,39 +0,0 @@ -/*===---- stdbool.h - Standard header for booleans -------------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -#ifndef __STDBOOL_H -#define __STDBOOL_H - -#define __bool_true_false_are_defined 1 - -#if defined(__MVS__) && __has_include_next() -#include_next -#else - -#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L -/* FIXME: We should be issuing a deprecation warning here, but cannot yet due - * to system headers which include this header file unconditionally. - */ -#elif !defined(__cplusplus) -#define bool _Bool -#define true 1 -#define false 0 -#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) -/* Define _Bool as a GNU extension. */ -#define _Bool bool -#if defined(__cplusplus) && __cplusplus < 201103L -/* For C++98, define bool, false, true as a GNU extension. */ -#define bool bool -#define false false -#define true true -#endif -#endif - -#endif /* __MVS__ */ -#endif /* __STDBOOL_H */ diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stdbool.h.blob deleted file mode 100644 index bc6cdcffb16c80c5eb9f63cb80b5067d2806b58c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1461 zcmb`G&ubGw6vt;1#Il62Mlfj+jl}jKwA1EP3Q7q*NYS*=g5YJG?9TpZHZx&n(x#;a zul}ImT@T_({0|f_^&p;G@gI;}1jU=Dt}~mT7j4>R4sU+&-sgSao0(hS_-A$M2p9nR ztVZA_4untfCR`$-Dp?)g-$tvPZ4g@uSSC%mCLKuCEYwVzxKWv6Cy~TJnpx(3-a3z58?b~Ni3DU43I1GadjK#rX5eC!_8xDa8sX83uBA;M~a8$!K zXET1gDMN&bV22>t3pjlXyF#cybso?dHFjg~aERPB+(bAGJUSrYZ}dB(%K-B15@E*$ZDkJUqUfRO{X_GNnvq(TMiHNA|*}N4De* zjT`IY^gchQXgMpFOK5wwLwnJBxAEZ8w_=5{a4) -#undef __need_ptrdiff_t -#undef __need_size_t -#undef __need_rsize_t -#undef __need_wchar_t -#undef __need_NULL -#undef __need_nullptr_t -#undef __need_unreachable -#undef __need_max_align_t -#undef __need_offsetof -#undef __need_wint_t -#include <__stddef_header_macro.h> -#include_next - -#else - -#if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \ - !defined(__need_rsize_t) && !defined(__need_wchar_t) && \ - !defined(__need_NULL) && !defined(__need_nullptr_t) && \ - !defined(__need_unreachable) && !defined(__need_max_align_t) && \ - !defined(__need_offsetof) && !defined(__need_wint_t) -#define __need_ptrdiff_t -#define __need_size_t -/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is - * enabled. */ -#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 -#define __need_rsize_t -#endif -#define __need_wchar_t -#if !defined(__STDDEF_H) || __has_feature(modules) -/* - * __stddef_null.h is special when building without modules: if __need_NULL is - * set, then it will unconditionally redefine NULL. To avoid stepping on client - * definitions of NULL, __need_NULL should only be set the first time this - * header is included, that is when __STDDEF_H is not defined. However, when - * building with modules, this header is a textual header and needs to - * unconditionally include __stdef_null.h to support multiple submodules - * exporting _Builtin_stddef.null. Take module SM with submodules A and B, whose - * headers both include stddef.h When SM.A builds, __STDDEF_H will be defined. - * When SM.B builds, the definition from SM.A will leak when building without - * local submodule visibility. stddef.h wouldn't include __stddef_null.h, and - * SM.B wouldn't import _Builtin_stddef.null, and SM.B's `export *` wouldn't - * export NULL as expected. When building with modules, always include - * __stddef_null.h so that everything works as expected. - */ -#define __need_NULL -#endif -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \ - defined(__cplusplus) -#define __need_nullptr_t -#endif -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -#define __need_unreachable -#endif -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ - (defined(__cplusplus) && __cplusplus >= 201103L) -#define __need_max_align_t -#endif -#define __need_offsetof -/* wint_t is provided by and not . It's here - * for compatibility, but must be explicitly requested. Therefore - * __need_wint_t is intentionally not defined here. */ -#include <__stddef_header_macro.h> -#endif - -#if defined(__need_ptrdiff_t) -#include <__stddef_ptrdiff_t.h> -#undef __need_ptrdiff_t -#endif /* defined(__need_ptrdiff_t) */ - -#if defined(__need_size_t) -#include <__stddef_size_t.h> -#undef __need_size_t -#endif /*defined(__need_size_t) */ - -#if defined(__need_rsize_t) -#include <__stddef_rsize_t.h> -#undef __need_rsize_t -#endif /* defined(__need_rsize_t) */ - -#if defined(__need_wchar_t) -#include <__stddef_wchar_t.h> -#undef __need_wchar_t -#endif /* defined(__need_wchar_t) */ - -#if defined(__need_NULL) -#include <__stddef_null.h> -#undef __need_NULL -#endif /* defined(__need_NULL) */ - -#if defined(__need_nullptr_t) -#include <__stddef_nullptr_t.h> -#undef __need_nullptr_t -#endif /* defined(__need_nullptr_t) */ - -#if defined(__need_unreachable) -#include <__stddef_unreachable.h> -#undef __need_unreachable -#endif /* defined(__need_unreachable) */ - -#if defined(__need_max_align_t) -#include <__stddef_max_align_t.h> -#undef __need_max_align_t -#endif /* defined(__need_max_align_t) */ - -#if defined(__need_offsetof) -#include <__stddef_offsetof.h> -#undef __need_offsetof -#endif /* defined(__need_offsetof) */ - -/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use -__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */ -#if defined(__need_wint_t) -#include <__stddef_wint_t.h> -#undef __need_wint_t -#endif /* __need_wint_t */ - -#endif /* __MVS__ */ diff --git a/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stddef.h.blob b/.ccls-cache/@@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/@usr@lib@clang@22@include@stddef.h.blob deleted file mode 100644 index a95cd902fce90aa41843133c534c8b6afd360d18..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1986 zcmb`H%}*0S6u@VSA85#?krbjaiUH9S=s+Qn#9%6EVg(9S&=3t7m)+^^!gi<5E?=Sv z7Zdg7#S>hKC(lMS@eh!A07>+s9OR~ni3cyVPItH4QV*=a9^Ov&z4v=>-p7VP?&oCl zI)DJFG(*s|sF|uEPNO(6CoP&q$vK>2bb?5hi3Z86HEhYq;BS+^$*h>k>cm7H-B`7( zY(xT8k}ev`0m0g4D4Wy_rA^itPk^$yo;_p<1Tn+9IlAn_r(&00`EV(3 z#A_e+-rjxiVO+Yyh7W7EZNGh(?%crb9Pr^&wtv+j(0Duo+H2zAT1^7<)!YM8f&w;R zftl1}@T3cXWBL1=Up_C=AM+R+gvhw)4gfgQ$bVd#K^p#1!J*(#Bw$OBhXB9@VWBk! z^WQpGZZ8Zc>RpGj^f|7n0=Gj8lfh(Hz?KeiUYL(^V*TMyD|d3WRovfus^amu9D|A8 z#CQz$$NTv?KUi10G@_j7aU&1j8W`aAbrm6<&#*Vx+Z?c^6H6ELCeE0+p2St`v5TDZ{N&xYtIIEowe|*_qZ%quWjYuRhT8+SbZDc(XoS<2 U7E{mUUuR|R?L9Em9vX?kzk0a5*8l(j diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c deleted file mode 100644 index f3ae711..0000000 --- a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "../include/ns.h" -#include "../include/ns_string.h" -#include "../include/ns_http.h" - -int main(void) -{ - ns_println("=== NextStd HTTP GET and POST Demo ==="); - - ns_println("\n[1] Performing HTTP GET..."); - { - ns_autohttp ns_http_response out = {0}; - - ns_error_t err = ns_http_get("https://jsonplaceholder.typicode.com/posts/1", &out); - - if (err == 0) { - ns_println("GET Status: {}", out.status_code); - ns_println("Body: \n{}", out.body); - } else { - ns_println("Failed to GET data: {}", ns_error_message(err)); - } - } - - ns_println("\n[2]: Performing HTTP POST..."); - { - ns_autohttp ns_http_response out = {0}; - - const char* json_payload = "{\n" - " \"title\": \"NextStd HTTP\",\n" - " \"body\": \"Memory safe C is incredible!\",\n" - " \"userId\": 99\n" - "}"; - - ns_println("Sending Payload..."); - - ns_error_t err = ns_http_post("https://jsonplaceholder.typicode.com/posts", json_payload, &out); - - if (err == 0) { - ns_println("POST Status: {}", out.status_code); - ns_println("POSt Response: \n{}", out.body); - } else { - ns_println("POST request failed: {}", ns_error_message(err)); - } - } - - return 0; -} diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/examples@18_http.c.blob deleted file mode 100644 index f082bdfcd41869db79906fd12c90570f9e72f8f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6790 zcmb_hZ)_Y#72iE?oa<#UWa!D-7%LM6+r^j+UjIo>ioBbWGN#4Ye43 za5gcasmJ7`p+^tOGsZ(kDyl%QL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qnI}aBUq6-hd=k0g{ipaAUNCd{Ns-u zdGc+Cj0{;GcS%>Q+K)^}$5w}oGds&lm7|h#F!JzTemlpCUJ+We@7L#N-+p~y!ckFD zbhtQ^Q$k)lj0)T{%zCq1t7kam9fFbOXLwuXxaOJ_ObJf>t<@vK-pc&| zxl|C*YxGz&dQ4Z9VqQwhSv3zAl@XXoE~%#ENK!3C@l{<63;0r^D9yr7oeB#*aIesd z_XwS0mj?}T(R3_*J502t%ik5?+0b0*^HvKN0gj6SscLrxQH&@e*}8F{eB$nT&=VXD zj(gakH+ZNL1*m6}__FxQ0^2>_eGskzppAQaCVCzQAAlBgZh7KUE8qO#wKB-2zE`Cs z7Q^ckX6vvQmj)Zozt4Y=XR!rohkK6lEVdxc@q=o!zNeva3s{GpqdURUj&1o)9&8J) z_PuJ`-r>IkY}-E5{)p8AGw0~;-qG9(1~)drcl#UISUfSQh(2NMpC|~EqLDN5@}wAp zNBchr!uX*>6O&?iJyOu@mXHVK0^Gg}x|EiMj|({+?ue3_oXSCwv}2t@OS-JxpF*)C zBh8YThdrO|5ITlEY=^h=0E2$Tir)}l;92vywk-8e95{vLZmoaDVz@(<^aO?q;|-I| zn>bM0!L}67VjK5#Pjshw7F$>*=kldil+a8F_(pvY0zR*=CIt9%{C5}FwtZ~}IMT*F z{(Jpn9E&aJeBrL&JbQdw`5|;~=jQ<_opB5&XwBjImsc+Rd~U({EA~D}z`-~RwKlYn hdWAR(DG6GrdZC4+3*&H3*iPzS7=h{+TBv=Y{Xb7Ej)(vN diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h deleted file mode 100644 index 31d0e26..0000000 --- a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef NS_H -#define NS_H - -#include "ns_string.h" -#include "ns_print.h" -#include "ns_read.h" - -#endif // !NS_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns.h.blob deleted file mode 100644 index d68f38a08f033141ecf57ca27d140bf270e7c779..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1308 zcmb_byGjE=6rD{#f`wRGDiRAJ8BC*%Vqqadf{+gwCcCpcV|HhjJCm2_2lz{ZUtk%* zKS(LqStZVH%%d`!Y?`^u>)dnhx%U)}??z^b9E7=w817P`xujiu!*tuI7}p2n9@GPK zjm8buH%;SVX`{B0^=TA`Oyjc)!i|ZmE-JbqmBE(4Dm?{lA%lu1z!Fd}xZHpx+QS_U zI20|MlEbwc7Satn9>auK9Uk)uXVharBI<&way0&GpL}Haro|&8X8vLQ63&Q7O=1u- zg(@9A4>RPBXrItf1agVMYN5*aH8aZJ4rd0SAc6XM3x*qbvm_s^0}0Y~Ig|R>fG2!E zi*{>qOQ~?Kcy*CvCtN(wWvVvT)gVcI^}=&jC>=42^g4R_r#Gh!y@uGH%PB1CSlr3y z<6LnmAI@wXcJsmfwG~3hnb1Q0{ImT2-Dr|qdr&&IlP@GYobDZG-#I9xE1Ed={uiES B?WzC( diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h deleted file mode 100644 index 26ad053..0000000 --- a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef NS_ERROR_H -#define NS_ERROR_H - -#ifdef __cplusplus -extern "C" { -#endif - - typedef enum { - NS_SUCCESS = 0, - - // Catch all - NS_ERROR_ANY = 1, - - //ns_io errors - NS_ERROR_IO_READ = 10, - NS_ERROR_IO_WRITE = 11, - NS_ERROR_INVALID_INPUT = 12, - - // ns_string errors - NS_ERROR_STRING_ALLOC = 20, - NS_ERROR_STRING_UTF8 = 21, - - NS_ERROR_OUT_OF_BOUNDS = 22, - } ns_error_t; - - const char* ns_error_message(ns_error_t err); - -#define NS_TRY(err_var, expr) \ - if (((err_var) = (expr)) == NS_SUCCESS) - -#define NS_EXCEPT(err_var, err_type) \ - else if ((err_var) == (err_type) || (err_type) == NS_ERROR_ANY) - -#ifdef __cplusplus - -} - -#endif // __cplusplus - -#endif // !NS_ERROR_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_error.h.blob deleted file mode 100644 index 0abe7211e27bd8ec9cb328a6db4a2abe93f21555..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2219 zcmb`GPi)&%9LJy2(pp{BMXXAjHQL;=Zf0VK2oXq7t=B%uiGHNvX{mlLM7^u<{euy z^f}2BC&gltZfeGSo=6yjk31>h5>fNS#uZhwt)nG$?@syfPrGPy^fw81S;K=zxGltV zaMjjL55@Psy}FCNE9xRv4ZUbK2)Msdt59%=YZV@gW(qlV+g*K#Q)w`6L-v&PLjSIO zS6w@=7Ye&^4Tn2tSqAfZ|9H%KqrUu+j?;1BJd1Se@%KxQn2>k5fb{k4<^P#Vf0Q4< z>{+d(+Vvb!pb0(E-i!L9TrGJ0`a93JF5J~D({Tm5PKd&c65F=mmJr8Li$r8ETme1| zpzdw~!5>$fiPfSi`;=-5^8-`U;1XzC{DAlqZ#O>qv#V8Z%@y!)3L|xX_H-7#3^7@ar7%i24 zd15k^z^U|fP66CV43-U2oNh5xkPnVh6x4BsYFjV<(59|^0VqYDfv)zaAU543g8xPY zA$UQx2L-ZNwFiVVZGxZ|1X0}nFaX<$-Z%I)M!T}Pcs!ZS4nQJ3!5#>=Cm4}Y%~O8i z^tW#%S6-W~E6?CpG;_uguM z(eg6H!dm=f{G*>p&(LfR1P}BD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55GSWwE~jR1vl$YL8Tu+xcr7%Tlq>@n2V9bUc?ohY4wR4{Z%aAP2q67dYsZ?b>guY(8 zZ@Rm?fq1Gp)y1*Te^|(Xj)9k~7KEE1Xa9v=>xv1=ax9*4!44;r5>P zy|Lrw{R-8?1#41d%QO!G%8DFcha|56(k z-M|3*`EVUMYpMj*_rmJHu~@8)LBt~PT)_1L;~lK9+N|LM1-W1?EKCWrzT8n^wvs!r z7Rasoam~OF3@{k9tDp6%p`}4&2w+4pw04=m!$apT{#sZ#J2ED-6)X<|D?XUfnnR46 LaU18~%LDfx49z8i diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h deleted file mode 100644 index a227d46..0000000 --- a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef NS_PRINT_H -#define NS_PRINT_H - -#include -#include "ns_string.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Formatting & Interpolation Types - -// 1. The Tag: Identifies what type is stored in the union -typedef enum ns_type_tag { - NS_TYPE_INT, - NS_TYPE_FLOAT, - NS_TYPE_DOUBLE, - NS_TYPE_BOOL, - NS_TYPE_SIZE_T, - NS_TYPE_CSTR, - NS_TYPE_NS_STRING -} ns_type_tag; - -// 2. The Data: A union that is exactly as large as its largest member -typedef union ns_any_data { - int v_int; - float v_float; - double v_double; - _Bool v_bool; - size_t v_size_t; - const char* v_cstr; - ns_string v_ns_string; -} ns_any_data; - -// 3. The Package: A single struct we can pass to Rust safely -typedef struct ns_any_t { - ns_type_tag tag; - ns_any_data data; -} ns_any_t; - -// 4. Constructor Functions (Shields from strict _Generic type-checking and nested designator warnings) -static inline ns_any_t ns_any_from_int(int v) { ns_any_t a; a.tag = NS_TYPE_INT; a.data.v_int = v; return a; } -static inline ns_any_t ns_any_from_float(float v) { ns_any_t a; a.tag = NS_TYPE_FLOAT; a.data.v_float = v; return a; } -static inline ns_any_t ns_any_from_double(double v) { ns_any_t a; a.tag = NS_TYPE_DOUBLE; a.data.v_double = v; return a; } -static inline ns_any_t ns_any_from_bool(_Bool v) { ns_any_t a; a.tag = NS_TYPE_BOOL; a.data.v_bool = v; return a; } -static inline ns_any_t ns_any_from_size_t(size_t v) { ns_any_t a; a.tag = NS_TYPE_SIZE_T; a.data.v_size_t = v; return a; } -static inline ns_any_t ns_any_from_cstr(const char* v) { ns_any_t a; a.tag = NS_TYPE_CSTR; a.data.v_cstr = v; return a; } -static inline ns_any_t ns_any_from_ns_string(ns_string v) { ns_any_t a; a.tag = NS_TYPE_NS_STRING; a.data.v_ns_string = v; return a; } - -// 5. The Magic Converter: Selects the correct constructor function -#define ns_to_any(x) _Generic((x), \ - int: ns_any_from_int, \ - float: ns_any_from_float, \ - double: ns_any_from_double, \ - _Bool: ns_any_from_bool, \ - size_t: ns_any_from_size_t, \ - char*: ns_any_from_cstr, \ - const char*: ns_any_from_cstr, \ - ns_string: ns_any_from_ns_string \ -)(x) - -// Rust FFI Functions - -// Formatted printing (Our new Rust functions) -void ns_print_fmt_c(const char* fmt, ns_any_t* args, size_t num_args); -void ns_println_fmt_c(const char* fmt, ns_any_t* args, size_t num_args); - -// Single-variable printing (No Newline) -void ns_print_int(int val); -void ns_print_float(float val); -void ns_print_double(double val); -void ns_print_bool(_Bool val); -void ns_print_size_t(size_t val); -void ns_print_string(const char* val); -void ns_print_ns_string(ns_string val); - -// Single-variable printing (Newline) -void ns_println_int(int val); -void ns_println_float(float val); -void ns_println_double(double val); -void ns_println_bool(_Bool val); -void ns_println_size_t(size_t val); -void ns_println_string(const char* val); -void ns_println_ns_string(ns_string val); - -// The Macro Magic (Overloading by Argument Count) - -// 1. Single argument dispatcher (The original generic macros) -#define ns_print_1(x) _Generic((x), \ - int: ns_print_int, \ - float: ns_print_float, \ - double: ns_print_double, \ - _Bool: ns_print_bool, \ - size_t: ns_print_size_t, \ - char*: ns_print_string, \ - const char*: ns_print_string, \ - ns_string: ns_print_ns_string \ -)(x) - -#define ns_println_1(x) _Generic((x), \ - int: ns_println_int, \ - float: ns_println_float, \ - double: ns_println_double, \ - _Bool: ns_println_bool, \ - size_t: ns_println_size_t, \ - char*: ns_println_string, \ - const char*: ns_println_string, \ - ns_string: ns_println_ns_string \ -)(x) - -// 2. Formatted argument dispatchers (Supports up to 8 variables formatted at once) -// ns_print (No newline) -#define ns_print_2(fmt, a) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a)}, 1) -#define ns_print_3(fmt, a, b) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b)}, 2) -#define ns_print_4(fmt, a, b, c) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c)}, 3) -#define ns_print_5(fmt, a, b, c, d) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d)}, 4) -#define ns_print_6(fmt, a, b, c, d, e) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e)}, 5) -#define ns_print_7(fmt, a, b, c, d, e, f) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f)}, 6) -#define ns_print_8(fmt, a, b, c, d, e, f, g) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f), ns_to_any(g)}, 7) -#define ns_print_9(fmt, a, b, c, d, e, f, g, h) ns_print_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f), ns_to_any(g), ns_to_any(h)}, 8) - -// ns_println (With newline) -#define ns_println_2(fmt, a) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a)}, 1) -#define ns_println_3(fmt, a, b) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b)}, 2) -#define ns_println_4(fmt, a, b, c) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c)}, 3) -#define ns_println_5(fmt, a, b, c, d) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d)}, 4) -#define ns_println_6(fmt, a, b, c, d, e) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e)}, 5) -#define ns_println_7(fmt, a, b, c, d, e, f) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f)}, 6) -#define ns_println_8(fmt, a, b, c, d, e, f, g) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f), ns_to_any(g)}, 7) -#define ns_println_9(fmt, a, b, c, d, e, f, g, h) ns_println_fmt_c(fmt, (ns_any_t[]){ns_to_any(a), ns_to_any(b), ns_to_any(c), ns_to_any(d), ns_to_any(e), ns_to_any(f), ns_to_any(g), ns_to_any(h)}, 8) - -// 3. The Router Macros -#define NS_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, NAME, ...) NAME - -#define ns_print(...) \ - NS_GET_MACRO(__VA_ARGS__, ns_print_9, ns_print_8, ns_print_7, ns_print_6, ns_print_5, ns_print_4, ns_print_3, ns_print_2, ns_print_1)(__VA_ARGS__) - -#define ns_println(...) \ - NS_GET_MACRO(__VA_ARGS__, ns_println_9, ns_println_8, ns_println_7, ns_println_6, ns_println_5, ns_println_4, ns_println_3, ns_println_2, ns_println_1)(__VA_ARGS__) - -#ifdef __cplusplus -} -#endif // !__cplusplus - -#endif // !NS_PRINT_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_print.h.blob deleted file mode 100644 index 14c832a60f82c33a06c0fa065f27d3df2f4ad9ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11818 zcmc&a3wRS%x@SVf7@ZCIY0?DJq$JZ)NdKFQxtm1QB*HxAa_+oju-~$yAU+7)9sK_dM6}_K?x&N7&GfA4l7V&fWKF*n$ z&iUW(34=}>ezW8qL?PZEZt?Q%?m*NZa<}tNZ*;yGZsn^M2{n=MJg-NL@-A;pHL|HMX{ChpaGtsJJkFO0kbU(N9G4Y&9s6=Ue zTQtH41C6{)9G{=h2ST1;Ta%X;1mL5|>l6H5cat|Fw75NyFy}|7znY)7zaPh*?d))A-Ka)? z*Tqa*dpOWUgMGHbD`GGtz@_rKS-Ya!-9Za78qEm)QPP*r?%&qlyp=(N;I7_SpHETs zsJ;dv>G(}^Hg4>?YOqH0mC6QJ$*e9f>! z<5peP8yYq)voIZ20xDYpHSrPYo@=K+RxN|7G1izVss`0e15i`$-#@|r>|gVHgK7%5 zH3q$AWh2m3!i?8#{cz{ny+>te)y8TdtQu8g!X7wr$HyO^{6gvt%@+*2MYFsTShPaf z9`60)4Fv@^$go^S7ei4l-jUVK+9RB$JXL`c|WtibVfs=($Js5V-YioB$0&XCh zmK6riXtT?^Fc=7VEm%39ow|E@dPC*CGNvkHRUSoEp{hc_w9_)Xa?O{YUELd#s%=j= z6cuS~n>3^9TNT6u)o+aBi}eceb;ddnL>;Pg0m!0@Ud{?lfBBvykY}@?TtysrzcXp$ zrtlR{$wXEdD>#a(Koyk$ambB5;~Qo+RwP3_Gl{C^pAtXGSiW(qQwCUWEC z_}ok1e6j1V4JV_bTMT&UKnP0;+q*loND#?|FA{DMG?7~n$7NF%&QhtPEXeW^n#j>J zuy`VE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xw)S(~xDKWwtGC1I6_~*h=kl>^}MZ3cFA9Xl0r@{DlJ>9vgbPibxvb z4>WXrMlIavc}yONA|6waSRfgV_g%KyJM29&;(4$uy?1=0HkBG z#>hP`OqugF(aQB2zn?z_?n=I~sBqMuCaBCi8Xa;A0$)ky^1`PosT9pRj)RCaYGb(I)F9amSW+R7#n%u+|{Bs8s{CV=LPVFpio>R}Jw$Aac(uW0$Nzt zsXqDKTP5Gz@W$(Sn5>YD2ZpI=`y3bc3$q-_w8=EkArA`|m=*vXux?Z7AitmLTh`^% z%geB=%bD^rRn|jhuZul4Dnrr;$Mr%g;b*B9eg^r8%=8|tlUgBaiUMn}#^Bf0N_%Qc rU%cVV%Rc!?qZJR9Q)xZ>Sos$wH<1-D?r-FwvS<>4cvxdOD)Ijh_YR77 diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h deleted file mode 100644 index 4d5357d..0000000 --- a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef NS_READ_H -#define NS_READ_H - -#include -#include "ns_error.h" -#include "ns_string.h" - -// Check if we are in C++ -#ifdef __cplusplus -extern "C" { -#endif - - // ----Reading functions------ - ns_error_t ns_read_int(int* ptr); - ns_error_t ns_read_float(float* ptr); - ns_error_t ns_read_double(double* ptr); - ns_error_t ns_read_bool(_Bool* ptr); - ns_error_t ns_read_ns_string(ns_string* ptr); - - // Generic Read macro -#define ns_read(x) _Generic((x), \ - int*: ns_read_int, \ - float*: ns_read_float, \ - double*: ns_read_double, \ - _Bool*: ns_read_bool, \ - ns_string*: ns_read_ns_string \ -)(x) - -#ifdef __cplusplus -} -#endif // !__cplusplus - -#endif // !NS_READ_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_read.h.blob deleted file mode 100644 index 24ce8a1d3e5c513e74a43e05640e8533693b971e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2241 zcmb_cO=#3W6rO3LE~}eOw3HI+x+=<6+(t{O9%{8~g<7@LA9|=iG0o2I#%7Zx$+lf- z@noThhJ8X`8-^A%`}g_iMXlmKCq6A32+h*eZR5GQ4ad7(fOLCuJv*ar#JU5tNxK$w(UQ&-@>lZi;Hy)2Qgvb@ROKuj)j>FM}n=QfaMI?e# zd>!bh0oB&7La?wi*}C^SbKwGqmcSb?@U0m041WkA=kSBa7gN=z&&+^J#g&j!U<0^1 z4{po(>(7Uu_R20CCvZ&|a}3u7aPdOSoVd!Lm;o+r6#F%j@U{T4-a~ABt1KQ-9*(<+ zQ6bubag>Sn0OF?AJ8|8~)7xi2%xH#eCtMrg2_D}0=5bPLytLfKV+FPuW0qle1Ky{B zcih4Dt;c4-gI`nvo&c*Bp(Lz*Fk}#WJX6#aTQzixeoQ9mT)!@R6n}J7x#p&c2$2mK zN0>+lLX5L>Z~dDaQyk+?}TEprRCrN z@H>2{FpBv$zK6li%UyR@u4%p}{hErtIi>1br^b$)`|PJ9dNEH^Ow&>MhyKyHic2no*=4f}>*=NS*6NSUnGtwGKQO`(IBvtlY z{Nky)=NnH2L9Y{3#jXZcRGs)Y4B~3InphQBA%q-E3-<+9QD3=mwu9}W8Q2!KtDJ%P j@T&Lq<@-0g_e=YBw0B6I0I<~0G3_JVBD|`~wO*E=YPR}` diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h deleted file mode 100644 index 9eeef4d..0000000 --- a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef NS_STRING_H -#define NS_STRING_H - -#include -#include -#include "ns_error.h" // <-- Import your new error types! - -#ifdef __cplusplus -extern "C" { -#endif - - // Heap allocation details - typedef struct ns_string_heap { - char *ptr; - size_t capacity; - } ns_string_heap; - - // Union : 24 bytes of inline chars OR the heap struct - typedef union ns_string_data { - char inline_data[24]; - ns_string_heap heap; - } ns_string_data; - - // Final string struct - typedef struct ns_string { - size_t len; - bool is_heap; - ns_string_data data; - } ns_string; - - // ========================================== - // Core String Functions - // ========================================== - - // Safely creates a new string, returning an error if heap allocation fails. - // The result is written directly into the `dest` pointer. - ns_error_t ns_string_new(ns_string* dest, const char* c_str); - - // Safely concatenates two strings, returning an error if heap allocation fails. - // The result is written directly into the `dest` pointer. - ns_error_t ns_string_concat(ns_string* dest, ns_string s1, ns_string s2); - - // Safely frees heap memory if the string used it. - // Safe to call on inline strings (it just zeroes them out). - void ns_string_free(ns_string* s); - -#ifdef __cplusplus -} -#endif // !__cplusplus - -#endif // !NS_STRING_H diff --git a/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h.blob b/.ccls-cache/@home@vaishnav@Desktop@My_Projects@NextStd@nextstd/include@ns_string.h.blob deleted file mode 100644 index f00ded65f310028d8f5c881bc1cb5ec79b957b6a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3803 zcmcguTWl0n7(TOIU|hFbXt$-^ZtzftX4ovdur$PMN<*OGD&^8Dh_S=4d$v0;JG0Kr zw%u|GCI$tG5%k3vUyLse5tIiAL}M^UViXfoqXvVw#2SJjh$4ni#{bN8W|x*rxx{&x z>DiwDKi~JA@BhzEh3 zjZPySSKzC|m-LIdyiD}?yeEXLVdP^eRFRTJrRO0fo71Oi+a#rDPFm6cfT|T2-Umt) zh!=D%E=ybD7PxpK5to#dTu76+AOMdv$p~2@rimux#FVDSvgpReZOz|IAWWAAh+wz@ z_b#CWMA3!3CMi}bcIM8Z39OwH`vp;!dXzE%cPFZ5GCDET%)`MiLs((M~8M=?X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 26 Jun 2026 22:55:22 +0530 Subject: [PATCH 3/5] chore(cliff): Updated cliff.toml Signed-off-by: Vaishnav Sabari Girish --- cliff.toml | 61 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/cliff.toml b/cliff.toml index f4d6dba..169ca55 100644 --- a/cliff.toml +++ b/cliff.toml @@ -1,7 +1,6 @@ # git-cliff ~ configuration file # https://git-cliff.org/docs/configuration - [remote.github] owner = "NextStd" repo = "nextstd" @@ -16,22 +15,43 @@ body = """ ## Unreleased {% endif %} -{% for group, commits in commits | group_by(attribute="group") %} -### {{ group | striptags | trim | upper_first }} -{% for commit in commits %} +{% macro render_group(group_name, emoji) %} + {% set group_commits = commits | filter(attribute="group", value=emoji ~ " " ~ group_name) %} + {% if group_commits | length > 0 %} +### {{ emoji }} {{ group_name }} + {% for commit in group_commits %} - {% if commit.scope %}**({{ commit.scope }})** {% endif %}{{ commit.message | upper_first | trim }} -{% endfor %} -{% endfor %} + {% endfor %} + {% endif %} +{% endmacro %} + +{{ self::render_group(group_name="New features", emoji=":rocket:") }} +{{ self::render_group(group_name="Bug fixes", emoji=":bug:") }} +{{ self::render_group(group_name="Performance", emoji=":zap:") }} +{{ self::render_group(group_name="Refactoring", emoji=":recycle:") }} +{{ self::render_group(group_name="Styling", emoji=":art:") }} +{{ self::render_group(group_name="Build", emoji=":hammer:") }} + +{%- if github -%} +{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %} +### :tada: New Contributors +{%- endif %}\ +{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %} +- @{{ contributor.username }} made their first contribution + {%- if contributor.pr_number %} in [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}){%- endif %} +{%- endfor -%} +{%- endif -%} + +{%- macro remote_url() -%} + https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} +{%- endmacro -%} """ # Remove leading and trailing whitespaces from the changelog's body. trim = true # A Tera template to be rendered as the changelog's footer. -# See https://keats.github.io/tera/docs/#introduction footer = """ - """ # An array of regex based postprocessors to modify the changelog. -# Replace the placeholder `` with a URL. postprocessors = [] [git] @@ -39,27 +59,22 @@ postprocessors = [] # See https://www.conventionalcommits.org conventional_commits = true # Exclude commits that do not match the conventional commits specification. -filter_unconventional = false +filter_unconventional = true # Split commits on newlines, treating each line as an individual commit. split_commits = false commit_parsers = [ - { message = "^feat", group = ":rocket: New features" }, - { message = "^fix", group = ":bug: Bug fixes" }, - { message = "^docs", group = ":page_facing_up: Documentation" }, - { message = "^perf", group = ":zap: Performance" }, - { message = "^chore", group = ":wrench: Miscellaneous" }, - { message = "^refactor", group = ":recycle: Refactoring" }, - { message = "^style", group = ":art: Styling" }, - { message = "^test", group = ":white_check_mark: Testing" }, - { message = "^Merge", group = ":twisted_rightwards_arrows: Pull Requests" }, - { message = "^build", group = ":hammer: Build" }, - { message = "^ci", group = ":construction_worker: CI" }, - { message = ".*", group = ":package: Other" }, + { message = "^feat", group = ":rocket: New features" }, + { message = "^fix", group = ":bug: Bug fixes" }, + { message = "^perf", group = ":zap: Performance" }, + { message = "^refactor", group = ":recycle: Refactoring" }, + { message = "^style", group = ":art: Styling" }, + { message = "^build", group = ":hammer: Build" }, + { message = ".*", skip = true }, ] # An array of regex based parsers to modify commit messages prior to further processing. commit_preprocessors = [{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" }] # Exclude commits that are not matched by any commit parser. -filter_commits = false +filter_commits = true # Order releases topologically instead of chronologically. topo_order = false # Order of commits in each group/release within the changelog. From 154c4d3fd45e9d2ed32af6cd6bc09dc1f2f962b0 Mon Sep 17 00:00:00 2001 From: Vaishnav Sabari Girish Date: Fri, 26 Jun 2026 23:39:46 +0530 Subject: [PATCH 4/5] fix(fixes): resolve HTTP payload corruption and Makefile uninstall bugs - ns_http: Replaced `to_string_lossy()` with raw byte extraction (`to_bytes().to_vec()`) for POST payloads to prevent the silent corruption of non-UTF-8 and binary data. - ns_http: Added explicit UTF-8 validation for GET response bodies, correctly returning `NsError::StringInvalidUtf8` upon failure. - ns_http: Updated null pointer validation in POST requests to return `NsError::InvalidInput` instead of a generic error. - ns_http: Also added bot-check bypass for sites protected by bots - build: Refactored the Makefile `uninstall` target to dynamically sync with `LIBS_TO_INSTALL` (using `addprefix` and `notdir`), fixing the bug where local build caches were targeted instead of system directories. - examples: Fixed capitalization typo in `18_http.c` console output. Signed-off-by: Vaishnav Sabari Girish --- Cargo.lock | 14 ++++++------- Makefile | 5 +---- crates/ns_http/src/lib.rs | 41 ++++++++++++++++++++++++++------------- examples/18_http.c | 2 +- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0cff41a..3919020 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -627,7 +627,7 @@ dependencies = [ [[package]] name = "ns_cmd" -version = "0.2.7" +version = "0.3.0" dependencies = [ "ns_error", "ns_string", @@ -635,21 +635,21 @@ dependencies = [ [[package]] name = "ns_data" -version = "0.2.7" +version = "0.3.0" dependencies = [ "ns_error", ] [[package]] name = "ns_error" -version = "0.2.7" +version = "0.3.0" dependencies = [ "thiserror", ] [[package]] name = "ns_http" -version = "0.2.7" +version = "0.3.0" dependencies = [ "ns_error", "ns_string", @@ -658,7 +658,7 @@ dependencies = [ [[package]] name = "ns_io" -version = "0.2.7" +version = "0.3.0" dependencies = [ "ns_error", "ns_string", @@ -666,14 +666,14 @@ dependencies = [ [[package]] name = "ns_process" -version = "0.2.7" +version = "0.3.0" dependencies = [ "ns_error", ] [[package]] name = "ns_string" -version = "0.2.7" +version = "0.3.0" dependencies = [ "ns_error", ] diff --git a/Makefile b/Makefile index b634e12..2a9989a 100644 --- a/Makefile +++ b/Makefile @@ -71,10 +71,7 @@ uninstall: @echo "Removing NextStd headers from $(INCLUDE_DIR)..." @rm -rf $(INCLUDE_DIR) @echo "Removing NextStd libraries from $(LIB_DIR)..." - @rm -f $(LIB_DIR)/libns_data.a \ - $(LIB_DIR)/libns_io.a \ - $(LIB_DIR)/libns_string.a \ - $(LIB_DIR)/libns_error.a + @rm -f $(addprefix $(LIB_DIR)/, $(notdir $(LIBS_TO_INSTALL))) @echo "Uninstallation complete!" # --- Clean Rules --- diff --git a/crates/ns_http/src/lib.rs b/crates/ns_http/src/lib.rs index de81bb4..58db652 100644 --- a/crates/ns_http/src/lib.rs +++ b/crates/ns_http/src/lib.rs @@ -6,6 +6,9 @@ use ns_error::NsError; use ns_string::{NsString, NsStringData, NsStringHeap, ns_string_free}; use reqwest::blocking::Client; +const BROWSER_USER_AGENT: &str = + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0"; + #[repr(C)] pub struct NsHttpResponse { pub body: NsString, @@ -44,7 +47,7 @@ fn rust_str_to_ns(s: String) -> NsString { } /// # Safety -/// * `url` must be a vald, null-terminated C string +/// * `url` must be a valid, null-terminated C string /// * `output` must point to a valid, zero-initialized `NsHttpResponse` #[unsafe(no_mangle)] pub unsafe extern "C" fn ns_http_get(url: *const c_char, output: *mut NsHttpResponse) -> NsError { @@ -54,10 +57,19 @@ pub unsafe extern "C" fn ns_http_get(url: *const c_char, output: *mut NsHttpResp let url_str = unsafe { CStr::from_ptr(url).to_string_lossy() }; - match reqwest::blocking::get(url_str.as_ref()) { + // Build client with User-Agent to bypass basic bot protections + let client = match Client::builder().user_agent(BROWSER_USER_AGENT).build() { + Ok(c) => c, + Err(_) => return NsError::Any, + }; + + match client.get(url_str.as_ref()).send() { Ok(resp) => { let status = resp.status().as_u16() as c_int; - let body_text = resp.text().unwrap_or_default(); + let body_text = match resp.text() { + Ok(t) => t, + Err(_) => return NsError::StringInvalidUtf8, + }; unsafe { (*output).status_code = status; @@ -71,7 +83,7 @@ pub unsafe extern "C" fn ns_http_get(url: *const c_char, output: *mut NsHttpResp } /// # Safety -/// * `url` must be a vald, null-terminated C string +/// * `url` must be a valid, null-terminated C string /// * `output` must point to a valid, zero-initialized `NsHttpResponse` #[unsafe(no_mangle)] pub unsafe extern "C" fn ns_http_post( @@ -80,18 +92,21 @@ pub unsafe extern "C" fn ns_http_post( output: *mut NsHttpResponse, ) -> NsError { if url.is_null() || body_data.is_null() || output.is_null() { - return NsError::Any; + return NsError::InvalidInput; } let url_str = unsafe { CStr::from_ptr(url).to_string_lossy() }; - let payload_str = unsafe { CStr::from_ptr(body_data).to_string_lossy() }; - - let client = Client::new(); - match client - .post(url_str.as_ref()) - .body(payload_str.into_owned()) - .send() - { + + // FIX: Safely extract raw bytes without mutating non-UTF-8 characters + let payload_bytes = unsafe { CStr::from_ptr(body_data).to_bytes().to_vec() }; + + // Build client with User-Agent + let client = match Client::builder().user_agent(BROWSER_USER_AGENT).build() { + Ok(c) => c, + Err(_) => return NsError::Any, + }; + + match client.post(url_str.as_ref()).body(payload_bytes).send() { Ok(resp) => { let status = resp.status().as_u16() as c_int; let body_text = resp.text().unwrap_or_default(); diff --git a/examples/18_http.c b/examples/18_http.c index f3ae711..b4d236b 100644 --- a/examples/18_http.c +++ b/examples/18_http.c @@ -36,7 +36,7 @@ int main(void) if (err == 0) { ns_println("POST Status: {}", out.status_code); - ns_println("POSt Response: \n{}", out.body); + ns_println("POST Response: \n{}", out.body); } else { ns_println("POST request failed: {}", ns_error_message(err)); } From 0323427e63c17cf0395a2a6a56e9349b60f91483 Mon Sep 17 00:00:00 2001 From: Vaishnav Sabari Girish Date: Fri, 26 Jun 2026 23:54:28 +0530 Subject: [PATCH 5/5] fix(http): centralize HTTP client configuration and update error handling - ns_http: Extracted duplicated `reqwest` client configuration into a single `build_default_client()` helper to prevent config drift between GET and POST requests. - ns_http: Updated error mapping in `ns_http_get` response text parsing to return the generic `NsError::Any` instead of `NsError::StringInvalidUtf8`. Signed-off-by: Vaishnav Sabari Girish --- crates/ns_http/src/lib.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/crates/ns_http/src/lib.rs b/crates/ns_http/src/lib.rs index 58db652..11de965 100644 --- a/crates/ns_http/src/lib.rs +++ b/crates/ns_http/src/lib.rs @@ -46,6 +46,16 @@ fn rust_str_to_ns(s: String) -> NsString { } } +// --- NEW HELPER --- +// Centralizes the client configuration so GET, POST, and any future methods +// use the exact same headers, timeouts, and settings. +fn build_default_client() -> Result { + Client::builder() + .user_agent(BROWSER_USER_AGENT) + .build() + .map_err(|_| NsError::Any) +} + /// # Safety /// * `url` must be a valid, null-terminated C string /// * `output` must point to a valid, zero-initialized `NsHttpResponse` @@ -57,10 +67,10 @@ pub unsafe extern "C" fn ns_http_get(url: *const c_char, output: *mut NsHttpResp let url_str = unsafe { CStr::from_ptr(url).to_string_lossy() }; - // Build client with User-Agent to bypass basic bot protections - let client = match Client::builder().user_agent(BROWSER_USER_AGENT).build() { + // Use the central helper + let client = match build_default_client() { Ok(c) => c, - Err(_) => return NsError::Any, + Err(e) => return e, }; match client.get(url_str.as_ref()).send() { @@ -68,7 +78,7 @@ pub unsafe extern "C" fn ns_http_get(url: *const c_char, output: *mut NsHttpResp let status = resp.status().as_u16() as c_int; let body_text = match resp.text() { Ok(t) => t, - Err(_) => return NsError::StringInvalidUtf8, + Err(_) => return NsError::Any, }; unsafe { @@ -97,13 +107,13 @@ pub unsafe extern "C" fn ns_http_post( let url_str = unsafe { CStr::from_ptr(url).to_string_lossy() }; - // FIX: Safely extract raw bytes without mutating non-UTF-8 characters + // Safely extract raw bytes without mutating non-UTF-8 characters let payload_bytes = unsafe { CStr::from_ptr(body_data).to_bytes().to_vec() }; - // Build client with User-Agent - let client = match Client::builder().user_agent(BROWSER_USER_AGENT).build() { + // Use the central helper + let client = match build_default_client() { Ok(c) => c, - Err(_) => return NsError::Any, + Err(e) => return e, }; match client.post(url_str.as_ref()).body(payload_bytes).send() {