Skip to content

Commit

Permalink
Fix API doc and organize it
Browse files Browse the repository at this point in the history
Signed-off-by: Travis F. Collins <travis.collins@analog.com>
  • Loading branch information
tfcollins committed Aug 30, 2024
1 parent 3e998b2 commit 5b16b68
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 38 deletions.
2 changes: 1 addition & 1 deletion doc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = "__api = "

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
4 changes: 4 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
import sys
sys.path.insert(0, os.path.abspath('../bindings/c/include'))
sys.path.insert(0, os.path.abspath('../bindings/python'))
sys.path.insert(0, os.path.dirname(__file__))

# Generate API page for documentation
from gen_api_page import gen_pages
gen_pages()

# -- Project information -----------------------------------------------------

Expand Down
114 changes: 114 additions & 0 deletions doc/gen_api_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Generate API page for documentation
import os

def gen_pages():
header = os.path.join(
os.path.dirname(__file__), "..", "bindings", "c", "include", "cgenalyzer.h"
)

if not os.path.exists(header):
print("Header file not found")
exit()

with open(header, "r") as f:
lines = f.readlines()

functions = []

for line in lines:
if "__api" in line:
line = line.split(" ")
for l in line:
if "gn_" in l:
# Remove everything after (
l = l.split("(")[0]
functions.append(l)

# print(line.strip())
# functions.append(line.strip())

count = len(functions)

# Organize

set_functions = []
get_functions = []
config_functions = []
generate_functions = []
operation_functions = []
missed = []
for function in functions:
if "set" in function:
set_functions.append(function)
continue
if "get" in function:
get_functions.append(function)
continue
if "config" in function:
config_functions.append(function)
continue
if "gen" in function:
generate_functions.append(function)
continue
operation_functions.append(function)

set_count = len(set_functions)
config_count = len(config_functions)

print(f"Total functions: {count}")
print(f"Set functions: {set_count}")
print(f"Config functions: {config_count}")
print(f"Get functions: {len(get_functions)}")
print(f"Generate functions: {len(generate_functions)}")

# Generate md file for breathe
page = "<!--- This file is auto-generated. Do not edit -->\n\n"

page += "# API Reference\n\n"
page += "This page contains the API reference for the Genalyzer library.\n\n"

# Table of contents

page += "## Function Groups\n\n"
page += "- [Set Functions](#set-functions)\n"
page += "- [Get Functions](#get-functions)\n"
page += "- [Config Functions](#config-functions)\n"
page += "- [Generate Functions](#generate-functions)\n"
page += "- [Operation Functions](#operation-functions)\n\n"

page += "## Structs\n\n"


def gen_functions(functions):
page = ""
for function in functions:
page += "```{eval-rst}\n"
page += f".. doxygenfunction:: {function}\n\n"
page += "```\n\n"
return page

page += "---\n\n"
page += "## Set Functions\n\n"
page += gen_functions(set_functions)

page += "---\n\n"
page += "## Get Functions\n\n"
page += gen_functions(get_functions)

page += "---\n\n"
page += "## Config Functions\n\n"
page += gen_functions(config_functions)

page += "---\n\n"
page += "## Generate Functions\n\n"
page += gen_functions(generate_functions)

page += "---\n\n"
page += "## Operation Functions\n\n"
page += gen_functions(operation_functions)

with open("reference.md", "w") as f:
f.write(page)
print("API page generated")


1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Reference
.. 02_using_genalyzer
03_examples
reference
reference_advanced



Expand Down
37 changes: 0 additions & 37 deletions doc/reference.md

This file was deleted.

118 changes: 118 additions & 0 deletions doc/reference_advanced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Advanced API Reference

Advanced API Reference for Genalyzer library. This API is meant for advanced users who want to use the library functions for more complex tasks.

## Table of Contents

```{contents}
:class: this-will-duplicate-information-and-it-is-still-useful-here
```

## Enumerations

```{eval-rst}
.. doxygengroup:: Enumerations
```

## API Utilities

```{eval-rst}
.. doxygengroup:: APIUtilities
```

## Array Operations

```{eval-rst}
.. doxygengroup:: ArrayOperations
```

## Code Density

```{eval-rst}
.. doxygengroup:: CodeDensity
```


## Code Density Helpers

```{eval-rst}
.. doxygengroup:: CodeDensityHelpers
```

## Fourier Analysis

```{eval-rst}
.. doxygengroup:: FourierAnalysis
```

## Fourier Analysis Configuration

```{eval-rst}
.. doxygengroup:: FourierAnalysisConfiguration
```

## Fourier Analysis Results

```{eval-rst}
.. doxygengroup:: FourierAnalysisResults
```

## Fourier Analysis Helpers

```{eval-rst}
.. doxygengroup:: FourierAnalysisHelpers
```

## Fourier Transforms

```{eval-rst}
.. doxygengroup:: FourierTransforms
```

## Fourier Transform Helpers

```{eval-rst}
.. doxygengroup:: FourierTransformHelpers
```

## Fourier Utilities

```{eval-rst}
.. doxygengroup:: FourierUtilities
```

## Fourier Utility Helpers

```{eval-rst}
.. doxygengroup:: FourierUtilityHelpers
```

## Manager

```{eval-rst}
.. doxygengroup:: Manager
```

## Manager Helpers

```{eval-rst}
.. doxygengroup:: ManagerHelpers
```

## Signal Processing

```{eval-rst}
.. doxygengroup:: SignalProcessing
```

## Signal Processing Helpers

```{eval-rst}
.. doxygengroup:: SignalProcessingHelpers
```

## Waveforms

```{eval-rst}
.. doxygengroup:: Waveforms
```

0 comments on commit 5b16b68

Please sign in to comment.