8000 fc : flowchart : fc.sh -> fc.mk · cheoljoo/doxygen_perlmod_python@8a360fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a360fd

Browse files
author
charles.lee
committed
fc : flowchart : fc.sh -> fc.mk
1 parent 8d84f0b commit 8a360fd

File tree

5 files changed

+180
-0
lines changed

5 files changed

+180
-0
lines changed

taf/fc.mk

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
all:
3+
ifndef INDIR
4+
@echo "error: INDIR is not defined"
5+
exit 4
6+
endif
7+
@echo "INDIR = ${INDIR}"
8+
ifndef OUTDIR
9+
@echo "error: OUTDIR is not defined"
10+
exit 4
11+
endif
12+
@echo "OUTDIR = ${OUTDIR}"
13+
@echo "MODULE = ${MODULE}"
14+
rm -rf _hpp_ _all_
15+
python3 copyFile.py --inDir=${INDIR} --startDirname="service,include,interface" --endExt="hpp,hxx,h" --destDir="_hpp_" > doxygen_perlmod_python.log 2>&1
16+
python3 copyFile.py --inDir=${INDIR} --startDirname="service,include,interface" --endExt="hpp,hxx,h,c,cpp,cxx" --destDir="_all_" >> doxygen_perlmod_python.log 2>&1
17+
if [ ! -e mysetting.py ]; then cp -f ../src/mysetting_example.py mysetting.py; fi
18+
rm -f plantuml.md plantuml.json
19+
echo "doxgen_flowchart"
20+
-./doxygen_flowchart Doxyfile.flowchart > /dev/null 2>&1 # _all_
21+
rm -rf _output_ _plantuml DoxyDocs.pm DoxyDocs.py
22+
echo "doxgen"
23+
doxygen >> doxygen_perlmod_python.log 2>&1 # _hpp_
24+
echo "DoxyDocs.pm is used for this document"
25+
cp -f _output_/perlmod/DoxyDocs.pm .
26+
echo "doxy2py.pl"
27+
perl doxy2py.pl >> doxygen_perlmod_python.log 2>&1
28+
echo "taf_create_docker.sh"
29+
/bin/bash taf_create_docker.sh >> doxygen_perlmod_python.log 2>&1
30+
echo "mkdir -p ${OUTDIR}"
31+
mkdir -p ${OUTDIR}
32+
#docker run -it --user `id -u`:`id -g` -v `pwd`/_hpp_:/docker_in -v `realpath ${OUTDIR}`:/docker_out -v `pwd`:/docker_git -e DOCKER_IN=/docker_in -e DOCKER_OUT=/docker_out -e DOCKER_GIT=/docker_git -e DOCKER_MODULE=${MODULE} doxygen_perlmod_python:latest bash /docker_git/taf_run_in_docker.sh
33+
if [ -e plantuml.md ]; then echo "parse_flowchart.py --inpuml=plantuml.md --outjson=plantuml.json"; python3 parse_flowchart.py --inpuml=plantuml.md --outjson=plantuml.json; fi
34+
if [ -e plantuml.md ]; then echo "copy plantuml.md ${OUTDIR}"; cp -f plantuml.md ${OUTDIR} ; fi
35+
if [ -e plantuml.json ]; then echo "taf_run_flowchart_in_docker.sh" ; mkdir -p ${OUTDIR}; docker run -it --user `id -u`:`id -g` -v `pwd`/_hpp_:/docker_in -v `realpath ${OUTDIR}`:/docker_out -v `pwd`:/docker_git -e DOCKER_IN=/docker_in -e DOCKER_OUT=/docker_out -e DOCKER_GIT=/docker_git -e DOCKER_MODULE=${MODULE} doxygen_perlmod_python:latest bash /docker_git/taf_run_flowchart_in_docker.sh ; fi
36+
if [ -e doxygen_perlmod_python.log ]; then echo "copy doxygen_perlmod_python.log ${OUTDIR}"; cp -f doxygen_perlmod_python.log ${OUTDIR} ; fi

taf/fc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
make -f fc.mk all INDIR=../services/region-service OUTDIR=./module/Regionxxx MODULE="Regionxxx"

taf/m.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
make all INDIR=../services/region-service OUTDIR=./module/Regionxxx MODULE="Regionxxx"

