struct Doc_Array files;
};
+
+typedef struct DocGenerator {
+
+} DocGenerator;
+
+u32 doc_gen_add_string(DocGenerator *gen, char *data, u32 len) {
+
+}
+
void onyx_docs_emit_odoc(const char *dest) {
bh_file doc_file;
if (bh_file_create(&doc_file, dest) != BH_FILE_ERROR_NONE) {
return;
}
+ DocGenerator gen;
+
struct Doc final_doc;
memcpy(final_doc.header.magic_bytes, Doc_Magic_Bytes, 4);
final_doc.header.version = 1;
- final_doc.header.program_name.offset = 0;
- final_doc.header.program_name.length = 0;
+ char *program_name = context.options->target_file;
+ u32 program_name_len = strlen(program_name);
+ final_doc.header.program_name.offset = doc_gen_add_string(&gen, program_name, program_name_len);
+ final_doc.header.program_name.length = program_name_len;
final_doc.header.build_time = bh_time_curr() / 1000;
use core {array, hash, memory, math, conv, Optional}
use core.intrinsics.onyx { __initialize }
-//
-// Map is a generic hash-map implementation that uses chaining.
-// Values can be of any type. Keys must of a type that supports
-// the core.hash.hash, and the '==' operator.
-//
+#doc """
+ Map is a generic hash-map implementation that uses chaining.
+ Values can be of any type. Keys must of a type that supports
+ the core.hash.hash, and the '==' operator.
+"""
@conv.Custom_Format.{ #solidify format_map {K=Key_Type, V=Value_Type} }
Map :: struct (Key_Type: type_expr, Value_Type: type_expr) where ValidKey(Key_Type) {
allocator : Allocator;
}
-//
-// Allows for creation of a Map using make().
-//
-// m := make(Map(str, i32));
-//
+#doc """
+ Allows for creation of a Map using make().
+
+ m := make(Map(str, i32));
+"""
#overload
__make_overload :: macro (x: &Map($K, $V), allocator := context.allocator) =>
#this_package.make(K, V);
-//
-// Creates and initializes a new map using the types provided.
+#doc """
+ Creates and initializes a new map using the types provided.
+"""
make :: macro ($Key: type_expr, $Value: type_expr, default := Value.{}) -> Map(Key, Value) {
map : Map(Key, Value);
#this_package.init(&map, default = default);
else do hashes[last.hash_index] = lr.entry_index;
}
-//
-// Helper macro that finds a value by the key, and if it exists,
-// runs the code, providing an `it` variable that is a pointer
-// to the value.
-//
-// m: Map(str, i32);
-// m->update("test") {
-// *it += 10;
-// }
-// or:
-// m->update("test", #(*it += 10));
-//
-update :: macro (map: &Map, key: map.Key_Type, body: Code) {
+#doc """
+ Helper macro that finds a value by the key, and if it exists,
+ runs the code, providing an `it` variable that is a pointer
+ to the value.
+
+ m: Map(str, i32);
+ m->update("test") {
+ *it += 10;
+ }
+ or:
+ m->update("test", #(*it += 10));
+"""
+update :: macro (map: ^Map, key: map.Key_Type, body: Code) {
lookup_ :: lookup
lr := lookup_(map, key);