示例#1
0
def FindLexersInXcode(xCodeProject):
    lines = FileGenerator.ReadFileAsList(xCodeProject)

    uidsOfBuild = {}
    markersPBXBuildFile = [
        "Begin PBXBuildFile section", "", "End PBXBuildFile section"
    ]
    for buildLine in lines[FileGenerator.FindSectionInList(
            lines, markersPBXBuildFile)]:
        # Occurs for each file in the build. Find the UIDs used for the file.
        #\t\t[0-9A-F]+ /* [a-zA-Z]+.cxx in sources */ = {isa = PBXBuildFile; fileRef = [0-9A-F]+ /* [a-zA-Z]+ */; };
        pieces = buildLine.split()
        uid1 = pieces[0]
        filename = pieces[2].split(".")[0]
        uid2 = pieces[12]
        uidsOfBuild[filename] = [uid1, uid2]

    lexers = {}
    markersLexers = ["/* Lexers */ =", "children", ");"]
    for lexerLine in lines[FileGenerator.FindSectionInList(
            lines, markersLexers)]:
        #\t\t\t\t[0-9A-F]+ /* [a-zA-Z]+.cxx */,
        uid, _, rest = lexerLine.partition("/* ")
        uid = uid.strip()
        lexer, _, _ = rest.partition(".")
        lexers[lexer] = uidsOfBuild[lexer]

    return lexers
示例#2
0
def RegenerateAll(root):
	HFacer.RegenerateAll(root, False)
	f = Face.Face()
	include = root / "include"
	f.ReadFromFile(include / "Scintilla.iface")
	FileGenerator.Regenerate(include / "ScintillaMessages.h", "//", HMessages(f))
	FileGenerator.Regenerate(include / "ScintillaTypes.h", "//", HEnumerations(f), HConstants(f))
	FileGenerator.Regenerate(include / "ScintillaCall.h", "//", HMethods(f))
	FileGenerator.Regenerate(root / "call" / "ScintillaCall.cxx", "//", CXXMethods(f))
示例#3
0
def slack_response():
    
    global burritoCount
    global burritos

    command =  request.form.get("command") 
    text = request.form.get("text")
    burrito = {}
    burrito['id'] = burritoCount
    burrito['start_time'] = time() + 60
    
    print("Recieved command: ", command, text)
    
    locations = get_your_loc_burrito_loc(text)
    
    burritoInfo = FileGenerator.burrito(locations[0], locations[1])
    
    burrito['coords'] = burritoInfo['coords']
   
    burritos.append(burrito)
    burritoCount += 1

    re = {}

    re["response_type"] = "in_channel"
   
    re['text'] = "Burrit numbo " + str(burrito['id']) + " will be leaving " + locations[1] + " in 60 seconds. It will arrive at " + locations[0] + " Flight Waypoint file: " + burritoInfo['link']
    
    re['attachments'] = [{'image_url': "https://food.fnr.sndimg.com/content/dam/images/food/fullset/2013/2/14/0/FNK_breakfast-burrito_s4x3.jpg.rend.hgtvcom.616.462.suffix/1382542427230.jpeg"}]

    re['unfurl_media'] = True
    re['unfurl_links'] = True
    
    return Response(json.dumps(re), mimetype="application/json")
示例#4
0
def RegenerateAll(root, showMaxID):
	f = Face.Face()
	f.ReadFromFile(root / "include/Scintilla.iface")
	FileGenerator.Regenerate(root / "include/Scintilla.h", "/* ", printHFile(f))
	if showMaxID:
		valueSet = set(int(x) for x in f.values if int(x) < 3000)
		maximumID = max(valueSet)
		print("Maximum ID is %d" % maximumID)
示例#5
0
def generateFiles(data_set, search_term):
    """
    generateFiles() uses the data_set from generateDataSet() to create CSV and JSON files, named with the search term.
    """

    file_generator = FileGenerator.FileGenerator(
    )  # Instantiate FileGenerator object.

    csv_file_name = search_term + "twitterDataCSV"  # Name the csv file.
    json_file_name = search_term + "twitterDataJSON"  # Name the json file.

    file_generator.createCSV(
        data_set,
        csv_file_name)  # Create csv file with the given data set and filename.
    file_generator.createJSON(
        data_set, json_file_name
    )  # Create json file with the given data set and filename.
 def __init__(self, theGlobals=None):
     tk.Toplevel.__init__(self)
     self.protocol('WM_DELETE_WINDOW', self.Close)
     self.perspectiveIndx = tk.StringVar(value=self.PERSPECTIVES[0])
     self.activeViewIndx = tk.StringVar()
     self.activeViewIndx.trace("w", self.setActiveView)
     self.leftPaneIndx = tk.IntVar(value=-1)
     self.leftPaneVisible = tk.BooleanVar()
     self.leftPaneVisible.trace("w", self.setLeftPaneVisibility)
     self.rightPaneIndx = tk.IntVar(value=-1)
     #         self.rightPaneIndx.trace("w", self.setRightPane)
     self.xbmcThreads = menuThreads.menuThreads()
     self.addonSettings = xmlFileWrapper.xmlFileWrapper(
         'addonIdeSettingFile.xml')
     self.coder = addonCoder.Addoncoder(self.xbmcThreads,
                                        self.addonSettings)
     self.fileGenerator = FileGenerator.FileGenerator(
         self.addonSettings, self.xbmcThreads, self.coder)
     self.settings = {}
     self.setGUI()
     self.activeUrl.set('')
     self.newFile()
     self.currentFile = 'default.pck'
     self.title(self.currentFile)
