1 # The ucode Scripting Language 2 3 The ucode language is a small, general-purpose scripting language that resembles 4 ECMAScript syntax. It can be used as a standalone interpreter or embedded into 5 host applications. Ucode supports template mode with control flow and expression 6 logic statements embedded in Jinja-like markup blocks. 7 8 The development of ucode was motivated by the need to rewrite the OpenWrt 9 firewall framework using nftables. Initially intended as a template processor, 10 ucode evolved into a versatile scripting language for various system scripting 11 tasks. Its design goals include easy integration with C applications, efficient 12 handling of JSON data and complex data structures, support for OpenWrt's ubus 13 message bus system, and a comprehensive set of built-in functions inspired by 14 Perl 5. 15 16 Ucode provides the ability to embed code logic into plain text templates, 17 supports JSON parsing and serialization, has distinct array and object types, 18 includes built-in support for bit operations and regular expressions, and offers 19 bindings for relevant Linux and OpenWrt APIs. It follows ECMAScript syntax for 20 familiarity and reusability of existing tooling, emphasizes synchronous 21 programming flow, aims for a small executable size, and can be embedded into C 22 host applications. 23 24 In summary, ucode is a synchronous scripting language resembling ECMAScript, 25 designed for template processing, system scripting tasks, and integration into C 26 applications, with features such as JSON support, comprehensive built-in 27 functions, and bindings for relevant APIs. 28 29 ## Installation 30 31 The *ucode* package should be already preinstalled on modern OpenWrt releases. 32 33 To learn how to install it on other systems, refer to the 34 [Installation Section](https://ucode.mein.io/#installation) in the 35 documentation. 36 37 ## Documentation 38 39 The most up-to-date documentation is hosted at the 40 [ucode documentation portal](https://ucode.mein.io/). 41 42 You can build the documentation yourself by running `npm install` followed by 43 `npm run doc` in the cloned repository. The generated documentation will be 44 placed in the `docs/` directory. 45 46 ## Examples 47 48 Examples for embedding ucode into C applications can be found in the 49 [`examples/` directory](https://github.com/jow-/ucode/tree/master/examples). 50 51 Notable OpenWrt programs *embedding* ucode are the 52 [OpenWrt ubus rpc daemon](https://github.com/openwrt/rpcd) and the 53 [Tiny uhttpd web server](https://github.com/openwrt/uhttpd). 54 55 Some ucode scripting examples can be found in the ucode 56 [testcase sources](https://github.com/jow-/ucode/tree/master/tests/custom). 57 58 Projects using ucode scripting include the 59 [OpenWrt LuCI web interface](https://github.com/openwrt/luci) and the 60 [OpenWrt firewall4 framework](https://github.com/openwrt/firewall4).
This page was automatically generated by LXR 0.3.1. • OpenWrt