package snippet:plugin@0.1.1; interface types { enum lang { c, cxx, rust, } enum mode { /// Compile the code to object compile, /// Expand the macro expand, /// Compile the code to assembly assemble, /// Compile the code and link the object to executable link, } enum error-type { /// Not support given mode invalid-mode, /// Not support given mode when link objects invalid-mode-for-link, /// Not support given optimization level invalid-opt-level, /// Not support given language standard invalid-standard, /// Not found given binary invalid-binary, /// Invalid language, not supported invalid-language, /// Invalid option string invalid-optstr, /// Can not get optset resource from resource table invalid-optset-resource, /// Can not get services resource from resource table invalid-services-resource, /// Failed read/write command stdin/stdout command-io-failed, /// Command need stdin for write command-need-stdin, /// Failed invoke command command-invoke-failed, /// Command spawn failed command-spawn-failed, /// Initialize optset failed optset-init-failed, /// Can not access value of optset optset-access-value-failed, /// There are no codes for compile empty-code, /// Can not create directory create-dir-failed, /// Can not create file create-file-failed, /// Can not initialize rustyline init-rustyline-failed, /// Can not read line from rustyline rustyline-io-failed, } record binary { path: string, args: list, } record source { path: string, } record object { path: string, } variant output { binary(binary), source(source), object(object), } record target { clean: bool, output: output, codes: list, cmd-result: cmd-result, } record cmd-result { out: list, err: list, ret: s32, } record slient { stderr: bool, stdout: bool, } resource optset { constructor(); default: static func() -> result; /// Add an option to the option set add-opt: func(opt: string) -> result; get-val-bool: func(name: string) -> result; get-val-str: func(name: string) -> result; get-val-int: func(name: string) -> result; get-vals-str: func(name: string) -> result, error-type>; } resource services { constructor(); /// Return the debug value of services debug: func() -> result; /// Return the language of services lang: func() -> result; /// Return all the aguments of services args: func() -> result, error-type>; /// Return the compile mode of services mode: func() -> result; /// Set the language of services set-lang: func(language: lang) -> result<_, error-type>; /// Set the debug value of services set-debug: func(debug: bool) -> result<_, error-type>; /// Set the compile mode of services set-mode: func(mode: mode) -> result<_, error-type>; /// Add a arguments to services add-arg: func(arg: string) -> result<_, error-type>; /// Append a arguments to services add-args: func(args: list) -> result<_, error-type>; /// Find the executable binary in PATH find-bin: static func(bin: string) -> result; /// Invoke the command invoke-cmd: static func(bin: string, args: list, stdin: list, slient: slient) -> result; /// Read from stdin until line match end read-from-stdin: static func(end: string) -> result, error-type>; /// Log message to debug channel log-debug: static func(log: string) -> result<_, error-type>; /// Create a temp directory for objects create-tmpdir: static func(prefix: string) -> result; /// Create a temp file with given content create-tmpfile: static func(tmpdir: string, ext: string, content: list) -> result; } }