def UpdateDependencies(filepath, dependencies, comment=""):
    """ Write a dependencies file if different from dependencies. """
    FileGenerator.UpdateFile(
        os.path.abspath(filepath),
        comment.rstrip() + os.linesep + TextFromDependencies(dependencies))
示例#8
0
def RegenerateAll():
	lexers = FindModules('../lexers', '../../build/VS2017/Notepad2.vcxproj')

	modules = sorted(lexers.values(), key=lambda m: m.lower())
	FileGenerator.Regenerate('../lexlib/LexerModule.cxx', '//', modules)
示例#9
0
def RegenerateAll(root):
	f = Face.Face()
	f.ReadFromFile(root + "include/Scintilla.iface")
	FileGenerator.Regenerate(root + "include/ScintillaMessages.h", "//", HMessages(f))
	FileGenerator.Regenerate(root + "include/ScintillaTypes.h", "//", HEnumerations(f), HConstants(f))
示例#10
0
#!/usr/bin/env python
'''generate c file from binary file'''
import FileGenerator, os
NOTES = '''\
This is the 2nd stage upgrade program, compile and link it with the 
main firmware.  After preparing the new firmware in swap flash sectors,
copy the program to sram and run it.'''
BIN_FILE = 'upgrade_stage2.bin'
DST_FILE = 'upgrade_stage2.c'

prog = open(BIN_FILE, 'rb').read()
size = len(prog)

OUTPUT = FileGenerator.CGenerator(DST_FILE, DST_FILE)
OUTPUT.writeSeperator()
OUTPUT.writeComment(NOTES)
OUTPUT.writeSeperator()
OUTPUT.writeLine()
OUTPUT.writeLine('const unsigned int upgrade_prog_length = %d;' % size)
OUTPUT.writeLine('')
OUTPUT.writeLine('const char upgrade_prog_data[] = {')
chars = []
for _ in range(size):
    chars.append('0x%02x, ' % ord(prog[_]))
    if len(chars) > 12:
        OUTPUT.writeLine(''.join(chars))
        chars = []
if chars:
    OUTPUT.writeLine(''.join(chars))
OUTPUT.writeLine('};')
OUTPUT.close()
示例#11
0
def RegenerateAll(root):
    f = Face.Face()
    f.ReadFromFile(root / "include/SciLexer.iface")
    FileGenerator.Regenerate(root / "include/SciLexer.h", "/* ",
                             printLexHFile(f))
示例#12
0
文件: LexFacer.py 项目: riQQ/lexilla
def RegenerateAll(root, _showMaxID):
    f = Face.Face()
    f.ReadFromFile(root / "include/LexicalStyles.iface")
    FileGenerator.Regenerate(root / "include/SciLexer.h", "/* ",
                             printLexHFile(f))
示例#13
0
'''

COMMON_C_HEAD = '''\
#include <stdint.h>

uint8_t _crc8(const uint8_t *data, int len, uint8_t crc, const uint8_t *table);
uint16_t _crc16(const uint8_t *data, int len, uint16_t crc, const uint16_t *table);
uint32_t _crc32(const uint8_t *data, int len, uint32_t crc, const uint32_t *table);
'''

NOTES = '''\
crc libs, generated from python crcmod module
crcmod module is designed by Raymond L. Buvel and Craig McQueen
MCUSH designed by Peng Shulin, all rights reserved.'''

C = FileGenerator.CGenerator(OUTPUT_C_SRC, os.path.basename(OUTPUT_C_SRC))
C.writeSeperator()
C.writeComment(NOTES)
C.writeSeperator()
C.writeLine(COMMON_C_SRC)

H = FileGenerator.HGenerator(OUTPUT_C_HEAD, os.path.basename(OUTPUT_C_HEAD))
H.writeSeperator()
H.writeComment(NOTES)
H.writeSeperator()
H.writeLine(COMMON_C_HEAD)

INT_CTYPE = ['uint8_t', 'uint16_t', 'uint32_t', 'uint32_t']
INT_WIDTH = [8, 16, 32, 32]
INT_FORMAT = ['0x%02Xu', '0x%04Xu', '0x%08Xu', '0x%08Xu']