]> Creatis software - bbtk.git/blob - kernel/appli/bbCreateBlackBox/bbCreateBlackBox.bat.in
Feature #1774
[bbtk.git] / kernel / appli / bbCreateBlackBox / bbCreateBlackBox.bat.in
1 rem # ---------------------------------------------------------------------
2 rem #
3 rem # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 rem #                        pour la SantÈ)
5 rem # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 rem # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 rem # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 rem #
9 rem #  This software is governed by the CeCILL-B license under French law and
10 rem #  abiding by the rules of distribution of free software. You can  use,
11 rem #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 rem #  license as circulated by CEA, CNRS and INRIA at the following URL
13 rem #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 rem #  or in the file LICENSE.txt.
15 rem #
16 rem #  As a counterpart to the access to the source code and  rights to copy,
17 rem #  modify and redistribute granted by the license, users are provided only
18 rem #  with a limited warranty  and the software's author,  the holder of the
19 rem #  economic rights,  and the successive licensors  have only  limited
20 rem #  liability.
21 rem #
22 rem #  The fact that you are presently reading this means that you have had
23 rem #  knowledge of the CeCILL-B license and that you accept its terms.
24 rem # ------------------------------------------------------------------------ */
25 rem
26
27 @echo off
28
29 echo creates the file architecture for a new blackbox
30
31
32 if %0%5==%0 goto ERROR01
33
34
35 rem bbCreatePackage path
36 set BINPATH=%~dp0
37 rem Input data path
38 set INPUT="%BINPATH%\@bbCreateBlackBox_DATA_REL_PATH_FROM_BIN@\xml-templates"
39
40 set OUTPUT=%1
41 set PACK=%2
42 set BLACKBOX=%3
43 set TYPE=%4
44 set FORMAT=%5
45 set AUTHOR=%6
46 set DESCRIPTION=%7
47 set FILENAME=bb%PACK%%BLACKBOX%
48
49 echo output=  %OUTPUT%
50 echo bin   =  %BINPATH%
51 echo input =  %INPUT%
52 echo pack  =  %PACK%
53 echo blackbox  =  %BLACKBOX%
54 echo type  =  %TYPE%
55 echo format  =  %FORMAT%
56 echo author  =  %AUTHOR%
57 echo description  =  %DESCRIPTION%
58 echo filename  =  %FILENAME%
59
60 echo "** Creating new black box  '%BLACKBOX%'  xml/c++ in folder '%OUTPUT%'"
61
62 echo Creating XML file..
63 echo copy %INPUT%\%type%-template.xml %OUTPUT%\%FILENAME%.xml
64 copy %INPUT%\%type%-template.xml %OUTPUT%\%FILENAME%.xml_tmp
65 "%BINPATH%\bbSed" %OUTPUT%\%FILENAME%.xml_tmp  __BLACKBOXNAME__ %BLACKBOX% > %OUTPUT%\%FILENAME%_1.xml
66 "%BINPATH%\bbSed" %OUTPUT%\%FILENAME%_1.xml  __AUTHOR__ %AUTHOR% > %OUTPUT%\%FILENAME%_2.xml
67 "%BINPATH%\bbSed" %OUTPUT%\%FILENAME%_2.xml  __DESCRIPTION__ %DESCRIPTION% > %OUTPUT%\%FILENAME%.xml_tmp
68 del %OUTPUT%\%FILENAME%_1.xml 
69 del %OUTPUT%\%FILENAME%_2.xml
70
71
72 IF %FORMAT%==XML GOTO module_XML
73 IF %FORMAT%==C++ GOTO module_C++
74
75 goto ERROR03
76
77 :module_XML
78   IF EXIST %OUTPUT%\%FILENAME%.xml GOTO ERROR02
79   move %OUTPUT%\%FILENAME%.xml_tmp %OUTPUT%\%FILENAME%.xml 
80 goto END
81
82 :module_C++
83   IF EXIST %OUTPUT%\%FILENAME%.cxx GOTO ERROR02
84   echo "%BINPATH%\bbfy" %OUTPUT%\%FILENAME%.xml_tmp %PACK% %OUTPUT% 
85   "%BINPATH%\bbfy" %OUTPUT%\%FILENAME%.xml_tmp %PACK% %OUTPUT%\
86   del %OUTPUT%\%FILENAME%.xml_tmp 
87 goto END
88
89
90
91 :ERROR01
92 echo -----------------------------------------------------------------------------  
93 echo bbCreateBlackBox.bat "<dir-path> <package-name> <blackbox-name> <type> <format> [author] [description] "
94 echo    type:  
95 echo          std  
96 echo          VTK_ImageAlgorithm  
97 echo          VTK_PolyDataAlgorithm  
98 echo          widget  
99 echo    format:  
100 echo          XML  
101 echo          C++ 
102 echo -----------------------------------------------------------------------------  
103 goto END
104
105 :ERROR02
106 echo "ERROR : File '%OUTPUT%\%FILENAME%'  %FORMAT%  already exists !"  
107 del %OUTPUT%\%FILENAME%.xml_tmp 
108 goto end
109
110 :ERROR03
111 echo "ERROR : format not match '%FORMAT%'  "  
112 del %OUTPUT%\%FILENAME%.xml_tmp 
113 goto end
114
115
116 :END
117