Commit a7d33526 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Work on doc script

parent 96f0ad50
all: all:
cp templates/templates_from_wiki preprocess # copy the previous one
rm templates/* # delete the old templates
$(MAKE) -C preprocess $(MAKE) -C preprocess
cp preprocess/output/order.txt . cp preprocess/output/order.txt .
./kazoo-merge-doc.py
clean: clean:
rm -rf preprocess/output/* rm -rf preprocess/output/*
......
...@@ -19,6 +19,8 @@ import signal ...@@ -19,6 +19,8 @@ import signal
import argparse import argparse
import traceback import traceback
import logging import logging
import shutil
from itertools import chain
from typing import List, Dict, Tuple from typing import List, Dict, Tuple
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
...@@ -84,12 +86,15 @@ def process_one_file (tmplt: str, old: str, new: str, res_folder: str) -> None: ...@@ -84,12 +86,15 @@ def process_one_file (tmplt: str, old: str, new: str, res_folder: str) -> None:
old_content = open(old, "r").readlines() old_content = open(old, "r").readlines()
except FileNotFoundError: except FileNotFoundError:
LOG.info("Skipping template " + old + " (file not found)") LOG.info("Skipping template " + old + " (file not found)")
return raise
try: try:
new_content = open(new, "r").readlines() new_content = open(new, "r").readlines()
except FileNotFoundError: except FileNotFoundError:
LOG.info("Skipping template " + new + " (file not found)") LOG.info("Skipping template " + new + " (file not found)")
return raise
shutil.copyfile(old + ".pre", res_folder + "/" + tmplt + ".pre")
shutil.copyfile(old + ".post", res_folder + "/" + tmplt + ".post")
# Build dictionnaries from the content of the two files # Build dictionnaries from the content of the two files
assert len(old_content) > 4 and len(new_content) > 5 assert len(old_content) > 4 and len(new_content) > 5
...@@ -172,12 +177,27 @@ def run(options): ...@@ -172,12 +177,27 @@ def run(options):
orderlist = open(options.orderlist, "r").readlines() orderlist = open(options.orderlist, "r").readlines()
wiki_output = open(result_folder + "/templates_from_wiki", "w")
wiki_output.write("== Templates ==\n")
for each in orderlist: for each in orderlist:
name=each.strip() name=each.strip()
process_one_file (tmplt=name, try:
old=old_folder+"/"+name, process_one_file (tmplt=name,
new=new_folder+"/"+name, old=old_folder+"/"+name,
res_folder=result_folder) new=new_folder+"/"+name,
res_folder=result_folder)
except FileNotFoundError:
pass
else:
wiki_output.write(f"\n=== {name} ===\n")
pre_content=open(result_folder+"/"+name+".pre", "r").readlines()
middle_content=open(result_folder+"/"+name, "r").readlines()
post_content=open(result_folder+"/"+name+".post", "r").readlines()
for lines in chain(pre_content, middle_content, post_content):
wiki_output.write(lines)
wiki_output.close()
def main(): def main():
''' Tool entry point ''' ''' Tool entry point '''
......
...@@ -20,126 +20,126 @@ ...@@ -20,126 +20,126 @@
|Required |Required
|Required interfaces (from ri.tmplt) |Required interfaces (from ri.tmplt)
|- |-
|Is_Type |List_Of_PIs
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Glue |PIs_Have_Params
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Partition_Name |CP_Names
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|List_Of_RIs |CP_Values
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Debug_Flag |Node_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CP_Values |ASync_PI_Param_Type
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|List_Of_PIs |Has_Context
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|List_Of_Sync_RIs |No_Stdlib_Flag
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|List_Of_ASync_RIs |Deployment_View
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|ASync_PI_Param_Name |CP_Types
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Check_Data_View |List_Of_ASync_PIs
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Sync_RIs_Parent |Interface_View
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Zip_File |Instance_Of
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Binary_Path |ASync_RI_Param_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|List_Of_Sync_PIs |Debug_Flag
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Property_Values |Property_Values
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|ASync_RI_Param_Type |Data_View
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Node_Name |List_Of_Sync_RIs
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Has_Context |Use_POHIC
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|No_Stdlib_Flag |Output_Dir
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Data_View |CP_Asn1Modules
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Output_Dir |Sync_RIs_Parent
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|ASync_PI_Param_Type |Timer_Resolution
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Timer_Resolution |Check_Data_View
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Async_RIs_Parent |List_Of_Sync_PIs
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Use_POHIC |Other_Files
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Timers |Skeletons
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CP_Types |List_Of_ASync_RIs
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Deployment_View |List_Of_RIs
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Interface_View |Glue
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Instance_Of |CP_Asn1Filenames
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|ASync_RI_Param_Name |Zip_File
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Skeletons |Async_RIs_Parent
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CP_Names |Partition_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|List_Of_ASync_PIs |ASync_RI_Param_Type
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|RIs_Have_Params |Property_Names
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CP_Asn1Filenames |Binary_Path
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Other_Files |RIs_Have_Params
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Property_Names |Timers
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CP_Asn1Modules |Is_Type
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|PIs_Have_Params |ASync_PI_Param_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|} |}
\ No newline at end of file
And all the system configuration obtained from the command line:
Interface_View, Deployment_View, Data_View, Binary_Path, Check_Data_View,
Output_Dir, Skeletons, Glue, Use_POHIC, Timer_Resolution, Debug_Flag,
No_Stdlib_Flag, Timer_Resolution, Other_Files (list of aadl files)
This template is evaluated for every block.
...@@ -26,24 +26,24 @@ ...@@ -26,24 +26,24 @@
|VP_Classifiers |VP_Classifiers
| |_ Corresponding aadl classifier | |_ Corresponding aadl classifier
|- |-
|Ada_Runtime |CPU_Classifier
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Package_Name |CPU_Family
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CPU_Platform |CPU_Instance
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CPU_Family |CPU_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CPU_Name |Package_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CPU_Classifier |CPU_Platform
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|CPU_Instance |Ada_Runtime
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|} |}
\ No newline at end of file
This file is evaluated for every node. The result of this file is saved to the file with name returned by filenode.tmplt. The result is also used as a parameter for system.tmplt.
...@@ -89,19 +89,19 @@ ...@@ -89,19 +89,19 @@
|Block_Languages |Block_Languages
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|VP_Duration |Ada_Runtime
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Block_Instance_Of |Block_Instance_Of
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Thread_Has_Param |Memory_Region
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Ada_Runtime |Thread_Has_Param
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Memory_Region |VP_Duration
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|VP_Package_Name |VP_Package_Name
......
This file is evaluated for every partition.
...@@ -20,51 +20,51 @@ ...@@ -20,51 +20,51 @@
|Param_Directions |Param_Directions
| |_ Corresponding direction | |_ Corresponding direction
|- |-
|Param_Encodings |IF_Property_Values
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Partition_Name |Period
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Param_ASN1_Modules |Is_Timer
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Remote_Function_Names |Param_Encodings
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Language |Remote_Interface_Names
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Is_Timer |Remote_Languages
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Remote_Languages |Language
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|WCET |Queue_Size
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Caller_Is_Local |IF_Property_Names
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|IF_Property_Values |Calling_Threads
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|IF_Property_Names |Remote_Function_Names
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Protected_Block_Name |Caller_Is_Local
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Period |Partition_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Remote_Interface_Names |WCET
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Queue_Size |Param_ASN1_Modules
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Calling_Threads |Protected_Block_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|} |}
\ No newline at end of file
The template pi.tmplt is evaluated many times for every protected and unprotected provided interface.
The result of every evaluation is joined to one string and passed as a parameter to block.tmplt
...@@ -20,45 +20,45 @@ ...@@ -20,45 +20,45 @@
|Param_Directions |Param_Directions
|Corresponding direction |Corresponding direction
|- |-
|Param_Encodings |IF_Property_Values
|DOCUMENTATION MISSING
|-
|Partition_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Param_ASN1_Modules |Period
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Remote_Function_Names |Is_Timer
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Language |Param_Encodings
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Is_Timer |Remote_Interface_Names
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Remote_Languages |Remote_Languages
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|WCET |Language
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|IF_Property_Values |Queue_Size
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|IF_Property_Names |IF_Property_Names
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Period |Calling_Threads
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Remote_Interface_Names |Remote_Function_Names
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Queue_Size |Partition_Name
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Calling_Threads |WCET
|DOCUMENTATION MISSING
|-
|Param_ASN1_Modules
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|} |}
\ No newline at end of file
The template ri.tmplt is evaluated many times for every required interface.
The result of every evaluation is koined to one string and passed as a parameter to block.tmplt
...@@ -112,51 +112,51 @@ ...@@ -112,51 +112,51 @@
|Connect_Port_Name |Connect_Port_Name
| |_ port name | |_ port name
|- |-
|Glue |No_Stdlib_Flag
|DOCUMENTATION MISSING |DOCUMENTATION MISSING
|- |-
|Block_Names |Deployment_View
|DOCUMENTATION MISSING |DOCUMENTATION MISSING