• source navigation  • diff markup  • identifier search  • freetext search  • 


  1 # The ucode Scripting Language
  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.
  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.
 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.
 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.
 29 ## Installation
 31 The *ucode* package should be already preinstalled on modern OpenWrt releases.
 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.
 37 ## Documentation
 39 The most up-to-date documentation is hosted at the
 40 [ucode documentation portal](https://ucode.mein.io/).
 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.
 46 ## Examples
 48 Examples for embedding ucode into C applications can be found in the
 49 [`examples/` directory](https://github.com/jow-/ucode/tree/master/examples).
 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).
 55 Some ucode scripting examples can be found in the ucode
 56 [testcase sources](https://github.com/jow-/ucode/tree/master/tests/custom).
 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