Skip to content

Commit

Permalink
fix old broken const declarations, fix #include lines in some docgen …
Browse files Browse the repository at this point in the history
…formats
  • Loading branch information
samtupy committed May 18, 2024
1 parent 9e90bea commit b902fbd
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 41 deletions.
7 changes: 3 additions & 4 deletions doc/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def process_topic(tree, path, indent):
open(os.path.join("chm", chm), "w", encoding = "UTF8").write(html_base.format(title = tree[path]["name"], body = mistune.html(markdown).replace("<p><code>", "<pre><code>").replace("</code></p>", "</code></pre>").replace("!!!", "#")))
except Exception as e: print(f"Error creating {chm}, {e}\n")
# hacking around no number signs within markdown code blocks.
markdown = markdown.replace("!!!", "&#35;")
# output the markdown of the topic.
md_file, heading_indent = get_markdown_document(tree, path)
if md_file is not None:
Expand All @@ -170,13 +169,13 @@ def process_topic(tree, path, indent):
if "category_heading" in tree[parent_cat]:
del(tree[parent_cat]["category_heading"])
if markdown[:len(tree[parent_cat]["name"]) + 32].lstrip("\n\t# ").lower().startswith(tree[parent_cat]["name"].lower()):
markdown = "\n" + markdown[1:].partition("\n")[2]
markdown = "\n" + markdown[1:].partition("\n")[2].replace("!!!", "#")
heading_indent -= 1
indent -= 1
# fix heading levels in the document.
heading = "#" * heading_indent
markdown = markdown.replace("\n#", "\n" + heading)
md_file.write(f"{markdown[1:]}\n\n")
md_file.write(f"{markdown[1:].replace('!!!', '#')}\n\n")
# Now we prepare to return the plain text/indented version of the document.
tab_indent = "\t" * indent
tab_heading_indent = "\t" * (indent -1)
Expand All @@ -187,7 +186,7 @@ def process_topic(tree, path, indent):
lines[i] == "```"
continue # Lines that are equal to "```" will not be included in the output.
if l.lstrip("\t").startswith("#"): lines[i] = tab_heading_indent + l.strip("\t#: ") + ":"
else: lines[i] = tab_indent + l.replace("&#35;", "#")
else: lines[i] = tab_indent + l.replace("!!!", "#")
return "\n".join([i for i in lines if i != "```"]) + "\n\n"