taf/parse_flowchart.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#from collections import defaultdict
2+
#import numpy as np
3+
4+
import sys
5+
import os
6+
import argparse
7+
import math
8+
import random
9+
# https://www.daleseo.com/python-typing/
10+
from typing import Optional
11+
from typing import Union
12+
from typing import List
13+
from typing import Final
14+
from typing import Dict
15+
from typing import Tuple
16+
from typing import Set
17+
import re
18+
import csv
19+
import json
20+
import mysetting
21+
import datetime
22+
23+
from pprint import PrettyPrinter
24+
import re
25+
26+
custom_printer = PrettyPrinter(
27+
indent=2,
28+
width=500,
29+
depth=6,
30+
compact=True,
31+
sort_dicts=False
32+
#underscore_numbers=True
33+
)
34+
pprint = custom_printer.pprint
35+
36+
37+
38+
39+
def extract_braces_content(text):
40+
# DOTALL 플래그를 사용하여 개행 문자도 포함하여 매치합니다.
41+
pattern = r'\{([^{}]*?)\}'
42+
match = re.search(pattern, text, re.DOTALL)
43+
if match:
44+
return match.group(1) # 중괄호 안의 내용만 반환합니다.
45+
else:
46+
return None
47+
48+
# 테스트를 위한 멀티라인 문자열
49+
sample_text = """
50+
function example() {
51+
var config = {
52+
option1: true,
53+
option2: "value",
54+
option3: [1, 2, 3]
55+
};
56+
return config;
57+
}
58+
"""
59+
60+
# 함수 호출 및 결과 출력
61+
#content = extract_braces_content(sample_text)
62+
#print("Extracted Content:")
63+
#print(content)
64+
65+
class Solution:
66+
def __init__(self,inpuml,outjson,debug):
67+
self.inpuml = inpuml
68+
self.outjson = outjson
69+
self.debug = debug
70+
self.uml = []
71+
self.json = {}
72+
#a = [1,2,3,4]
73+
#pprint({ 'a' : a })
74+
lines = []
75+
with open(self.inpuml, 'r') as file:
76+
lines = file.readlines()
77+
78+
self.startFlowChart = re.compile('^```puml\s*:\s*func-FlowChart\s*:\s*(?P<func>.*)\s*$')
79+
self.startSequenceDiagram = re.compile('^```puml\s*:\s*func-SequenceDiagram\s*:\s*(?P<func>.*)\s*$')
80+
self.startUmlRe = re.compile('^\s*@startuml\s*$')
81+
self.endUmlRe = re.compile('^\s*@enduml\s*$')
82+
83+
for line in lines:
84+
if not line.strip():
85+
continue
86+
grp = self.startFlowChart.search(line)
87+
if grp:
88+
self.func = grp.group('func')
89+
self.func_no_space = self.func.replace(' ','')
90+
self.kind = 'flowchart'
91+
#print(grp.group('func'))
92+
continue
93+
grp = self.startSequenceDiagram.search(line)
94+
if grp:
95+
self.func = grp.group('func')
96+
self.func_no_space = self.func.replace(' ','')
97+
self.kind = 'sequencediagram'
98+
#print(grp.group('func'))
99+
continue
100+
if self.endUmlRe.search(line):
101+
self.uml.append(line)
102+
if self.func_no_space not in self.json:
103+
self.json[self.func_no_space] = { 'func': self.func, 'flowchart':[] , 'sequencediagram':[] }
104+
self.json[self.func_no_space][self.kind] = self.uml
105+
self.uml = []
106+
continue
107+
self.uml.append(line.replace('::','__'))
108+
109+
#pprint({'json':self.json})
110+
with open(self.outjson, 'w') as file:
111+
print('write:',self.outjson , '<- self.json')
112+
json.dump({ 'json':self.json } ,file,indent = 4)
113+
114+
115+
if (__name__ == "__main__"):
116+
117+
parser = argparse.ArgumentParser(
118+
prog=sys.argv[0],
119+
description=
120+
'parse plantuml from doxygen_flowchart'
121+
)
122+
parser.add_argument( '--debug', default=False , action="store_true" , help="debug mode on default : false")
123+
parser.add_argument( '--inpuml', type=str,default='plantuml.md' ,
124+
help='input plantuml file default:plantuml.md')
125+
parser.add_argument( '--outjson', type=str,default='parse-out.json' ,
126+
help='output json from --inpuml default:parse-out.json')
127+
args = parser.parse_args()
128+
129+
S = Solution(args.inpuml,args.outjson,args.debug)
130+
131+

taf/taf_run_flowchart_in_docker.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# docker image (doxygen_perlmod_python:latest) is created from docker image(vaeum/alpine-python3-pip3) with taf_install.sh
2+
# docker run -it --user `id -u`:`id -g` -v `pwd`:/docker_in -v `pwd`/op:/docker_out -e DOCKER_IN=/docker_in -e DOCKER_OUT=/docker_out -e DOCKER_GIT=/docker_in doxygen_perlmod_python:latest bash /docker_in/taf_run.sh
3+
umask 000
4+
chmod 777 -R ${DOCKER_OUT}
5+
echo "DOCKER_IN ${DOCKER_IN}"
6+
echo "DOCKER_GIT ${DOCKER_GIT}"
7+
echo "DOCKER_OUT ${DOCKER_OUT}"
8+
echo "DOCKER_MODULE ${DOCKER_MODULE}"
9+
#ls -l ${DOCKER_OUT}
10+
cd ${DOCKER_GIT}; python3 hpp2plantuml.py $(find ${DOCKER_IN} \( -name "*.h" -o -name "*.hpp" \) -print0 | xargs -0 -n 1 echo -i) -o all.puml -j out.json
11+
cd ${DOCKER_GIT}; python3 sample-mako.py --infile=class.flowchart.mako --service="${DOCKER_MODULE} Service" --plantumlServerProxy="http://tiger02.lge.com:18080/proxy?fmt=svg" --tcmdoutdir=${DOCKER_OUT}

0 commit comments

Comments
 (0)
0