Skip to content

Commit 0c84b29

Browse files
SanderMertensmeta-codesync[bot]
authored andcommitted
Add missing comments to Flecs headers (#2010)
Summary: Pull Request resolved: #2010 TSIA Differential Revision: D96177556
1 parent 9dfb8c0 commit 0c84b29

File tree

141 files changed

+6922
-4167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+6922
-4167
lines changed

include/flecs.h

Lines changed: 1091 additions & 1065 deletions
Large diffs are not rendered by default.

include/flecs/addons/alerts.h

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,36 @@
2828
extern "C" {
2929
#endif
3030

31+
/** Maximum number of severity filters per alert. */
3132
#define ECS_ALERT_MAX_SEVERITY_FILTERS (4)
3233

33-
/** Module id. */
34+
/** Module ID. */
3435
FLECS_API extern ECS_COMPONENT_DECLARE(FlecsAlerts);
3536

36-
/* Module components */
37+
/** Module components. */
3738

38-
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlert); /**< Component added to alert, and used as first element of alert severity pair. */
39+
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlert); /**< Component added to alert, and used as the first element of the alert severity pair. */
3940
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertInstance); /**< Component added to alert instance. */
40-
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertsActive); /**< Component added to alert source which tracks how many active alerts there are. */
41-
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertTimeout); /**< Component added to alert which tracks how long an alert has been inactive. */
41+
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertsActive); /**< Component added to alert source, which tracks how many active alerts there are. */
42+
FLECS_API extern ECS_COMPONENT_DECLARE(EcsAlertTimeout); /**< Component added to alert, which tracks how long an alert has been inactive. */
4243

43-
/* Alert severity tags */
44+
/** Alert severity tags. */
4445
FLECS_API extern ECS_TAG_DECLARE(EcsAlertInfo); /**< Info alert severity. */
4546
FLECS_API extern ECS_TAG_DECLARE(EcsAlertWarning); /**< Warning alert severity. */
4647
FLECS_API extern ECS_TAG_DECLARE(EcsAlertError); /**< Error alert severity. */
4748
FLECS_API extern ECS_TAG_DECLARE(EcsAlertCritical); /**< Critical alert severity. */
4849

4950
/** Component added to alert instance. */
5051
typedef struct EcsAlertInstance {
51-
char *message; /**< Generated alert message */
52+
char *message; /**< Generated alert message. */
5253
} EcsAlertInstance;
5354

5455
/** Map with active alerts for entity. */
5556
typedef struct EcsAlertsActive {
56-
int32_t info_count; /**< Number of alerts for source with info severity */
57-
int32_t warning_count; /**< Number of alerts for source with warning severity */
58-
int32_t error_count; /**< Number of alerts for source with error severity */
59-
ecs_map_t alerts;
57+
int32_t info_count; /**< Number of alerts for source with info severity. */
58+
int32_t warning_count; /**< Number of alerts for source with warning severity. */
59+
int32_t error_count; /**< Number of alerts for source with error severity. */
60+
ecs_map_t alerts; /**< Map of active alerts for entity. */
6061
} EcsAlertsActive;
6162

6263
/** Alert severity filter.
@@ -66,18 +67,18 @@ typedef struct EcsAlertsActive {
6667
* severity of an alert from Warning to Error.
6768
*/
6869
typedef struct ecs_alert_severity_filter_t {
69-
ecs_entity_t severity; /* Severity kind */
70-
ecs_id_t with; /* Component to match */
71-
const char *var; /* Variable to match component on. Do not include the
72-
* '$' character. Leave to NULL for $this. */
73-
int32_t _var_index; /* Index of variable in filter (do not set) */
70+
ecs_entity_t severity; /**< Severity kind. */
71+
ecs_id_t with; /**< Component to match. */
72+
const char *var; /**< Variable to match component on. Do not include the
73+
* '$' character. Leave as NULL for $this. */
74+
int32_t _var_index; /**< Index of variable in query (do not set). */
7475
} ecs_alert_severity_filter_t;
7576

