Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2009-07-20 21:22:02 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2009-07-20 21:22:02 (GMT)
commit5218ffdac0a504cbd0c1b229ac899db9b7f9771c (patch)
tree34edc5d425ebe86fb77f82aebc5ab0372556619b
parentcd9cbacea55658d6df1cb57383bbd00090abd1a4 (diff)
ëmpty box error message
-rw-r--r--images/emptybox.svg32
-rw-r--r--tajail.py3
-rw-r--r--talogo.py18
-rw-r--r--tasetup.py1
4 files changed, 48 insertions, 6 deletions
diff --git a/images/emptybox.svg b/images/emptybox.svg
index e018a1b..323cff9 100644
--- a/images/emptybox.svg
+++ b/images/emptybox.svg
@@ -235,6 +235,34 @@
style="stop-color:#ffff00;stop-opacity:1"
offset="1" />
</linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="104"
+ y2="21"
+ id="linearGradient2539"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient2533">
+ <stop
+ id="stop2535"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2537"
+ style="stop-color:#ffff00;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="22"
+ x2="128.68382"
+ y2="22"
+ id="linearGradient2543"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.75,0,0,0.75,160.75,11.125)" />
</defs>
<path
d="M 15,37.5 C 11.5,37.5 8,35 5.5,32.5 C 3,30 0.5,26.5 0.5,23 L 0.5,15 C 0.5,11.75 3,6.5 5.5,4.5 C 8,2.5 11.5,0.5 15,0.5 L 751.5,0.5 C 754,0.5 758.5,1.5 762,4.5 C 765.5,7.25 766.5,12 766.5,15 L 766.5,23 C 766.5,26.5 764.5,30 762,32.5 C 759.5,35 755.5,37.5 751.5,37.5 L 15,37.5 z"
@@ -321,4 +349,8 @@
y="29"
id="tspan2620"
style="font-size:24px;fill:#ff0000;fill-opacity:1">???</tspan></text>
+ <path
+ d="M 161.5,11.5 L 165.25,11.5 L 165.25,14.5 L 170.5,14.5 L 170.5,11.5 L 239.125,11.5 L 239.125,26.5 L 170.5,26.5 L 170.5,23.5 L 165.25,23.5 L 165.25,26.5 L 161.5,26.5 L 161.5,11.5 z"
+ id="path2541"
+ style="fill:url(#linearGradient2543);fill-opacity:1;stroke:none;stroke-width:2;stroke-opacity:1" />
</svg>
diff --git a/tajail.py b/tajail.py
index e2b1c85..64ec02e 100644
--- a/tajail.py
+++ b/tajail.py
@@ -19,7 +19,6 @@
#THE SOFTWARE.
# a naive approach to running myfun in a jail
-import re
from time import *
from math import *
try:
@@ -30,7 +29,7 @@ from taturtle import *
def myfunc(lc, f, x):
# check to make sure no import calls are made
- myf = "def f(x): return " + re.sub("import","",f)
+ myf = "def f(x): return " + f.replace("import","")
userdefined = {}
try:
exec myf in globals(), userdefined
diff --git a/talogo.py b/talogo.py
index 892993a..e955adf 100644
--- a/talogo.py
+++ b/talogo.py
@@ -95,8 +95,8 @@ def blocks_to_code(lc,spr):
code.append(float(ord(spr.label[0])))
elif spr.proto.name=='string' or spr.proto.name=='title':
if type(spr.label) == float or type(spr.label) == int:
- #if int(spr.label) == spr.label:
- # spr.label = int(spr.label)
+ if int(spr.label) == spr.label:
+ spr.label = int(spr.label)
code.append('#s'+str(spr.label))
else:
code.append('#s'+spr.label)
@@ -485,7 +485,7 @@ def lcNew(tw):
defprim(lc,'stack', 1, prim_stack, True)
defprim(lc,'box1', 0, lambda lc: lc.boxes['box1'])
defprim(lc,'box2', 0, lambda lc: lc.boxes['box2'])
- defprim(lc,'box', 1, lambda lc,x: lc.boxes['box3'+str(x)])
+ defprim(lc,'box', 1, lambda lc,x: box(lc,x))
defprim(lc,'storeinbox1', 1, lambda lc,x: setbox(lc, 'box1',x))
defprim(lc,'storeinbox2', 1, lambda lc,x: setbox(lc, 'box2',x))
defprim(lc,'storeinbox', 2, lambda lc,x,y: setbox(lc, 'box3'+str(x),y))
@@ -522,12 +522,14 @@ def lcNew(tw):
lc.istack = []
lc.stacks = {}
- lc.boxes = noKeyError({'box1': 0, 'box2': 0})
+ # lc.boxes = noKeyError({'box1': 0, 'box2': 0})
+ lc.boxes = {'box1': 0, 'box2': 0}
lc.heap = []
lc.keyboard = 0
lc.trace = 0 # flag for enabling debug output via showlabel
lc.gplay = None
lc.ag = None
+ lc.nobox = ""
lc.title_height = int((tw.turtle.height/30)*tw.scale)
lc.body_height = int((tw.turtle.height/60)*tw.scale)
lc.bullet_height = int((tw.turtle.height/45)*tw.scale)
@@ -549,6 +551,13 @@ def lcNew(tw):
return lc
+def box(lc,x):
+ try:
+ return lc.boxes['box3'+str(x)]
+ except:
+ lc.nobox = str(x)
+ raise logoerror("#emptybox")
+
def loadmyblock(lc,x):
# execute code inported from the Journal
if lc.tw.myblock != None:
@@ -956,6 +965,7 @@ def showlabel(lc,label):
if label=='#nostack': shp = 'nostack'; label=''
elif label=='#noinput': shp = 'noinput'; label=''
elif label=='#emptyheap': shp = 'emptyheap'; label=''
+ elif label=='#emptybox': shp = 'emptybox'; label=' '+lc.nobox
elif label=='#nomedia': shp = 'nomedia'; label=''
elif label=='#nocode': shp = 'nocode'; label=''
elif label=='#syntaxerror': shp = 'syntaxerror'; label=''
diff --git a/tasetup.py b/tasetup.py
index 440b08c..6899067 100644
--- a/tasetup.py
+++ b/tasetup.py
@@ -275,6 +275,7 @@ def setup_misc(tw):
tw.status_shapes['nostack'] = load_image(tw.path, '', 'nostack')
tw.status_shapes['noinput'] = load_image(tw.path, '', 'noinput')
tw.status_shapes['emptyheap'] = load_image(tw.path, '', 'emptyheap')
+ tw.status_shapes['emptybox'] = load_image(tw.path, '', 'emptybox')
tw.status_shapes['nomedia'] = load_image(tw.path, '', 'nomedia')
tw.status_shapes['nocode'] = load_image(tw.path, '', 'nocode')
tw.status_shapes['syntaxerror'] = load_image(tw.path, '', 'syntaxerror')