Skip to content

Commit 7bf0a46

Browse files
committed
Sync docs structure with P4 repo
1 parent 1dd5e51 commit 7bf0a46

File tree

7 files changed

+180084
-69170
lines changed

7 files changed

+180084
-69170
lines changed

docs/README.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ overlooked) job. We can always write better documentation!
130130

131131
In P4C, documentation is generated using Doxygen. The generated documentation depends on [Doxygen Awesome CSS](https://github.com/jothepro/doxygen-awesome-css). The documentation is dynamically updated and deployed on [GitHub Pages](https://p4lang.github.io/p4c/).
132132

133-
There are two main sources from which we generate documentation: comments
134-
in the code and markup documents in the docs/doxygen directory.
133+
Documentation is generated from two main sources: README files distributed
134+
across the repository and comments within the code. The README files are
135+
tagged with documentation inclusion notes to indicate their integration into
136+
the P4 compiler documentation.
135137

136138
Code comments should capture the main intent of the implementation and
137139
the "why", rather than the "how". The how can be read from the code,
@@ -150,14 +152,45 @@ XX is a number between 02-99. Currently, 00_revision_history.md
150152
contains the documentation revision history, and 01_overview.md is the
151153
overview of the compiler goals and architecture.
152154

153-
## Documentation Comments Style Guide
155+
## C/C++ Documentation Comments Style Guide
154156
- Use triple slashes `///` for documenting functions and classes in files.
155157
- Double slashes `//` should be used for "internal" comments within functions.
156158
- Double slashes `//` should be used for inline comment.
157159
- For rare occasions such as adding comments to multi-line macros, you may use `/* ... */` style comments.
158-
- There should be no space at the end of the comment.
159-
- First letter of the comment should be a capital letter.
160-
- Each comment should end with a period.
160+
- Formatting:
161+
- There should be no space at the end of the comment.
162+
- First letter of the comment should be a capital letter.
163+
- Each comment should end with a period.
164+
165+
## Building the Doxygen documentation
166+
- Doxygen is configured in `docs/doxygen/doxygen.cfg`.
167+
- The main HTML page is configured in `docs/doxygen/Doxymain.md`:
168+
- CSS for the card effect is in `docs/assets/css/card.css`.
169+
- The effect for the Easter egg toggle is defined in `docs/assets/css/flow.css`.
170+
- The homepage P4C architecture is rendered using `docs/assets/architecture_unanimated.html`, with the editable draw file available at `docs/assets/Architecture.drawio`.
171+
- Add pages and subpages manually to the sidebar (see `docs/doxygen/p4c_layout.xml`).
172+
- TOCs in markdown files are created with the `[TOC]` command.
173+
- The base style for Doxygen Awesome is described in the [Doxygen Awesome Documentation](https://jothepro.github.io/doxygen-awesome-css/) and the updated color scheme is defined in [`docs\assets\css\p4c_custom.css`](https://github.com/p4lang/p4c/blob/main/docs/assets/css/p4c_custom.css).
174+
175+
### Doxygen Comments Style Guide
176+
- Comment Markup and Documentation Commands
177+
- `<!-- ... -->` is used for adding documentation inclusion notes. This content is hidden from both the rendered Markdown and Doxygen, but visible in the raw view on GitHub.
178+
- Use HTML comments with an exclamation mark to add instructions for Doxygen. These comments are hidden in GitHub's Markdown but processed by Doxygen. For example:
179+
```
180+
<!--!
181+
\page changelog Releases
182+
-->
183+
```
184+
- `\internal` and `\endinternal` commands within comments can be used to hide information from Doxygen while still displaying it on GitHub.
185+
```
186+
<!--!
187+
\internal
188+
-->
189+
This section is hidden from Doxygen but will be visible on GitHub.
190+
<!--!
191+
\endinternal
192+
-->
193+
```
161194

162195
Happy writing! Should you have any questions, please don't hesitate to ask.
163196

@@ -178,6 +211,23 @@ git push -f
178211
[guidelines](CodingStandardPhilosophy.md#git-commits-and-pull-requests)
179212
to write commit messages and open pull requests.
180213

214+
+ For every pull request opened, a standard set of CI tests will run
215+
automatically. If any of these fail, look at the Github page for
216+
your pull request for the list of tests that have been run. There
217+
should be "Details" links there for any tests that have failed. Ask
218+
for help via messages in comments on your PR if you are not able to
219+
determine the cause of the failures.
220+
221+
+ There are several CI tests that are not run on every pull request
222+
automatically, but only via following the steps below, in order to
223+
reduce the compute resources used on every pull request. If you
224+
wish to run one or more of these, look through the list of Github
225+
labels for the p4c project
226+
[here](https://github.com/p4lang/p4c/labels) for labels whose name
227+
begins with "run-". Add one or more of those labels to your PR.
228+
On all future pushes to the branch of that PR, those additional CI
229+
runs should run.
230+
181231
## Debugging
182232

183233
* To debug the build process you can run `make V=1`

docs/doxygen/bfn_header.tex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
\fancyfoot[LO]{\fancyplain{}{\bfseries\scriptsize Barefoot Networks }}
9797
\fancyfoot[CO]{\fancyplain{}{}}
9898
\fancyfoot[RO]{\fancyplain{}{}}
99-
%\fancyfoot[C]{\sffamily\scriptsize\textbf{Company Confidential}}
10099
\renewcommand{\footrulewidth}{0.4pt}
101100
\renewcommand{\sectionmark}[1]{%
102101
\markright{\thesection\ #1}%

docs/doxygen/doxygen.cfg

Lines changed: 71 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Doxyfile 1.12.0
1+
# Doxyfile 1.13.2
22

33
# This file describes the settings to be used by the documentation system
44
# Doxygen (www.doxygen.org) for a project.
@@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
4242
# title of most generated pages and in a few other places.
4343
# The default value is: My Project.
4444

45-
PROJECT_NAME = P4 Compiler Documentation (P4C)
45+
PROJECT_NAME = "P4 Compiler Documentation (P4C)"
4646

4747
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
4848
# could be handy for archiving the generated documentation or if some version
@@ -51,7 +51,7 @@ PROJECT_NAME = P4 Compiler Documentation (P4C)
5151
PROJECT_NUMBER =
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
54-
# for a project that appears at the top of each page and should give viewer a
54+
# for a project that appears at the top of each page and should give viewers a
5555
# quick idea about the purpose of the project. Keep the description short.
5656

5757
PROJECT_BRIEF = "The P4 Compiler"
@@ -80,7 +80,7 @@ OUTPUT_DIRECTORY = ./build
8080
# sub-directories (in 2 levels) under the output directory of each output format
8181
# and will distribute the generated files over these directories. Enabling this
8282
# option can be useful when feeding Doxygen a huge amount of source files, where
83-
# putting all generated files in the same directory would otherwise causes
83+
# putting all generated files in the same directory would otherwise cause
8484
# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to
8585
# control the number of sub-directories.
8686
# The default value is: NO.
@@ -192,17 +192,17 @@ STRIP_FROM_PATH =
192192
STRIP_FROM_INC_PATH =
193193

194194
# If the SHORT_NAMES tag is set to YES, Doxygen will generate much shorter (but
195-
# less readable) file names. This can be useful is your file systems doesn't
195+
# less readable) file names. This can be useful if your file system doesn't
196196
# support long names like on DOS, Mac, or CD-ROM.
197197
# The default value is: NO.
198198

199199
SHORT_NAMES = NO
200200

201201
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen will interpret the
202-
# first line (until the first dot) of a Javadoc-style comment as the brief
203-
# description. If set to NO, the Javadoc-style will behave just like regular Qt-
204-
# style comments (thus requiring an explicit @brief command for a brief
205-
# description.)
202+
# first line (until the first dot, question mark or exclamation mark) of a
203+
# Javadoc-style comment as the brief description. If set to NO, the Javadoc-
204+
# style will behave just like regular Qt-style comments (thus requiring an
205+
# explicit @brief command for a brief description.)
206206
# The default value is: NO.
207207

208208
JAVADOC_AUTOBRIEF = NO
@@ -218,9 +218,10 @@ JAVADOC_AUTOBRIEF = NO
218218
JAVADOC_BANNER = NO
219219

220220
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will interpret the first
221-
# line (until the first dot) of a Qt-style comment as the brief description. If
222-
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
223-
# requiring an explicit \brief command for a brief description.)
221+
# line (until the first dot, question mark or exclamation mark) of a Qt-style
222+
# comment as the brief description. If set to NO, the Qt-style will behave just
223+
# like regular Qt-style comments (thus requiring an explicit \brief command for
224+
# a brief description.)
224225
# The default value is: NO.
225226

226227
QT_AUTOBRIEF = NO
@@ -373,11 +374,20 @@ MARKDOWN_ID_STYLE = GITHUB
373374
# When enabled Doxygen tries to link words that correspond to documented
374375
# classes, or namespaces to their corresponding documentation. Such a link can
375376
# be prevented in individual cases by putting a % sign in front of the word or
376-
# globally by setting AUTOLINK_SUPPORT to NO.
377+
# globally by setting AUTOLINK_SUPPORT to NO. Words listed in the
378+
# AUTOLINK_IGNORE_WORDS tag are excluded from automatic linking.
377379
# The default value is: YES.
378380

379381
AUTOLINK_SUPPORT = NO
380382

383+
# This tag specifies a list of words that, when matching the start of a word in
384+
# the documentation, will suppress auto links generation, if it is enabled via
385+
# AUTOLINK_SUPPORT. This list does not affect affect links explicitly created
386+
# using \# or the \link or commands.
387+
# This tag requires that the tag AUTOLINK_SUPPORT is set to YES.
388+
389+
AUTOLINK_IGNORE_WORDS =
390+
381391
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
382392
# to include (a tag file for) the STL sources as input, then you should set this
383393
# tag to YES in order to let Doxygen match functions declarations and
@@ -589,6 +599,14 @@ HIDE_UNDOC_MEMBERS = NO
589599

590600
HIDE_UNDOC_CLASSES = NO
591601

602+
# If the HIDE_UNDOC_NAMESPACES tag is set to YES, Doxygen will hide all
603+
# undocumented namespaces that are normally visible in the namespace hierarchy.
604+
# If set to NO, these namespaces will be included in the various overviews. This
605+
# option has no effect if EXTRACT_ALL is enabled.
606+
# The default value is: YES.
607+
608+
HIDE_UNDOC_NAMESPACES = YES
609+
592610
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all friend
593611
# declarations. If set to NO, these declarations will be included in the
594612
# documentation.
@@ -956,6 +974,7 @@ WARN_LOGFILE = p4c-doxygen-warn.log
956974
# Note: If this tag is empty the current directory is searched.
957975

958976
INPUT = ../../docs/README.md \
977+
../../frontends/README.md \
959978
../../README.md \
960979
../../docs/doxygen \
961980
../../frontends \
@@ -990,10 +1009,10 @@ INPUT = ../../docs/README.md \
9901009
INPUT_ENCODING = UTF-8
9911010

9921011
# This tag can be used to specify the character encoding of the source files
993-
# that Doxygen parses The INPUT_FILE_ENCODING tag can be used to specify
1012+
# that Doxygen parses. The INPUT_FILE_ENCODING tag can be used to specify
9941013
# character encoding on a per file pattern basis. Doxygen will compare the file
9951014
# name with each pattern and apply the encoding instead of the default
996-
# INPUT_ENCODING) if there is a match. The character encodings are a list of the
1015+
# INPUT_ENCODING if there is a match. The character encodings are a list of the
9971016
# form: pattern=encoding (like *.php=ISO-8859-1).
9981017
# See also: INPUT_ENCODING for further information on supported encodings.
9991018

@@ -1035,7 +1054,6 @@ RECURSIVE = YES
10351054
# run.
10361055

10371056
EXCLUDE = ../../frontends/p4/README.md \
1038-
../../midend/README.md \
10391057
./awesome_css \
10401058
./build \
10411059
../../backends/p4tools/cmake/README.md \
@@ -1052,9 +1070,9 @@ EXCLUDE = ../../frontends/p4/README.md \
10521070
../../docs/doxygen/01_overview.md \
10531071
../../docs/doxygen/00_revision_history.md \
10541072
../../lib/README.md \
1055-
../../backends/bmv2/pna_nic/README.md \
1073+
../../backends/bmv2/pna_nic/README.md \
10561074
../../ir/README.md \
1057-
../../backends/bmv2/portable_common/README.md \
1075+
../../backends/bmv2/portable_common/README.md
10581076

10591077
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
10601078
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -1171,6 +1189,15 @@ FILTER_SOURCE_PATTERNS =
11711189

11721190
USE_MDFILE_AS_MAINPAGE = ./Doxymain.md
11731191

1192+
# If the IMPLICIT_DIR_DOCS tag is set to YES, any README.md file found in sub-
1193+
# directories of the project's root, is used as the documentation for that sub-
1194+
# directory, except when the README.md starts with a \dir, \page or \mainpage
1195+
# command. If set to NO, the README.md file needs to start with an explicit \dir
1196+
# command in order to be used as directory documentation.
1197+
# The default value is: YES.
1198+
1199+
IMPLICIT_DIR_DOCS = YES
1200+
11741201
# The Fortran standard specifies that for fixed formatted Fortran code all
11751202
# characters from position 72 are to be considered as comment. A common
11761203
# extension is to allow longer lines before the automatic comment starts. The
@@ -1588,9 +1615,9 @@ DOCSET_PUBLISHER_NAME = Publisher
15881615
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
15891616
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
15901617
# on Windows. In the beginning of 2021 Microsoft took the original page, with
1591-
# a.o. the download links, offline the HTML help workshop was already many years
1592-
# in maintenance mode). You can download the HTML help workshop from the web
1593-
# archives at Installation executable (see:
1618+
# a.o. the download links, offline (the HTML help workshop was already many
1619+
# years in maintenance mode). You can download the HTML help workshop from the
1620+
# web archives at Installation executable (see:
15941621
# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
15951622
# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
15961623
#
@@ -1749,7 +1776,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project
17491776
# of each HTML page. A value of NO enables the index and the value YES disables
17501777
# it. Since the tabs in the index contain the same information as the navigation
17511778
# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
1752-
# The default value is: NO.
1779+
# The default value is: YES.
17531780
# This tag requires that the tag GENERATE_HTML is set to YES.
17541781

17551782
DISABLE_INDEX = NO
@@ -1766,7 +1793,7 @@ DISABLE_INDEX = NO
17661793
# shows how to put an image at the root of the tree instead of the PROJECT_NAME.
17671794
# Since the tree basically has the same information as the tab index, you could
17681795
# consider setting DISABLE_INDEX to YES when enabling this option.
1769-
# The default value is: NO.
1796+
# The default value is: YES.
17701797
# This tag requires that the tag GENERATE_HTML is set to YES.
17711798

17721799
GENERATE_TREEVIEW = YES
@@ -2178,7 +2205,7 @@ LATEX_HIDE_INDICES = NO
21782205
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
21792206
# bibliography, e.g. plainnat, or ieeetr. See
21802207
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
2181-
# The default value is: plain.
2208+
# The default value is: plainnat.
21822209
# This tag requires that the tag GENERATE_LATEX is set to YES.
21832210

21842211
LATEX_BIB_STYLE = plain
@@ -2785,24 +2812,29 @@ DIR_GRAPH_MAX_DEPTH = 1
27852812
# generated by dot. For an explanation of the image formats see the section
27862813
# output formats in the documentation of the dot tool (Graphviz (see:
27872814
# https://www.graphviz.org/)).
2788-
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
2789-
# to make the SVG files visible in IE 9+ (other browsers do not have this
2790-
# requirement).
2815+
#
2816+
# Note the formats svg:cairo and svg:cairo:cairo cannot be used in combination
2817+
# with INTERACTIVE_SVG (the INTERACTIVE_SVG will be set to NO).
27912818
# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
2792-
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
2793-
# png:gdiplus:gdiplus.
2819+
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus,
2820+
# png:gdiplus:gdiplus, svg:cairo, svg:cairo:cairo, svg:svg, svg:svg:core,
2821+
# gif:cairo, gif:cairo:gd, gif:cairo:gdiplus, gif:gdiplus, gif:gdiplus:gdiplus,
2822+
# gif:gd, gif:gd:gd, jpg:cairo, jpg:cairo:gd, jpg:cairo:gdiplus, jpg:gd,
2823+
# jpg:gd:gd, jpg:gdiplus and jpg:gdiplus:gdiplus.
27942824
# The default value is: png.
27952825
# This tag requires that the tag HAVE_DOT is set to YES.
27962826

27972827
DOT_IMAGE_FORMAT = svg
27982828

2799-
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
2800-
# enable generation of interactive SVG images that allow zooming and panning.
2829+
# If DOT_IMAGE_FORMAT is set to svg or svg:svg or svg:svg:core, then this option
2830+
# can be set to YES to enable generation of interactive SVG images that allow
2831+
# zooming and panning.
28012832
#
28022833
# Note that this requires a modern browser other than Internet Explorer. Tested
28032834
# and working are Firefox, Chrome, Safari, and Opera.
2804-
# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
2805-
# the SVG files visible. Older versions of IE do not have SVG support.
2835+
#
2836+
# Note This option will be automatically disabled when DOT_IMAGE_FORMAT is set
2837+
# to svg:cairo or svg:cairo:cairo.
28062838
# The default value is: NO.
28072839
# This tag requires that the tag HAVE_DOT is set to YES.
28082840

@@ -2852,6 +2884,12 @@ PLANTUML_CFG_FILE =
28522884

28532885
PLANTUML_INCLUDE_PATH =
28542886

2887+
# The PLANTUMLFILE_DIRS tag can be used to specify one or more directories that
2888+
# contain PlantUml files that are included in the documentation (see the
2889+
# \plantumlfile command).
2890+
2891+
PLANTUMLFILE_DIRS =
2892+
28552893
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
28562894
# that will be shown in the graph. If the number of nodes in a graph becomes
28572895
# larger than this value, Doxygen will truncate the graph, which is visualized

0 commit comments

Comments
 (0)