7677
/** Alert descriptor, used with ecs_alert_init(). */
7778
typedef struct ecs_alert_desc_t {
78-
int32_t _canary;
79+
int32_t _canary; /**< Used for validity testing. Do not set. */
7980

80-
/** Entity associated with alert */
81+
/** Entity associated with alert. */
8182
ecs_entity_t entity;
8283

8384
/** Alert query. An alert will be created for each entity that matches the
@@ -96,13 +97,13 @@ typedef struct ecs_alert_desc_t {
9697
*/
9798
const char *message;
9899

99-
/** User friendly name. Will only be set if FLECS_DOC addon is enabled. */
100+
/** User-friendly name. Will only be set if FLECS_DOC addon is enabled. */
100101
const char *doc_name;
101102

102-
/** Description of alert. Will only be set if FLECS_DOC addon is enabled */
103+
/** Description of alert. Will only be set if FLECS_DOC addon is enabled. */
103104
const char *brief;
104105

105-
/** Metric kind. Must be EcsAlertInfo, EcsAlertWarning, EcsAlertError or
106+
/** Alert severity. Must be EcsAlertInfo, EcsAlertWarning, EcsAlertError, or
106107
* EcsAlertCritical. Defaults to EcsAlertError. */
107108
ecs_entity_t severity;
108109

@@ -114,20 +115,20 @@ typedef struct ecs_alert_desc_t {
114115

115116
/** The retain period specifies how long an alert must be inactive before it
116117
* is cleared. This makes it easier to track noisy alerts. While an alert is
117-
* inactive its duration won't increase.
118+
* inactive, its duration won't increase.
118119
* When the retain period is 0, the alert will clear immediately after it no
119120
* longer matches the alert query. */
120121
ecs_ftime_t retain_period;
121122

122-
/** Alert when member value is out of range. Uses the warning/error ranges
123+
/** Alert when member value is out of range. Uses the warning and error ranges
123124
* assigned to the member in the MemberRanges component (optional). */
124125
ecs_entity_t member;
125126

126-
/** (Component) id of member to monitor. If left to 0 this will be set to
127+
/** (Component) ID of member to monitor. If left to 0, this will be set to
127128
* the parent entity of the member (optional). */
128129
ecs_id_t id;
129130

130-
/** Variable from which to fetch the member (optional). When left to NULL
131+
/** Variable from which to fetch the member (optional). When left to NULL,
131132
* 'id' will be obtained from $this. */
132133
const char *var;
133134
} ecs_alert_desc_t;

include/flecs/addons/app.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* The app addon is a wrapper around the application's main loop. Its main
66
* purpose is to provide a hook to modules that need to take control of the
77
* main loop, as is for example the case with native applications that use
8-
* emscripten with webGL.
8+
* Emscripten with WebGL.
99
*/
1010

1111
#ifdef FLECS_APP
@@ -36,17 +36,17 @@ typedef int(*ecs_app_init_action_t)(
3636
/** Used with ecs_app_run(). */
3737
typedef struct ecs_app_desc_t {
3838
ecs_ftime_t target_fps; /**< Target FPS. */
39-
ecs_ftime_t delta_time; /**< Frame time increment (0 for measured values) */
39+
ecs_ftime_t delta_time; /**< Frame time increment (0 for measured values). */
4040
int32_t threads; /**< Number of threads. */
41-
int32_t frames; /**< Number of frames to run (0 for infinite) */
42-
bool enable_rest; /**< Enables ECS access over HTTP, necessary for explorer */
43-
bool enable_stats; /**< Periodically collect statistics */
44-
uint16_t port; /**< HTTP port used by REST API */
41+
int32_t frames; /**< Number of frames to run (0 for infinite). */
42+
bool enable_rest; /**< Enables ECS access over HTTP, necessary for the explorer. */
43+
bool enable_stats; /**< Periodically collects statistics. */
44+
uint16_t port; /**< HTTP port used by REST API. */
4545

46-
ecs_app_init_action_t init; /**< If set, function is ran before starting the
46+
ecs_app_init_action_t init; /**< If set, the function is run before starting the
4747
* main loop. */
4848

49-
void *ctx; /**< Reserved for custom run/frame actions */
49+
void *ctx; /**< Reserved for custom run and frame actions. */
5050
} ecs_app_desc_t;
5151

5252
/** Callback type for run action. */
@@ -61,27 +61,28 @@ typedef int(*ecs_app_frame_action_t)(
6161

6262
/** Run application.
6363
* This will run the application with the parameters specified in desc. After
64-
* the application quits (ecs_quit() is called) the world will be cleaned up.
64+
* the application quits (ecs_quit() is called), the world will be cleaned up.
6565
*
6666
* If a custom run action is set, it will be invoked by this operation. The
6767
* default run action calls the frame action in a loop until it returns a
6868
* non-zero value.
6969
*
7070
* @param world The world.
7171
* @param desc Application parameters.
72+
* @return Zero if success, non-zero if failed.
7273
*/
7374
FLECS_API
7475
int ecs_app_run(
7576
ecs_world_t *world,
7677
ecs_app_desc_t *desc);
7778

7879
/** Default frame callback.
79-
* This operation will run a single frame. By default this operation will invoke
80+
* This operation will run a single frame. By default, this operation will invoke
8081
* ecs_progress() directly, unless a custom frame action is set.
8182
*
8283
* @param world The world.
8384
* @param desc The desc struct passed to ecs_app_run().
84-
* @return value returned by ecs_progress()
85+
* @return Value returned by ecs_progress().
8586
*/
8687
FLECS_API
8788
int ecs_app_run_frame(
@@ -92,6 +93,7 @@ int ecs_app_run_frame(
9293
* See ecs_app_run().
9394
*
9495
* @param callback The run action.
96+
* @return Zero if success, non-zero if failed.
9597
*/
9698
FLECS_API
9799
int ecs_app_set_run_action(
@@ -101,6 +103,7 @@ int ecs_app_set_run_action(
101103
* See ecs_app_run_frame().
102104
*
103105
* @param callback The frame action.
106+
* @return Zero if success, non-zero if failed.
104107
*/
105108
FLECS_API
106109
int ecs_app_set_frame_action(

0 commit comments

Comments
 (0)