Skip to content

Commit 91ca544

Browse files
committed
250507.1
1 parent 34ccb53 commit 91ca544

8 files changed

+43
-27
lines changed
-39.7 KB
Binary file not shown.
39.8 KB
Binary file not shown.
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__ = "250506.3"
12+
__version__ = "250507.1"

easycoder/ec_classes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ def __init__(self, compiler, message):
88
print(f'Compile error in {compiler.program.name} at line {lino + 1} ({script}): {message}')
99
sys.exit()
1010

11+
class NoValueError(FatalError):
12+
def __init__(self, compiler, record):
13+
super().__init__(compiler, 'Variable {record["name"]} does not hold a value')
14+
1115
class AssertionError:
1216
def __init__(self, program, msg=None):
1317
code = program.code[program.pc]
@@ -30,6 +34,10 @@ def __init__(self, program, message):
3034
print(f'Runtime Error in {program.name} at line {lino + 1} ({script}): {message}')
3135
sys.exit()
3236

37+
class NoValueRuntimeError(RuntimeError):
38+
def __init__(self, program, record):
39+
super().__init__(program, 'Variable {record["name"]} does not hold a value')
40+
3341
class RuntimeWarning:
3442
def __init__(self, program, message):
3543
if program == None:

easycoder/ec_core.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from psutil import Process
33
from datetime import datetime, timezone
44
from random import randrange
5-
from .ec_classes import FatalError, RuntimeWarning, RuntimeError, AssertionError, Condition, Object
5+
from .ec_classes import FatalError, RuntimeWarning, RuntimeError, AssertionError, NoValueError, NoValueRuntimeError, Condition, Object
66
from .ec_handler import Handler
77
from .ec_timestamp import getTimestamp
88

@@ -94,7 +94,7 @@ def k_append(self, command):
9494
command['target'] = symbolRecord['name']
9595
self.add(command)
9696
return True
97-
self.warning(f'Core.append: Variable "{symbolRecord["name"]}" does not hold a value')
97+
self.warning(f'Core.append: Variable {symbolRecord["name"]} does not hold a value')
9898
return False
9999

100100
def r_append(self, command):
@@ -251,7 +251,7 @@ def k_decrement(self, command):
251251
command['target'] = self.getToken()
252252
self.add(command)
253253
return True
254-
self.warning(f'Core.decrement: Variable "{symbolRecord["name"]}" does not hold a value')
254+
self.warning(f'Core.decrement: Variable {symbolRecord["name"]} does not hold a value')
255255
return False
256256

257257
def r_decrement(self, command):
@@ -277,7 +277,7 @@ def k_delete(self, command):
277277
command['var'] = record['name']
278278
self.add(command)
279279
return True
280-
FatalError(self.compiler, f'Variable {record['name']} does not hold a value')
280+
NoValueError(self.compiler, record)
281281
self.warning(f'Core.delete: variable expected; got {self.getToken()}')
282282
else:
283283
self.warning(f'Core.delete: "file", "property" or "element" expected; got {token}')
@@ -418,7 +418,7 @@ def k_get(self, command):
418418
if symbolRecord['hasValue']:
419419
command['target'] = self.getToken()
420420
else:
421-
FatalError(self.compiler, f'Variable "{symbolRecord["name"]}" does not hold a value')
421+
NoValueError(self.compiler, symbolRecord)
422422
if self.nextIs('from'):
423423
if self.nextIs('url'):
424424
url = self.nextValue()
@@ -629,7 +629,7 @@ def k_increment(self, command):
629629
command['target'] = self.getToken()
630630
self.add(command)
631631
return True
632-
self.warning(f'Core.increment: Variable "{symbolRecord["name"]}" does not hold a value')
632+
self.warning(f'Core.increment: Variable {symbolRecord["name"]} does not hold a value')
633633
return False
634634

635635
def r_increment(self, command):
@@ -829,13 +829,13 @@ def k_negate(self, command):
829829
command['target'] = self.getToken()
830830
self.add(command)
831831
return True
832-
self.warning(f'Core.negate: Variable "{symbolRecord["name"]}" does not hold a value')
832+
self.warning(f'Core.negate: Variable {symbolRecord["name"]} does not hold a value')
833833
return False
834834

835835
def r_negate(self, command):
836836
symbolRecord = self.getVariable(command['target'])
837837
if not symbolRecord['hasValue']:
838-
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
838+
NoValueRuntimeError(self.program, symbolRecord)
839839
return None
840840
value = self.getSymbolValue(symbolRecord)
841841
if value == None:
@@ -937,7 +937,7 @@ def k_pop(self, command):
937937
def r_pop(self, command):
938938
symbolRecord = self.getVariable(command['target'])
939939
if not symbolRecord['hasValue']:
940-
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
940+
NoValueRuntimeError(self.program, symbolRecord)
941941
stackRecord = self.getVariable(command['from'])
942942
stack = self.getSymbolValue(stackRecord)
943943
v = stack.pop()
@@ -1091,7 +1091,7 @@ def r_put(self, command):
10911091
return -1
10921092
symbolRecord = self.getVariable(command['target'])
10931093
if not symbolRecord['hasValue']:
1094-
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
1094+
NoValueRuntimeError(self.program, symbolRecord)
10951095
return -1
10961096
self.putSymbolValue(symbolRecord, value)
10971097
return self.nextPC()
@@ -1406,13 +1406,13 @@ def k_shuffle(self, command):
14061406
command['target'] = self.getToken()
14071407
self.add(command)
14081408
return True
1409-
self.warning(f'Core.negate: Variable "{symbolRecord["name"]}" does not hold a value')
1409+
self.warning(f'Core.negate: Variable {symbolRecord["name"]} does not hold a value')
14101410
return False
14111411

