Skip to content

Commit d31d7b2

Browse files
committed
v250126.1
1 parent 3f53b36 commit d31d7b2

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed
33.3 KB
Binary file not shown.

dist/easycoder-250126.1.tar.gz

3.1 MB
Binary file not shown.

easycoder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
from .ec_timestamp import *
1010
from .ec_value import *
1111

12-
__version__ = "250123.2"
12+
__version__ = "250126.1"

easycoder/ec_core.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import json, math, hashlib, threading, os, subprocess, sys, requests, time, numbers, base64
1+
import json, math, hashlib, threading, os, subprocess, sys, requests, time, numbers, base64, binascii
22
from psutil import Process
33
from datetime import datetime, timezone
44
from random import randrange
@@ -484,7 +484,6 @@ def r_goto(self, command):
484484
except:
485485
pass
486486
RuntimeError(self.program, f'There is no label "{label}"')
487-
return None
488487

489488
def r_gotoPC(self, command):
490489
return command['goto']
@@ -499,12 +498,14 @@ def k_gosub(self, command):
499498

500499
def r_gosub(self, command):
501500
label = command['gosub'] + ':'
502-
address = self.symbols[label]
503-
if address != None:
504-
self.stack.append(self.nextPC())
505-
return address
506-
RuntimeError(self.program, f'There is no label "{label + ":"}"')
507-
return None
501+
try:
502+
address = self.symbols[label]
503+
if address != None:
504+
self.stack.append(self.nextPC())
505+
return address
506+
except:
507+
pass
508+
RuntimeError(self.program, f'There is no label "{label}"')
508509

509510
# if <condition> <action> [else <action>]
510511
def k_if(self, command):
@@ -1988,6 +1989,10 @@ def v_decode(self, v):
19881989
value['type'] = 'text'
19891990
if self.encoding == 'utf-8':
19901991
value['content'] = content.decode('utf-8')
1992+
elif self.encoding == 'hex':
1993+
b = content.encode('utf-8')
1994+
mb = binascii.unhexlify(b)
1995+
value['content'] = mb.decode('utf-8')
19911996
elif self.encoding == 'base64':
19921997
base64_bytes = content.encode('ascii')
19931998
message_bytes = base64.b64decode(base64_bytes)
@@ -2031,6 +2036,10 @@ def v_encode(self, v):
20312036
value['type'] = 'text'
20322037
if self.encoding == 'utf-8':
20332038
value['content'] = content.encode('utf-8')
2039+
elif self.encoding == 'hex':
2040+
b = content.encode('utf-8')
2041+
mb = binascii.hexlify(b)
2042+
value['content'] = mb.decode('utf-8')
20342043
elif self.encoding == 'base64':
20352044
data_bytes = content.encode('ascii')
20362045
base64_bytes = base64.b64encode(data_bytes)

0 commit comments

Comments
 (0)