source: src/Actions/createdef.sh@ 1fd675

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 1fd675 was 1fd675, checked in by Frederik Heber <heber@…>, 15 years ago

All Actions are converted to the new macro framework.

  • included all three values that have been used to create or convert the files
    • createdef.sh
    • createCpp.sh
    • createHeader.sh
  • Property mode set to 100755
File size: 2.9 KB
Line 
1#!/bin/bash
2#
3#
4
5if [ -z $1 ]; then
6 echo "Usage: $0 <Action.cpp>"
7 exit 1
8fi
9
10DIR=`dirname $1`
11ACTION=`basename $1 | awk -F"." {'print $1'} | awk -F"Action" {'print $1'}`
12CATEGORY=`echo $DIR | awk -F"/" {'print $NF'} | awk -F"Action" {'print $1'}`
13PARAMTYPES="#define paramtypes"
14count=0
15liste=`grep "void ${CATEGORY}${ACTION}(" $1 | awk -F"(" {'print $2'} | awk -F")" {'print $1'} | tr \ \# | sed -e "s/#*,#*/ /g" | sed -e "s/#*=#*/=/g"`
16for paramtype in $liste; do
17 paramtype=`echo $paramtype | sed -e "s/^const#*//"`
18 ptype=`echo $paramtype | awk -F"=" {'print $1'} | rev | cut -d"#" -f2- | rev | tr -d \&\*`
19 PARAMTYPES="$PARAMTYPES ($ptype)"
20 ((count+=1))
21done
22PARAMTOKENS="#define paramtokens "`grep ValueStorage::getInstance\(\).setCurrentValue $1 | awk -F"(" {'print $3'} | awk -F"," {'print "("$1")"'}`
23PARAMREFS="#define paramreferences "`grep ValueStorage::getInstance\(\).setCurrentValue $1 | awk -F"," {'print $2'} | awk -F")" {'print "("$1")"'} | tr -d \ `
24PARAMTOKENS=`echo $PARAMTOKENS | sed -e "s#\n##g"`
25PARAMREFS=`echo $PARAMREFS | sed -e "s#\n##g"`
26if [ $count == 0 ]; then
27 PARAMTYPES="#undefine paramtypes"
28 PARAMTOKENS="#undefine paramtokens"
29 PARAMREFS="#undefine paramreferences"
30fi
31STATETYPES="#define statetypes"
32STATEREFS="#define statereferences"
33rcount=1
34liste=`grep "^[[:blank:]]*${CATEGORY}${ACTION}State(" $1 | awk -F"(" {'print $2'} | awk -F")" {'print $1'} | tr \ \# | tr , \ `
35for statetype in $liste; do
36 statetype=`echo $statetype | sed -e "s/^const#*//"`
37 ptype=`echo $statetype | sed -e "s/#*\&*_/_/" | awk -F"_" {'print $1'} | tr \# \ `
38 pstate=`echo $statetype | awk -F"_" {'print $2'} | tr \# \ `
39 STATETYPES="$STATETYPES ($ptype)"
40 STATEREFS="$STATEREFS ($pstate)"
41 ((rcount+=1))
42 if [ $rcount -ge $count ]; then
43 break
44 fi
45done
46if [ $rcount == 1 ]; then
47 STATETYPES="#undefine statetypes"
48 STATEREFS="#undefine statereferences"
49fi
50
51TOKEN=`grep '::NAME\[\] =' $1 | awk -F"=" {'print $2'} | tr -d \ \;`
52action=`echo ${ACTION}Action | tr [a-z] [A-Z]`
53start=`grep -n "#define $action" ${DIR}/${ACTION}Action.hpp | awk -F":" {'print $1'}`
54end=`grep -n "^void ${CATEGORY}${ACTION}(" ${DIR}/${ACTION}Action.hpp | awk -F":" {'print $1'}`
55((end-=1))
56bitmore=$((end-start))
57if [ $bitmore != 0 ]; then
58 INCLUDES=`head -n $end ${DIR}/${ACTION}Action.hpp | tail -n $bitmore | grep -v "/Action.hpp" | sed -e '/^$/d'`
59else
60 INCLUDES=""
61fi
62
63cat >${DIR}/${ACTION}Action.def <<EOF
64/*
65 * ${ACTION}Action.def
66 *
67 * Created on: Aug 26, 2010
68 * Author: heber
69 */
70
71// all includes and forward declarations necessary for non-integral types below
72$INCLUDES
73
74// i.e. there is an integer with variable name Z that can be found in
75// ValueStorage by the token "Z" -> first column: int, Z, "Z"
76// "undefine" if no parameters are required
77$PARAMTYPES
78$PARAMTOKENS
79$PARAMREFS
80
81$STATETYPES
82$STATEREFS
83
84// some defines for all the names, you may use ACTION, STATE and PARAMS
85#define CATEGORY $CATEGORY
86#define ACTIONNAME $ACTION
87#define TOKEN $TOKEN
88
89EOF
Note: See TracBrowser for help on using the repository browser.