Example #1
0
def makeNewLDefinitions(aParams, aClass):
    def_str = ''

    if len(aParams) > 0:
        def_str += 'IMPORT_C static C' + aClass + '* NewL(' + makeParameters(aParams) +');\n\t'

    return def_str + 'IMPORT_C static C' + aClass +'* NewL();' 
Example #2
0
def writeCommand(aCmd, aMatchData, aParams, aHeaderTemplate, aSourceTemplate, aHeaderPath, aSourcePath):
    # separate by ,
    matchParams = re.split(r'[^a-zA-Z_0-9\*]+', aMatchData);
    
    # Make template values
    c = {'COMMAND': aCmd, # plain command name
         'CLASSNAME': 'C' + aCmd + 'Command', #CaCmd
         'FILENAME': aCmd.lower() + 'command', # acmd
         'HEADERGUARD': aCmd.upper() + 'COMMAND', # ACMD
         'PARAMETERS': makeParameters(aParams), # aParam1, aParam2
         'MEMBERS': makeMembers(aParams), # iParam1; iParam2
         'NEWL_DEFINITIONS': makeNewLDefinitions(aParams, aCmd + 'Command'), # NewL($PARAMETERS)
         'NEWL_IMPLEMENTATIONS': makeNewLImplementations(aParams, aCmd + 'Command'), 
         'CONSTRUCTOR_DEFINITIONS': makeConstructorDefinitions(aParams, aCmd + 'Command'),
         'CONSTRUCTOR_IMPLEMENTATIONS': makeConstructorImplementations(aParams, aCmd, matchParams), # Don't add 'Command', aCmd is used to build K...Opcode
         'DESTRUCTOR_IMPLEMENTATION': makeDestructorImplementation(aParams),
         'WRITE_FRAME':  makeWriteFrame(aParams),
         'COMMANDFRAME': makeCommandFrame(aParams),
         'MEMBER_ASSIGNMENT': makeMemberAssignment(aParams),
         'ACCESSOR_DEFINITIONS': makeAccessorDefinitions(aParams),
         'ACCESSOR_IMPLEMENTATIONS': makeAccessorImplementations(aParams, 'C' + aCmd + 'Command'),
         'EVENT_MATCH_DEFINITIONS': makeEventMatchDefinitions(matchParams),
         'EVENT_MATCH_IMPLEMENTATIONS': makeEventMatchImplementations(matchParams, aCmd),
         'EVENT_MATCH_INCLUDES': makeEventMatchIncludes(matchParams),
         'PRAGMA_HW_VOICE_SETTING_ADVICE': makePragmaHwVoiceSettingAdvice(aCmd),
         'GENERATE_TIME_STAMP': strftime("%a, %d %b %Y %H:%M:%S") + ' (time stamp)'}  # (time stamp) is needed for preventing unneccesary submissions.

    # Fill in template
    #file(aHeaderPath + '\\' + c['FILENAME'] + '.h', 'w+').write(aHeaderTemplate.substitute(c))
    #file(aSourcePath + '\\' + c['FILENAME'] + '.cpp', 'w+').write(aSourceTemplate.substitute(c))
    
    doTimeStampCompareAndWrite(aHeaderPath + '\\' + c['FILENAME'] + '.h', aHeaderTemplate.substitute(c))
    doTimeStampCompareAndWrite(aSourcePath + '\\' + c['FILENAME'] + '.cpp', aSourceTemplate.substitute(c))
Example #3
0
def makeNewLDefinitions(aParams, aClass):
    def_str = ''

    if len(aParams) > 0:
        def_str += 'IMPORT_C static C' + aClass + '* NewL(' + makeParameters(
            aParams) + ');\n\t'

    return def_str + 'IMPORT_C static C' + aClass + '* NewL();'
