# red/system

Published articles for red/system.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Red/System: New Features

DevFeed: [Red/System: New Features](<https://devfeed.tech/articles/red-system-new-features-22378.md>)

Original publisher: [Read original article](<https://www.red-lang.org/2020/08/redsystem-new-features.html>)

Author: Nenad Rakocevic (noreply@blogger.com)

Published: 2020-08-20T10:54:00Z

Content type: release

Language: en

Sources: [Red](<https://devfeed.tech/sources/red.md>)

Topics: [Red](<https://devfeed.tech/topics/red.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [arrays](<https://devfeed.tech/tags/arrays.md>), [atomic](<https://devfeed.tech/tags/atomic.md>), [bugfixes](<https://devfeed.tech/tags/bugfixes.md>), [compilation](<https://devfeed.tech/tags/compilation.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [features](<https://devfeed.tech/tags/features.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [fpu](<https://devfeed.tech/tags/fpu.md>), [ia-32](<https://devfeed.tech/tags/ia-32.md>), [literal-arrays](<https://devfeed.tech/tags/literal-arrays.md>), [math](<https://devfeed.tech/tags/math.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [pointers](<https://devfeed.tech/tags/pointers.md>), [red-system](<https://devfeed.tech/tags/red-system.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [vfp](<https://devfeed.tech/tags/vfp.md>)

### AI overview

An overview of recent Red/System features, including subroutines, atomic and stack intrinsics, FPU status access, and changes to literal arrays.

### Source excerpt

In the past months, many new features were added to Red/System, the low-level dialect embedded in Red. Here is a sum up if you missed them. Subroutines During the work on the low-level parts of the new Red lexer, the need arised for intra-function factorization abilities to keep the lexer code as DRY as possible. Subroutines were introduced to solve that. They act as the GOSUB directive from Basic language. They are defined as a separate block of code inside a function's body and are called like regular functions (but without any arguments). So they are much lighter and faster than real function calls and require just one slot of stack space to store the return address. The declaration syntax is straightforward: <name>: [<body>] <name> : subroutine's name (local variable). <body> : subroutine's code (regular R/S code). To define a subroutine, you need to declare a local variable with the subroutine! datatype, then set that variable to a block of code. You can then invoke the subroutine by calling its name from anywhere in the function body (but after the subroutine own definition). Here is a first example of a fictive function processing I/O events: process: func [buf [byte-ptr!] event [integer!] return: [integer!] /local log do-error [subroutine!] ][ log: [print-line [">>" tab e "<<"]] do-error: [print-line ["** Error:" e] return 1] switch event [ EVT_OPEN [e: "OPEN" log unless connect buf [do-error]] EVT_READ [e: "READ" log unless receive buf [do-error]] EVT_WRITE [e: "WRITE" log unless send buf [do-error]] EVT_CLOSE [e: "CLOSE" log unless close buf [do-error]] default [e: "<unknown>" do-error] ] 0 ] This second example is more complete. It shows how subroutines can be combined and how values can be returned from a subroutine: #enum modes! [ CONV_UPPER CONV_LOWER CONV_INVERT ] convert: func [mode [modes!] text [c-string!] return: [c-string!] /local lower? upper? alpha? do-conv [subroutine!] delta [integer!] s [c-string!] c [byte!] ][ lower?: [all [#"a" <= c c <= #