Enum
Console program44 lines of .st119 lines of generated C
FALSE
On this page
The .st files#
intent.st
structop {
type_app {
exec = {
lang = "C"
}
}
lib_provider {
core = {
source = "StructOp/core"
version = "@latest"
}
}
}main.st
ability "set" "Init" {
target = ability.value.b_var
value = BOOLEAN.no
}
ability "if" "Check" {
condition = data.value.b_var.current == BOOLEAN.yes
then = [ability.print.True]
else = [ability.print.False]
depends_on = [ability.set.Init]
}
ability "print" "True" {
message = "TRUE"
}
ability "print" "False" {
message = "FALSE"
}vars.st
ability "enum" "BOOLEAN" {
values = [no, yes]
}
ability "value" "b_var" {
type = BOOLEAN
}
data "value" "b_var" {
of = ability.value.b_var
}Input, plan and generated C#
structop plan
structop plan
# program.app will be created
+ program.app (.structop/build/app)
+ ability.set.Init
+ ability.if.Check
+ ability.print.True
+ ability.print.False
+ ability.enum.BOOLEAN
+ ability.value.b_var
Plan: 1 to add, 0 to change, 0 to destroy.Generated main.c
To inspect this generated file, select C in intent.st, initialize the project and export its source.
Export locally
structop init
structop apply -source -no-runTry it
cd c-enum # a folder holding the .st files above
structop init
structop plan
structop apply