From 1e9b70265052dd1ba5d2ef162f03d11ade5b9173 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Thu, 7 Jul 2022 18:47:59 +0200 Subject: [PATCH] brssl: c2nim-generated spelling (#33) * generate brssl.nim with regenerate.sh as well --- bearssl/abi/brssl.nim | 12 +++++++----- regenerate.sh | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bearssl/abi/brssl.nim b/bearssl/abi/brssl.nim index e7a04aa..4ba073a 100644 --- a/bearssl/abi/brssl.nim +++ b/bearssl/abi/brssl.nim @@ -2,7 +2,6 @@ import "."/[csources, bearssl_x509] {.pragma: importcFunc, cdecl, gcsafe, noSideEffect, raises: [].} -{.pragma: headerFunc, importcFunc, header: "brssl.h".} {.used.} const @@ -16,9 +15,12 @@ const {.compile: bearToolsPath & "files.c".} type - X509NoAnchorContext* {.importc: "x509_noanchor_context", - header: "brssl.h", bycopy.} = object + X509NoanchorContext* {.importc: "x509_noanchor_context", header: "brssl.h", bycopy.} = object vtable* {.importc: "vtable".}: ptr X509Class + inner* {.importc: "inner".}: ptr ptr X509Class -proc initNoAnchor*(xwc: var X509NoAnchorContext, inner: ptr ptr X509Class) {. - importcFunc, importc: "x509_noanchor_init", header: "brssl.h".} +proc x509NoanchorInit*(xwc: var X509NoanchorContext; inner: ptr ptr X509Class) {.importcFunc, + importc: "x509_noanchor_init", header: "brssl.h".} + +proc initNoAnchor*(xwc: var X509NoanchorContext, inner: ptr ptr X509Class) {. + importcFunc, importc: "x509_noanchor_init", header: "brssl.h", deprecated: "x509NoanchorInit".} diff --git a/regenerate.sh b/regenerate.sh index 15cb5a2..2a9e666 100644 --- a/regenerate.sh +++ b/regenerate.sh @@ -1,6 +1,10 @@ #!/bin/sh + +[[ $(c2nim -v) == "0.9.18" ]] || echo "Different c2nim used, check the code" + mkdir -p gen cp bearssl/csources/inc/*.h gen +cp bearssl/csources/tools/brssl.h gen # c2nim gets confused by #ifdef inside struct's unifdef -m -UBR_DOXYGEN_IGNORE gen/*.h @@ -11,7 +15,6 @@ unifdef -m -UBR_DOXYGEN_IGNORE gen/*.h # https://github.com/nim-lang/c2nim/issues/241 # https://github.com/nim-lang/c2nim/issues/242 -[[ $(c2nim -v) == "0.9.18" ]] || echo "Different c2nim used, check the code" c2nim --header --importc --nep1 --prefix:br_ --prefix:BR_ --skipinclude --cdecl --skipcomments gen/*.h rm gen/*.h