Example #4
0
def makeNewLImplementations(aParams, aClass):
    imp_str = ''

    if len(aParams) > 0:
        imp_str += makeNewLImp(aClass, makeParameters(aParams), makeConstructorParameters(aParams), makeConstructLCall(aParams))
        imp_str += '\n\n'
        
    imp_str += makeNewLImp(aClass, '', '', 'CHCICommandBase::BaseConstructL()')
    return imp_str
Example #5
0
def makeNewLImplementations(aParams, aClass):
    imp_str = ''

    if len(aParams) > 0:
        imp_str += makeNewLImp(aClass, makeParameters(aParams),
                               makeConstructorParameters(aParams),
                               makeConstructLCall(aParams))
        imp_str += '\n\n'

    imp_str += makeNewLImp(aClass, '', '', 'CHCICommandBase::BaseConstructL()')
    return imp_str
Example #6
0
def writeCommand(aCmd, aMatchData, aParams, aHeaderTemplate, aSourceTemplate,
                 aHeaderPath, aSourcePath):
    # separate by ,
    matchParams = re.split(r'[^a-zA-Z_0-9\*]+', aMatchData)

    # Make template values
    c = {
        'COMMAND':
        aCmd,  # plain command name
        'CLASSNAME':
        'C' + aCmd + 'Command',  #CaCmd
        'FILENAME':
        aCmd.lower() + 'command',  # acmd
        'HEADERGUARD':
        aCmd.upper() + 'COMMAND',  # ACMD
        'PARAMETERS':
        makeParameters(aParams),  # aParam1, aParam2
        'MEMBERS':
        makeMembers(aParams),  # iParam1; iParam2
        'NEWL_DEFINITIONS':
        makeNewLDefinitions(aParams, aCmd + 'Command'),  # NewL($PARAMETERS)
        'NEWL_IMPLEMENTATIONS':
        makeNewLImplementations(aParams, aCmd + 'Command'),
        'CONSTRUCTOR_DEFINITIONS':
        makeConstructorDefinitions(aParams, aCmd + 'Command'),
        'CONSTRUCTOR_IMPLEMENTATIONS':
        makeConstructorImplementations(
            aParams, aCmd, matchParams
        ),  # Don't add 'Command', aCmd is used to build K...Opcode
        'DESTRUCTOR_IMPLEMENTATION':
        makeDestructorImplementation(aParams),
        'WRITE_FRAME':
        makeWriteFrame(aParams),
        'COMMANDFRAME':
        makeCommandFrame(aParams),
        'MEMBER_ASSIGNMENT':
        makeMemberAssignment(aParams),
        'ACCESSOR_DEFINITIONS':
        makeAccessorDefinitions(aParams),
        'ACCESSOR_IMPLEMENTATIONS':
        makeAccessorImplementations(aParams, 'C' + aCmd + 'Command'),
        'EVENT_MATCH_DEFINITIONS':
        makeEventMatchDefinitions(matchParams),
        'EVENT_MATCH_IMPLEMENTATIONS':
        makeEventMatchImplementations(matchParams, aCmd),
        'EVENT_MATCH_INCLUDES':
        makeEventMatchIncludes(matchParams),
        'PRAGMA_HW_VOICE_SETTING_ADVICE':
        makePragmaHwVoiceSettingAdvice(aCmd),
        'GENERATE_TIME_STAMP':
        strftime("%a, %d %b %Y %H:%M:%S") + ' (time stamp)'
    }  # (time stamp) is needed for preventing unneccesary submissions.

    # Fill in template
    #file(aHeaderPath + '\\' + c['FILENAME'] + '.h', 'w+').write(aHeaderTemplate.substitute(c))
    #file(aSourcePath + '\\' + c['FILENAME'] + '.cpp', 'w+').write(aSourceTemplate.substitute(c))

    doTimeStampCompareAndWrite(aHeaderPath + '\\' + c['FILENAME'] + '.h',
                               aHeaderTemplate.substitute(c))
    doTimeStampCompareAndWrite(aSourcePath + '\\' + c['FILENAME'] + '.cpp',
                               aSourceTemplate.substitute(c))