14121412
def r_shuffle(self, command):
14131413
symbolRecord = self.getVariable(command['target'])
14141414
if not symbolRecord['hasValue']:
1415-
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
1415+
NoValueRuntimeError(self.program, symbolRecord)
14161416
return None
14171417
value = self.getSymbolValue(symbolRecord)
14181418
if value == None:
@@ -1735,7 +1735,7 @@ def r_write(self, command):
17351735
def incdec(self, command, mode):
17361736
symbolRecord = self.getVariable(command['target'])
17371737
if not symbolRecord['hasValue']:
1738-
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
1738+
NoValueRuntimeError(self.program, symbolRecord)
17391739
value = self.getSymbolValue(symbolRecord)
17401740
if value == None:
17411741
RuntimeError(self.program, f'{symbolRecord["name"]} has not been initialised')
@@ -1805,7 +1805,7 @@ def compileValue(self):
18051805
if symbolRecord['hasValue']:
18061806
value['target'] = symbolRecord['name']
18071807
return value
1808-
self.warning(f'Core.compileValue: Token \'{self.getToken()}\' does not hold a value')
1808+
self.warning(f'Core.compileValue: Token {symbolRecord["name"]} does not hold a value')
18091809
return None
18101810

18111811
if token == 'property':
@@ -1816,7 +1816,7 @@ def compileValue(self):
18161816
if symbolRecord['hasValue']:
18171817
value['target'] = symbolRecord['name']
18181818
return value
1819-
FatalError(self.compiler, 'Variable does not hold a value')
1819+
NoValueError(self.compiler, symbolRecord)
18201820
return None
18211821

18221822
if token == 'arg':

easycoder/ec_pyside.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from easycoder import Handler, FatalError, RuntimeError
2+
from easycoder import Handler, RuntimeError
33
from PySide6.QtCore import Qt, QTimer
44
from PySide6.QtGui import QPixmap
55
from PySide6.QtWidgets import (

rbrconf.ecs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,10 @@ GetConfigData:
481481
begin
482482
put element K of Keys into Name
483483
log `Adding ` cat Name cat ` ` cat property Name of Value
484-
if Name is `ssid` set property `host-ssid` of SystemConfig to property Name of Value
485-
else if Name is `password` set property `host-password` of SystemConfig to property Name of Value
486-
else set property Name of SystemConfig to property Name of Value
484+
! if Name is `ssid` set property `host-ssid` of SystemConfig to property Name of Value
485+
! else if Name is `password` set property `host-password` of SystemConfig to property Name of Value
486+
! else
487+
set property Name of SystemConfig to property Name of Value
487488
increment K
488489
end
489490
end
@@ -887,26 +888,33 @@ CreateDevice:
887888
PopulateSystemInfo:
888889
log `Populate fields for ` cat SystemName
889890
put property `host-ssid` of SystemConfig into SystemHostSSID
891+
put property `host-password` of SystemConfig into Password
890892
if SystemHostSSID is not HostSSID
891893
begin
892-
put property SystemHostSSID of Hosts into Password
893-
put `Connect to host ` cat SystemHostSSID cat ` with password ` cat Password into StatusMessage
894+
put `Unknown host SSID ` cat SystemHostSSID into StatusMessage
894895
gosub to Working
895-
put system `nmcli dev wifi connect ` cat SystemHostSSID cat ` password ` cat Password into SystemCallResult
896+
put SystemHostSSID into HostSSID
897+
put Password into HostPassword
898+
put system `nmcli dev wifi connect ` cat HostSSID cat ` password ` cat HostPassword into SystemCallResult
896899
split SystemCallResult on ` `
897900
if the elements of SystemCallResult is greater than 2
898901
begin
899902
index SystemCallResult to 2
900903
if SystemCallResult is `successfully`
901904
begin
902-
put SystemHostSSID into HostSSID
905+
set property HostSSID of Hosts to HostPassword
906+
set property `hosts` of Config to Hosts
907+
gosub to PostConfigData
903908
put HostSSID into CurrentSSID
904909
put `Connected to ` cat HostSSID into StatusMessage
905-
go to Idle
910+
gosub to Working
911+
end
912+
else
913+
begin
914+
put `Failed to connect to ` cat HostSSID into StatusMessage
915+
go to Error
906916
end
907917
end
908-
put `Failed to connect to ` cat HostSSID into StatusMessage
909-
go to Error
910918
end
911919
put property `mac` of SystemConfig into SystemMAC
912920
put property `password` of SystemConfig into SystemPassword

0 commit comments

Comments
 (0)