# Path: progSpec.py
# def cdlog(lvl, mesg):
#     global MaxLogLevelToShow
#     global lastLogMesgs
#     global highestLvl
#     highestLvl=lvl
#     resizeLogArray(lvl)
#     lastLogMesgs[lvl]=mesg
#     for i in range(highestLvl+1, len(lastLogMesgs)):
#         lastLogMesgs[i]=''
#     if(lvl<=MaxLogLevelToShow):
#         if(lvl==0): print('')
#         printAtLvl(lvl, mesg, '|    ')
# 
# def cdErr(mesg):
#     global lastLogMesgs
#     global highestLvl
#     highestLvl+=1
#     lastLogMesgs[highestLvl]="\n\nError: "+mesg
#     exit(1)


import progSpec
import codeDogParser
import pattern_GenSymbols
from progSpec import cdlog, cdErr



classesToProcess=[]
classesEncoded={}

class structProcessor:

    def addGlobalCode(self, classes):
        pass

    def resetVars(self, modelRef):
        pass

    def processField(self, fieldName, field, fldCat):
        pass

    def addOrAmendClasses(self, classes, className, modelRef):
        pass

    def processStruct(self, classes, className):
        global classesEncoded
        classesEncoded[className]=1
        self.currentClassName = className
        modelRef = progSpec.findSpecOf(classes[0], className, 'model')
        self.resetVars(modelRef)
        self.currentModelSpec = modelRef
        if modelRef==None:
            cdErr('To write a processing function for class "'+className+'" a model is needed but is not found.')
        ### Write code for each field

# Path: progSpec.py
# def cdlog(lvl, mesg):
#     global MaxLogLevelToShow
#     global lastLogMesgs
#     global highestLvl
#     highestLvl=lvl
#     resizeLogArray(lvl)
#     lastLogMesgs[lvl]=mesg
#     for i in range(highestLvl+1, len(lastLogMesgs)):
#         lastLogMesgs[i]=''
#     if(lvl<=MaxLogLevelToShow):
#         if(lvl==0): print('')
#         printAtLvl(lvl, mesg, '|    ')
# 
# def cdErr(mesg):
#     global lastLogMesgs
#     global highestLvl
#     highestLvl+=1
#     lastLogMesgs[highestLvl]="\n\nError: "+mesg
#     exit(1)


# Path: pattern_DispData.py
import progSpec
import codeDogParser
import pattern_GenSymbols
from progSpec import cdlog, cdErr




classesToProcess=[]
classesEncoded={}

class structProcessor:

    def addGlobalCode(self, classes):
        pass

    def resetVars(self, modelRef):
        pass

    def processField(self, fieldName, field, fldCat):
        pass

    def addOrAmendClasses(self, classes, className, modelRef):
        pass

    def processStruct(self, classes, className):
        global classesEncoded
        classesEncoded[className]=1
        self.currentClassName = className
        modelRef = progSpec.findSpecOf(classes[0], className, 'model')
        self.resetVars(modelRef)
        self.currentModelSpec = modelRef
        if modelRef==None:
            cdErr('To write a processing function for class "'+className+'" a model is needed but is not found.')
        ### Write code for each field

        for field in modelRef['fields']: