Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-geocore

Source of release 0.7.6

0.7.6 / tests / script / main.lucb

## luce-geocore's Script node API checks (`luc test` runs them): the geometry API, the
## cook and its parameters, the text scan, and the child protocol run against this very
## program started as a child (`--l3d PORT` makes it serve test cooks).
import c
import platform
import strings
from luce_std import files
from luce_geocore.script import serve
import api
import edits
import calls
import process

pub func main(arguments: str[]) -> i32!:
    if arguments.length == 3 and (arguments[1] == "--l3d" or arguments[1] == "--request"):
        return try serve(arguments, process.child_cook)
    try api.building()
    try api.attributes()
    try api.reshaping()
    try api.grouping()
    try api.families()
    try api.locking()
    try api.version()
    try edits.vertices()
    try edits.arrays()
    try edits.volumes()
    try edits.volume_handles()
    try calls.verbs()
    try calls.cooking()
    try calls.scanning()
    # This program, by its full path (Windows names it without its .exe).
    var buffer: u8[1024]
    let named = try strings.format(buffer, f"{arguments[0]}.exe") if platform.windows and not strings.ends_with(arguments[0], ".exe") else arguments[0]
    let terminated = try strings.copy(named)
    defer strings.release(terminated)
    let program = try files.canonical((c.str)terminated)
    defer program.release()
    try process.run_all(program.value)
    return 0