Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/code-prettify/run_prettify.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ var IN_GLOBAL_SCOPE = false;
"if," +
"implements," +
"import," +
"in," +
"include," +
"initial," +
"input," +
Expand Down
673 changes: 480 additions & 193 deletions docs/fpp-spec.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/fpp-users-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -18608,7 +18608,7 @@ <h3 id="Writing-C-Plus-Plus-Implementations_Serialization-of-FPP-Values">19.4. S
</div>
<div id="footer">
<div id="footer-text">
Last updated 2026-10-23 09:57:19 -0700
Last updated 2026-10-26 11:08:33 -0700
</div>
</div>
<script src="code-prettify/run_prettify.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions docs/spec/Definitions/Array-Definitions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ The type _T_ is called the *element type* of the array type _T'_.
The expression following the keyword `default` is optional.
If present, it specifies the <<Types_Default-Values,default value>> associated
with the type.
The type of the expression must be
<<Type-Checking_Type-Conversion,convertible to>> _T'_.
The expression must <<Evaluation_Evaluating-Expressions,evaluate to>> a value
that is <<Evaluation_Type-Conversion,convertible to>> _T'_.

The optional format specifier specifies a <<Format-Strings,format string>>.
When displaying the array, the format is applied to each element of the array.
Expand Down
4 changes: 2 additions & 2 deletions docs/spec/Definitions/Constant-Definitions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ _]_
==== Semantics

_expression_ must
<<Evaluation,evaluate>>
to a compile-time constant value _v_. At any model point where the
<<Evaluation_Evaluating-Expressions,evaluate to>>
a compile-time constant value _v_. At any model point where the
<<Scoping-of-Names_Qualified-Identifiers,qualified identifier>> _Q_ refers to
the constant definition according to the
<<Scoping-of-Names_Resolution-of-Qualified-Identifiers,scoping
Expand Down
5 changes: 2 additions & 3 deletions docs/spec/Definitions/Enum-Definitions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ a primitive integer type, called the

There must be at least one enumerated constant.
No two enumerated constants may have the same identifier.
Each enumerated constant must <<Evaluation,evaluate>> to
a compile-time constant whose type is
<<Type-Checking_Type-Conversion,convertible to>> the
Each enumerated constant must <<Evaluation_Evaluating-Expressions,evaluate to>>
a value that is <<Evaluation_Type-Conversion,convertible to>> the
representation type.
No two enumerated constants may have the same value after the conversion.

Expand Down
4 changes: 2 additions & 2 deletions docs/spec/Definitions/Enumerated-Constant-Definitions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ _]_
==== Semantics

If present, _expression_ must
<<Evaluation,evaluate>>
to a compile-time constant value _v_. At any model point where the
<<Evaluation_Evaluating-Expressions,evaluate to>> a value _v_. At any model
point where the
<<Scoping-of-Names_Qualified-Identifiers,qualified identifier>> _Q_ refers to
the enumerated constant definition according to the
<<Scoping-of-Names_Resolution-of-Qualified-Identifiers,scoping
Expand Down
4 changes: 2 additions & 2 deletions docs/spec/Definitions/Struct-Definitions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ translator applies the format to each element.
The expression following the keyword `default` is optional.
If present, it specifies the <<Types_Default-Values,default value>>
associated with the type.
The type of the expression must be
<<Type-Checking_Type-Conversion,convertible to>> _T_.
The expression must <<Evaluation_Evaluating-Expressions,evaluate to>> a value
that is <<Evaluation_Type-Conversion,convertible to>> _T_.
If the expression specifies a value for a member with size
greater than one, then the value is applied to each element.

Expand Down
2 changes: 1 addition & 1 deletion docs/spec/Definitions/Topology-Definitions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ it is specified in the model source.
appearing in a
<<Specifiers_Connection-Graph-Specifiers,direct connection graph>> of _D_,
if _E_ has a port number expression _e_ in the FPP source, then
<<Evaluation,evaluate>> _e_,
<<Evaluation_Evaluating-Expressions,evaluate>> _e_,
<<Type-Checking_Type-Conversion,convert>> the result to a value _n_ of type
_Integer_, and assign the port number _n_ at endpoint _E_ of connection _C_.
Check that _n_ is in bounds for the port instance being numbered.
Expand Down
124 changes: 78 additions & 46 deletions docs/spec/Evaluation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,68 +21,100 @@ The following rules govern the conversion of a value stem:[v_1] of canonical typ
stem:[T_1]
to a value stem:[v_2] of canonical type stem:[T_2].

