### Install llcppg and Dependencies Source: https://pkg.go.dev/github.com/maturesurfac/llcppg Installs necessary system libraries and llcppg's build tools using brew, apt-get, and llgo install commands. ```bash brew install cjson # macos apt-get install libcjson-dev # linux llgo install ./_xtool/llcppsymg llgo install ./_xtool/llcppsigfetch go install ./cmd/llcppcfg go install ./cmd/gogensig go install . ``` -------------------------------- ### Get Cppg Configuration from Path Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Retrieves the Cppg configuration from a specified file path. ```go func GetCppgCfgFromPath(filePath string) (*llcppg.Config, error) ``` -------------------------------- ### C to Go Type Mapping Example Source: https://pkg.go.dev/github.com/maturesurfac/llcppg Shows a sample mapping table from C types to Go type names used by llcppg. ```text cJSON CJSON cJSON_Hooks Hooks cJSON_bool Bool ``` -------------------------------- ### llcppg Configuration Example (cjson) Source: https://pkg.go.dev/github.com/maturesurfac/llcppg A sample llcppg.cfg file for generating LLGo bindings for the cjson library. It specifies package name, compiler flags, headers, library flags, and name prefixes to trim. ```json { "name": "cjson", "cflags": "$(pkg-config --cflags libcjson)", "include": ["cJSON.h","cJSON_Utils.h"], "libs": "$(pkg-config --libs libcjson libcjson_utils)", "trimPrefixes": ["cJSONUtils_","cJSON_"], "cplusplus": false, "deps": ["c"], "mix": false, "typeMap":{} } ``` -------------------------------- ### Run Single Generated Package Demo Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/llcppgtest/demo Tests a single LLCPPG conversion case. It validates the configuration, generates the converted package, verifies it builds with llgo, and runs example programs. Panics on failure. ```go func RunGenPkgDemo(demoRoot string, confDir string) ``` -------------------------------- ### Get Output Directory Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Returns the directory where generated Go files will be placed. ```go func (p *Package) GetOutputDir() string ``` -------------------------------- ### Get Include Paths Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Retrieves the include paths for C or C++ compilation. ```go func GetIncludePaths(isCpp bool) []string ``` -------------------------------- ### llcppg Symbol Table Configuration Source: https://pkg.go.dev/github.com/maturesurfac/llcppg An example of the `llcppg.symb.json` file used to customize function name generation and method/function conversion. ```json [ { "mangle": "cJSON_CreateObject", "c++": "cJSON_CreateObject()", "go": "CreateObject" }, { "mangle": "cJSON_AddItemToObject", "c++": "cJSON_AddItemToObject(cJSON *, const char *, cJSON *)", "go": "(*CJSON).AddItemToObject" }, { "mangle": "cJSON_PrintUnformatted", "c++": "cJSON_PrintUnformatted(const cJSON *)", "go": "(*CJSON).PrintUnformatted" }, ] ``` -------------------------------- ### RunGenPkgDemo Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/llcppgtest/demo Tests a single LLCPPG conversion case in the given demo directory. This involves reading configuration, running LLCPPG, verifying the generated package builds with llgo, and running example programs. ```APIDOC ## RunGenPkgDemo ### Description Tests a single LLCPPG conversion case in the given demo directory. The testing process includes: 1. Reading and validating the llcppg.cfg configuration file 2. Running LLCPPG to generate the converted package 3. Verifying the generated package can be built using llgo 4. Running example programs in the demo subdirectory that use the generated package. The function will panic if any step in the testing process fails. ### Signature ```go func RunGenPkgDemo(demoRoot string, confDir string) ``` ### Parameters * `demoRoot` (string) - Path to the root directory of a single demo case. * `confDir` (string) - Path to the configuration directory relative to `demoRoot`, defaults to "." if empty. ``` -------------------------------- ### Get Location Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Retrieves the file, line, column, and offset from a Clang source location. ```go func GetLocation(loc clang.SourceLocation) (file clang.File, line c.Uint, column c.Uint, offset c.Uint) ``` -------------------------------- ### Get Generated Package Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Retrieves the underlying gogen.Package representation. ```go func (p *Package) GetGenPackage() *gogen.Package ``` -------------------------------- ### Get Include Paths Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/syspath Retrieves the system's include paths. This function is part of the syspath package. ```go func GetIncludePaths() []string ``` -------------------------------- ### Customize Type Name Mapping Source: https://pkg.go.dev/github.com/maturesurfac/llcppg Example of `llcppg.cfg` configuration to change a C type name to a different Go type name. ```json { "typeMap": { "cJSON": "JSON" } } ``` -------------------------------- ### Get String Argument Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/args Retrieves a string command-line argument. If the argument is not found, it returns the specified default value. ```go func StringArg(arg string, defaultValue string) string ``` -------------------------------- ### Get Library Paths Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/syspath Retrieves the system's library paths. This function is part of the syspath package. ```go func GetLibPaths() []string ``` -------------------------------- ### Get Public Data from Path Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Retrieves public data, typically in a map[string]string format, from a specified file path. ```go func GetPubFromPath(filePath string) (map[string]string, error) ``` -------------------------------- ### Get Clang Resource Directory Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Retrieves the Clang resource directory. This function is a temporary measure to avoid calling exec.Command directly in llsigfetch. ```go func ClangResourceDir() string ``` -------------------------------- ### HeaderFileToGo Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/names Converts a C/C++ header file path to a Go file name. For example, '/path/to/foo.h' becomes 'foo.go' and '/path/to/_intptr.h' becomes 'X_intptr.go'. ```APIDOC ## func HeaderFileToGo(incPath string) string ### Description Converts a C/C++ header file path to a Go file name. For example, '/path/to/foo.h' becomes 'foo.go' and '/path/to/_intptr.h' becomes 'X_intptr.go'. ### Signature ```go func HeaderFileToGo(incPath string) string ``` ``` -------------------------------- ### HeaderFileToGo Conversion Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/names Converts a C/C++ header file path to a Go file path. For example, /path/to/foo.h becomes foo.go, and /path/to/_intptr.h becomes X_intptr.go. ```go func HeaderFileToGo(incPath string) string ``` -------------------------------- ### Initialize Module Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Initializes a Go module with a specified output directory and module path. If modulePath is not empty, it initializes the module using that path. ```go func ModInit(deps []string, outputDir string, modulePath string) error ``` -------------------------------- ### NewPkgInfo Function Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Creates a new PkgInfo instance with the specified package path, directory, configuration, and published symbols. ```go func NewPkgInfo(pkgPath string, pkgDir string, conf *llcppg.Config, pubs map[string]string) *PkgInfo ``` -------------------------------- ### Get CType from BuiltinTypeMap Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Retrieves the C representation of a Go type from the BuiltinTypeMap. ```go func (p *BuiltinTypeMap) CType(typ string) types.Type ``` -------------------------------- ### PkgDepLoader.InitDeps Method Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Initializes the dependencies for a given package. ```go func (pm *PkgDepLoader) InitDeps(p *PkgInfo) error ``` -------------------------------- ### Do Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsigfetch/parse Initiates the parsing process with the given configuration. ```APIDOC ## Do ### Description Starts the parsing process using the provided configuration. Returns a Converter object and an error if any occurs. ### Signature ```go func Do(cfg *ParseConfig) (*Converter, error) ``` ``` -------------------------------- ### Do Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsigfetch/parse%40v0.0.0-20250423000629-b7004bb04fe0 Initiates the parsing process with the given configuration. ```APIDOC ## Do ### Description Starts the parsing process using the provided configuration. ### Signature ```go func Do(cfg *ParseConfig) (*Converter, error) ``` ### Parameters - **cfg** (*ParseConfig) - The configuration for the parsing process. ``` -------------------------------- ### ModInit Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Initializes a Go module with the specified parameters. ```APIDOC ## func ModInit ### Description Initializes a Go module. If `modulePath` is provided, it initializes the module using that path. ### Signature ```go func ModInit(deps []string, outputDir string, modulePath string) error ``` ### Parameters * **deps** ([]string) - A list of dependencies. * **outputDir** (string) - The directory where the module will be initialized. * **modulePath** (string) - The path for the Go module. If empty, module initialization might behave differently. ``` -------------------------------- ### Get Debug Flags Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/dbg These functions retrieve the current state of specific debug flags. ```APIDOC ## Get Debug Flags ### Description Retrieves the current state of specific debug flags. ### Functions * `GetDebugError() bool`: Returns `true` if debug error logging is enabled, `false` otherwise. * `GetDebugLog() bool`: Returns `true` if general debug logging is enabled, `false` otherwise. * `GetDebugSymbolNotFound() bool`: Returns `true` if debug messages for symbol not found are enabled, `false` otherwise. ``` -------------------------------- ### Get Debug Log Flag Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/dbg Retrieves the current status of the debug log flag. ```go func GetDebugLog() bool ``` -------------------------------- ### Generate Bindings with Configuration File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg Invokes llcppg using a specified configuration file to generate the Go bindings. ```bash llcppg llcppg.cfg ``` -------------------------------- ### Get Debug Error Flag Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/dbg Retrieves the current status of the debug error flag. ```go func GetDebugError() bool ``` -------------------------------- ### Get Inclusions Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Visits all inclusions within a translation unit using a provided visitor function. ```go func GetInclusions(unit *clang.TranslationUnit, visitor InclusionVisitor) ``` -------------------------------- ### PkgInfo Methods Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Information and structure for a Go package. ```APIDOC ## func NewPkgInfo ### Description Creates a new PkgInfo. ### Signature ```go func NewPkgInfo(pkgPath string, pkgDir string, conf *llcppg.Config, pubs map[string]string) *PkgInfo ``` ``` -------------------------------- ### Get Debug Symbol Not Found Flag Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/dbg Retrieves the current status of the debug symbol not found flag. ```go func GetDebugSymbolNotFound() bool ``` -------------------------------- ### Create New Package for Conversion Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Initializes a new Package for conversion. A default Go file is generated, and type conversions are written to it unless SetCurFile is called. ```go func NewPackage(config *PackageConfig) *Package ``` -------------------------------- ### Create New HeaderFile Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Initializes a new HeaderFile object with the specified file name and type. ```go func NewHeaderFile(file string, fileType llcppg.FileType) *HeaderFile ``` -------------------------------- ### NewPackage Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Creates a new Package instance for conversion. A default Go file is generated, and type conversions are written to it unless SetCurFile is called. ```APIDOC ## NewPackage ### Description Initializes a new Package for code conversion. By default, a Go file named after the package is created. If `SetCurFile` is not invoked, all subsequent type conversions will be directed to this default file. ### Method `NewPackage(config *PackageConfig) *Package` ``` -------------------------------- ### Get Boolean Argument Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/args Retrieves a boolean command-line argument. If the argument is not found, it returns the specified default value. ```go func BoolArg(arg string, defaultValue bool) bool ``` -------------------------------- ### Run llcppg Command Source: https://pkg.go.dev/github.com/maturesurfac/llcppg Executes the llcppg tool to generate Go bindings. If no config file is specified, it defaults to 'llcppg.cfg' in the current directory. ```bash llcppg [config-file] ``` -------------------------------- ### NewPkgInfo Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert%40v0.0.0-20250423000629-b7004bb04fe0 Creates a new PkgInfo object with the specified details. ```APIDOC ## func NewPkgInfo(pkgPath string, pkgDir string, conf *llcppg.Config, pubs map[string]string) *PkgInfo ### Description Initializes a PkgInfo object, containing information about a Go package, including its path, directory, configuration, and public API mappings. ### Parameters #### Path Parameters - **pkgPath** (string) - Required - The import path of the package. - **pkgDir** (string) - Required - The directory containing the package source files. - **conf** (*llcppg.Config) - Required - The configuration for the package. - **pubs** (map[string]string) - Required - A map of public API name mappings. ### Returns - ***PkgInfo**: A pointer to the newly created PkgInfo object. ``` -------------------------------- ### Write Link File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Generates a link file for the package. ```go func (p *Package) WriteLinkFile() (string, error) ``` -------------------------------- ### Get Debug Symbol Status Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/dbg Retrieves the current status of the debug symbol flag. Returns true if enabled, false otherwise. ```go func GetDebugSymbol() bool ``` -------------------------------- ### Compose Includes Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Creates an include list in the format #include #include . ```go func ComposeIncludes(files []string, outfile string) error ``` -------------------------------- ### Write All Package Files Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Writes all converted header files to Go files. It first calls deferTypeBuild() to complete any incomplete type definitions that might span multiple files. ```go func (p *Package) WritePkgFiles() error ``` -------------------------------- ### Get Debug Parse Status Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsigfetch/dbg Retrieves the current status of the debug parse flag. Call this function to check if debug parsing is enabled. ```go func GetDebugParse() bool ``` -------------------------------- ### Run All Generated Package Demos Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/llcppgtest/demo Executes all LLCPPG conversion test cases within the specified base and configuration directories. This function is used to run a comprehensive suite of demos. ```go func RunAllGenPkgDemos(baseDir string, confDir string) ``` -------------------------------- ### RunAllGenPkgDemos Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/llcppgtest/demo Executes all generated package demos within a specified base directory and configuration directory. ```APIDOC ## RunAllGenPkgDemos ### Description Executes all generated package demos within a specified base directory and configuration directory. ### Signature ```go func RunAllGenPkgDemos(baseDir string, confDir string) ``` ### Parameters * `baseDir` (string) - The base directory containing the demos. * `confDir` (string) - The configuration directory relative to `baseDir`. ``` -------------------------------- ### Configure Interface Header Files in llcppg.cfg Source: https://pkg.go.dev/github.com/maturesurfac/llcppg Specify the list of interface header files to be converted by llcppg. Each file in the 'include' list generates a corresponding .go file. ```json { "name": "xslt", "cflags": "$(pkg-config --cflags libxslt)", "include": [ "libxslt/xslt.h", "libxslt/security.h" ] } ``` -------------------------------- ### Get Debug Parse Method Status Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/dbg Retrieves the current status of the debug parse method flag. Returns true if enabled, false otherwise. ```go func GetDebugParseIsMethod() bool ``` -------------------------------- ### File Structure Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/ast Represents a complete Go source file, containing declarations, includes, and macros. ```go type File struct { Decls []Decl `json:"decls"` Includes []*Include `json:"includes,omitempty"` Macros []*Macro `json:"macros,omitempty"` } ``` -------------------------------- ### ExportName Function Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/names Converts a given name to an exported (public) Go identifier. It ensures the name starts with an uppercase letter without applying other camel case transformations. ```go func ExportName(name string) string ``` -------------------------------- ### PkgDepLoader.InitDeps Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert%40v0.0.0-20250423000629-b7004bb04fe0 Initializes the dependencies for a given package info. ```APIDOC ## func (pm *PkgDepLoader) InitDeps(p *PkgInfo) error ### Description Initializes the dependency resolution process for a specific package. ### Parameters #### Path Parameters - **p** (*PkgInfo) - Required - The PkgInfo object for which to initialize dependencies. ### Returns - **error**: An error if the dependency initialization fails. ``` -------------------------------- ### CurPkgFiles method signature Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/config%40v0.0.0-20250423000629-b7004bb04fe0 Returns the list of header files belonging to the current package. ```go func (p *PkgHfilesInfo) CurPkgFiles() []string ``` -------------------------------- ### Converter Do Function Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsigfetch/parse Initializes and performs the parsing process with the given configuration. ```go func Do(cfg *ParseConfig) (*Converter, error) ``` -------------------------------- ### Package Methods Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert%40v0.0.0-20250423000629-b7004bb04fe0 Methods for managing and converting C/C++ packages to Go. ```APIDOC ## NewPackage ### Description Creates a new Package for conversion. By default, a Go file named after the package is generated. If SetCurFile is not called, all type conversions will be written to this default Go file. ### Method NewPackage ### Parameters - config (*PackageConfig): Configuration for the new package. ### Response - *Package: A pointer to the newly created Package object. ``` ```APIDOC ## Package.CollectNameMapping ### Description Collects the name mapping between an origin name and a public name. If within the current package, it is collected in the public symbol table. ### Method (*Package) CollectNameMapping ### Parameters - originName (string): The original name. - newName (string): The new public name. ### Response None ``` ```APIDOC ## Package.DeclName ### Description Declares a name, ensuring it is unique. It returns the public name, whether it was changed, and any error encountered. ### Method (*Package) DeclName ### Parameters - name (string): The name to declare. - toCamel (bool): Whether to convert the name to camel case. ### Response - pubName (string): The unique public name. - changed (bool): True if the name was changed, false otherwise. - err (error): An error if the declaration failed. ``` ```APIDOC ## Package.GetGenPackage ### Description Retrieves the generated Go package object. ### Method (*Package) GetGenPackage ### Response - *gogen.Package: A pointer to the generated Go package. ``` ```APIDOC ## Package.GetOutputDir ### Description Retrieves the output directory for generated files. ### Method (*Package) GetOutputDir ### Response - string: The path to the output directory. ``` ```APIDOC ## Package.LookupSymbol ### Description Looks up a symbol within the package. ### Method (*Package) LookupSymbol ### Parameters - mangleName (config.MangleNameType): The mangled name of the symbol to look up. ### Response - (*GoFuncSpec, error): A pointer to the GoFuncSpec and an error if the symbol is not found or an error occurs. ``` ```APIDOC ## Package.NewConstGroup ### Description Creates a new constant group. ### Method (*Package) NewConstGroup ### Response - *ConstGroup: A pointer to the new ConstGroup. ``` ```APIDOC ## Package.NewEnumTypeDecl ### Description Converts and registers a C/C++ enum type declaration. ### Method (*Package) NewEnumTypeDecl ### Parameters - enumTypeDecl (*ast.EnumTypeDecl): The AST node for the enum type declaration. ### Response - error: An error if the conversion or registration fails. ``` ```APIDOC ## Package.NewFuncDecl ### Description Converts and registers a C/C++ function declaration. ### Method (*Package) NewFuncDecl ### Parameters - funcDecl (*ast.FuncDecl): The AST node for the function declaration. ### Response - error: An error if the conversion or registration fails. ``` ```APIDOC ## Package.NewMacro ### Description Converts and registers a C/C++ macro. ### Method (*Package) NewMacro ### Parameters - macro (*ast.Macro): The AST node for the macro. ### Response - error: An error if the conversion or registration fails. ``` ```APIDOC ## Package.NewTypeDecl ### Description Converts C/C++ type declarations to Go. It supports forward declarations and self-referential types. ### Method (*Package) NewTypeDecl ### Parameters - typeDecl (*ast.TypeDecl): The AST node for the type declaration. ### Response - error: An error if the conversion or registration fails. ``` ```APIDOC ## Package.NewTypedefDecl ### Description Converts and registers a C/C++ typedef declaration. ### Method (*Package) NewTypedefDecl ### Parameters - typedefDecl (*ast.TypedefDecl): The AST node for the typedef declaration. ### Response - error: An error if the conversion or registration fails. ``` ```APIDOC ## Package.NewTypedefs ### Description Creates a new Go type declaration from a typedef. ### Method (*Package) NewTypedefs ### Parameters - name (string): The name of the typedef. - typ (types.Type): The underlying Go type. ### Response - *gogen.TypeDecl: A pointer to the generated Go type declaration. ``` ```APIDOC ## Package.SetCurFile ### Description Sets the current header file for subsequent type conversions. ### Method (*Package) SetCurFile ### Parameters - hfile (*HeaderFile): The header file to set as current. ### Response None ``` ```APIDOC ## Package.ToSigSignature ### Description Converts a receiver and function declaration into a Go types.Signature. ### Method (*Package) ToSigSignature ### Parameters - recv (*types.Var): The receiver variable. - funcDecl (*ast.FuncDecl): The AST node for the function declaration. ### Response - (*types.Signature, error): A pointer to the Go types.Signature and an error if the conversion fails. ``` ```APIDOC ## Package.ToType ### Description Converts an AST expression to a Go types.Type. ### Method (*Package) ToType ### Parameters - expr (ast.Expr): The AST expression to convert. ### Response - (types.Type, error): The converted Go types.Type and an error if the conversion fails. ``` ```APIDOC ## Package.Write ### Description Generates a Go file based on the package content. The output file is created in a subdirectory named after the package within the output directory. If outputDir is not provided, the current directory is used. Files already processed in dependent packages will not be output. ### Method (*Package) Write ### Parameters - headerFile (string): The name of the header file (which becomes the Go file name). ### Response - error: An error if the writing process fails. ``` ```APIDOC ## Package.WriteAutogenFile ### Description Generates an autogenerated file for the package. ### Method (*Package) WriteAutogenFile ### Response - error: An error if the file writing fails. ``` ```APIDOC ## Package.WriteLinkFile ### Description Generates a link file for the package. ### Method (*Package) WriteLinkFile ### Response - (string, error): The path to the generated link file and an error if the writing process fails. ``` ```APIDOC ## Package.WritePkgFiles ### Description Writes all converted header files to Go files. It first calls deferTypeBuild() to complete all incomplete type definitions, as some types may be implemented across multiple files. ### Method (*Package) WritePkgFiles ### Response - error: An error if writing the package files fails. ``` ```APIDOC ## Package.WritePubFile ### Description Generates a public API file for the package. ### Method (*Package) WritePubFile ### Response - error: An error if writing the public file fails. ``` ```APIDOC ## Package.WriteToBuffer ### Description Writes the corresponding files in the gogen package to a buffer. ### Method (*Package) WriteToBuffer ### Parameters - genFName (string): The name of the generated file. ### Response - (*bytes.Buffer, error): A pointer to the byte buffer and an error if the writing process fails. ``` -------------------------------- ### Parse Go Function Name Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Parses a Go function name string into its components (function name, receiver, etc.). Input examples from llcppg.symb.json's "go" field: 1. Simple function: "AddPatchToArray" 2. Method with pointer receiver: "(*Sqlite3Stmt).Sqlite3BindParameterIndex" 3. Method with value receiver: "CJSONBool.CJSONCreateBool" ```go func NewGoFuncSpec(name string) *GoFuncSpec ``` -------------------------------- ### Generate Dynamic Library Paths Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/config/cfgparse Searches for dynamic libraries in provided and default paths, appending appropriate file extensions (.dylib for macOS, .so for Linux). System libraries like -lm are ignored and included in notFound. An error is returned if no libraries are found. ```go func (l *Libs) GenDylibPaths(defaultPaths []string) ([]string, []string, error) ``` -------------------------------- ### Package.Write Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Generates a Go file for the package content in the specified output directory. ```APIDOC ## Package.Write ### Description Generates a Go file based on the package's converted content. The output file is placed in a subdirectory named after the package within the `outputDir`. If `outputDir` is not specified, the current directory is used. Files already processed in dependent packages are excluded from this output. The `headerFile` parameter specifies the name of the Go file to be generated. ### Method `Write(headerFile string) error` ``` -------------------------------- ### Write Package Content to File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Generates a Go file for the package content in a subdirectory named after the package. If outputDir is not specified, the current directory is used. The header file name determines the Go file name. ```go func (p *Package) Write(headerFile string) error ``` -------------------------------- ### Convert C Function to Go Method Source: https://pkg.go.dev/github.com/maturesurfac/llcppg Demonstrates how a C function with a pointer type as the first argument is converted into a Go method. ```c CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item); ``` ```go // llgo:link (*CJSON).AddItemToObject C.cJSON_AddItemToObject func (p *CJSON) AddItemToObject(string *int8, item *CJSON) CJSONBool { return 0 } ``` -------------------------------- ### Create JSON File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Creates a JSON file at the specified filepath with the given data. ```go func CreateJSONFile(filepath string, data any) error ``` -------------------------------- ### Write Public File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Generates a public-facing file for the package. ```go func (p *Package) WritePubFile() error ``` -------------------------------- ### PkgInfo Methods Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert The PkgInfo type represents information about a Go package, including its path, directory, and configuration. ```APIDOC ## PkgInfo ### Description Represents information about a Go package. ### Methods - **NewPkgInfo(pkgPath string, pkgDir string, conf *llcppg.Config, pubs map[string]string) *PkgInfo**: Creates a new PkgInfo instance. ``` -------------------------------- ### NewPackage Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert%40v0.0.0-20250423000629-b7004bb04fe0 Creates a new Package object with the specified configuration. ```APIDOC ## func NewPackage(config *PackageConfig) *Package ### Description Initializes a new Package object, which manages code generation aspects for a Go package, using the provided configuration. ### Parameters #### Path Parameters - **config** (*PackageConfig) - Required - The configuration for the package. ### Returns - ***Package**: A pointer to the newly created Package object. ``` -------------------------------- ### Create BuiltinTypeMap with Package Path and Config Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Constructs a new BuiltinTypeMap using a package path, type name, and a gogen configuration. ```go func NewBuiltinTypeMap(pkgPath, name string, conf *gogen.Config) *BuiltinTypeMap ``` -------------------------------- ### Set Current File for Package Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Specifies the current header file being processed for the package. ```go func (p *Package) SetCurFile(hfile *HeaderFile) ``` -------------------------------- ### Generate llcppg.cfg Configuration File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg The 'llcppcfg' command-line tool is used to generate the 'llcppg.cfg' configuration file for a given library. ```bash llcppcfg [libname] ``` -------------------------------- ### Create SymbolTable from File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Creates a new SymbolTable by reading symbols from a specified file path. ```go func NewSymbolTable(filePath string) (*SymbolTable, error) ``` -------------------------------- ### Create BuiltinTypeMap with Package References Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Constructs a new BuiltinTypeMap from a variable number of package references. ```go func NewBuiltinTypeMapWithPkgRefS(pkgs ...gogen.PkgRef) *BuiltinTypeMap ``` -------------------------------- ### PkgInfo Structure Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Represents information about a Go package, including its base details, dependencies, and local directory path. ```go type PkgInfo struct { PkgBase Deps []*PkgInfo Dir string // absolute local path of the package } ``` -------------------------------- ### Run Command in Directory Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Executes an external command in a specified directory with given arguments. ```go func RunCommand(dir, cmdName string, args ...string) error ``` -------------------------------- ### Demo Program Using Generated cjson Bindings Source: https://pkg.go.dev/github.com/maturesurfac/llcppg A Go program that imports the generated cjson package and demonstrates creating and printing a JSON object using the bindings. ```go package main import ( "github.com/author/cjson" "github.com/goplus/llgo/c" ) func main() { mod := cjson.CreateObject() mod.AddItemToObject(c.Str("hello"), cjson.CreateString(c.Str("llgo"))) mod.AddItemToObject(c.Str("hello"), cjson.CreateString(c.Str("llcppg"))) cstr := mod.PrintUnformatted() c.Printf(c.Str("%s\n"), cstr) } ``` -------------------------------- ### Create Type C Documentation Comments Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Initializes and returns a comment group for Type C documentation. ```go func NewTypecDocComments() *goast.CommentGroup ``` -------------------------------- ### LLCPPG_SIGFETCH Constant Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/llcppg Defines the signature fetch file name for llcppg. ```go const LLCPPG_SIGFETCH = "llcppg.sigfetch.json" ``` -------------------------------- ### PPD Interface Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/ast Represents a preprocessor directive. ```go type PPD interface { Node // contains filtered or unexported methods } ``` -------------------------------- ### NewSymbolProcessor Function Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/parse Initializes and returns a new SymbolProcessor. Requires a list of files to process and a list of prefixes to apply. ```go func NewSymbolProcessor(Files []string, Prefixes []string) *SymbolProcessor ``` -------------------------------- ### RunTestWithConfig Function Signature Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsigfetch/parse/cvt_test Runs a test with the provided configuration. ```go func RunTestWithConfig(config *parse.ParseConfig) ``` -------------------------------- ### NewPkgDepLoader Function Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Creates a new PkgDepLoader instance. ```go func NewPkgDepLoader(mod *gopmod.Module, pkg *gogen.Package) *PkgDepLoader ``` -------------------------------- ### Generate Bindings with Module Flag Source: https://pkg.go.dev/github.com/maturesurfac/llcppg Generates Go bindings using llcppg, specifying a module path with the -mod flag to create a new Go module for the generated package. ```bash llcppg -mod github.com/author/cjson llcppg.cfg ``` -------------------------------- ### PkgDepLoader.Imports Method Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Imports multiple packages by their paths. ```go func (pm *PkgDepLoader) Imports(pkgPaths []string) (pkgs []*PkgInfo, err error) ``` -------------------------------- ### PkgDepLoader.Import Method Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Imports a single package by its path. ```go func (pm *PkgDepLoader) Import(pkgPath string) (*PkgInfo, error) ``` -------------------------------- ### NewDefaultConfig Function Signature Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/llcppg Returns a new default configuration for llcppg. ```go func NewDefaultConfig() *Config ``` -------------------------------- ### Read Sigfetch File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Reads the content of a sigfetch configuration file into a byte slice. ```go func ReadSigfetchFile(sigfetchFile string) ([]byte, error) ``` -------------------------------- ### RunCommand Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Executes a command in a specified directory with given arguments. ```APIDOC ## RunCommand ### Description Executes a command in a specified directory with given arguments. ### Parameters #### Path Parameters - **dir** (string) - Required - The directory in which to run the command. - **cmdName** (string) - Required - The name of the command to execute. - **args** (...string) - Required - A variadic list of arguments for the command. ### Returns - `error`: An error if the command execution fails. ``` -------------------------------- ### Manage Incomplete Types Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert A collection for managing incomplete type declarations during conversion. ```go type IncompleteTypes struct { // contains filtered or unexported fields } ``` -------------------------------- ### Generate Sigfetch Configuration Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Generates sigfetch configuration data based on the provided configuration file, directory, and C++ flag. ```go func SigfetchConfig(configFile string, dir string, isCpp bool) ([]byte, error) ``` -------------------------------- ### Generate Header File Paths Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/config/cfgparse Generates header file paths from a list of files and default paths, returning found and not found paths along with any errors. ```go func (cf *CFlags) GenHeaderFilePaths(files []string, defaultPaths []string) ([]string, []string, error) ``` -------------------------------- ### Define Libs Structure Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/config/cfgparse Defines the structure to hold library paths and names. ```go type Libs struct { Paths []string // Dylib Path Names []string } ``` -------------------------------- ### LLCPPG_PUB Constant Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/llcppg Defines the public key file name for llcppg. ```go const LLCPPG_PUB = "llcppg.pub" ``` -------------------------------- ### Create New IncompleteTypes Manager Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Initializes a new manager for incomplete types. ```go func NewIncompleteTypes() *IncompleteTypes ``` -------------------------------- ### Package.WritePkgFiles Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Writes all converted header files to Go files after completing type definitions. ```APIDOC ## Package.WritePkgFiles ### Description Writes all converted header files into their respective Go files. This method first calls `deferTypeBuild()` to ensure all incomplete type definitions are finalized, as some types might be defined across multiple files. Converted files from dependent packages that have already been processed are not included. ### Method `WritePkgFiles() error` ``` -------------------------------- ### Convert HeaderFile to Go File Name Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Generates the corresponding Go file name for a given HeaderFile and package name. ```go func (p *HeaderFile) ToGoFileName(pkgName string) string ``` -------------------------------- ### NewConv Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Initializes a new TypeConv instance. ```APIDOC ## func NewConv(p *Package) *TypeConv ### Description Initializes and returns a new TypeConv instance associated with the given Package. ### Parameters #### Path Parameters - **p** (*Package) - Required - The package to associate with the TypeConv instance. ``` -------------------------------- ### Create SysTypeNotFoundError Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/errs Constructor function for creating a new SysTypeNotFoundError. It requires the system type name, its file, package, and full path. ```go func NewSysTypeNotFoundError(sysType, sysTypeFile, pkg, fullPath string) *SysTypeNotFoundError ``` -------------------------------- ### Write Converted Code to Files Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Writes the converted and formatted code to the appropriate output files. ```go func (p *Converter) Write() ``` -------------------------------- ### Preprocess Code Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Performs preprocessing on a C/C++ source file. ```go func Preprocess(cfg *PreprocessConfig) error ``` -------------------------------- ### Package.WritePkgFiles Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert%40v0.0.0-20250423000629-b7004bb04fe0 Writes all necessary package files, including source and header files. ```APIDOC ## func (p *Package) WritePkgFiles() error ### Description Generates and writes all required files for the package, encompassing source code, headers, and potentially others. ### Returns - **error**: An error if any part of the file writing process fails. ``` -------------------------------- ### Declare Macro Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Converts and registers an AST macro. ```go func (p *Package) NewMacro(macro *ast.Macro) error ``` -------------------------------- ### NewImplFiles Function Signature Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/llcppg Returns a new ImplFiles struct. ```go func NewImplFiles() *ImplFiles ``` -------------------------------- ### Converter Configuration Structure Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Configuration options for the code converter, including package name, symbol file, and output directory. ```go type Config struct { PkgName string SymbFile string // llcppg.symb.json CfgFile string // llcppg.cfg PubFile string // llcppg.pub OutputDir string Pkg *llcppg.Pkg } ``` -------------------------------- ### Convert Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsigfetch/parse%40v0.0.0-20250423000629-b7004bb04fe0 Converts the parsed C++ code into an llcppg.Pkg object. ```APIDOC ## (*Converter) Convert ### Description Converts the processed C++ code into an AST representation (llcppg.Pkg). This method is intended for use after the clang preprocessor has run. ### Signature ```go func (ct *Converter) Convert() (*llcppg.Pkg, error) ``` ### Returns - (*llcppg.Pkg) - The resulting package AST. - (error) - An error if the conversion fails. ``` -------------------------------- ### Converter.CreateDeclBase Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsigfetch/parse Creates a base declaration node from a clang.Cursor. ```APIDOC ## Converter.CreateDeclBase ### Description Creates a base declaration node from a given clang cursor. ### Signature ```go func (ct *Converter) CreateDeclBase(cursor clang.Cursor) ast.DeclBase ``` ``` -------------------------------- ### NewLLCppgConfig Function Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/llcppcfg/llcppgcfg Creates a new llcppg configuration object. ```APIDOC ## NewLLCppgConfig ### Description Creates a new llcppg configuration object. ### Signature ```go func NewLLCppgConfig(name string, flag FlagMode) *llcppg.Config ``` ``` -------------------------------- ### Create Function Documentation Comments Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Generates documentation comments for a Go function, including its name and the original Go function name. ```go func NewFuncDocComments(funcName string, goFuncName string) *goast.CommentGroup ``` -------------------------------- ### PkgDepLoader.Imports Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert%40v0.0.0-20250423000629-b7004bb04fe0 Imports multiple packages and returns their information. ```APIDOC ## func (pm *PkgDepLoader) Imports(pkgPaths []string) (pkgs []*PkgInfo, err error) ### Description Loads and returns information for a slice of Go packages specified by their paths. ### Parameters #### Path Parameters - **pkgPaths** ([]string) - Required - A slice of package import paths. ### Returns - **pkgs** ([]*PkgInfo): A slice of PkgInfo objects for the imported packages. - **err** (error): An error if any of the imports fail. ``` -------------------------------- ### Config Struct Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Configuration struct for creating a translation unit. ```go type Config struct { File string Temp bool Args []string IsCpp bool Index *clang.Index } ``` -------------------------------- ### Create Translation Unit Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Creates a Clang index and a translation unit for parsing C/C++ code. ```go func CreateTranslationUnit(config *Config) (*clang.Index, *clang.TranslationUnit, error) ``` -------------------------------- ### HeaderFile Structure Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Represents a header file, storing its name and type (e.g., C, C++). ```go type HeaderFile struct { File string FileType llcppg.FileType } ``` -------------------------------- ### PkgHfileInfo Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/config%40v0.0.0-20250423000629-b7004bb04fe0 Analyzes header files and categorizes them. ```APIDOC ## PkgHfileInfo ### Description Analyzes header files dependencies based on the provided configuration and arguments. It categorizes header files into three groups: 'Inters' (direct includes), 'Impls' (from the same root directory), and 'Thirds' (external sources). ### Function Signature ```go func PkgHfileInfo(conf *llcppg.Config, args []string) *PkgHfilesInfo ``` ### Parameters * **conf** (*llcppg.Config) - The configuration object containing include paths. * **args** ([]string) - Additional arguments for analysis. ### Returns * (*PkgHfilesInfo) - A pointer to a `PkgHfilesInfo` struct containing the categorized header file information. ``` -------------------------------- ### PreprocessConfig Struct Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Configuration struct for preprocessing C/C++ code. ```go type PreprocessConfig struct { File string IsCpp bool Args []string OutFile string } ``` -------------------------------- ### Package.WriteLinkFile Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Writes a link file for the package and returns its path. ```APIDOC ## Package.WriteLinkFile ### Description Generates and writes a link file for the package. Returns the path to the generated link file and any error encountered. ### Method `WriteLinkFile() (string, error)` ``` -------------------------------- ### NewConv Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert%40v0.0.0-20250423000629-b7004bb04fe0 Initializes a new TypeConv instance with the given package context. ```APIDOC ## func NewConv(p *Package) *TypeConv ### Description Initializes and returns a new TypeConv instance. This instance is used to perform type conversions within the context of a given package. ### Parameters #### Path Parameters - **p** (*Package) - Required - The package context for the TypeConv instance. ``` -------------------------------- ### PkgHfileInfo Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/config Analyzes header file dependencies and categorizes them. ```APIDOC ## PkgHfileInfo ### Description Analyzes header file dependencies for a given configuration and arguments, categorizing them into three groups: Inters, Impls, and Thirds. It uses clang for parsing. ### Usage This function is useful for understanding the header file structure and dependencies of a package. ### Signature ```go func PkgHfileInfo(conf *llcppg.Config, args []string) *PkgHfilesInfo ``` ### Parameters * **conf** (*llcppg.Config) - The configuration object containing include paths. * **args** ([]string) - Additional arguments for the analysis. ``` -------------------------------- ### PkgBase Structure Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Represents the base information for a package, including its path, C++ binding configuration, and published symbols. ```go type PkgBase struct { PkgPath string // package path, e.g. github.com/goplus/llgo/cjson CppgConf *llcppg.Config // llcppg.cfg Pubs map[string]string // llcppg.pub } ``` -------------------------------- ### Converter Constructors Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsigfetch/parse Functions for creating and initializing a Converter instance. ```APIDOC ## Converter Constructors ### Description Functions to create and initialize the `Converter` type, which is central to the parsing process. ### Methods * **func Do(cfg *ParseConfig) (*Converter, error)** Initializes a new `Converter` with the given `ParseConfig` and returns it, along with any potential error. * **func NewConverter(config *Config) (*Converter, error)** Creates a new `Converter` instance using the provided `Config` and returns it, or an error if creation fails. ``` -------------------------------- ### Create Temporary JSON File Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/config Creates a temporary JSON file with a given filename and data, returning the path to the created file. ```go func CreateTmpJSONFile(filename string, data any) (string, error) ``` -------------------------------- ### Macro Structure Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/ast Represents a preprocessor macro. ```go type Macro struct { Loc *Location Name string Tokens []*Token // Tokens[0].Lit is the macro name } ``` -------------------------------- ### Include Structure Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/ast Represents an include directive in the source code. ```go type Include struct { Path string `json:"path"` } ``` -------------------------------- ### PkgDepLoader Methods Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/cmd/gogensig/convert Methods for loading and managing package dependencies. ```APIDOC ## func NewPkgDepLoader ### Description Creates a new PkgDepLoader. ### Signature ```go func NewPkgDepLoader(mod *gopmod.Module, pkg *gogen.Package) *PkgDepLoader ``` ``` ```APIDOC ## func (*PkgDepLoader) Import ### Description Imports a single package by its path. ### Signature ```go func (pm *PkgDepLoader) Import(pkgPath string) (*PkgInfo, error) ``` ``` ```APIDOC ## func (*PkgDepLoader) Imports ### Description Imports multiple packages by their paths. ### Signature ```go func (pm *PkgDepLoader) Imports(pkgPaths []string) (pkgs []*PkgInfo, err error) ``` ``` ```APIDOC ## func (*PkgDepLoader) InitDeps ### Description Initializes the dependencies for a given package. ### Signature ```go func (pm *PkgDepLoader) InitDeps(p *PkgInfo) error ``` ``` ```APIDOC ## func (*PkgDepLoader) LoadDeps ### Description Loads direct and recursive dependencies of a package. ### Signature ```go func (pm *PkgDepLoader) LoadDeps(p *PkgInfo) ([]*PkgInfo, error) ``` ``` ```APIDOC ## func (*PkgDepLoader) RegisterDep ### Description Registers a single dependent package. ### Signature ```go func (pm *PkgDepLoader) RegisterDep(dep *PkgInfo) ``` ``` ```APIDOC ## func (*PkgDepLoader) RegisterDeps ### Description Registers types from dependent packages into the current conversion project's scope. ### Signature ```go func (pm *PkgDepLoader) RegisterDeps(p *PkgInfo) ``` ``` -------------------------------- ### C Header File with Type Dependencies Source: https://pkg.go.dev/github.com/maturesurfac/llcppg This C header file demonstrates dependencies on types defined in other libraries, such as 'xmlChar' and 'xmlNodePtr' from libxml2. ```c #include #include #include xmlChar * xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace); ``` -------------------------------- ### LLCPPG_CFG Constant Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/llcppg Defines the default configuration file name for llcppg. ```go const LLCPPG_CFG = "llcppg.cfg" ``` -------------------------------- ### Preprocess Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/clangutils Preprocess performs preprocessing on a given C/C++ file according to the provided configuration. ```APIDOC ## func Preprocess ### Description Preprocesses a file. ### Signature ```go func Preprocess(cfg *PreprocessConfig) error ``` ``` -------------------------------- ### PkgHfilesInfo type definition Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/config%40v0.0.0-20250423000629-b7004bb04fe0 Represents information about header files, categorizing them into inter-package includes, implementation includes, and third-party includes. ```go type PkgHfilesInfo struct { Inters []string // From types.Config.Include Impls []string // From same root of types.Config.Include Thirds []string // Not Current Pkg's Files } ``` -------------------------------- ### GetConf function signature Source: https://pkg.go.dev/github.com/maturesurfac/llcppg/_xtool/llcppsymg/config%40v0.0.0-20250423000629-b7004bb04fe0 Constructs a Conf object by parsing byte data. ```go func GetConf(data []byte) (Conf, error) ```