gtkdoc.scan

Extracts declarations of functions, macros, enums, structs and unions from header files.

It is called with a module name, an optional source directory, an optional output directory, and the header files to scan.

It outputs all declarations found to a file named ‘$MODULE-decl.txt’, and the list of decarations to another file ‘$MODULE-decl-list.txt’.

This second list file is typically copied to ‘$MODULE-sections.txt’ and organized into sections ready to output the XML pages.

gtkdoc.scan.AddSymbolToList(slist, symbol)

Adds symbol to list of declaration if not already present.

Parameters:
  • slist – The list of symbols.

  • symbol – The symbol to add to the list.

gtkdoc.scan.InitScanner(options)

Apply options to regexps.

gtkdoc.scan.ScanHeader(input_file, section_list, decl_list, get_types, seen_headers, options)

Scan a header file for doc commants.

Look for doc comments and extract them. Parse each doc comments and the symbol declaration.

Parameters:
  • input_file (str) – the header file to scan.

  • section_list (dict) – a map of section per filename

  • decl_list (list) – a list of declarations

  • seen_headers (set) – set to avoid scanning headers twice

gtkdoc.scan.ScanHeaderContent(input_lines, decl_list, get_types, options)

Scan the the given content lines.

Parameters:
  • input_lines (list) –

  • decl_list (list) – symbols declarations

  • get_types (list) – lst of symbols that have a get_type function

  • options – commandline options

Returns:

a list of symbols found and a set of symbols for which we have a

doc-comment

Return type:

list

gtkdoc.scan.ScanHeaders(source_dir, section_list, decl_list, get_types, seen_headers, options)

Scans a directory tree looking for header files.

Parameters:
  • source_dir (str) – the directory to scan.

  • section_list (dict) – map of section to filenames.

  • seen_headers (set) – set to avoid scanning headers twice

gtkdoc.scan.SeparateSubSections(slist, doc_comments)

Separate the standard macros and functions.

Place them at the end of the current section, in a subsection named ‘Standard’. Do this in a loop to catch objects, enums and flags.

Parameters:
  • slist (list) – list of symbols

  • doc_comments (dict) – comments for each symbol

Returns:

the section doc xml fomatted as string

Return type:

str

gtkdoc.scan.remove_braced_content(decl)

Remove all nested pairs of curly braces.

Parameters:

decl (str) – the decl

Returns:

a declaration stripped of braced content

Return type:

str