==== Unsigned Primitive Integer Values

. If stem:[T_1] and stem:[T_2] are both unsigned primitive integer types and
stem:[T_2] is
narrower than stem:[T_1], then construct stem:[v_2] by truncating the
unsigned
binary representation of stem:[v_1] to the width of stem:[v_2]. For
example, converting `0x1234: U16` to `U8` yields `0x34: U8`.

. Otherwise if stem:[T_1] and stem:[T_2] are both unsigned primitive integer
types, then
stem:[v_2] is the integer value of stem:[v_1] at the type of
stem:[v_2]. For example,
converting `0x12: U8` to `U16` yields `0x12: U16`.

==== Signed Primitive Integer Values

. If stem:[T_1] and stem:[T_2] are both signed primitive integer types and
stem:[T_2] is narrower than stem:[T_1], then construct stem:[v_2] by truncating
the two's complement binary representation of stem:[v_1] to the width of
stem:[v_2]. For example, converting `-0x1234: I16` to `I8` yields `-0x34:
I8`.

. Otherwise if stem:[T_1] and stem:[T_2] are both signed primitive integer
types, then stem:[v_2]
is the integer value of stem:[v_1] at the type of stem:[v_2]. For
example, converting `-0x12: I8` to `I16` yields `-0x12: I16`.

==== Primitive Integer Values of Mixed Sign

If stem:[T_1] and stem:[T_2] are primitive integer types with one signed and
one unsigned,
then do the following:

. Construct the value stem:[v] by converting stem:[v_1] to the type
stem:[T], where
stem:[T] is signed if stem:[T_1] is signed and unsigned if
stem:[T_1] is unsigned, and
stem:[T] has the same width as stem:[T_2].
. The type stem:[T_1] must be <<Type-Checking_Type-Conversion,convertible to>>
stem:[T_2].

. Construct stem:[v_2] by converting stem:[v] to stem:[T_2].

For example converting `-1: I8` to `U16` yields `0xFFFF: U16`
. The value stem:[v_1] must be convertible to a value of type stem:[v_2] as
described below.

==== Primitive and Non-Primitive Integer Values

If stem:[T_1] is _Integer_ and stem:[T_2] is a primitive integer type, then
proceed as if stem:[T_1] were a signed primitive integer
type of the narrowest bit width that will hold stem:[v_1].
For example, converting `-0x1234` to `I8` yields `-0x34: I8`.
then check whether the numeric value of
stem:[v_1] is contained in type stem:[T_2].
If it is, then let stem:[v_2] be the element of stem:[T_2] with that
numeric value.
Otherwise an error results.
For example:

* Converting `0x12: Integer` to `U8` yields `0x12: U8`.

* Converting `0x1234: Integer` to `U8` causes an error.

* Converting `-0x12: Integer` to `I8` yields `-0x12: I8`.

* Converting `-0x1234: Integer` to `I8` causes an error.

* Converting `-1: Integer` to `U16` causes an error.

If stem:[T_1] is a primitive integer type and stem:[T_2] is
_Integer_, then stem:[v_2] is the integer value of stem:[v_1]
at type _Integer_. For example, converting
`0xFFFF: U32` to _Integer_ yields `0xFFFF:` _Integer_.

==== Primitive Integer Values

If stem:[T_1] and stem:[T_2] are both primitive integer types,
then proceed as if stem:[T_1] were _Integer_.
For example:

* Converting `0x12: U16` to `U8` yields `0x12: U8`.

* Converting `0x12: U8` to `U16` yields `0x12: U16`.

* Converting `0x1234: U16` to `U8` causes an error.

* Converting `-0x12: I16` to `I8` yields `-0x12: I8`.

* Converting `-0x1234: I16` to `I8` causes an error.

* Converting `-1: I8` to `U16` causes an error.

==== Floating-Point Values

We use the standard rules for IEEE floating-point values to convert
among integer values to and from floating-point values and
integer values to and from floating-point values and
floating-point values to and from each other.

We say that a floating-point value is a *finite number*
if it is not `+` or `-` `Nan` or `Inf`.
Attempting any of the following conversions causes an error:

* stem:[T_1] is a floating-point type, stem:[v_1] is not a
finite number, and stem:[T_2] is an integer type.

