about summary refs log tree commit diff stats
path: root/src/bindings
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-07-04 18:31:42 +0200
committerbptato <nincsnevem662@gmail.com>2023-07-04 18:31:42 +0200
commitaf1d9de37938a37dc0368be242c44a1ab5b83a56 (patch)
tree822bdc68bd2d62964f097277012f4baf3d19d1dc /src/bindings
parent515bbf076848e238aaf4368db954c7f51cfff481 (diff)
downloadchawan-af1d9de37938a37dc0368be242c44a1ab5b83a56.tar.gz
Add libregexp header to libregexp binding
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/libregexp.nim14
-rw-r--r--src/bindings/quickjs.nim13
2 files changed, 12 insertions, 15 deletions
diff --git a/src/bindings/libregexp.nim b/src/bindings/libregexp.nim
index ecc0813a..c26111fd 100644
--- a/src/bindings/libregexp.nim
+++ b/src/bindings/libregexp.nim
@@ -6,14 +6,16 @@ const
   LRE_FLAG_UTF16* = 1 shl 4
   LRE_FLAG_STICKY* = 1 shl 5
 
+{.passC: "-Ilib/".}
+
+{.push header: "quickjs/libregexp.h", importc.}
 proc lre_compile*(plen: ptr cint, error_msg: cstring, error_msg_size: cint,
-                  buf: cstring, buf_len: csize_t, re_flags: cint,
-                  opaque: pointer): ptr uint8 {.importc.}
+  buf: cstring, buf_len: csize_t, re_flags: cint, opaque: pointer): ptr uint8
 
 proc lre_exec*(capture: ptr ptr uint8, bc_buf: ptr uint8, cbuf: ptr uint8,
-               cindex: cint, clen: cint, cbuf_type: cint,
-               opaque: pointer): cint {.importc.}
+  cindex: cint, clen: cint, cbuf_type: cint, opaque: pointer): cint
 
-proc lre_get_capture_count*(bc_buf: ptr uint8): cint {.importc.}
+proc lre_get_capture_count*(bc_buf: ptr uint8): cint
 
-proc lre_get_flags*(bc_buf: ptr uint8): cint {.importc.}
+proc lre_get_flags*(bc_buf: ptr uint8): cint
+{.pop.}
diff --git a/src/bindings/quickjs.nim b/src/bindings/quickjs.nim
index c438ae21..7ff8fd0f 100644
--- a/src/bindings/quickjs.nim
+++ b/src/bindings/quickjs.nim
@@ -1,12 +1,7 @@
-const lib = "lib/"
-const hlib = "lib/"
-const qjsheader = "<quickjs/quickjs.h>"
-
-when lib != "":
-  {.passL: "-L" & lib.}
-when hlib != "":
-  {.passC: "-I" & hlib.}
-{.passL: "-lquickjs -lm -lpthread".}
+const qjsheader = "quickjs/quickjs.h"
+
+{.passC: "-Ilib/".}
+{.passL: "-Llib/ -lquickjs -lm -lpthread".}
 
 const                         ##  all tags with a reference count are negative
   JS_TAG_FIRST* = -10           ##  first negative tag