Example #1
0
    def parse_models(self):
        '''
        Parse the c++ reference implementation
        of the custom instruction.
        '''

        logger.info('Determine if modelpath is a folder or a single file')
        if os.path.isdir(self._modelpath):
            # restore the toolchain to its defaults
            self.restore()
            logger.info('Traverse over directory')
            self.treewalk(self._modelpath)
        else:
            logger.info('Single file, start parsing')
            model = Model(self._modelpath)
            self._models.append(model)

        # add model for read function
        self._models.append(Model(read=True))
        # add model for write function
        self._models.append(Model(write=True))

        self._exts = Extensions(self._models)
        self._compiler = Compiler(self._exts, self._regs, self._tcpath)
        self._gem5 = Gem5(self._exts, self._regs)
Example #2
0
 def __init__(self, root="."):
     self.root = os.path.abspath(root)
     self.paths = Paths(root=self.root)
     self.extensions = Extensions()
     self.aliases = {}
Example #3
0
 def prepend_extensions(self, *extensions):
     new = Extensions(extensions)
     new.extend(self.extensions)
     self.extensions = new
Example #4
0
    def plansza3(self):
        """Rysuje trzecią planszę."""

        for i in range(2):
            self.add_speed = Extensions(
                random.randrange(30, self.screen_width - 30),
                random.randrange(30, self.screen_height / 2),
                "data/add_speed.png")
            self.AddSpeedSprite.add(self.add_speed)

        for i in range(2):
            self.add_speed = Extensions(
                random.randrange(30, self.screen_width - 30),
                random.randrange(30, self.screen_height / 2),
                "data/substract_speed.png")
            self.SubstractSpeedSprite.add(self.add_speed)

        i = 10
        j = 35
        while i < self.screen_width - 10:
            block = Blocks(i, j, 'data/gray_brick.png')
            self.BlocksSprite.add(block)
            i = i + 87.5

        i = 97.5
        j = 70
        while i < self.screen_width - 97.5:
            block = Blocks(i, j, 'data/wood_brick.png')
            self.BlocksSprite.add(block)
            i = i + 87.5

        i = 185
        j = 105
        while i < self.screen_width - 185:
            block = Blocks(i, j, 'data/gray_brick.png')
            self.BlocksSprite.add(block)
            i = i + 87.5

        i = 272.5
        j = 140
        while i < self.screen_width - 272.5:
            block = Blocks(i, j, 'data/wood_brick.png')
            self.BlocksSprite.add(block)
            i = i + 87.5

        ####

        block = Blocks(360, 175, 'data/gray_brick.png')
        self.BlocksSprite.add(block)

        ####

        i = 272.5
        j = 210
        while i < self.screen_width - 272.5:
            block = Blocks(i, j, 'data/wood_brick.png')
            self.BlocksSprite.add(block)
            i = i + 175

        i = 185
        j = 245
        while i < self.screen_width - 185:
            block = Blocks(i, j, 'data/gray_brick.png')
            self.BlocksSprite.add(block)
            i = i + 175

        i = 97.5
        j = 280
        while i < self.screen_width - 97.5:
            block = Blocks(i, j, 'data/wood_brick.png')
            self.BlocksSprite.add(block)
            i = i + 175

        i = 10
        j = 315
        while i < self.screen_width - 10:
            block = Blocks(i, j, 'data/gray_brick.png')
            self.BlocksSprite.add(block)
            i = i + 175

        ####

        i = 10
        for k in range(3):
            block = Blocks(i, 175, 'data/light_wood_brick.png')
            self.BlocksSprite.add(block)
            i = i + 87.5

        j = 140
        for k in range(2):
            block = Blocks(97.5, j, 'data/light_wood_brick.png')
            self.BlocksSprite.add(block)
            j = j + 70

        i = 535
        for k in range(3):
            block = Blocks(i, 175, 'data/light_wood_brick.png')
            self.BlocksSprite.add(block)
            i = i + 87.5

        j = 140
        for k in range(2):
            block = Blocks(622.5, j, 'data/light_wood_brick.png')
            self.BlocksSprite.add(block)
            j = j + 70

        self.counter = len(self.BlocksSprite)
Example #5
0
# -*- coding: utf-8 -*-

# Copyright (C) 2013 Sylvain Boily <*****@*****.**>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from flask import Blueprint
from extensions import Extensions
import wtforms_json

bp_extensions = Blueprint('extensions',
                          __name__,
                          template_folder='templates/extensions')

extensions = Extensions()
wtforms_json.init()