{"id":15375043,"url":"https://github.com/bovine/nodetcl","last_synced_at":"2025-10-12T01:41:33.375Z","repository":{"id":46029605,"uuid":"2611482","full_name":"bovine/nodetcl","owner":"bovine","description":"Node.JS extension to allow Tcl code to be invoked from JavaScript","archived":false,"fork":false,"pushed_at":"2024-07-08T17:04:18.000Z","size":147,"stargazers_count":19,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T14:05:44.176Z","etag":null,"topics":["javascript","nodejs","tcl-command","tcl-extension"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bovine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-10-20T06:49:01.000Z","updated_at":"2024-03-13T20:52:33.000Z","dependencies_parsed_at":"2024-11-08T11:01:00.028Z","dependency_job_id":"872f809e-ee84-4e06-b36c-4da0b7e772f5","html_url":"https://github.com/bovine/nodetcl","commit_stats":{"total_commits":26,"total_committers":5,"mean_commits":5.2,"dds":0.3846153846153846,"last_synced_commit":"53f335f549ce5c88e80f6772911d5a9eb8bdec2a"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bovine/nodetcl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bovine%2Fnodetcl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bovine%2Fnodetcl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bovine%2Fnodetcl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bovine%2Fnodetcl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bovine","download_url":"https://codeload.github.com/bovine/nodetcl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bovine%2Fnodetcl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009797,"owners_count":26084648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","tcl-command","tcl-extension"],"created_at":"2024-10-01T14:00:56.999Z","updated_at":"2025-10-12T01:41:33.369Z","avatar_url":"https://github.com/bovine.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NodeTcl\n\nNodeTcl is a native Node extension that embeds a Tcl interpreter within the Node.js environment, allowing you to invoke Tcl commands from within JavaScript code.\n\nThis is especially useful for leveraging existing Tcl code or packages in a new Node.js application.\n\n\n## Installation\n\nJust run `make` and a shared-library named `nodetcl.node` will be created.\n\nCompilation has only been tested on FreeBSD 8.2 with node-0.4.12 and tcl-8.5.10.\n\n\n## Example\n\nIncluded is an `example1.js` which contains the following:\n\n```js\nvar tcl = require('./nodetcl.node');\nvar interp = new tcl.NodeTcl();\nconsole.log(interp.eval(\"expr 6*7\"));\n```\n\nOnce you have built the extension, you can run it with:\n\n```bash\n  node example1.js\n```\n\nWhich will print simply:\n\n```js\n  42\n```\n\n## Methods\n\n* `eval(string)` executes a string containing one or more Tcl commands, returning the result.\n* `call(command, ...)` executes a single Tcl command with explicit arguments, returning the result.\n* `proc(name, body)` declares a new Tcl command that invokes the specified JavaScript function body.\n* `getStacktrace()` returns Tcl's stacktrace of the last error that occured.\n* `setTimeLimit(seconds)` sets a time limit (in seconds) for all subsequent 'call' or 'eval' calls, a limit of 0 disables this.\n* `getTimeLimit()` returns the current time limit setting.\n* `makeSafe()` converts the interpreter into a safe interpreter.\n* `deleteProc(name)` removes a proc from the interpreter (also works on default procs, such as `exit`).\n* `process_events(allEvents)` allows pending Tcl events to be processed.  If the argument is false, only one pending event will be processed.\n\n### Call vs Eval\n\nThe `call` method differs from `eval` in that the arguments are not evaluated (no need to escape special characters). It takes an arbitrary amount of arguments and executes them as a Tcl statement:\n\n```js\ninterp.call(\"puts\", \"[hello world]\")\n```\n\nWhich will return:\n\n```js\n  [hello world]\n```\n\n`call` also accepts JavaScript arrays (will be converted to Tcl lists) and simple key-value-mapping objects (will be converted to Tcl dicts) as arguments:\n\n```js\ninterp.call(\"llength\", [1, 2, 3, 4, 5])\n```\n\nWhich will return:\n\n```js\n  5\n```\n\n`eval` and `call` both convert their Tcl return values to JavaScript data types: lists become arrays, dicts become objects, and numbers are returned as numbers.\n\nReturn values from custom procs can also have different types, just like call's arguments:\n\n```js\ninterp.proc(\"foo\", function() { return [\"foo\", \"bar\"] })\n```\n\n## Known Limitations\n\n* The Tcl event loop is not automatically invoked after `eval` or `call` returns, so any Tcl timers or events will not be triggered.  To keep the Tcl event loop alive in an asyncronous Node-compatible style, you must periodically invoke `interp.process_events()`.  See the included `example3.js` for an example of how to do this.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbovine%2Fnodetcl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbovine%2Fnodetcl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbovine%2Fnodetcl/lists"}