* stem:[T_1] is `F64`, stem:[T_2] is `F32`, stem:[v_1]
is a finite number, and the result of the conversion
would not be a finite number.

* stem:[T_1] is a floating-point type, stem:[T_2] is a primitive integer type,
stem:[v_1] is a finite number, and stem:[v_1] is larger than the largest value
or smaller than the smallest value that may be represented at stem:[T_2].

==== Range Values

If either of stem:[T_1] and stem:[T_2] is a <<Types_Range-Types,range type>>,
then do the following:

. If stem:[T_1] is a range type and stem:[T_2] is a primitive numeric type,
then let stem:[v_2] be the result of
<<Evaluation_Type-Conversion,converting>> the primitive integer
or floating-point value stem:[v_1] to stem:[T_2].

. Otherwise if stem:[T_1] is a primitive integer type or a range type
and stem:[T_2] is a range type, then

.. Let stem:[T'_2] be the base type of stem:[T_2].

.. Let stem:[v_2] be the result of
<<Evaluation_Type-Conversion,converting>> the primitive integer
or floating-point value stem:[v_1] to stem:[T'_2].

.. Check that the numeric value of stem:[v_2] is in range for
stem:[T_2].

. Otherwise the conversion is invalid.

==== String Values

If stem:[T_1] is a string type and stem:[T_2] is a string type,
Expand Down
11 changes: 6 additions & 5 deletions docs/spec/Expressions/Array-Expressions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ is a comma.

. The sequence must have at least one element.

. The types of the expressions in the sequence must be
. The types of the expressions in the sequence must have a
<<Type-Checking_Computing-a-Common-Type_Lists-of-Types,
convertible to a common type>>.
common type>>.

. The value of the expression is formed by computing
the value of each element and then converting all the
elements to the common type.
. The value of the expression is formed by
<<Evaluation_Evaluating-Expressions,evaluating>>
each element to a value and then <<Evaluation_Type-Conversion,converting>>
each value to the common type.

==== Example

Expand Down
11 changes: 6 additions & 5 deletions docs/spec/Expressions/Array-Subscript-Expressions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ stem:[e_1] `[` stem:[e_2] `]`:
<<Types_Internal-Types_Anonymous-Array-Types,anonymous array type>>
with element type _T_ and size _n_.

. The type of stem:[e_2] must be <<Type-Checking_Type-Conversion,convertible to>>
<<Types_Internal-Types_Integer,_Integer_>>.
. The type of stem:[e_2] must be <<Type-Checking_Type-Conversion,convertible
to>> <<Types_Internal-Types_Integer,_Integer_>>.
stem:[e_2] must
<<Evaluation,evaluate>> to a value _m_ after
<<Evaluation_Type-Conversion,conversion>> to _Integer_.
_m_ must be greater than or equal to zero and less than _n_.
<<Evaluation_Evaluating-Expressions,evaluate to>> a value
that is <<Evaluation_Type-Conversion,convertible to>> _Integer_.
After conversion, the value _m_ must be greater than or equal to zero and less
than _n_.

. Evaluation of stem:[e_1] `[` stem:[e_2] `]` occurs as follows:

Expand Down
1 change: 1 addition & 0 deletions docs/spec/Lexical-Elements.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ hook
id
if
import
in
include
initial
input
Expand Down
8 changes: 5 additions & 3 deletions docs/spec/Specifiers/Command-Specifiers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ If there are no parameters, the list may be omitted.

* The optional expression _e_ following `opcode` specifies the numeric
opcode for the command.
If _e_ is present, its type must be convertible to
<<Types_Internal-Types_Integer,_Integer_>>, and _e_ must evaluate
to a nonnegative integer.
If _e_ is present, it must <<Evaluation_Evaluating-Expressions,evaluate to>> a
value that is
<<Evaluation_Type-Conversion,convertible to>>
<<Types_Internal-Types_Integer,_Integer_>>.
After conversion, the value _n_ must be nonnegative.
If _e_ is not present, then the default opcode is either zero (for the first
opcode appearing in a component) or the previous opcode plus one.

Expand Down
2 changes: 1 addition & 1 deletion docs/spec/Specifiers/Connection-Graph-Specifiers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ array of port instances.
The type of _e_ must be a
<<Types_Internal-Types_Numeric-Types,numeric type>>, and
_e_ must
<<Evaluation,evaluate>> to a compile-time constant
<<Evaluation_Evaluating-Expressions,evaluate to>> a compile-time constant
that becomes a non-negative integer _n_ when
<<Evaluation_Type-Conversion,converted to>> type _Integer_.
_n_ must lie in the range [0,2^31^) and must be in bounds for the
Expand Down
16 changes: 8 additions & 8 deletions docs/spec/Specifiers/Container-Specifiers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ _]_

. The optional expression _e_ after the keyword `id` specifies the
numeric identifier for the container.
If _e_ is present, then the type of _e_ must be
<<Type-Checking_Type-Conversion,convertible to>>
<<Types_Internal-Types_Integer,_Integer_>>, and _e_ must evaluate
to a nonnegative integer.
If _e_ is present, then _e_ must <<Evaluation_Evaluating-Expressions,evaluate
to>> a value that is <<Evaluation_Type-Conversion,convertible to>>
<<Types_Internal-Types_Integer,_Integer_>>.
After conversion, the value _n_ must be nonnegative.
If _e_ is not present, then the
default identifier is either zero (for the first container appearing in a
component) or the previous container identifier plus one.

. The optional expression _e_ after the keywords `default` `priority`
specifies a downlink priority for the container.
This priority can be overridden by the command that downlinks the data.
If _e_ is present, then the type of _e_ must be
<<Type-Checking_Type-Conversion,convertible to>>
<<Types_Internal-Types_Integer,_Integer_>>, and _e_ must evaluate
to a nonnegative integer.
If _e_ is present, then _e_ must <<Evaluation_Evaluating-Expressions,evaluate
to>> a value that is <<Evaluation_Type-Conversion,convertible to>>
<<Types_Internal-Types_Integer,_Integer_>>.
After conversion, the value _n_ must be nonnegative.

==== Examples

Expand Down
27 changes: 12 additions & 15 deletions docs/spec/Specifiers/Event-Specifiers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ If there are no parameters, the list may be omitted.

* The optional expression _e_ following `id` specifies the numeric
identifier for instances of the event.
If _e_ is present, then the type of _e_ must be convertible to
<<Types_Internal-Types_Integer,_Integer_>>, and _e_ must evaluate
to a nonnegative integer.
If _e_ is present, then _e_ must <<Evaluation_Evaluating-Expressions,evaluate
to>> a value that is <<Evaluation_Type-Conversion,convertible to>>
<<Types_Internal-Types_Integer,_Integer_>>.
After conversion, the value _n_ must be nonnegative.
If _e_ is not present, then the default identifier is either zero (for the
first
event appearing in a component) or the previous event identifier plus one.
Expand All @@ -69,9 +70,10 @@ argument whose type is a <<Types_Internal-Types_Numeric-Types,numeric type>>.

** The expression _e_ following `throttle` specifies the *maximum throttle
count* for instances of _E_.
The type of _e_ must be convertible to
<<Types_Internal-Types_Integer,_Integer_>> and must evaluate to an integer
in the range stem:[[1, 2^31)].
_e_ must <<Evaluation_Evaluating-Expressions,evaluate to>> a value that is
<<Evaluation_Type-Conversion,convertible to>>
<<Types_Internal-Types_Integer,_Integer_>>.
After conversion, the value _n_ must be in the range stem:[[1, 2^31)].
When throttling is specified for an event _E_,
the framework maintains a *throttle count* for _E_.
The throttle count
Expand All @@ -84,16 +86,11 @@ count for identifier _E_ is reset.
period*.
_e_ must satisfy the following rules:

*** The type of _e_ must be convertible to the
*** _e_ must <<Evaluation_Evaluating-Expressions,evaluate to >> a value that is
<<Evaluation_Type-Conversion,convertible to>> the
<<Types_Internal-Types_Anonymous-Struct-Types,
anonymous struct type>> _T =_ `{ seconds: U32, useconds: U32 }`.

*** After conversion to _T_, _e_ must evaluate to an
<<Values_Anonymous-Struct-Values,anonymous struct value>>
`{ seconds =` _s_ `: U32, useconds =` _u_ `: U32 }`.

*** _s_ must be in the range stem:[[0, 2^32)] and _u_ must be in the range
stem:[[0,10^6)].
anonymous struct type>> _T =_ `{ seconds: U32, useconds: U32 in [0, 1000000)
}`.

+
+
Expand Down
Loading
Loading