Commit 5e09126b681ee4d90d95639df14bf88e0a3ad26f

Authored by totoro
1 parent c480c7a8

add graphviz output for each ds_type_file with file_name as attribute

calexium_lib @ b3734f8f0b4
1 -Subproject commit 891e24cfc2eca3152e2cf33c5963979d963b7bae 1 +Subproject commit b3734f8f0b4bf27ade1712f3c159380ddd828acb
densaku_lib @ fedd3d94917
1 -Subproject commit e19a5e659e24d4bf9c97e5a4f313f80a86414f5e 1 +Subproject commit fedd3d949174b60ead3215c6aea0f8bf3e73e053
src/generation/files.anubis
@@ -35,7 +35,7 @@ public define Maybe(One) @@ -35,7 +35,7 @@ public define Maybe(One)
35 println("Destination dir: "+destination_dir); 35 println("Destination dir: "+destination_dir);
36 with ini = loadIniFile(destination_dir+"/densaku.ini"), 36 with ini = loadIniFile(destination_dir+"/densaku.ini"),
37 37
38 - with types_SHA1 = "::", //readString(ini, "TYPES", "SHA1", "N/A"), 38 + with types_SHA1 = readString(ini, "TYPES", "SHA1", "N/A"),
39 with messages_SHA1 = readString(ini, "MESSAGES", "SHA1", "N/A"), 39 with messages_SHA1 = readString(ini, "MESSAGES", "SHA1", "N/A"),
40 40
41 println("Saved Types SHA1 = "+types_SHA1); 41 println("Saved Types SHA1 = "+types_SHA1);
@@ -55,25 +55,26 @@ public define Maybe(One) @@ -55,25 +55,26 @@ public define Maybe(One)
55 { 55 {
56 failure then failure, 56 failure then failure,
57 success(_) then 57 success(_) then
58 -  
59 println("Generating types and message files"); 58 println("Generating types and message files");
60 make_all_types(output_dir, file_name, types, destination_dir); 59 make_all_types(output_dir, file_name, types, destination_dir);
61 - 60 +
62 println("Generating messages collection"); 61 println("Generating messages collection");
63 make_all_messages(messages, destination_dir); 62 make_all_messages(messages, destination_dir);
64 - 63 +
65 println("Generating graphviz"); 64 println("Generating graphviz");
66 - forget(make_graphviz_types(types, destination_dir));  
67 -  
68 - writeString(ini, "TYPES", "SHA1", current_types_SHA1);  
69 - writeString(ini, "MESSAGES", "SHA1", current_messages_SHA1);  
70 - writeIniInfo(ini); 65 + forget(make_graphviz_types(output_dir, file_name, types, destination_dir));
  66 +
71 success(unique) 67 success(unique)
72 }, 68 },
73 type_files) is 69 type_files) is
74 { 70 {
75 failure then failure, 71 failure then failure,
76 - success(_) then success(unique) 72 + success(_) then
  73 + forget(make_graphviz_types(relative_path(""), auto, get_all_types(type_files), destination_dir));
  74 + writeString(ini, "TYPES", "SHA1", current_types_SHA1);
  75 + writeString(ini, "MESSAGES", "SHA1", current_messages_SHA1);
  76 + writeIniInfo(ini);
  77 + success(unique)
77 } 78 }
78 . 79 .
79 80
src/generation/graphviz/graphviz_main.anubis
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 8
9 read tools/basis.anubis 9 read tools/basis.anubis
10 read tools/streams.anubis 10 read tools/streams.anubis
  11 +read system/string.anubis
11 read densaku_lib/types/densaku.anubis 12 read densaku_lib/types/densaku.anubis
12 read generation/graphviz/graphviz_header.anubis 13 read generation/graphviz/graphviz_header.anubis
13 read generation/graphviz/graphviz_type.anubis 14 read generation/graphviz/graphviz_type.anubis
@@ -15,11 +16,25 @@ read generation/graphviz/graphviz_type.anubis @@ -15,11 +16,25 @@ read generation/graphviz/graphviz_type.anubis
15 public define Maybe(One) 16 public define Maybe(One)
16 make_graphviz_types 17 make_graphviz_types
17 ( 18 (
18 - List(DS_Type) types,  
19 - String destination_dir 19 + DS_Type_File_Output_Dir out_dir,
  20 + DS_Type_File_Output_Name output_file_name,
  21 + List(DS_Type) types,
  22 + String destination_dir
20 )= 23 )=
21 - with file_name = destination_dir+"types/generated/graphviz.gv", 24 + with final_destination_dir =
  25 + if out_dir is
  26 + {
  27 + auto then destination_dir + "types/generated/",
  28 + relative_path(path) then destination_dir + path + "/",
  29 + absolute_path(path) then path
  30 + },
22 31
  32 + with file_name = if output_file_name is
  33 + {
  34 + auto then final_destination_dir+"graphviz.gv",
  35 + name(_file_name) then final_destination_dir+to_lower(_file_name)+".gv",
  36 + },
  37 +
23 if file(file_name, new) is 38 if file(file_name, new) is
24 { 39 {
25 failure then println("can't create file "+file_name);failure, 40 failure then println("can't create file "+file_name);failure,
src/generation/types.anubis
@@ -82,7 +82,18 @@ define String @@ -82,7 +82,18 @@ define String
82 join("\n", 82 join("\n",
83 map((String intermediate) 83 map((String intermediate)
84 |-> 84 |->
85 - "public type "+intermediate+":..." 85 + "public type "+intermediate+":...\n\n"+
  86 + "public define Maybe("+intermediate+")\n"+
  87 +" from_Message\n"+
  88 +" (\n"+
  89 +" Message _"+to_lower(intermediate)+"_message\n"+
  90 +" )\n"+
  91 +".\n\n"+
  92 +"public define Message\n"+
  93 +" to_Message\n"+
  94 +" (\n"+
  95 +" "+intermediate+" _"+to_lower(intermediate)+"\n"+
  96 +" ).\n"
86 , 97 ,
87 final_list 98 final_list
88 ) 99 )
@@ -206,7 +217,7 @@ public define One @@ -206,7 +217,7 @@ public define One
206 types) 217 types)
207 218
208 name(_file_name) then 219 name(_file_name) then
209 - with file_name = final_destination_dir+_file_name+".anubis", 220 + with file_name = final_destination_dir+to_lower(_file_name)+".anubis",
210 221
211 with header = generate_header, 222 with header = generate_header,
212 with file_parts = 223 with file_parts =