def output_documentation_section(tree, path, txt_output_file, hhc_output_file, hhk_output_file, indent = 0):
Expand Down
2 changes: 1 addition & 1 deletion src/bullet3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void RegisterScriptBullet3(asIScriptEngine* engine) {
engine->RegisterObjectMethod("vector", "vector opDiv(float) const", asFUNCTION(Vector3OpDivN), asCALL_CDECL_OBJFIRST);
engine->RegisterObjectMethod("vector", "float length() const", asMETHOD(Vector3, length), asCALL_THISCALL);
engine->RegisterObjectMethod("vector", "float dot() const", asMETHOD(Vector3, dot), asCALL_THISCALL);
engine->RegisterObjectMethod("vector", "vector &normalize() const", asMETHOD(Vector3, normalize), asCALL_THISCALL);
engine->RegisterObjectMethod("vector", "vector& normalize()", asMETHOD(Vector3, normalize), asCALL_THISCALL);
engine->RegisterObjectMethod("vector", "vector normalized() const", asMETHOD(Vector3, normalized), asCALL_THISCALL);
engine->RegisterObjectMethod("vector", "vector rotate(const vector&in, const float) const", asMETHOD(Vector3, rotate), asCALL_THISCALL);
engine->RegisterObjectMethod("vector", "float angle(const vector&in) const", asMETHOD(Vector3, angle), asCALL_THISCALL);
Expand Down
2 changes: 1 addition & 1 deletion src/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,6 @@ void RegisterScriptLibrary(asIScriptEngine* engine) {
engine->RegisterObjectBehaviour(_O("library"), asBEHAVE_RELEASE, _O("void f()"), asMETHOD(library, release), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("library"), _O("bool load(const string&in)"), asMETHOD(library, load), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("library"), _O("bool unload()"), asMETHOD(library, load), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("library"), _O("bool get_active() property"), asMETHOD(library, is_active), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("library"), _O("bool get_active() const property"), asMETHOD(library, is_active), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("library"), _O("dictionary@ call(const string&in, ?&in=null, ?&in=null, ?&in=null, ?&in=null, ?&in=null, ?&in=null, ?&in=null, ?&in=null, ?&in=null, ?&in=null)"), asFUNCTION(library_call_generic), asCALL_GENERIC);
}
2 changes: 1 addition & 1 deletion src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,5 +417,5 @@ void RegisterScriptMap(asIScriptEngine* engine) {
engine->RegisterObjectMethod(_O("coordinate_map"), _O("coordinate_map_area@[]@ get_areas(float, float, float, float = 0.0, coordinate_map_filter_callback@ = null, int64=0, int64=0) const"), asMETHOD(coordinate_map, get_areas_script), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("coordinate_map"), _O("coordinate_map_area@[]@ get_areas(float, float, float, float, float, float, float = 0.0, coordinate_map_filter_callback@ = null, int64=0, int64=0) const"), asMETHOD(coordinate_map, get_areas_in_range_script), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("coordinate_map"), _O("coordinate_map_area@ get_area(float, float, float, int = -1, float = 0.0, coordinate_map_filter_callback@ = null, int64=0, int64=0) const"), asMETHOD(coordinate_map, get_area), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("coordinate_map"), _O("void reset() const"), asMETHOD(coordinate_map, reset), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("coordinate_map"), _O("void reset()"), asMETHOD(coordinate_map, reset), asCALL_THISCALL);
}
32 changes: 16 additions & 16 deletions src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,27 +262,27 @@ void RegisterScriptNetwork(asIScriptEngine* engine) {
engine->RegisterObjectBehaviour(_O("network"), asBEHAVE_FACTORY, _O("network @n()"), asFUNCTION(ScriptNetwork_Factory), asCALL_CDECL);
engine->RegisterObjectBehaviour(_O("network"), asBEHAVE_ADDREF, _O("void f()"), asMETHOD(network, addRef), asCALL_THISCALL);
engine->RegisterObjectBehaviour(_O("network"), asBEHAVE_RELEASE, _O("void f()"), asMETHOD(network, release), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("void destroy() const"), asMETHOD(network, destroy), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool setup_client(uint8, uint16) const"), asMETHOD(network, setup_client), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool setup_server(uint16, uint8, uint16) const"), asMETHOD(network, setup_server), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool setup_local_server(uint16, uint8, uint16) const"), asMETHOD(network, setup_local_server), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("uint64 connect(const string& in, uint16) const"), asMETHOD(network, connect), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("network_event@ request() const"), asMETHOD(network, request), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("void destroy()"), asMETHOD(network, destroy), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool setup_client(uint8, uint16)"), asMETHOD(network, setup_client), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool setup_server(uint16, uint8, uint16)"), asMETHOD(network, setup_server), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool setup_local_server(uint16, uint8, uint16)"), asMETHOD(network, setup_local_server), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("uint64 connect(const string& in, uint16)"), asMETHOD(network, connect), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("network_event@ request()"), asMETHOD(network, request), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("string get_peer_address(uint64) const"), asMETHOD(network, get_peer_address), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("uint get_peer_average_round_trip_time(uint64) const"), asMETHOD(network, get_peer_average_round_trip_time), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send(uint64, const string& in, uint8, bool = true) const"), asMETHOD(network, send), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_reliable(uint64, const string& in, uint8) const"), asMETHOD(network, send_reliable), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_unreliable(uint64, const string& in, uint8) const"), asMETHOD(network, send_unreliable), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_peer(uint64, const string& in, uint8, bool = true) const"), asMETHOD(network, send_peer), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_reliable_peer(uint64, const string& in, uint8) const"), asMETHOD(network, send_reliable_peer), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_unreliable_peer(uint64, const string& in, uint8) const"), asMETHOD(network, send_unreliable_peer), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool disconnect_peer_softly(uint64) const"), asMETHOD(network, disconnect_peer_softly), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool disconnect_peer(uint64) const"), asMETHOD(network, disconnect_peer), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool disconnect_peer_forcefully(uint64) const"), asMETHOD(network, disconnect_peer_forcefully), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send(uint64, const string& in, uint8, bool = true)"), asMETHOD(network, send), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_reliable(uint64, const string& in, uint8)"), asMETHOD(network, send_reliable), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_unreliable(uint64, const string& in, uint8)"), asMETHOD(network, send_unreliable), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_peer(uint64, const string& in, uint8, bool = true)"), asMETHOD(network, send_peer), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_reliable_peer(uint64, const string& in, uint8)"), asMETHOD(network, send_reliable_peer), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool send_unreliable_peer(uint64, const string& in, uint8)"), asMETHOD(network, send_unreliable_peer), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool disconnect_peer_softly(uint64)"), asMETHOD(network, disconnect_peer_softly), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool disconnect_peer(uint64)"), asMETHOD(network, disconnect_peer), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("bool disconnect_peer_forcefully(uint64)"), asMETHOD(network, disconnect_peer_forcefully), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("uint64[]@ get_peer_list() const"), asMETHOD(network, list_peers), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("uint64 get_connected_peers() const property"), asMETHOD(network, get_connected_peers), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("uint get_duplicate_peers() const property"), asMETHOD(network, get_duplicate_peers), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("void set_duplicate_peers(uint) const property"), asMETHOD(network, set_duplicate_peers), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("void set_duplicate_peers(uint) property"), asMETHOD(network, set_duplicate_peers), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("uint get_bytes_received() const property"), asMETHOD(network, get_bytes_received), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("uint get_bytes_sent() const property"), asMETHOD(network, get_bytes_sent), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("network"), _O("void set_bandwidth_limits(uint, uint)"), asMETHOD(network, set_bandwidth_limits), asCALL_THISCALL);
Expand Down
8 changes: 4 additions & 4 deletions src/timestuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,11 @@ void RegisterScriptTimestuff(asIScriptEngine* engine) {
engine->RegisterObjectProperty(_O("timer_queue"), _O("const string failures"), asOFFSET(timer_queue, failures));
engine->RegisterObjectMethod(_O("timer_queue"), _O("void set(const string&in, timer_callback@, const string&in, uint64, bool = false)"), asMETHOD(timer_queue, set), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("void set(const string&in, timer_callback@, uint64, bool = false)"), asMETHOD(timer_queue, set_dataless), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("uint64 elapsed(const string&in)"), asMETHOD(timer_queue, elapsed), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("uint64 timeout(const string&in)"), asMETHOD(timer_queue, timeout), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("bool exists(const string&in)"), asMETHOD(timer_queue, exists), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("uint64 elapsed(const string&in) const"), asMETHOD(timer_queue, elapsed), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("uint64 timeout(const string&in) const"), asMETHOD(timer_queue, timeout), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("bool exists(const string&in) const"), asMETHOD(timer_queue, exists), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("bool restart(const string&in)"), asMETHOD(timer_queue, restart), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("bool is_repeating(const string&in)"), asMETHOD(timer_queue, is_repeating), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("bool is_repeating(const string&in) const"), asMETHOD(timer_queue, is_repeating), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("bool set_timeout(const string&in, uint64, bool = false)"), asMETHOD(timer_queue, set_timeout), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("bool delete(const string&in)"), asMETHOD(timer_queue, erase), asCALL_THISCALL);
engine->RegisterObjectMethod(_O("timer_queue"), _O("void flush()"), asMETHOD(timer_queue, flush), asCALL_THISCALL);
Expand Down
28 changes: 14 additions & 14 deletions src/tts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,24 +359,24 @@ void RegisterTTSVoice(asIScriptEngine* engine) {
engine->RegisterObjectBehaviour("tts_voice", asBEHAVE_FACTORY, _O("tts_voice @t(const string&in = \"builtin fallback voice\")"), asFUNCTION(Script_tts_voice_Factory), asCALL_CDECL);
engine->RegisterObjectBehaviour("tts_voice", asBEHAVE_ADDREF, "void f()", asMETHOD(tts_voice, AddRef), asCALL_THISCALL);
engine->RegisterObjectBehaviour("tts_voice", asBEHAVE_RELEASE, "void f()", asMETHOD(tts_voice, Release), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak(const string &in, bool = false) const", asMETHOD(tts_voice, speak), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak_interrupt(const string &in) const", asMETHOD(tts_voice, speak_interrupt), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak_to_file(const string& in, const string &in) const", asMETHOD(tts_voice, speak_to_file), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak_wait(const string &in, bool = false) const", asMETHOD(tts_voice, speak_wait), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "string speak_to_memory(const string &in) const", asMETHOD(tts_voice, speak_to_memory), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak_interrupt_wait(const string &in) const", asMETHOD(tts_voice, speak_interrupt_wait), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool refresh() const", asMETHOD(tts_voice, refresh), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool stop() const", asMETHOD(tts_voice, stop), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak(const string &in, bool = false)", asMETHOD(tts_voice, speak), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak_interrupt(const string &in)", asMETHOD(tts_voice, speak_interrupt), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak_to_file(const string& in, const string &in)", asMETHOD(tts_voice, speak_to_file), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak_wait(const string &in, bool = false)", asMETHOD(tts_voice, speak_wait), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "string speak_to_memory(const string &in)", asMETHOD(tts_voice, speak_to_memory), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool speak_interrupt_wait(const string &in)", asMETHOD(tts_voice, speak_interrupt_wait), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool refresh()", asMETHOD(tts_voice, refresh), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool stop()", asMETHOD(tts_voice, stop), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "array<string>@ list_voices() const", asMETHOD(tts_voice, list_voices), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool set_voice(int)", asMETHOD(tts_voice, set_voice), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "int get_rate() property", asMETHOD(tts_voice, get_rate), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "int get_rate() const property", asMETHOD(tts_voice, get_rate), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "void set_rate(int) property", asMETHOD(tts_voice, set_rate), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "int get_pitch() property", asMETHOD(tts_voice, get_pitch), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "int get_pitch() const property", asMETHOD(tts_voice, get_pitch), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "void set_pitch(int) property", asMETHOD(tts_voice, set_pitch), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "int get_volume() property", asMETHOD(tts_voice, get_volume), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "int get_volume() const property", asMETHOD(tts_voice, get_volume), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "void set_volume(int) property", asMETHOD(tts_voice, set_volume), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "int get_voice_count() property", asMETHOD(tts_voice, get_voice_count), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "string get_voice_name(int)", asMETHOD(tts_voice, get_voice_name), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool get_speaking() property", asMETHOD(tts_voice, get_speaking), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "int get_voice_count() const property", asMETHOD(tts_voice, get_voice_count), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "string get_voice_name(int) const", asMETHOD(tts_voice, get_voice_name), asCALL_THISCALL);
engine->RegisterObjectMethod("tts_voice", "bool get_speaking() const property", asMETHOD(tts_voice, get_speaking), asCALL_THISCALL);
engine->RegisterObjectProperty("tts_voice", "const int voice", asOFFSET(tts_voice, voice_index));
}

0 comments on commit b902fbd

Please sign in to comment.