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

Work on doc script

parent 96f0ad50
all:
cp templates/templates_from_wiki preprocess # copy the previous one
rm templates/* # delete the old templates
$(MAKE) -C preprocess
cp preprocess/output/order.txt .
./kazoo-merge-doc.py
clean:
rm -rf preprocess/output/*
......
......@@ -19,6 +19,8 @@ import signal
import argparse
import traceback
import logging
import shutil
from itertools import chain
from typing import List, Dict, Tuple
LOG = logging.getLogger(__name__)
......@@ -84,12 +86,15 @@ def process_one_file (tmplt: str, old: str, new: str, res_folder: str) -> None:
old_content = open(old, "r").readlines()
except FileNotFoundError:
LOG.info("Skipping template " + old + " (file not found)")
return
raise
try:
new_content = open(new, "r").readlines()
except FileNotFoundError:
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
assert len(old_content) > 4 and len(new_content) > 5
......@@ -172,12 +177,27 @@ def run(options):
orderlist = open(options.orderlist, "r").readlines()
wiki_output = open(result_folder + "/templates_from_wiki", "w")
wiki_output.write("== Templates ==\n")
for each in orderlist:
name=each.strip()
process_one_file (tmplt=name,
old=old_folder+"/"+name,
new=new_folder+"/"+name,
res_folder=result_folder)
try:
process_one_file (tmplt=name,
old=old_folder+"/"+name,
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():
''' Tool entry point '''
......
......@@ -20,126 +20,126 @@
|Required
|Required interfaces (from ri.tmplt)
|-
|Is_Type
|List_Of_PIs
|DOCUMENTATION MISSING
|-
|Glue
|PIs_Have_Params
|DOCUMENTATION MISSING
|-
|Partition_Name
|CP_Names
|DOCUMENTATION MISSING
|-
|List_Of_RIs
|CP_Values
|DOCUMENTATION MISSING
|-
|Debug_Flag
|Node_Name
|DOCUMENTATION MISSING
|-
|CP_Values
|ASync_PI_Param_Type
|DOCUMENTATION MISSING
|-
|List_Of_PIs
|Has_Context
|DOCUMENTATION MISSING
|-
|List_Of_Sync_RIs
|No_Stdlib_Flag
|DOCUMENTATION MISSING
|-
|List_Of_ASync_RIs
|Deployment_View
|DOCUMENTATION MISSING
|-
|ASync_PI_Param_Name
|CP_Types
|DOCUMENTATION MISSING
|-
|Check_Data_View
|List_Of_ASync_PIs
|DOCUMENTATION MISSING
|-
|Sync_RIs_Parent
|Interface_View
|DOCUMENTATION MISSING
|-
|Zip_File
|Instance_Of
|DOCUMENTATION MISSING
|-
|Binary_Path
|ASync_RI_Param_Name
|DOCUMENTATION MISSING
|-
|List_Of_Sync_PIs
|Debug_Flag
|DOCUMENTATION MISSING
|-
|Property_Values
|DOCUMENTATION MISSING
|-
|ASync_RI_Param_Type
|Data_View
|DOCUMENTATION MISSING
|-
|Node_Name
|List_Of_Sync_RIs
|DOCUMENTATION MISSING
|-
|Has_Context
|Use_POHIC
|DOCUMENTATION MISSING
|-
|No_Stdlib_Flag
|Output_Dir
|DOCUMENTATION MISSING
|-
|Data_View
|CP_Asn1Modules
|DOCUMENTATION MISSING
|-
|Output_Dir
|Sync_RIs_Parent
|DOCUMENTATION MISSING
|-
|ASync_PI_Param_Type
|Timer_Resolution
|DOCUMENTATION MISSING
|-
|Timer_Resolution
|Check_Data_View
|DOCUMENTATION MISSING
|-
|Async_RIs_Parent
|List_Of_Sync_PIs
|DOCUMENTATION MISSING
|-
|Use_POHIC
|Other_Files
|DOCUMENTATION MISSING
|-
|Timers
|Skeletons
|DOCUMENTATION MISSING
|-
|CP_Types
|List_Of_ASync_RIs
|DOCUMENTATION MISSING
|-
|Deployment_View
|List_Of_RIs
|DOCUMENTATION MISSING
|-
|Interface_View
|Glue
|DOCUMENTATION MISSING
|-
|Instance_Of
|CP_Asn1Filenames
|DOCUMENTATION MISSING
|-
|ASync_RI_Param_Name
|Zip_File
|DOCUMENTATION MISSING
|-
|Skeletons
|Async_RIs_Parent
|DOCUMENTATION MISSING
|-
|CP_Names
|Partition_Name
|DOCUMENTATION MISSING
|-
|List_Of_ASync_PIs
|ASync_RI_Param_Type
|DOCUMENTATION MISSING
|-
|RIs_Have_Params
|Property_Names
|DOCUMENTATION MISSING
|-
|CP_Asn1Filenames
|Binary_Path
|DOCUMENTATION MISSING
|-
|Other_Files
|RIs_Have_Params
|DOCUMENTATION MISSING
|-
|Property_Names
|Timers
|DOCUMENTATION MISSING
|-
|CP_Asn1Modules
|Is_Type
|DOCUMENTATION MISSING
|-
|PIs_Have_Params
|ASync_PI_Param_Name
|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 @@
|VP_Classifiers
| |_ Corresponding aadl classifier
|-
|Ada_Runtime
|CPU_Classifier
|DOCUMENTATION MISSING
|-
|Package_Name
|CPU_Family
|DOCUMENTATION MISSING
|-
|CPU_Platform
|CPU_Instance
|DOCUMENTATION MISSING
|-
|CPU_Family
|CPU_Name
|DOCUMENTATION MISSING
|-
|CPU_Name
|Package_Name
|DOCUMENTATION MISSING
|-
|CPU_Classifier
|CPU_Platform
|DOCUMENTATION MISSING
|-
|CPU_Instance
|Ada_Runtime
|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 @@
|Block_Languages
|DOCUMENTATION MISSING
|-
|VP_Duration
|Ada_Runtime
|DOCUMENTATION MISSING
|-
|Block_Instance_Of
|DOCUMENTATION MISSING
|-
|Thread_Has_Param
|Memory_Region
|DOCUMENTATION MISSING
|-
|Ada_Runtime
|Thread_Has_Param
|DOCUMENTATION MISSING
|-
|Memory_Region
|VP_Duration
|DOCUMENTATION MISSING
|-
|VP_Package_Name
......
This file is evaluated for every partition.
......@@ -20,51 +20,51 @@
|Param_Directions
| |_ Corresponding direction
|-
|Param_Encodings
|IF_Property_Values
|DOCUMENTATION MISSING
|-
|Partition_Name
|Period
|DOCUMENTATION MISSING
|-
|Param_ASN1_Modules
|Is_Timer
|DOCUMENTATION MISSING
|-
|Remote_Function_Names
|Param_Encodings
|DOCUMENTATION MISSING
|-
|Language
|Remote_Interface_Names
|DOCUMENTATION MISSING
|-
|Is_Timer
|Remote_Languages
|DOCUMENTATION MISSING
|-
|Remote_Languages
|Language
|DOCUMENTATION MISSING
|-
|WCET
|Queue_Size
|DOCUMENTATION MISSING
|-
|Caller_Is_Local
|IF_Property_Names
|DOCUMENTATION MISSING
|-
|IF_Property_Values
|Calling_Threads
|DOCUMENTATION MISSING
|-
|IF_Property_Names
|Remote_Function_Names
|DOCUMENTATION MISSING
|-
|Protected_Block_Name
|Caller_Is_Local
|DOCUMENTATION MISSING
|-
|Period
|Partition_Name
|DOCUMENTATION MISSING
|-
|Remote_Interface_Names
|WCET
|DOCUMENTATION MISSING
|-
|Queue_Size
|Param_ASN1_Modules
|DOCUMENTATION MISSING
|-
|Calling_Threads
|Protected_Block_Name
|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 @@
|Param_Directions
|Corresponding direction
|-
|Param_Encodings
|DOCUMENTATION MISSING
|-
|Partition_Name
|IF_Property_Values
|DOCUMENTATION MISSING
|-
|Param_ASN1_Modules
|Period
|DOCUMENTATION MISSING
|-
|Remote_Function_Names
|Is_Timer
|DOCUMENTATION MISSING
|-
|Language
|Param_Encodings
|DOCUMENTATION MISSING
|-
|Is_Timer
|Remote_Interface_Names
|DOCUMENTATION MISSING
|-
|Remote_Languages
|DOCUMENTATION MISSING
|-
|WCET
|Language
|DOCUMENTATION MISSING
|-
|IF_Property_Values
|Queue_Size
|DOCUMENTATION MISSING
|-
|IF_Property_Names
|DOCUMENTATION MISSING
|-
|Period
|Calling_Threads
|DOCUMENTATION MISSING
|-
|Remote_Interface_Names
|Remote_Function_Names
|DOCUMENTATION MISSING
|-
|Queue_Size
|Partition_Name
|DOCUMENTATION MISSING
|-
|Calling_Threads
|WCET
|DOCUMENTATION MISSING
|-
|Param_ASN1_Modules
|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 @@
|Connect_Port_Name
| |_ port name
|-
|Glue
|No_Stdlib_Flag
|DOCUMENTATION MISSING
|-
|Block_Names
|Deployment_View
|DOCUMENTATION MISSING
|-
|Debug_Flag
|Device_Names
|DOCUMENTATION MISSING
|-
|Check_Data_View
|Interface_View
|DOCUMENTATION MISSING
|-
|Binary_Path
|Debug_Flag
|DOCUMENTATION MISSING
|-
|No_Stdlib_Flag
|Data_View
|DOCUMENTATION MISSING
|-
|Data_View
|Use_POHIC
|DOCUMENTATION MISSING
|-
|Output_Dir
|Node_Has_Memory
|DOCUMENTATION MISSING
|-
|Timer_Resolution
|Output_Dir
|DOCUMENTATION MISSING
|-
|Use_POHIC
|Timer_Resolution
|DOCUMENTATION MISSING
|-
|Deployment_View
|Check_Data_View
|DOCUMENTATION MISSING
|-
|Interface_View
|Skeletons
|DOCUMENTATION MISSING
|-
|Device_Names
|Other_Files
|DOCUMENTATION MISSING
|-
|Node_Has_Memory
|Block_Names
|DOCUMENTATION MISSING
|-
|Skeletons
|Glue
|DOCUMENTATION MISSING
|-
|Other_Files
|Binary_Path
|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 file is evaluated for every node. The result of this file is save to the file with name returned by
filesys.tmplt.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment