Skip to content

Instantly share code, notes, and snippets.

View sebres's full-sized avatar
🛠️
WiP

Sergey G. Brester sebres

🛠️
WiP
View GitHub Profile
@sebres
sebres / multi-thread-eval-tcl-vs-python.tcl
Last active November 1, 2021 17:29
Multi-threaded evaluation Tcl vs. Python (with GIL)
#
# IMPORTANT:
# note to get correct results you should warm up Tcl and Python,
# so better execute it 3 times before you take results for
# the comparison
## ============================================================
## Tcl
## ============================================================
@sebres
sebres / uuid-ffidl.tcl
Created September 19, 2019 20:04
Tcl/C ffi -- example illustrating how simple one can create C-binding within tcl using ffidl
## -------------------------------------------------------------------------------
## ::uuid -- Generate UUID
##
## Example illustrating how simple one can create C-binding within tcl using ffidl
## -------------------------------------------------------------------------------
# ::uuid creator (with on demand binding):
proc ::uuid {args} {
# create _fdl_uuid binding to UuidCreate :
ffidl::callout ::_fdl_uuid {pointer-var} int [ffidl::symbol rpcrt4.dll UuidCreate] stdcall
@sebres
sebres / json-encode.c
Created April 11, 2019 15:49
json-encode.c -- small C-module to get native json escape in Tcl
/*
* json-encode.c --
*
* Small module to get native json escape in tcl.
*
* Compile:
* mingw: gcc -O2 -DUSE_TCL_STUBS=1 -I$tcl/win -I$tcl/generic json-encode.c -shared -o json.dll libtclstub87.a
* *nix: gcc -O2 -DUSE_TCL_STUBS=1 -I$tcl/unix -I$tcl/generic json-encode.c -shared -o json.so libtclstub87.a
*
* Usage: