From 199bb68d2041f31a18ed33378e41512e97b9be37 Mon Sep 17 00:00:00 2001 From: TimePath Date: Tue, 22 Mar 2016 21:03:14 +1100 Subject: [PATCH] Doxygen: improve --- qcsrc/Doxyfile | 31 ++++++++++++++----- qcsrc/common/mutators/base.qh | 2 +- qcsrc/common/notifications/all.qh | 2 +- qcsrc/common/util.qh | 8 ++--- qcsrc/common/weapons/all.qh | 2 +- qcsrc/lib/_all.inc | 2 ++ qcsrc/lib/arraylist.qh | 2 +- qcsrc/lib/enumclass.qh | 2 +- qcsrc/lib/map.qh | 2 +- qcsrc/lib/oo.qh | 4 +-- qcsrc/lib/sort.qh | 4 +-- qcsrc/lib/stats.qh | 2 +- qcsrc/lib/unsafe.qh | 2 +- qcsrc/lib/urllib.qh | 2 +- qcsrc/lib/warpzone/common.qh | 2 +- qcsrc/server/defs.qh | 2 +- .../mutators/mutator/gamemode_keyhunt.qc | 2 +- 17 files changed, 46 insertions(+), 27 deletions(-) diff --git a/qcsrc/Doxyfile b/qcsrc/Doxyfile index cf700aa84..631b9d5cf 100644 --- a/qcsrc/Doxyfile +++ b/qcsrc/Doxyfile @@ -559,7 +559,7 @@ SORT_MEMBER_DOCS = YES # this will also influence the order of the classes in the class list. # The default value is: NO. -SORT_BRIEF_DOCS = NO +SORT_BRIEF_DOCS = YES # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and @@ -571,7 +571,7 @@ SORT_BRIEF_DOCS = NO # detailed member documentation. # The default value is: NO. -SORT_MEMBERS_CTORS_1ST = NO +SORT_MEMBERS_CTORS_1ST = YES # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will @@ -1956,7 +1956,7 @@ ENABLE_PREPROCESSING = YES # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -MACRO_EXPANSION = NO +MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # the macro expansion is limited to the macros specified with the PREDEFINED and @@ -1964,7 +1964,7 @@ MACRO_EXPANSION = NO # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_ONLY_PREDEF = NO +EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. @@ -1978,7 +1978,7 @@ SEARCH_INCLUDES = YES # preprocessor. # This tag requires that the tag SEARCH_INCLUDES is set to YES. -INCLUDE_PATH = +INCLUDE_PATH = . # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the @@ -1996,7 +1996,15 @@ 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 = \ + "USING(name, T)=using name = T" \ + "CLASS(name, base)=class name : public base { public:" \ + "CONSTRUCTOR(class)=class::class(" \ + "DESTRUCTOR(class)=class::~class()" \ + "ATTRIB(class, name, T, val)=T name = val;" \ + "METHOD(class, name, prototype)=virtual void class::name()" \ + "ENDCLASS(class)=};" \ + __STDC__ # 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 @@ -2005,7 +2013,16 @@ PREDEFINED = # definition found in the source code. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_AS_DEFINED = +EXPAND_AS_DEFINED = \ + USING \ + CLASS \ + CONSTRUCTOR \ + DESTRUCTOR \ + ATTRIB \ + METHOD \ + ENDCLASS \ + LABEL \ + __STDC__ # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will # remove all references to function-like macros that are alone on a line, have diff --git a/qcsrc/common/mutators/base.qh b/qcsrc/common/mutators/base.qh index 3bca32452..4d92b5d40 100644 --- a/qcsrc/common/mutators/base.qh +++ b/qcsrc/common/mutators/base.qh @@ -144,7 +144,7 @@ enum { MUTATOR_ROLLING_BACK }; -typedef bool(int) mutatorfunc_t; +USING(mutatorfunc_t, bool(int)); CLASS(Mutator, Object) ATTRIB(Mutator, m_id, int, 0) diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index 8f00087c0..525fc98e9 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -72,7 +72,7 @@ ENUMCLASS(CPID) CASE(CPID, LAST) ENUMCLASS_END(CPID) -typedef entity Notification; +USING(Notification, entity); // used for notification system multi-team identifiers #define APP_TEAM_NUM(num, prefix) ((num == NUM_TEAM_1) ? prefix##_RED : ((num == NUM_TEAM_2) ? prefix##_BLUE : ((num == NUM_TEAM_3) ? prefix##_YELLOW : prefix##_PINK))) diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 2a6d28e8e..7bc867533 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -114,8 +114,8 @@ string rgb_to_hexcolor(vector rgb); float boxesoverlap(vector m1, vector m2, vector m3, vector m4); float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs); -typedef float(string s, vector size) textLengthUpToWidth_widthFunction_t; -typedef float(string s) textLengthUpToLength_lenFunction_t; +USING(textLengthUpToWidth_widthFunction_t, float(string s, vector size)); +USING(textLengthUpToLength_lenFunction_t, float(string s)); float textLengthUpToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw); string textShortenToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw); float textLengthUpToLength(string theText, float maxWidth, textLengthUpToLength_lenFunction_t tw); @@ -247,8 +247,8 @@ float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x); // as it may exceed 0..1 bounds, or go in reverse float cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor); -typedef entity(entity cur, entity near, entity pass) findNextEntityNearFunction_t; -typedef float(entity a, entity b, entity pass) isConnectedFunction_t; +USING(findNextEntityNearFunction_t, entity(entity cur, entity near, entity pass)); +USING(isConnectedFunction_t, float(entity a, entity b, entity pass)); void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass); // expand multiple arguments into one argument by stripping parenthesis diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index cdf78c924..5bf03fdbe 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -6,7 +6,7 @@ #include "config.qh" // weapon sets -typedef vector WepSet; +USING(WepSet, vector); #ifdef SVQC void WriteWepSet(float dest, WepSet w); #endif diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index 97d560b5c..6f88d9067 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -25,6 +25,8 @@ #include #endif +#define USING(name, T) typedef T name + #include "bool.qh" #include "int.qh" diff --git a/qcsrc/lib/arraylist.qh b/qcsrc/lib/arraylist.qh index 209004b64..c0809ecdf 100644 --- a/qcsrc/lib/arraylist.qh +++ b/qcsrc/lib/arraylist.qh @@ -1,6 +1,6 @@ #pragma once -typedef entity ArrayList; +USING(ArrayList, entity); .int al_buf; .int al_len; diff --git a/qcsrc/lib/enumclass.qh b/qcsrc/lib/enumclass.qh index 68b106a5c..532db1deb 100644 --- a/qcsrc/lib/enumclass.qh +++ b/qcsrc/lib/enumclass.qh @@ -8,7 +8,7 @@ // zero overhead mode, use this for releases -#define ENUMCLASS(id) typedef int id; enum { CASE(id, Null) +#define ENUMCLASS(id) USING(id, int); enum { CASE(id, Null) #define CASE(class, id) class##_##id, #define ENUMCLASS_END(id) }; #define ORDINAL(it) (it) diff --git a/qcsrc/lib/map.qh b/qcsrc/lib/map.qh index 0ff16e13d..57b8f8c67 100644 --- a/qcsrc/lib/map.qh +++ b/qcsrc/lib/map.qh @@ -18,7 +18,7 @@ void db_save(int db, string filename) fclose(fh); } -typedef int HashMap; +USING(HashMap, int); int db_create() { diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index 4615ea970..5e0efc218 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -12,7 +12,7 @@ .vector origin; .bool pure_data; -/** @deprecated, use new_pure or NEW(class) */ +/** @deprecated use new_pure or NEW(class) */ #define make_pure(e) \ MACRO_BEGIN \ { \ @@ -63,7 +63,7 @@ entity __spawn(string _classname, string _sourceLoc, bool pure) #define EVAL_entityclass(...) __VA_ARGS__ #define entityclass_1(name) entityclass_2(name, Object) #ifndef QCC_SUPPORT_ENTITYCLASS - #define entityclass_2(name, base) typedef entity name + #define entityclass_2(name, base) USING(name, entity) #define class(name) #define _new(class, pure) __spawn( #class, __FILE__ ":" STR(__LINE__), pure) #else diff --git a/qcsrc/lib/sort.qh b/qcsrc/lib/sort.qh index 4313954cd..2790cdf2d 100644 --- a/qcsrc/lib/sort.qh +++ b/qcsrc/lib/sort.qh @@ -1,9 +1,9 @@ #pragma once /** is only ever called for i1 < i2 */ -typedef void (int i1, int i2, entity pass) swapfunc_t; +USING(swapfunc_t, void (int i1, int i2, entity pass)); /** <0 for <, ==0 for ==, >0 for > (like strcmp) */ -typedef int (int i1, int i2, entity pass) comparefunc_t; +USING(comparefunc_t, int (int i1, int i2, entity pass)); void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass) { diff --git a/qcsrc/lib/stats.qh b/qcsrc/lib/stats.qh index 2d10d9c46..228e604a2 100644 --- a/qcsrc/lib/stats.qh +++ b/qcsrc/lib/stats.qh @@ -6,7 +6,7 @@ #include "sort.qh" .int m_id; -typedef vector vectori; +USING(vectori, vector); #define REGISTER_STAT(...) EVAL_REGISTER_STAT(OVERLOAD(REGISTER_STAT, __VA_ARGS__)) #define EVAL_REGISTER_STAT(...) __VA_ARGS__ diff --git a/qcsrc/lib/unsafe.qh b/qcsrc/lib/unsafe.qh index e506ea518..97e1c7958 100644 --- a/qcsrc/lib/unsafe.qh +++ b/qcsrc/lib/unsafe.qh @@ -7,7 +7,7 @@ X(int) X(float) X(entity) X(string) -typedef float(...) rawfunc; +USING(rawfunc, float(...)); X(rawfunc) #undef X diff --git a/qcsrc/lib/urllib.qh b/qcsrc/lib/urllib.qh index 874640940..00523a84f 100644 --- a/qcsrc/lib/urllib.qh +++ b/qcsrc/lib/urllib.qh @@ -15,7 +15,7 @@ const float URL_READY_CLOSED = 0; const float URL_READY_CANWRITE = 1; const float URL_READY_CANREAD = 2; // errors: -1, or negative HTTP status code -typedef void (entity handle, entity pass, float status) url_ready_func; +USING(url_ready_func, void (entity handle, entity pass, float status)); void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass); void url_fclose(entity e); diff --git a/qcsrc/lib/warpzone/common.qh b/qcsrc/lib/warpzone/common.qh index d0c1f22ea..ebea01108 100644 --- a/qcsrc/lib/warpzone/common.qh +++ b/qcsrc/lib/warpzone/common.qh @@ -30,7 +30,7 @@ void WarpZone_MakeAllOther(); #define MOVE_NOTHING -1 entity WarpZone_trace_forent; // temp, callback is allowed to change it -typedef void(vector start, vector hit, vector end) WarpZone_trace_callback_t; // called on every elementary trace +USING(WarpZone_trace_callback_t, void(vector start, vector hit, vector end)); // called on every elementary trace var WarpZone_trace_callback_t WarpZone_trace_callback_t_null; entity WarpZone_trace_transform; // transform accumulator during a trace entity WarpZone_trace_firstzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then) diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 8139325f9..3b8a2480d 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -416,7 +416,7 @@ const float ACTIVE_TOGGLE = 3; void PlayerUseKey(); -typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t; +USING(spawn_evalfunc_t, vector(entity player, entity spot, vector current)); .spawn_evalfunc_t spawn_evalfunc; string modname; diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index d1316d288..344bedb4b 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -46,7 +46,7 @@ float kh_tracking_enabled; .entity kh_next; float kh_Key_AllOwnedByWhichTeam(); -typedef void() kh_Think_t; +USING(kh_Think_t, void()); void kh_StartRound(); void kh_Controller_SetThink(float t, kh_Think_t func); -- 2.39.2