Documentation
¶
Overview ¶
Package clang provides a documentation source adapter that parses C library source code from a local checkout of any C project (glibc, SQLite, OpenSSL, libcurl, etc.). It reads header files (.h) to discover the public API surface and uses tree-sitter for AST parsing plus regex for preprocessor macros.
Index ¶
- func NewCheckFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDPDKFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewESPIDFFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewFacilioFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewFreeRTOSFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewGLibFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewGTKFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewGlibcFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewH2OFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewJanssonFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewKoreFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewLibcurlFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewLibpngFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewLibuvFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewLinuxUAPIFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewMongooseFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewOpenSSLFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSDL2Factory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSQLiteFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewZephyrFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewZlibFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- type CSource
- func (s *CSource) DetectWrapper(method *source.Method) (bool, string, string)
- func (s *CSource) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)
- func (s *CSource) ID() string
- func (s *CSource) Meta() source.LibraryMeta
- func (s *CSource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
- func (s *CSource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
- func (s *CSource) ParseSourceCode(entityID string, content []byte) (string, error)
- func (s *CSource) ResolveWrapperURL(targetName, targetKind, entitySlug string) string
- type Config
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCheckFactory ¶
NewCheckFactory creates a Source for the Check unit testing framework.
func NewDPDKFactory ¶
NewDPDKFactory creates a Source for the DPDK networking framework.
func NewESPIDFFactory ¶
NewESPIDFFactory creates a Source for the ESP-IDF IoT framework.
func NewFacilioFactory ¶
NewFacilioFactory creates a Source for the facil.io web framework.
func NewFreeRTOSFactory ¶
NewFreeRTOSFactory creates a Source for the FreeRTOS framework.
func NewGLibFactory ¶
NewGLibFactory creates a Source for the GLib utility library.
func NewGTKFactory ¶
NewGTKFactory creates a Source for the GTK GUI framework.
func NewGlibcFactory ¶
NewGlibcFactory creates a Source for the GNU C Library.
func NewH2OFactory ¶
NewH2OFactory creates a Source for the H2O HTTP/2 web server framework.
func NewJanssonFactory ¶
NewJanssonFactory creates a Source for the Jansson JSON library.
func NewKoreFactory ¶
NewKoreFactory creates a Source for the Kore web application framework.
func NewLibcurlFactory ¶
NewLibcurlFactory creates a Source for the libcurl library.
func NewLibpngFactory ¶
NewLibpngFactory creates a Source for the libpng library.
func NewLibuvFactory ¶
NewLibuvFactory creates a Source for the libuv async I/O library.
func NewLinuxUAPIFactory ¶
NewLinuxUAPIFactory creates a Source for the Linux userspace API headers.
func NewMongooseFactory ¶
NewMongooseFactory creates a Source for the Mongoose embedded web framework.
func NewOpenSSLFactory ¶
NewOpenSSLFactory creates a Source for the OpenSSL library.
func NewSDL2Factory ¶
NewSDL2Factory creates a Source for the SDL2 multimedia library.
func NewSQLiteFactory ¶
NewSQLiteFactory creates a Source for the SQLite library.
func NewZephyrFactory ¶
NewZephyrFactory creates a Source for the Zephyr RTOS framework.
func NewZlibFactory ¶
NewZlibFactory creates a Source for the zlib compression library.
Types ¶
type CSource ¶
type CSource struct {
// contains filtered or unexported fields
}
CSource is a documentation source adapter for C libraries. It parses header files to discover public API entities (functions, structs, enums, unions, typedefs, and macros) and uses tree-sitter + regex to extract structured documentation.
func (*CSource) DetectWrapper ¶
DetectWrapper analyzes a method's source code for wrapper patterns.
func (*CSource) DiscoverEntities ¶
DiscoverEntities walks the repository header files and returns a sorted list of entity identifiers in the form "filepath#entity_name".
func (*CSource) Meta ¶
func (s *CSource) Meta() source.LibraryMeta
Meta returns metadata for the library record.
func (*CSource) ParseEntity ¶
func (s *CSource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
ParseEntity parses a single entity from a header file identified by entityID. The entityID format is "filepath#entity_name".
func (*CSource) ParseMethod ¶
func (s *CSource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
ParseMethod parses a function or method from file content.
func (*CSource) ParseSourceCode ¶
ParseSourceCode extracts the source code of a specific entity from file content.
func (*CSource) ResolveWrapperURL ¶
ResolveWrapperURL constructs the identifier to fetch the wrapped target's source.
type Config ¶
type Config struct {
// LibraryID is the canonical library identifier (e.g., "/c/sqlite").
LibraryID string
// Name is the human-readable library name (e.g., "SQLite").
Name string
// Description is a short description of the library.
Description string
// SourceURL is the upstream repository URL.
SourceURL string
// Version is the library version string.
Version string
// TrustScore is the documentation trust score (0.0-1.0).
TrustScore float64
// HeaderDirs restricts discovery to these subdirectories (relative to repo root).
// If empty, defaults to scanning the entire repo for .h files.
HeaderDirs []string
// ExcludePatterns are path substrings that skip files during discovery.
ExcludePatterns []string
}
Config holds the library-specific configuration for a C source adapter.