#!/bin/bash

#Synchronize Enums

#Get all lines of EnumDefinitions.h which hold Enum 
cat c.vim | sed "/ISSM's Enums begin/,/vim: ts=8/d" > temp
echo "\"ISSM's Enums begin" >> temp
cat ../../../../../src/c/EnumDefinitions/EnumDefinitions.h | grep -e "[0-9]Enum," -e "[aA-zZ]Enum," | grep -v StringToEnum | sed -e "s/,//g" | awk '{ printf "syn keyword cConstant " $1 "\n"}' >> temp
echo "\"ISSM's Enums end" >> temp
cat c.vim | sed "1,/ISSM's Enums end/d" >> temp

mv temp c.vim

#Synchronize objects
cat c.vim | sed "/ISSM's objects begin/,/vim: ts=8/d" > temp
echo "\"ISSM's objects begin" >> temp
cat ../../../../../src/c/objects/objects.h  | grep "\.h" | sed -e "s/\// /g" -e "s/\.h\"//" | awk '{print  $(NF)}' | awk '{ printf "syn keyword cType " $1 "\n"}' >> temp
echo "\"ISSM's objects end" >> temp
cat c.vim | sed "1,/ISSM's objects end/d" >> temp

mv temp c.vim
