code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env python
# vim:ts=4:sw=4:noet:
import sys
import time
from optparse import OptionParser
from c.base.version import InfoStrings
import c.base.support as support
import c.compiler.parse as parse
import c.compiler.mem as mem
import c.compiler.semantics as semantics
import c.compiler.cmg as cmg
from c.compile... | Python |
# vim:ts=4:sw=4:noet:
import unittest
from c.compiler.parse import Parser
from c.compiler.mem import Memory
from c.compiler.semantics import Checker
from c.compiler.codegen import CodeGen, Bytecodes
from c.compiler.optimise import Optimiser
from c.compiler.disassemble import disassembleMethod
import c.compiler.spy as s... | Python |
# vim:ts=4:sw=4:noet:
import unittest
from c.compiler.parse import Parser
from c.compiler.ir import *
from c.base.support import Status
def irmsg(name, recv, args, line=None):
return (IRMessage, {
"_line" : line,
"name" : name,
"recv" : recv,
"args" : args
})
def irname(name, line=None):
return (IRName... | Python |
# vim:ts=4:sw=4:noet:
import unittest
from c.compiler.lexer import Lexer
from c.base.support import Status
class LexerTests(unittest.TestCase):
def setUp(self):
self.stat = Status({"exceptions":True})
def checkLex(self, code, expect):
l = Lexer(self.stat, code)
l.nextLex()
for eline in expect:
eln = elin... | Python |
#!/usr/bin/env python
# vim:ts=4:sw=4:noet:
import os
import markdown
import sys
import glob
outdir = "."
def genFile(basepath, ifn, title, cssfile, next="", prev=""):
ofn = basepath+outdir+"/"+ifn.split(".")[0]+".html"
idata = file(basepath+ifn, "rt").read()
hdata = file(basepath+"header.html","rt").read()
fdat... | Python |
# vim:ts=4:sw=4:noet:
import os
import sys
import compileall
import shutil
import SCons
# check if we're being run from the main SConstruct
caninstall = True
try:
Import('installbin', 'installdata')
except:
caninstall = False
# Builder helpers
def inst(x):
env.Alias("install", x)
return x
def getAllSources():
... | Python |
import sys
from distutils.core import setup
from imagegen import ImageGen
from c.base.version import InfoStrings
import glob
# additional files
additionalFiles = [
"data/IM_ToolRun.png",
"data/IM_ToolStop.png",
"data/book_open.png",
"data/brick.png",
"data/bricks.png",
"data/car.png",
"data/cog_edit.png",
... | Python |
#!/usr/bin/env python
import sys
from c.ui.mainapp import MainApp
MainApp(sys.argv).run()
| Python |
#!/usr/bin/env python
import unittest
import sys
sys.path.insert(0, "test")
mods = "lexer parser codegen"
loader = unittest.TestLoader()
tests = [loader.loadTestsFromModule(__import__(m)) for m in mods.split()]
suite = unittest.TestSuite(tests)
unittest.TextTestRunner(verbosity=2).run(suite)
| Python |
# vim:ts=4:sw=4:noet:
""" Binary image format """
from c.base.support import CoreException
binmsgs = ["<", "<=", "+", "="," -", "new:"]
class CMG:
def __init__(self, mem):
self.mem = mem
self.objhash = {}
self.img = [0]*0x1000
def save(self, fn):
f = file(fn,"wb")
b = self.saveToBuf()
f.write(map(chr,... | Python |
# vim:ts=4:sw=4:noet:
"""
Core compiler
"""
import semantics
import parse
import codegen
import optimise
import logging
class Compiler:
""" Core Compiler
The main compiler class, of which only one should exist since it slowly
accrues a Method IR cache used in optimisation.
"""
def __init__(self, mem, mcheck... | Python |
# vim:ts=4:sw=4:noet:
""" Bytecode generator """
import spy
import logging
from c.base.support import CoreException
MAX_METHOD_SIZE = 120
class Bytecodes:
PushInstance = 0
PushTemporary = 1
PushLiteral = 2
PushConstant = 3
PushBlock = 4
DoPrimitive = 5
PopInstTemp ... | Python |
# vim:ts=4:sw=4:noet:
""" Optimiser Core """
from opt.bbopt import OptTrim
from opt.iropt import OptInline
class Optimiser:
def __init__(self, compiler, mem, classes):
self.mem = mem
self.compiler = compiler
self.classes = classes
self.opttrim = OptTrim()
self.optinline = OptInline(self.compiler, self.mem,... | Python |
# vim:ts=4:sw=4:noet:
""" Intermediate Compiler Representation """
import spy
import cfg
from environment import Environment
import cmg
import logging
from c.base.support import CoreException
# IR Node
class IRNode:
def __init__(self, line):
self.line = line
self.checked = False
def cfg(self, body, bb, inBlock... | Python |
# vim:ts=4:sw=4:noet:
""" Semantic Checker """
import spy
import ir
from environment import Environment
class IRProxy:
def __init__(self, spyobj):
self.spy = spyobj
if isinstance(spyobj, spy.SpyClass):
self.ivars = spyobj.instanceNames
self.name = spyobj.name
if isinstance(spyobj.parent, spy.SpyClass):
... | Python |
# vim:ts=4:sw=4:noet:
""" Object memory management and serialisation support """
import os
import pickle
import spy
import datetime
import logging
IMAGE_VERSION = 1
CORE_DEPENDANCIES = [
"Array",
"Block",
"ByteArray",
"Char",
"Class",
"Method",
"OrderedArray",
"Object",
"True",
"False",
"Undefined",
"Symb... | Python |
# vim:ts=4:sw=4:noet:
""" Control Flow Graph """
import logging
import ir
cfgcount = 1
class CFGBasicBlock:
def __init__(self,name=""):
global cfgcount
self.statements = []
self.prevs = []
self.nexts = []
self.references = []
self.name = "%d_%s" % (cfgcount, name)
cfgcount += 1
def addStatement(self... | Python |
# vim:ts=4:sw=4:noet:
""" Bytecode disassembler """
from codegen import Bytecodes
from cmg import binmsgs
extraBytes = [
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, # 0 push instance
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, # 1 push temporary
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, # 2 push literal
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, # 3 pus... | Python |
# vim:ts=4:sw=4:noet:
""" Parser """
import ir
import primtable as primtable
from lexer import Lexer, Token
class Parser:
def __init__(self, mem, status):
self.status = status
self.mainClass = None
self.prims = primtable.PrimTable()
def acceptType(self, type):
if type!=self.lex.token.type:
self.status.... | Python |
# vim:ts=4:sw=4:noet:
""" Primitive method table """
primitives = {
# Object
"objectIdentity" : 1,
"objectClass" : 2,
"objectSize" : 3,
"objectNew" : 4,
# Array
"arrayAt" : 5,
"arrayAtPut" : 6,
"bytearrayAlloc" : 7,
# String
"stringAt" : 8,
"stringAtPut" : 9,
"stringClone... | Python |
# vim:ts=4:sw=4:noet:
"""
Smalltalk-Python (Spy) Objects. This is the main representation of
Smalltalk objects in the environment.
SpyObjects are the core representation of smalltalk objects in the environment. The image files are serialised (pickled) versions of SpyObjects. A SpyObject can also emit the CMG version ... | Python |
# vim:ts=4:sw=4:noet:
""" Basic block optimiser base class """
import c.compiler.cfg
class BBVisitor:
def doMethod(self, meth):
self.visit(meth.body.bb)
def visit(self, bb, visited=[]):
if bb.name in visited:
return
visited.append(bb.name)
self.doBasicBlock(bb)
for n in bb.nexts:
self.visit(n, visi... | Python |
# vim:ts=4:sw=4:noet:
""" IR optimisers """
import c.compiler.cfg
from irvisit import IRVisitor
import c.compiler.ir as ir
class OptInline(IRVisitor):
def __init__(self, compiler, mem, classes):
self.mem = mem
self.compiler = compiler
self.classes = {}
for c in classes:
self.classes[c.name] = c
def get... | Python |
# vim:ts=4:sw=4:noet:
""" Basic block optimisers """
from bbvisit import BBVisitor
import c.compiler.cfg
class OptTrim(BBVisitor):
def doBasicBlock(self, bb):
newst = []
gotReturn = False
i = 0
while i<len(bb.statements):
st = bb.statements[i]
# check for store/pop pairs, and merge into a pop
if i<(... | Python |
"""
Optimisations
"""
| Python |
# vim:ts=4:sw=4:noet:
""" IR optimiser base class """
import c.compiler.ir as ir
from c.base.support import CoreException
class IRVisitor:
def doMethod(self, meth):
self.doIRBody(meth.body)
def doIRNode(self, node):
if isinstance(node, ir.IRReturn): return self.doIRReturn(node)
elif isinstance(node, ir.... | Python |
"""
The Foxtalk Compiler
The compiler can be roughly divided into 3 parts:
1. Frontend (Lexer, Parser, Semantic Analysis)
2. Midend (IR Generation, CFG, Optimisation)
3. Backend (Code Generation, Image Generation)
The L{compiler driver<Compiler>} manages the various steps of the compilation process. The common cas... | Python |
# vim:ts=4:sw=4:noet:
""" Lexer """
class Token:
EOF, ID, BIN, INT, STR, SYM, FLT = range(7)
typenames = ["EOF", "ID ", "BIN", "INT", "STR", "SYM", "FLT"]
prettyTypenames = [ "EOF", "Identifier", "Binary message", "Integer", "String", "Symbol", "Float" ]
def __init__(self, index, type, value=None, numchars=None):... | Python |
# vim:ts=4:sw=4:noet:
""" Semantic Checker Environments """
class Environment:
GLOBAL, IVAR, METH_TEMP, BLOCK_ARG = range(4)
typenames = [
"global",
"instance variable",
"method temporary",
"block argument"
]
def __init__(self, checker, vars, parent, type, name, varBase=0):
self.checker = checker
sel... | Python |
# vim:ts=4:sw=4:noet:
""" Connections to devices """
import socket
import serial
import time
class RemoteConnection:
def __init__(self):
self.timeout = 0.5
def setTimeout(self, to):
self.timeout = to
class RemoteTcpConnection(RemoteConnection):
def __init__(self, host="localhost", port=4321, connect=True):
... | Python |
# vim:ts=4:sw=4:noet:
""" VM remote interface """
import logging
from simpleobj import SimpleObj, SimpleSmallInt
ERROR_BAD_MSG = 7
ERROR_RUNTIME = 14
NIL_PTR = 0x4000
errNames = [
"Unknown error",
"Halt instruction",
"Fatal primitive error",
"Out of memory",
"Root stack overflow",
"Root stack underflo... | Python |
# vim:ts=4:sw=4:noet:
"""
VM remote object proxies
When interacting with the VM via L{Remote}, SimpleObjs are proxies representing
objects resident in the remote VMs memory.
Since the Foxtalk VM uses an optimised representation for Integers -8191 to 8192,
there's also a SimpleSmallInt proxy.
"""
class SimpleObj:
... | Python |
"""
Remote Object/Memory Interface
Remote provides an interface to a remote device's Foxtalk VM. It allows interaction with all the core functionality of the VM and Foxtalk code running on the VM.
L{Remote} interacts with the target device via the L{Device Manager<c.device>}. The remote allows interaction with live o... | Python |
# vim:ts=4:sw=4:noet:
"""
Simulator and VM-Sim Interface
"""
import socket
import SocketServer
import logging
import math
import subprocess
from Queue import Queue
from c.base.support import CoreException
from c.base.platform import Platform
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
def handl... | Python |
"""
Foxbot Simulator
"""
| Python |
# vim:ts=4:sw=4:noet:
""" Connection Manager to remote devices """
import threading
import logging
import time
import glob
import sys
from c.remote.connection import RemoteTcpConnection, RemoteSerialConnection
class DeviceChecker:
def __init__(self, dm):
self.dm = dm
self.connections = {}
def addConnection(sel... | Python |
"""
Remote Device Management
The L{DeviceManager} handles connections to target robots (or the simulator) via L{DeviceConnection}s. Device presence is polled via a medium-specific L{DeviceChecker}.
"""
| Python |
# vim:ts=4:sw=4:noet:
""" Support code """
import sys
class Struct:
def __init__(self, **entries): self.__dict__.update(entries)
Enum = Struct
class CoreException:
def __init__(self, msg, data=None):
self.msg = msg
self.data = data
def __str__(self):
if self.data:
return "%s" % (self.msg)
return self... | Python |
# vim:ts=4:sw=4:noet:
"""
Logger
"""
import logging
def initLogging():
logging.basicConfig(
level = logging.ERROR,
format = "%(asctime)s %(levelname)7s: %(message)s")
logging.info("Log started")
| Python |
""" Version information """
InfoStrings = {
"shortname" : "Foxtalk",
"longname" : "Foxtalk",
"copyright" : "Foxtalkbots.com, 2010",
"versionString" : "0.9.4",
"description" : "Foxtalk Smalltalk Environment",
"imageExtension" : "fox",
"binaryExtension" : "cmg",
"urlAppcast" : "h... | Python |
"""
Miscellaneous base support code
"""
| Python |
# vim:ts=4:sw=4:noet:
""" Platform specific tweaks """
import os
import sys
from c.base.version import InfoStrings
class SPlatform:
def __init__(self):
self.basePath = None
self.configPath = None
self.simPath = None
if sys.platform == "win32":
self.simExe = "cvm16.exe"
else:
self.simExe = "cvm16"
d... | Python |
# vim:ts=4:sw=4:noet:
"""
Class property helper
"""
import sys
def attribute(name, permit='rw', fget=None, fset=None, doc=''):
if _isprivate(name):
name = "_%s%s" % (_get_classname(), name)
if 'r' in permit and fget is None:
fget = lambda self: getattr(self, name)
if 'w' in permit and fset is None:
fset = la... | Python |
"""
Foxtalk
"""
| Python |
# vim:ts=4:sw=4:noet:
""" Documentation window """
import wx
import logging
from c.ui.wxw.common import loadWxImage, getProperPath
from c.base.platform import Platform
class IntroWindow(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent)
self.parent = parent
bmp = wx.Bitmap(getProperPat... | Python |
# vim:ts=4:sw=4:noet:
""" UI element ids and shortcuts """
import wx
MenuInfo = {
"FILE_NEW_PROJECT" : "Ctrl+Alt+N",
"FILE_OPEN" : "Ctrl+O",
"FILE_EXAMPLES" : "",
"FILE_SAVE" : "Ctrl+S",
"FILE_DELETE" : "Ctrl+Alt+D",
"FILE_SAVE_AS" : "Ctrl+Shif... | Python |
# vim:ts=4:sw=4:noet:
""" Memory inspector window """
import wx
from c.remote.simpleobj import *
from c.ui.wxw.widgets.baseframe import BaseFrame
class InspectorObject:
def __init__(self, value, ptr=None):
self.value = value
self.ptr = ptr
self.expanded = False
def __repr__(self):
return "<%s@%s>" % (self.... | Python |
# vim:ts=4:sw=4:noet:
""" Stacktrace window """
import wx
from c.remote.simpleobj import *
from c.ui.wxw.widgets.baseframe import BaseFrame
from c.ui.wxw.inspector import InspectWindow
class ObjectLink(wx.HyperlinkCtrl):
def __init__(self, parent, obj):
wx.HyperlinkCtrl.__init__(self, parent, -1, str(obj), obj.loc... | Python |
# vim:ts=4:sw=4:noet:
""" 2D Simulator Renderer """
import wx
import time
import math
from c.ui.wxw.common import *
from c.simulator.simulator import Simulator
SIM_FPS = 15
if wx.Platform=="__WXMSW__":
Paint = wx.BufferedPaintDC
else:
Paint = wx.PaintDC
class SimCanvas(wx.Panel):
def __init__(self, parent, mc):... | Python |
# vim:ts=4:sw=4:noet:
""" Method info bar """
import wx
from c.ui.wxw.platform import UITweaks
from c.ui.wxw.common import loadWxImage
class MethodBar(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
hbox = wx.BoxSizer(wx.HORIZONTAL)
self.methLabel = wx.TextCtrl(self, -1, "")
self.m... | Python |
# vim:ts=4:sw=4:noet:
""" Custom view splitter """
import wx
class MainSplitter(wx.SplitterWindow):
def __init__(self, parent):
wx.SplitterWindow.__init__(self, parent, -1,
style = wx.SP_LIVE_UPDATE #|wx.SP_3DSASH
)
if wx.Platform=="__WXMAC__":
self.SetSashSize(1)
self.SetBackgroundCo... | Python |
# vim:ts=4:sw=4:noet:
""" Validated input box """
import wx
from c.ui.wxw.common import loadWxImage, getProperPath
from c.base.platform import Platform
class CheckedEntry(wx.Panel):
def __init__(self, parent, callbkCheck, callbkDone, initVal=""):
wx.Panel.__init__(self, parent, -1)
hbox = wx.BoxSizer(wx.HORIZONT... | Python |
# vim:ts=4:sw=4:noet:
""" Main menubar """
import wx
from c.ui.wxw.ids import ids, shortcuts
class MainMenu(wx.MenuBar):
def __init__(self, parent):
wx.MenuBar.__init__(self)
# file menu
fileMenu = wx.Menu()
self.addItem(fileMenu, ids.FILE_NEW_PROJECT, "New Project")
fileMenu.AppendSeparator()
self.addI... | Python |
# vim:ts=4:sw=4:noet:
""" Toolbar """
import wx
import c.ui.wxw.common as common
from c.ui.wxw.ids import ids, shortcuts
class MainToolBar(wx.ToolBar):
def __init__(self, parent):
if wx.Platform == '__WXMAC__':
wx.ToolBar.__init__(self, parent, style=(
wx.TB_HORIZONTAL|wx.NO_BORDER|wx.TB_FLAT|wx.TB_TEXT))
... | Python |
# vim:ts=4:sw=4:noet:
""" Base Frame class """
import wx
from c.base.platform import Platform
from c.ui.wxw.common import getProperPath
class BaseFrame(wx.Frame):
def __init__(self, parent, name, **kwargs):
wx.Frame.__init__(self, parent, -1, name, **kwargs)
icon = wx.Icon(getProperPath(Platform.getDataFilePath(... | Python |
"""
Miscellaneous Widgets
"""
from toolbar import MainToolBar
from mainmenu import MainMenu
from methodbar import MethodBar
from splitter import MainSplitter
from baseframe import BaseFrame
from checkedentry import CheckedEntry
| Python |
# vim:ts=4:sw=4:noet:
""" Class info panel """
import wx
from c.ui.wxw.widgets.checkedentry import CheckedEntry
from c.base.support import CoreException
import re
class NewIvarDialog(wx.Dialog):
def __init__(self, parent, supername="", clsname=""):
wx.Dialog.__init__(self, parent, -1, "New Instance Variable")
s... | Python |
# vim:ts=4:sw=4:noet:
""" Project browser view (tree/sidebar) """
import wx
import os
import common
from c.compiler.spy import *
from wx.lib import dialogs
from c.ui.projectcontroller import *
from c.ui.wxw.dialogs import NewClassDialog, NewMethodDialog, RenameMethodDialog
from c.ui.wxw.ids import ids
from c.ui.wxw.ev... | Python |
# vim:ts=4:sw=4:noet:
""" Main window view"""
import wx
import os
import sys
import logging
import webbrowser
from c.base.version import *
from c.base.platform import Platform
from c.base.attribute import attribute
from c.compiler.compiler import Compiler
from c.ui.wxw.ids import ids, shortcuts
from c.ui.wxw.console i... | Python |
# vim:ts=4:sw=4:noet:
""" Documentation window """
import wx
import logging
from c.ui.wxw.widgets.baseframe import BaseFrame
from c.ui.wxw.editor import Editor
from c.compiler.spy import SpyClass, SpyMethod
class DocumentationWindow(BaseFrame):
def __init__(self, parent):
self.parent = parent
BaseFrame.__init__... | Python |
# vim:ts=4:sw=4:noet:
""" Code editor (StyledTextCtrl) """
import wx
import wx.stc
import re
DEFAULT_DOC_FONT_SIZE = 10
DEFAULT_FONT_SIZE = 10
if wx.Platform == '__WXMSW__':
DEFAULT_FONT_FACE = "Courier New"
DEFAULT_DOC_FONT_FACE = "Verdana"
elif wx.Platform == '__WXMAC__':
DEFAULT_FONT_FACE = "Monaco"
DEFAULT_D... | Python |
"""
wxWindows UI
"""
| Python |
# vim:ts=4:sw=4:noet:
""" Method Info dialog """
import wx
from c.ui.wxw.editor import Editor
class GetInfoMethodDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: GetInfoMethodDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME
wx.Dialog.__init__(self, *... | Python |
# vim:ts=4:sw=4:noet:
""" New Method dialog """
import wx
from c.ui.wxw.widgets.checkedentry import CheckedEntry
from c.base.support import CoreException
class RenameMethodDialog(wx.Dialog):
def __init__(self, parent, mclass, methSig, isClassMeth=False):
wx.Dialog.__init__(self, parent, -1, "New Method")
self.m... | Python |
# vim:ts=4:sw=4:noet:
""" New Class dialog """
import wx
import re
from c.ui.wxw.widgets.checkedentry import CheckedEntry
from c.base.support import CoreException
class NewClassDialog(wx.Dialog):
def __init__(self, parent, classes, supername="", clsname=""):
wx.Dialog.__init__(self, parent, -1, "New Class")
sel... | Python |
# vim:ts=4:sw=4:noet:
""" Jump To dialog """
import wx
class JumpToDialog(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent, -1, "Jump To ...",
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.mw = parent
self.SetMinSize((300,200))
self.textctrl = wx.TextCtrl(self, -1, ... | Python |
# vim:ts=4:sw=4:noet:
""" Robot Info dialog """
import wx
class GetInfoRobotDialog(wx.Dialog):
def __init__(self, parent, title):
wx.Dialog.__init__(self, parent, -1, title)
self.lblHdrVersion = wx.StaticText(self, -1, "Version")
self.lblVersion = wx.StaticText(self, -1, "")
self.lblHdrPlatform = wx.StaticT... | Python |
"""
Dialogs
"""
from getinforobot import GetInfoRobotDialog
from getinfomethod import GetInfoMethodDialog
from jumpto import JumpToDialog
from newclass import NewClassDialog
from newmethod import NewMethodDialog
from newproject import NewProjectDialog
from renamemethod import RenameMethodDialog
| Python |
# vim:ts=4:sw=4:noet:
""" New Method dialog """
import wx
from c.ui.wxw.widgets.checkedentry import CheckedEntry
from c.base.support import CoreException
class NewMethodDialog(wx.Dialog):
def __init__(self, parent, classes, chosenClass=None, methSig="", isClassMeth=False):
wx.Dialog.__init__(self, parent, -1, "Ne... | Python |
""" New Project dialog """
import wx
import c.ui.wxw.common as common
colourList = [ "Empty Project", "Basic Project", "Drawing Project" ]
class NewProjectDialog(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent, -1, "New Project", style=wx.DEFAULT_DIALOG_STYLE)
self.mw = parent
self.S... | Python |
# vim:ts=4:sw=4:noet:
""" Platform specific tweaks """
import os
import wx
from c.base.version import InfoStrings
class SPlatform:
def __init__(self):
self.divpad = 2
self.methpad = 2
self.methbarHeight = 26
if wx.Platform=="__WXMAC__":
wx.SystemOptions.SetOptionInt("mac.listctrl.always_use_generic", Fals... | Python |
# vim:ts=4:sw=4:noet:
""" Miscellaneous WX support code """
import wx
from c.base.platform import Platform
import os.path
import cStringIO
def getProperPath(fn):
if os.path.exists(fn):
return fn
elif os.path.exists(os.path.split(fn)[-1]):
return os.path.split(fn)[-1]
else:
raise Exception("File not found: %s... | Python |
# vim:ts=4:sw=4:noet:
""" Console Window """
import wx
import wx.stc
from c.ui.wxw.widgets.baseframe import BaseFrame
from c.base.support import CoreException
from editor import DEFAULT_FONT_FACE, DEFAULT_FONT_SIZE
from events import EVT_LOG_ID
import c.compiler.spy as spy
class Console(wx.stc.StyledTextCtrl):
def ... | Python |
# vim:ts=4:sw=4:noet:
""" Custom UI events """
import wx
EVT_LOG_ID = wx.NewId()
class LogMsgEvent(wx.PyEvent):
def __init__(self, data):
wx.PyEvent.__init__(self)
self.SetEventType(EVT_LOG_ID)
self.data = data
EVT_UISTATE_ID = wx.NewId()
class UiStateEvent(wx.PyEvent):
def __init__(self, type, data):
wx... | Python |
# vim:ts=4:sw=4:noet:
""" User interface state management """
import os
import pickle
from c.base.version import InfoStrings
from c.base.platform import Platform
SAVE_STATE_FILE = Platform.getConfigFilePath(InfoStrings["configfile"])
class UISaveState:
def __init__(self):
self.sdict = {}
if os.path.exists(SAVE_... | Python |
# vim:ts=4:sw=4:noet:
""" Project browser controller """
from c.compiler.spy import SpyClass, STATE_COMPILED, STATE_ERROR
from c.compiler.compiler import Compiler
from c.base.attribute import attribute
from c.base.platform import Platform
from c.base.support import Status, CoreException
from c.ui.wxw.events import *
f... | Python |
# vim:ts=4:sw=4:noet:
""" Update Checker """
from c.base.version import InfoStrings
import urllib2
from xml.dom.minidom import parse
import threading
import logging
import time
import platform
class UpdaterException(Exception):
pass
class Update:
def __init__(self):
self.sparkle = {}
def __repr__(self):
r = ... | Python |
# vim:ts=4:sw=4:noet:
""" Manager for long running tasks (compilation, etc) """
import threading
import logging
class TaskManager:
def __init__(self, mc):
self.mc = mc
self.tasks = {}
def __del__(self):
logging.info("[tm] killing old threads for shutdown")
for t in self.tasks:
self.stopTask(t)
de... | Python |
"""
User Interface
"""
| Python |
# vim:ts=4:sw=4:noet:
""" App Entrypoint """
import sys
import wx
import re
import traceback
import c.base.log as log
from c.ui.wxw.mainwindow import MainWindow
log.initLogging()
class BaseApp(wx.PySimpleApp):
def BringWindowToFront(self):
try:
self.GetTopWindow().Raise()
except:
pass
def OnActivate(se... | Python |
# vim:ts=4:sw=4:noet:
""" Main window controller """
import wx
import time
import os
import logging
import webbrowser
from c.base.attribute import attribute
from c.base.support import Status, CoreException
from c.base.version import InfoStrings
from c.base.platform import Platform
from c.compiler.mem import Memory
fro... | Python |
# vim:ts=4:sw=4:noet:
""" Dialog Controllers """
from c.ui.wxw.dialogs import GetInfoMethodDialog, GetInfoRobotDialog
from c.compiler.disassemble import *
import c.compiler.spy as spy
class GetInfoMethod:
def __init__(self, parent, pitem):
self.dialog = GetInfoMethodDialog(parent=parent, id=-1, title="Method - %s"... | Python |
# vim:ts=4:sw=4:noet:
import sys
installbin = "#release"
if sys.platform == 'darwin':
installdata = "%s/Foxtalk.app/Contents/Resources" % installbin
else:
installdata = "%s/data" % installbin
Export('installbin', 'installdata')
SConscript(["foxtalk/SConstruct"])
| Python |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "four_year_plan_v1.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Python |
#!/usr/bin/python
#
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
#!/usr/bin/python
#
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | Python |
# This is the version of this source code.
manual_verstr = "1.5"
auto_build_num = "211"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil insta... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | Python |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Multi-credential file store with lock support.
This module implements a JSON credential store where multiple
credentials can be stored in one file. That file supports locking
both in a single process and across processes.
The credential themselves are keyed off o... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | Python |
# Copyright (C) 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Python |
# Copyright 2011 Google Inc. All Rights Reserved.
"""Locked file interface that should work on Unix and Windows pythons.
This module first tries to use fcntl locking to ensure serialized access
to a file, then falls back on a lock file if that is unavialable.
Usage:
f = LockedFile('filename', 'r+b', 'rb')
f.... | Python |
__version__ = "1.0c2"
| Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.