Declarations
Public Only
interface Module
enum LabJobType {
Executable,
ProcessingOnly,
Library,
JITExecutable,
ToCTranslation,
ToChemicalTranslation,
CBI
}
enum OutputMode {
Debug,
DebugComplete,
DebugQuick,
ReleaseFast,
ReleaseSmall,
ReleaseSafe
}
interface LabJob
struct LabJobCBI : LabJob
enum CBIFunctionType {
ReplacementNode,
SymResDeclareTopLevelNode,
InitializeLexer,
SymResLinkSignatureValue,
ParseMacroValue,
SymResLinkSignatureNode,
ParseMacroNode,
ParseMacroTopLevelNode,
ParseMacroMemberNode,
SymResNode,
SymResValue,
ReplacementNodeDeclare,
ReplacementValue,
SemanticTokensPut,
FoldingRangesPut,
TransformerMain
}
struct DependencySymbolInfo {
var symbols : span<ImportSymbol>
var alias : string_view
var location : u64
}
enum ConflictResolutionStrategy {
Default,
OverridePrevious,
PreferNewerVersion,
PreferOlderVersion,
RaiseError,
KeepPrevious
}
interface BuildContext
func new_package(self : &BuildContext, type : ModuleType, package_kind : PackageKind, scope_name : &string_view, name : &string_view, dependencies : span<ModuleDependency>) : *Module
func set_module_symbol_info(self : &BuildContext, module : *Module, index : uint, info : &DependencySymbolInfo) : void
func get_cached(self : &BuildContext, job : *LabJob, scope_name : &string_view, name : &string_view) : *Module
func add_dependency(self : &BuildContext, job : *LabJob, module : *Module, info : *DependencySymbolInfo) : void
adds the module to given job (as a dependency)
put the given before the existing job, so it is done before it
func link_system_lib(self : &BuildContext, job : *LabJob, name : &string_view, module : *Module) : void
would link this system library into the job of whoever consumes this module
func add_compiler_interface(self : &BuildContext, module : *Module, interface : &string_view) : bool
adds the given compiler interface to the module
allows to include c header in the module
func translate_to_chemical(self : &BuildContext, module : *Module, output_path : &string_view) : *LabJob
translate a module to chemical
func translate_to_c(self : &BuildContext, name : &string_view, output_path : &string_view) : *LabJob
translate a chemical module to c file
build executable using module dependencies
compiles and runs the given executables instantly using jit
build a dynamic library using executable dependencies
build a cbi by given name, that can be used to integrate with compiler
sets the environment to testing mode
func index_cbi_fn(self : &BuildContext, job : *LabJobCBI, key : &string_view, fn_name : &string_view, fn_type : CBIFunctionType) : bool
indexes a function from cbi, so it can be called when required
add a linkable object (.o file)
check if argument given to chemical compiler
get the argument given to chemical compiler
remove the argument given to chemical compiler
define a definition, that you can access using defined compiler function
un-define a definition
invoke llvm dll tool with given cli args
invoke ranlib tool with given cli args
invoke lib tool with given cli args
invoke ar with given cli args
func set_conflict_resolution_strategy(self : &BuildContext, job : *LabJob, strategy : ConflictResolutionStrategy) : void
sets the conflict resolution strategy for the job
func fetch_job_dependency(self : &BuildContext, job : *LabJob, dep : &ImportRepo, strategy : ConflictResolutionStrategy) : bool
fetches a remote dependency for the job
func fetch_mod_dependency(self : &BuildContext, job : *LabJob, mod : *Module, dep : &ImportRepo, strategy : ConflictResolutionStrategy) : bool
fetches a remote dependency for the module
func new_module(ctx : &BuildContext, type : ModuleType, scope_name : &string_view, name : &string_view, dependencies : span<ModuleDependency>) : *Module
func new_app_module(ctx : &BuildContext, type : ModuleType, scope_name : &string_view, name : &string_view, dependencies : span<ModuleDependency>) : *Module
func directory_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, dependencies : span<ModuleDependency>) : *Module
func new_module_with_deps(ctx : &BuildContext, type : ModuleType, package_kind : PackageKind, scope_name : &string_view, name : &string_view, dependencies : span<*Module>) : *Module
func c_file_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
a single .c file
func cpp_file_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
a single .cpp file
func object_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view) : *Module
a single .o file
func chemical_dir_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
directory module
func directory_app_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
func make() : ImportSymbol
struct ImportRepo {
var scope : string_view
var name : string_view
var origin : string_view
var from : string_view
var subdir : string_view
var version : string_view
var branch : string_view
var commit : string_view
var alias : string_view
var symbols : span<ImportSymbol>
var location : u64
}
interface AppBuildContext : BuildContext
launch an executable at the path
func on_finished(self : &AppBuildContext, lambda : func(*void) : void, data : *void) : void
something you'd want to be invoked when lab build has finished
func add_compiler_interfaces(ctx : &BuildContext, mod : *Module, interfaces : span<string_view>) : void
func create_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, dir_path : &string_view, dependencies : span<*Module>, interfaces : span<string_view>) : *Module
func default_get(ctx : &BuildContext, buildFlag : *bool, cached : **Module, build : func(*BuildContext) : *Module) : *Module
func file_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
func translate_file_to_chemical(ctx : &BuildContext, c_path : &string_view, output_path : &string_view) : *LabJob
allows to include headers in the module
func index_def_cbi_fn(ctx : &BuildContext, job : *LabJobCBI, name : &string_view, type : CBIFunctionType) : void
-----------------------------------------------------
func build_mod_file_path(ctx : &BuildContext, job_name : &string_view, mod_scope : &string_view, mod_name : &string_view, file : &string_view) : string
func build_llvm_ir_path(ctx : &BuildContext, job_name : &string_view, mod_scope : &string_view, mod_name : &string_view) : string
func build_asm_path(ctx : &BuildContext, job_name : &string_view, mod_scope : &string_view, mod_name : &string_view) : string
func build_bitcode_path(ctx : &BuildContext, job_name : &string_view, mod_scope : &string_view, mod_name : &string_view) : string