api

lab.ch

Declarations in lab.ch

46 declarationslab

Declarations

Public only
ModuleType#
Publicenum
enum ModuleType { File, CFile, CPPFile, ObjFile, Directory }
PackageKind#
Publicenum
enum PackageKind { Library, Application }
ModuleChecksOptions#
Publicstruct
struct ModuleChecksOptions { var bounds : bool var overflow : bool var null : bool }
make#
functionConstructor
func make() : ModuleChecksOptions
ModuleOptions#
Publicstruct
struct ModuleOptions { var safety : bool var checks : ModuleChecksOptions var safe_mode : string_view var stack_protector : string_view var optimization_level : int }
make#
functionConstructor
func make() : ModuleOptions
Module#
Publicinterface
interface Module
getType#
Publicfunction
func getType(self : &Module) : ModuleType
getScopeName#
Publicfunction
func getScopeName(self : &Module) : string_view
getName#
Publicfunction
func getName(self : &Module) : string_view
getBitcodePath#
Publicfunction
func getBitcodePath(self : &Module) : string_view
setBitcodePath#
Publicfunction
func setBitcodePath(self : &Module, path : &string_view) : void
getObjectPath#
Publicfunction
func getObjectPath(self : &Module) : string_view
setObjectPath#
Publicfunction
func setObjectPath(self : &Module, path : &string_view) : void
getLlvmIrPath#
Publicfunction
func getLlvmIrPath(self : &Module) : string_view
setLlvmIrPath#
Publicfunction
func setLlvmIrPath(self : &Module, path : &string_view) : void
getAsmPath#
Publicfunction
func getAsmPath(self : &Module) : string_view
setAsmPath#
Publicfunction
func setAsmPath(self : &Module, path : &string_view) : void
getOptions#
Publicfunction
func getOptions(self : &Module) : *ModuleOptions
LabJobType#
Publicenum
enum LabJobType { Executable, JITExecutable, Library, ToCTranslation, ToChemicalTranslation, ProcessingOnly, CBI, Interpretation }
LabJobStatus#
Publicenum
enum LabJobStatus { Pending, Launched, Success, Failure }
OutputMode#
Publicenum
enum OutputMode { Debug, DebugQuick, DebugComplete, ReleaseFast, ReleaseSmall, ReleaseSafe }
LabJob#
Publicinterface
interface LabJob
getType#
Publicfunction
func getType(self : &LabJob) : LabJobType
getName#
Publicfunction
func getName(self : &LabJob) : string_view
getAbsPath#
Publicfunction
func getAbsPath(self : &LabJob) : string_view
getBuildDir#
Publicfunction
func getBuildDir(self : &LabJob) : string_view
getStatus#
Publicfunction
func getStatus(self : &LabJob) : LabJobStatus
getTargetTriple#
Publicfunction
func getTargetTriple(self : &LabJob) : string_view
getMode#
Publicfunction
func getMode(self : &LabJob) : OutputMode
getTarget#
Publicfunction
func getTarget(self : &LabJob) : &TargetData
setAbsPath#
Publicfunction
func setAbsPath(self : &LabJob, path : string_view) : void
set absolute path
LabJobCBI#
Publicinterface
interface LabJobCBI : LabJob
CBIFunctionType#
Publicenum
enum CBIFunctionType { InitializeLexer, ParseMacroValue, ParseMacroNode, ParseMacroTopLevelNode, ParseMacroMemberNode, SymResDeclareTopLevelNode, SymResLinkSignatureNode, SymResLinkSignatureValue, SymResNode, SymResValue, ReplacementNodeDeclare, ReplacementNode, ReplacementValue, SemanticTokensPut, FoldingRangesPut, TransformerMain }
DependencySymbolInfo#
Publicstruct
struct DependencySymbolInfo { var symbols : span<ImportSymbol> var alias : string_view var location : u64 }
ModuleDependency#
Publicstruct
struct ModuleDependency { var module : *Module var info : *DependencySymbolInfo }
ConflictResolutionStrategy#
Publicenum
enum ConflictResolutionStrategy { Default, PreferNewerVersion, PreferOlderVersion, RaiseError, OverridePrevious, KeepPrevious }
BuildContext#
Publicinterface
interface BuildContext
getAnnotationController#
Publicfunction
func getAnnotationController(self : &BuildContext) : *AnnotationController
new_package#
Publicfunction
func new_package(self : &BuildContext, type : ModuleType, package_kind : PackageKind, scope_name : &string_view, name : &string_view, dependencies : span<ModuleDependency>) : *Module
set_module_symbol_info#
Publicfunction
func set_module_symbol_info(self : &BuildContext, module : *Module, index : uint, info : &DependencySymbolInfo) : void
get_cached#
Publicfunction
func get_cached(self : &BuildContext, job : *LabJob, path : &string_view) : *Module
set_cached#
Publicfunction
func set_cached(self : &BuildContext, job : *LabJob, path : &string_view, module : *Module) : void
add_path#
Publicfunction
func add_path(self : &BuildContext, module : *Module, path : &string_view) : void
add_dependency#
Publicfunction
func add_dependency(self : &BuildContext, job : *LabJob, module : *Module, info : *DependencySymbolInfo) : void
add_module#
Publicfunction
func add_module(self : &BuildContext, job : *LabJob, module : *Module) : void
adds the module to given job (as a dependency)
put_job_before#
Publicfunction
func put_job_before(self : &BuildContext, newJob : *LabJob, existingJob : *LabJob) : void
put the given before the existing job, so it is done before it
ship_file#
Publicfunction
func ship_file(self : &BuildContext, job : *LabJob, path : &string_view) : void
add_lib_search_path#
Publicfunction
func add_lib_search_path(self : &BuildContext, job : *LabJob, path : &string_view, module : *Module) : void
would add this library search path into the job
add_compiler_interface#
Publicfunction
func add_compiler_interface(self : &BuildContext, module : *Module, interface : &string_view) : bool
adds the given compiler interface to the module
resolve_condition#
Publicfunction
func resolve_condition(self : &BuildContext, job : *LabJob, condition : &string_view) : bool
include_header#
Publicfunction
func include_header(self : &BuildContext, module : *Module, header : &string_view) : void
allows to include c header in the module
translate_to_chemical#
Publicfunction
func translate_to_chemical(self : &BuildContext, module : *Module, output_path : &string_view) : *LabJob
translate a module to chemical
translate_to_c#
Publicfunction
func translate_to_c(self : &BuildContext, name : &string_view, output_path : &string_view) : *LabJob
translate a chemical module to c file
build_exe#
Publicfunction
func build_exe(self : &BuildContext, name : &string_view) : *LabJob
build executable using module dependencies
run_jit_exe#
Publicfunction
func run_jit_exe(self : &BuildContext, name : &string_view) : *LabJob
compiles and runs the given executables instantly using jit
build_dynamic_lib#
Publicfunction
func build_dynamic_lib(self : &BuildContext, name : &string_view) : *LabJob
build a dynamic library using executable dependencies
build_interpretation#
Publicfunction
func build_interpretation(self : &BuildContext, name : &string_view) : *LabJob
build an interpretation job, that interprets the main function
build_cbi#
Publicfunction
func build_cbi(self : &BuildContext, name : &string_view) : *LabJobCBI
build a cbi by given name, that can be used to integrate with compiler
set_environment_testing#
Publicfunction
func set_environment_testing(self : &BuildContext, job : *LabJob, value : bool) : void
sets the environment to testing mode
contains_cbi#
Publicfunction
func contains_cbi(self : &BuildContext, key : &string_view) : bool
have we built this cbi (job) before
set_contains_cbi#
Publicfunction
func set_contains_cbi(self : &BuildContext, key : &string_view) : void
set that this cbi (job) has been built
index_cbi_fn#
Publicfunction
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_object#
Publicfunction
func add_object(self : &BuildContext, job : *LabJob, path : &string_view) : void
add a linkable object (.o file)
build_path#
Publicfunction
func build_path(self : &BuildContext) : string_view
get build
has_arg#
Publicfunction
func has_arg(self : &BuildContext, name : &string_view) : bool
check if argument given to chemical compiler
get_arg#
Publicfunction
func get_arg(self : &BuildContext, name : &string_view) : string_view
get the argument given to chemical compiler
remove_arg#
Publicfunction
func remove_arg(self : &BuildContext, name : &string_view) : void
remove the argument given to chemical compiler
define#
Publicfunction
func define(self : &BuildContext, job : *LabJob, name : &string_view) : bool
define a definition, that you can access using defined compiler function
undefine#
Publicfunction
func undefine(self : &BuildContext, job : *LabJob, name : &string_view) : bool
un-define a definition
invoke_dlltool#
Publicfunction
func invoke_dlltool(self : &BuildContext, string_arr : span<string_view>) : int
invoke llvm dll tool with given cli args
invoke_ranlib#
Publicfunction
func invoke_ranlib(self : &BuildContext, string_arr : span<string_view>) : int
invoke ranlib tool with given cli args
invoke_lib#
Publicfunction
func invoke_lib(self : &BuildContext, string_arr : span<string_view>) : int
invoke lib tool with given cli args
invoke_ar#
Publicfunction
func invoke_ar(self : &BuildContext, string_arr : span<string_view>) : int
invoke ar with given cli args
set_conflict_resolution_strategy#
Publicfunction
func set_conflict_resolution_strategy(self : &BuildContext, job : *LabJob, strategy : ConflictResolutionStrategy) : void
sets the conflict resolution strategy for the job
fetch_job_dependency#
Publicfunction
func fetch_job_dependency(self : &BuildContext, job : *LabJob, dep : &ImportRepo, strategy : ConflictResolutionStrategy) : bool
fetches a remote dependency for the job
fetch_mod_dependency#
Publicfunction
func fetch_mod_dependency(self : &BuildContext, job : *LabJob, mod : *Module, dep : &ImportRepo, strategy : ConflictResolutionStrategy) : bool
fetches a remote dependency for the module
add_include_dir#
Publicfunction
func add_include_dir(self : &BuildContext, module : *Module, path : &string_view) : void
adds an include directory for the module
new_module#
PublicfunctionExtension
func new_module(ctx : &BuildContext, type : ModuleType, scope_name : &string_view, name : &string_view, dependencies : span<ModuleDependency>) : *Module
new_app_module#
PublicfunctionExtension
func new_app_module(ctx : &BuildContext, type : ModuleType, scope_name : &string_view, name : &string_view, dependencies : span<ModuleDependency>) : *Module
directory_module#
PublicfunctionExtension
func directory_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, dependencies : span<ModuleDependency>) : *Module
make_deps#
function
func make_deps(vec : &vector<ModuleDependency>, dependencies : span<*Module>) : void
new_module_with_deps#
PublicfunctionExtension
func new_module_with_deps(ctx : &BuildContext, type : ModuleType, package_kind : PackageKind, scope_name : &string_view, name : &string_view, dependencies : span<*Module>) : *Module
c_file_module#
PublicfunctionExtension
func c_file_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
a single .c file
cpp_file_module#
PublicfunctionExtension
func cpp_file_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
a single .cpp file
object_module#
PublicfunctionExtension
func object_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view) : *Module
a single .o file
empty_module#
PublicfunctionExtension
func empty_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view) : *Module
directory module
chemical_dir_module#
PublicfunctionExtension
func chemical_dir_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
directory module
directory_app_module#
PublicfunctionExtension
func directory_app_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
ImportSymbol#
Publicstruct
struct ImportSymbol { var parts : span<string_view> var alias : string_view }
make#
functionConstructor
func make() : ImportSymbol
ImportRepo#
Publicstruct
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 orphan_branch : bool var commit : string_view var alias : string_view var symbols : span<ImportSymbol> var location : u64 }
AppBuildContext#
Publicinterface
interface AppBuildContext : BuildContext
add_compiler_interfaces#
PublicfunctionExtension
func add_compiler_interfaces(ctx : &BuildContext, mod : *Module, interfaces : span<string_view>) : void
create_module#
PublicfunctionExtension
func create_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, dir_path : &string_view, dependencies : span<*Module>, interfaces : span<string_view>) : *Module
default_get#
PublicfunctionExtension
func default_get(ctx : &BuildContext, buildFlag : *bool, cached : **Module, build : func(*BuildContext) : *Module) : *Module
file_module#
PublicfunctionExtension
func file_module(ctx : &BuildContext, scope_name : &string_view, name : &string_view, path : &string_view, dependencies : span<*Module>) : *Module
translate_file_to_chemical#
PublicfunctionExtension
func translate_file_to_chemical(ctx : &BuildContext, c_path : &string_view, output_path : &string_view) : *LabJob
include_headers#
PublicfunctionExtension
func include_headers(ctx : &BuildContext, module : *Module, headers : span<string_view>) : void
allows to include headers in the module
index_def_cbi_fn#
PublicfunctionExtension
func index_def_cbi_fn(ctx : &BuildContext, job : *LabJobCBI, name : &string_view, type : CBIFunctionType) : void
build_job_dir_path#
PublicfunctionExtension
func build_job_dir_path(ctx : &BuildContext, job_name : &string_view) : string
-----------------------------------------------------
job_dir_path#
PublicfunctionExtension
func job_dir_path(ctx : &BuildContext, job : *LabJob) : string
build_mod_file_path#
PublicfunctionExtension
func build_mod_file_path(ctx : &BuildContext, job_name : &string_view, mod_scope : &string_view, mod_name : &string_view, file : &string_view) : string
build_llvm_ir_path#
PublicfunctionExtension
func build_llvm_ir_path(ctx : &BuildContext, job_name : &string_view, mod_scope : &string_view, mod_name : &string_view) : string
build_asm_path#
PublicfunctionExtension
func build_asm_path(ctx : &BuildContext, job_name : &string_view, mod_scope : &string_view, mod_name : &string_view) : string
build_bitcode_path#
PublicfunctionExtension
func build_bitcode_path(ctx : &BuildContext, job_name : &string_view, mod_scope : &string_view, mod_name : &string_view) : string
llvm_ir_path#
PublicfunctionExtension
func llvm_ir_path(ctx : &BuildContext, job : *LabJob, mod : *Module) : string
asm_path#
PublicfunctionExtension
func asm_path(ctx : &BuildContext, job : *LabJob, mod : *Module) : string
bitcode_path#
PublicfunctionExtension
func bitcode_path(ctx : &BuildContext, job : *LabJob, mod : *Module) : string
lab#
Publicnamespace
namespace lab
find_last_pos_of_or#
function
func find_last_pos_of_or(str : *char, len : size_t, value : char, value2 : char) : int
parent_path#
function
func parent_path(str : string_view) : string
curr_dir_of#
Publicfunction
func curr_dir_of(path : *char, len : size_t) : string
TODO: remove retained, once runtime magic val support is available
curr_dir#
Publicfunction
func curr_dir() : string
view_of#
Publicfunction
func view_of(path : *char, len : size_t) : string_view
TODO: remove retained, once runtime magic val support is available
get_my_path#
Publicfunction
func get_my_path() : string_view
appended_str#
Publicfunction
func appended_str(str : string, path : *char) : string
TODO: remove retained, once runtime magic val support is available
rel_path_to#
Publicfunction
func rel_path_to(path : *char) : string