Param flags
Console program65 lines of .st210 lines of generated Cbuilds as C and Rust
3 bob 2 true 2.500000 Item 0 is a Item 1 is b
On this page
The .st files#
intent.st
structop {
type_app {
exec = {
lang = "C"
}
}
lib_provider {
core = {
source = "StructOp/core"
version = "@latest"
}
}
}main.st
parameter "n" {
type = Int
position = 1
}
parameter "name" {
type = String
position = 2
default = "anon"
}
parameter "items" {
type = String
position = 3
rest = true
}
parameter "verbose" {
type = Bool
default = false
}
parameter "scale" {
type = Float
default = 1.5
}
ability "print" "All" {
message = "${param.n} ${param.name} ${length(param.items)} ${param.verbose} ${param.scale}"
}
ability "for" "Each" {
counter = ability.value.i
from = 0
while = data.value.i.current < length(param.items)
next = data.value.i.current + 1
body = [ability.print.Item]
depends_on = [ability.print.All]
}
ability "print" "Item" {
message = "Item ${data.value.i.current} is ${param.items[data.value.i.current]}"
}vars.st
ability "value" "i" {
type = Int
initial = 0
}
data "value" "i" {
of = ability.value.i
}Input, plan and generated C#
args.txt · command-line arguments
args.txt · command-line arguments
--verbose
3
--scale
2.5
bob
a
bstructop plan
structop plan
# program.app will be created
+ program.app (.structop/build/app)
+ ability.print.All
+ ability.for.Each
+ ability.print.Item
+ ability.value.i
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-runGenerated main.rs (the same .st built as Rust)
To inspect this generated file, select Rust in intent.st, initialize the project and export its source.
Export locally
structop init
structop apply -source -no-runTry it
cd param-flags # a folder holding the .st files above
structop init
structop plan
structop apply -- --verbose 3 --scale 2.5 bob a b