mirror of
https://github.com/Architeuthis-Flux/Jumperless.git
synced 2024-11-23 23:00:57 +01:00
Added early probing support
This commit is contained in:
parent
f65f48b1a2
commit
2d21dfed12
Binary file not shown.
Binary file not shown.
BIN
Jumperless Wokwi Bridge App/Apple_Silicon/arduino-cli
Executable file
BIN
Jumperless Wokwi Bridge App/Apple_Silicon/arduino-cli
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -18,6 +18,7 @@ import shutil
|
||||
from urllib.request import urlretrieve
|
||||
|
||||
|
||||
|
||||
#import platform
|
||||
|
||||
#from watchedserial import WatchedReaderThread
|
||||
@ -28,6 +29,7 @@ import serial.tools.list_ports
|
||||
debug = False
|
||||
|
||||
|
||||
|
||||
justreconnected = 0
|
||||
|
||||
global serialconnected
|
||||
@ -120,13 +122,23 @@ def openSerial():
|
||||
#print(sortedports)
|
||||
print ("\n\n")
|
||||
|
||||
jumperlessIndex = chooseJumperlessPort(sortedports)
|
||||
arduinoIndex = (jumperlessIndex + 1) % 2
|
||||
|
||||
#print (jumperlessIndex)
|
||||
#print (arduinoIndex)
|
||||
|
||||
if autodetected != -1:
|
||||
#if False:
|
||||
|
||||
selection = autodetected
|
||||
|
||||
#portName = ports[int(selection) - 1].device
|
||||
portName = sortedports[0]
|
||||
arduinoPort = sortedports[1]
|
||||
|
||||
portName = sortedports[jumperlessIndex]
|
||||
|
||||
arduinoPort = sortedports[arduinoIndex]
|
||||
|
||||
portSelected = True
|
||||
serialconnected = 1
|
||||
|
||||
@ -163,8 +175,10 @@ def openSerial():
|
||||
"\n\nChoose the Arduino port ('x' to skip)\n\n(Choose the higher numbered port)\n\n")
|
||||
|
||||
if (ArduinoSelection == 'x' or ArduinoSelection == 'X'):
|
||||
disableArduino
|
||||
disableArduinoFlashing = 1
|
||||
|
||||
if ArduinoSelection.isdigit() == True and int(ArduinoSelection) <= i:
|
||||
|
||||
arduinoPort = ports[int(ArduinoSelection) - 1].device
|
||||
aPortSelected = True
|
||||
print(ports[int(ArduinoSelection) - 1].device)
|
||||
@ -188,6 +202,75 @@ def openSerial():
|
||||
#ser.open()
|
||||
|
||||
|
||||
jumperlessFirmwareNumber = [0,0,0,0,0,0]
|
||||
|
||||
def chooseJumperlessPort(sortedports):
|
||||
global jumperlessFirmwareString
|
||||
|
||||
jumperlessFirmwareString = ' '
|
||||
tryPort = 0
|
||||
|
||||
while (tryPort < 5 and tryPort < len(sortedports)):
|
||||
|
||||
tempSer1 = serial.Serial(sortedports[tryPort], 115200, timeout=None)
|
||||
#print (tryPort)
|
||||
tempSer1.write(b'?')
|
||||
|
||||
time.sleep(0.1)
|
||||
inputBuffer2 = b' '
|
||||
|
||||
if (tempSer1.in_waiting > 0):
|
||||
#justChecked = 0
|
||||
#reading = 1
|
||||
inputBuffer2 = b' '
|
||||
|
||||
waiting = tempSer1.in_waiting
|
||||
|
||||
while (serialconnected >= 0):
|
||||
inByte = tempSer1.read()
|
||||
|
||||
inputBuffer2 += inByte
|
||||
|
||||
if (tempSer1.in_waiting == 0):
|
||||
time.sleep(0.05)
|
||||
|
||||
if (tempSer1.in_waiting == 0):
|
||||
break
|
||||
else:
|
||||
continue
|
||||
tempSer1.close()
|
||||
|
||||
inputBuffer2 = str(inputBuffer2)
|
||||
inputBuffer2 = inputBuffer2.strip('b\'\\n \\r ')
|
||||
|
||||
jumperlessFirmwareString = inputBuffer2.split('\\r\\n')[0]
|
||||
|
||||
#print (inputBuffer2)
|
||||
#print (jumperlessFirmwareString)
|
||||
|
||||
if (jumperlessFirmwareString.startswith("Jumperless firmware version:") == True):
|
||||
|
||||
#print(jumperlessFirmwareString[29:39])
|
||||
|
||||
|
||||
jumperlessFirmwareNumber = jumperlessFirmwareString[29:39].split('.')
|
||||
|
||||
#print (jumperlessFirmwareNumber)
|
||||
|
||||
#print ("found a match!")
|
||||
#
|
||||
return tryPort
|
||||
|
||||
else:
|
||||
|
||||
tryPort = tryPort+1
|
||||
else:
|
||||
tryPort = tryPort+1
|
||||
#print ("fuck")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -199,16 +282,58 @@ latestFirmwareAddress = "https://github.com/Architeuthis-Flux/Jumperless/release
|
||||
|
||||
url_link = 0
|
||||
|
||||
def checkIfFWisOld ():
|
||||
|
||||
def updateJumperlessFirmware():
|
||||
response = requests.get("https://github.com/Architeuthis-Flux/Jumperless/releases/latest")
|
||||
version = response.url.split("/").pop()
|
||||
|
||||
|
||||
latestVersion = version.split('.')
|
||||
latestString = latestVersion[0] + '.' + latestVersion[1] + '.' + latestVersion[2]
|
||||
|
||||
splitIndex = jumperlessFirmwareString.rfind(':')
|
||||
currentString = jumperlessFirmwareString[splitIndex+2:]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
latestList = latestString.split('.')
|
||||
currentList = currentString.split('.')
|
||||
try:
|
||||
latestInt = int("".join(latestList))
|
||||
currentInt = int("".join(currentList))
|
||||
except:
|
||||
return True
|
||||
#print (latestInt)
|
||||
#print (currentInt)
|
||||
|
||||
|
||||
if (latestInt > currentInt):
|
||||
|
||||
|
||||
print("\n\n\rThe latest firmware is: " + latestString)
|
||||
print( "You're running version: " + currentString)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def updateJumperlessFirmware(force):
|
||||
global ser
|
||||
global menuEntered
|
||||
|
||||
#newFirmware = r
|
||||
|
||||
if (force == False):
|
||||
if (checkIfFWisOld() == False):
|
||||
print ("\n\rYour firmware is up to date (enter 'update' to force update)")
|
||||
return
|
||||
|
||||
print("\n\n\rWould you like to update your Jumperless with the latest firmware? Y/n\n\r")
|
||||
if (input ("\n\r").lower() == "y"):
|
||||
print("\n\rWould you like to update your Jumperless with the latest firmware? Y/n\n\r")
|
||||
if (force == True or input ("\n\r").lower() == "y"):
|
||||
|
||||
print ("\n\rDownloading latest firmware...")
|
||||
|
||||
@ -317,6 +442,9 @@ def openProject():
|
||||
|
||||
if (linkInput.startswith("http") == True):
|
||||
entryType = 2
|
||||
elif (linkInput == 'force' or linkInput == 'update' or linkInput == 'force update'):
|
||||
jumperlessFirmwareString = ' '
|
||||
updateJumperlessFirmware(True)
|
||||
elif (linkInput.isdigit() == True) and (int(linkInput) <= len(lines)):
|
||||
otherIndex = 0
|
||||
for idx in lines:
|
||||
@ -428,7 +556,7 @@ def openProject():
|
||||
|
||||
|
||||
openSerial()
|
||||
updateJumperlessFirmware()
|
||||
updateJumperlessFirmware(False)
|
||||
openProject()
|
||||
|
||||
|
||||
|
@ -431,12 +431,12 @@
|
||||
('stringprep',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/stringprep.py',
|
||||
'PYMODULE'),
|
||||
('_py_abc',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/_py_abc.py',
|
||||
'PYMODULE'),
|
||||
('tracemalloc',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tracemalloc.py',
|
||||
'PYMODULE'),
|
||||
('_py_abc',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/_py_abc.py',
|
||||
'PYMODULE'),
|
||||
('threading',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py',
|
||||
'PYMODULE'),
|
||||
@ -1431,9 +1431,6 @@
|
||||
('lib-dynload/fcntl.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/fcntl.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/_multibytecodec.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_multibytecodec.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -1446,6 +1443,9 @@
|
||||
('lib-dynload/_codecs_iso2022.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_codecs_iso2022.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/_codecs_cn.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_codecs_cn.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -1527,8 +1527,11 @@
|
||||
'/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless Wokwi Bridge '
|
||||
'App/JumperlessWokwiBridge/build/JumperlessWokwiBridge/base_library.zip',
|
||||
'DATA'),
|
||||
('certifi/py.typed',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/py.typed',
|
||||
('lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl',
|
||||
@ -1536,28 +1539,25 @@
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'DATA'),
|
||||
('certifi/cacert.pem',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/cacert.pem',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
('certifi/py.typed',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/py.typed',
|
||||
'DATA')],
|
||||
[])
|
||||
|
@ -2,6 +2,12 @@
|
||||
'/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless Wokwi Bridge '
|
||||
'App/JumperlessWokwiBridge/build/JumperlessWokwiBridge/JumperlessWokwiBridge',
|
||||
'EXECUTABLE'),
|
||||
('lib-dynload/_struct.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_struct.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/zlib.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/zlib.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('arduino-cli',
|
||||
'/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless Wokwi Bridge '
|
||||
'App/JumperlessWokwiBridge/arduino-cli',
|
||||
@ -15,9 +21,6 @@
|
||||
('lib-dynload/math.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/math.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/zlib.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/zlib.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/pyexpat.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/pyexpat.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -90,9 +93,6 @@
|
||||
('lib-dynload/_multiprocessing.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_multiprocessing.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/_struct.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_struct.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/array.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/array.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -120,9 +120,6 @@
|
||||
('lib-dynload/fcntl.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/fcntl.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/_multibytecodec.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_multibytecodec.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -135,6 +132,9 @@
|
||||
('lib-dynload/_codecs_iso2022.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_codecs_iso2022.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/_codecs_cn.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_codecs_cn.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -214,8 +214,11 @@
|
||||
'/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless Wokwi Bridge '
|
||||
'App/JumperlessWokwiBridge/build/JumperlessWokwiBridge/base_library.zip',
|
||||
'DATA'),
|
||||
('certifi/py.typed',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/py.typed',
|
||||
('lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl',
|
||||
@ -223,27 +226,24 @@
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'DATA'),
|
||||
('certifi/cacert.pem',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/cacert.pem',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
('certifi/py.typed',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/py.typed',
|
||||
'DATA')],)
|
||||
|
@ -2,6 +2,12 @@
|
||||
'/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless Wokwi Bridge '
|
||||
'App/JumperlessWokwiBridge/build/JumperlessWokwiBridge/JumperlessWokwiBridge',
|
||||
'EXECUTABLE'),
|
||||
('lib-dynload/_struct.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_struct.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/zlib.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/zlib.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('arduino-cli',
|
||||
'/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless Wokwi Bridge '
|
||||
'App/JumperlessWokwiBridge/arduino-cli',
|
||||
@ -15,9 +21,6 @@
|
||||
('lib-dynload/math.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/math.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/zlib.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/zlib.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/pyexpat.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/pyexpat.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -90,9 +93,6 @@
|
||||
('lib-dynload/_multiprocessing.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_multiprocessing.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/_struct.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_struct.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/array.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/array.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -120,9 +120,6 @@
|
||||
('lib-dynload/fcntl.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/fcntl.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/_multibytecodec.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_multibytecodec.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -135,6 +132,9 @@
|
||||
('lib-dynload/_codecs_iso2022.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_codecs_iso2022.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/unicodedata.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
('lib-dynload/_codecs_cn.cpython-311-darwin.so',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_codecs_cn.cpython-311-darwin.so',
|
||||
'EXTENSION'),
|
||||
@ -214,8 +214,11 @@
|
||||
'/Users/kevinsanto/Documents/GitHub/Jumperless/Jumperless Wokwi Bridge '
|
||||
'App/JumperlessWokwiBridge/build/JumperlessWokwiBridge/base_library.zip',
|
||||
'DATA'),
|
||||
('certifi/py.typed',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/py.typed',
|
||||
('lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl',
|
||||
@ -223,27 +226,24 @@
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'DATA'),
|
||||
('certifi/cacert.pem',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/cacert.pem',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/rng/iso-schematron.rng',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl',
|
||||
'DATA'),
|
||||
('lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl',
|
||||
('certifi/py.typed',
|
||||
'/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/certifi/py.typed',
|
||||
'DATA')],)
|
||||
|
@ -61,7 +61,7 @@
|
||||
[],
|
||||
False,
|
||||
False,
|
||||
1707614607,
|
||||
1707692502,
|
||||
[('runw',
|
||||
'/Users/kevinsanto/Library/Python/3.11/lib/python/site-packages/PyInstaller/bootloader/Darwin-64bit/runw',
|
||||
'EXECUTABLE')])
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,313 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><?xar XSLT?>
|
||||
|
||||
<!--
|
||||
OVERVIEW - iso_abstract_expand.xsl
|
||||
|
||||
This is a preprocessor for ISO Schematron, which implements abstract patterns.
|
||||
It also
|
||||
* extracts a particular schema using an ID, where there are multiple
|
||||
schemas, such as when they are embedded in the same NVDL script
|
||||
* allows parameter substitution inside @context, @test, @select, @path
|
||||
* experimentally, allows parameter recognition and substitution inside
|
||||
text (NOTE: to be removed, for compataibility with other implementations,
|
||||
please do not use this)
|
||||
|
||||
This should be used after iso-dsdl-include.xsl and before the skeleton or
|
||||
meta-stylesheet (e.g. iso-svrl.xsl) . It only requires XSLT 1.
|
||||
|
||||
Each kind of inclusion can be turned off (or on) on the command line.
|
||||
|
||||
-->
|
||||
|
||||
<!--
|
||||
Open Source Initiative OSI - The MIT License:Licensing
|
||||
[OSI Approved License]
|
||||
|
||||
This source code was previously available under the zlib/libpng license.
|
||||
Attribution is polite.
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2004-2010 Rick Jellife and Academia Sinica Computing Centre, Taiwan
|
||||
|
||||
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 rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
-->
|
||||
|
||||
<!--
|
||||
VERSION INFORMATION
|
||||
2013-09-19 RJ
|
||||
* Allow macro expansion in @path attributes, eg. for sch:name/@path
|
||||
|
||||
2010-07-10 RJ
|
||||
* Move to MIT license
|
||||
|
||||
2008-09-18 RJ
|
||||
* move out param test from iso:schema template to work with XSLT 1. (Noah Fontes)
|
||||
|
||||
2008-07-29 RJ
|
||||
* Create. Pull out as distinct XSL in its own namespace from old iso_pre_pro.xsl
|
||||
* Put everything in private namespace
|
||||
* Rewrite replace_substring named template so that copyright is clear
|
||||
|
||||
2008-07-24 RJ
|
||||
* correct abstract patterns so for correct names: param/@name and
|
||||
param/@value
|
||||
|
||||
2007-01-12 RJ
|
||||
* Use ISO namespace
|
||||
* Use pattern/@id not pattern/@name
|
||||
* Add Oliver Becker's suggests from old Schematron-love-in list for <copy>
|
||||
* Add XT -ism?
|
||||
2003 RJ
|
||||
* Original written for old namespace
|
||||
* http://www.topologi.com/resources/iso-pre-pro.xsl
|
||||
-->
|
||||
<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
|
||||
xmlns:nvdl="http://purl.oclc.org/dsdl/nvdl"
|
||||
|
||||
xmlns:iae="http://www.schematron.com/namespace/iae"
|
||||
|
||||
>
|
||||
|
||||
<xslt:param name="schema-id"></xslt:param>
|
||||
|
||||
|
||||
<!-- Driver for the mode -->
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="." mode="iae:go" />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- ================================================================================== -->
|
||||
<!-- Normal processing rules -->
|
||||
<!-- ================================================================================== -->
|
||||
<!-- Output only the selected schema -->
|
||||
<xslt:template match="iso:schema" >
|
||||
<xsl:if test="string-length($schema-id) =0 or @id= $schema-id ">
|
||||
<xslt:copy>
|
||||
<xslt:copy-of select="@*" />
|
||||
<xslt:apply-templates mode="iae:go" />
|
||||
</xslt:copy>
|
||||
</xsl:if>
|
||||
</xslt:template>
|
||||
|
||||
|
||||
<!-- Strip out any foreign elements above the Schematron schema .
|
||||
-->
|
||||
<xslt:template match="*[not(ancestor-or-self::iso:*)]" mode="iae:go" >
|
||||
<xslt:apply-templates mode="iae:go" />
|
||||
</xslt:template>
|
||||
|
||||
|
||||
<!-- ================================================================================== -->
|
||||
<!-- Handle Schematron abstract pattern preprocessing -->
|
||||
<!-- abstract-to-real calls
|
||||
do-pattern calls
|
||||
macro-expand calls
|
||||
multi-macro-expand
|
||||
replace-substring -->
|
||||
<!-- ================================================================================== -->
|
||||
|
||||
<!--
|
||||
Abstract patterns allow you to say, for example
|
||||
|
||||
<pattern name="htmlTable" is-a="table">
|
||||
<param name="row" value="html:tr"/>
|
||||
<param name="cell" value="html:td" />
|
||||
<param name="table" value="html:table" />
|
||||
</pattern>
|
||||
|
||||
For a good introduction, see Uche Ogbujii's article for IBM DeveloperWorks
|
||||
"Discover the flexibility of Schematron abstract patterns"
|
||||
http://www-128.ibm.com/developerworks/xml/library/x-stron.html
|
||||
However, note that ISO Schematron uses @name and @value attributes on
|
||||
the iso:param element, and @id not @name on the pattern element.
|
||||
|
||||
-->
|
||||
|
||||
<!-- Suppress declarations of abstract patterns -->
|
||||
<xslt:template match="iso:pattern[@abstract='true']" mode="iae:go" >
|
||||
<xslt:comment>Suppressed abstract pattern <xslt:value-of select="@id"/> was here</xslt:comment>
|
||||
</xslt:template>
|
||||
|
||||
|
||||
<!-- Suppress uses of abstract patterns -->
|
||||
<xslt:template match="iso:pattern[@is-a]" mode="iae:go" >
|
||||
|
||||
<xslt:comment>Start pattern based on abstract <xslt:value-of select="@is-a"/></xslt:comment>
|
||||
|
||||
<xslt:call-template name="iae:abstract-to-real" >
|
||||
<xslt:with-param name="caller" select="@id" />
|
||||
<xslt:with-param name="is-a" select="@is-a" />
|
||||
</xslt:call-template>
|
||||
|
||||
</xslt:template>
|
||||
|
||||
|
||||
|
||||
<!-- output everything else unchanged -->
|
||||
<xslt:template match="*" priority="-1" mode="iae:go" >
|
||||
<xslt:copy>
|
||||
<xslt:copy-of select="@*" />
|
||||
<xslt:apply-templates mode="iae:go"/>
|
||||
</xslt:copy>
|
||||
</xslt:template>
|
||||
|
||||
<!-- Templates for macro expansion of abstract patterns -->
|
||||
<!-- Sets up the initial conditions for the recursive call -->
|
||||
<xslt:template name="iae:macro-expand">
|
||||
<xslt:param name="caller"/>
|
||||
<xslt:param name="text" />
|
||||
<xslt:call-template name="iae:multi-macro-expand">
|
||||
<xslt:with-param name="caller" select="$caller"/>
|
||||
<xslt:with-param name="text" select="$text"/>
|
||||
<xslt:with-param name="paramNumber" select="1"/>
|
||||
</xslt:call-template>
|
||||
|
||||
</xslt:template>
|
||||
|
||||
<!-- Template to replace the current parameter and then
|
||||
recurse to replace subsequent parameters. -->
|
||||
|
||||
<xslt:template name="iae:multi-macro-expand">
|
||||
<xslt:param name="caller"/>
|
||||
<xslt:param name="text" />
|
||||
<xslt:param name="paramNumber" />
|
||||
|
||||
|
||||
<xslt:choose>
|
||||
<xslt:when test="//iso:pattern[@id=$caller]/iso:param[ $paramNumber]">
|
||||
|
||||
<xslt:call-template name="iae:multi-macro-expand">
|
||||
<xslt:with-param name="caller" select="$caller"/>
|
||||
<xslt:with-param name="paramNumber" select="$paramNumber + 1"/>
|
||||
<xslt:with-param name="text" >
|
||||
<xslt:call-template name="iae:replace-substring">
|
||||
<xslt:with-param name="original" select="$text"/>
|
||||
<xslt:with-param name="substring"
|
||||
select="concat('$', //iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@name)"/>
|
||||
<xslt:with-param name="replacement"
|
||||
select="//iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@value"/>
|
||||
</xslt:call-template>
|
||||
</xslt:with-param>
|
||||
</xslt:call-template>
|
||||
</xslt:when>
|
||||
<xslt:otherwise><xslt:value-of select="$text" /></xslt:otherwise>
|
||||
|
||||
</xslt:choose>
|
||||
</xslt:template>
|
||||
|
||||
|
||||
<!-- generate the real pattern from an abstract pattern + parameters-->
|
||||
<xslt:template name="iae:abstract-to-real" >
|
||||
<xslt:param name="caller"/>
|
||||
<xslt:param name="is-a" />
|
||||
<xslt:for-each select="//iso:pattern[@id= $is-a]">
|
||||
<xslt:copy>
|
||||
|
||||
<xslt:choose>
|
||||
<xslt:when test=" string-length( $caller ) = 0">
|
||||
<xslt:attribute name="id"><xslt:value-of select="concat( generate-id(.) , $is-a)" /></xslt:attribute>
|
||||
</xslt:when>
|
||||
<xslt:otherwise>
|
||||
<xslt:attribute name="id"><xslt:value-of select="$caller" /></xslt:attribute>
|
||||
</xslt:otherwise>
|
||||
</xslt:choose>
|
||||
|
||||
<xslt:apply-templates select="*|text()" mode="iae:do-pattern" >
|
||||
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
|
||||
</xslt:apply-templates>
|
||||
|
||||
</xslt:copy>
|
||||
</xslt:for-each>
|
||||
</xslt:template>
|
||||
|
||||
|
||||
<!-- Generate a non-abstract pattern -->
|
||||
<xslt:template mode="iae:do-pattern" match="*">
|
||||
<xslt:param name="caller"/>
|
||||
<xslt:copy>
|
||||
<xslt:for-each select="@*[name()='test' or name()='context' or name()='select' or name()='path' ]">
|
||||
<xslt:attribute name="{name()}">
|
||||
<xslt:call-template name="iae:macro-expand">
|
||||
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
|
||||
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
|
||||
</xslt:call-template>
|
||||
</xslt:attribute>
|
||||
</xslt:for-each>
|
||||
<xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select'][name()!='path']" />
|
||||
<xsl:for-each select="node()">
|
||||
<xsl:choose>
|
||||
<!-- Experiment: replace macros in text as well, to allow parameterized assertions
|
||||
and so on, without having to have spurious <iso:value-of> calls and multiple
|
||||
delimiting.
|
||||
NOTE: THIS FUNCTIONALITY WILL BE REMOVED IN THE FUTURE -->
|
||||
<xsl:when test="self::text()">
|
||||
<xslt:call-template name="iae:macro-expand">
|
||||
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
|
||||
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
|
||||
</xslt:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xslt:apply-templates select="." mode="iae:do-pattern">
|
||||
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
|
||||
</xslt:apply-templates>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</xslt:copy>
|
||||
</xslt:template>
|
||||
|
||||
<!-- UTILITIES -->
|
||||
<!-- Simple version of replace-substring function -->
|
||||
<xslt:template name="iae:replace-substring">
|
||||
<xslt:param name="original" />
|
||||
<xslt:param name="substring" />
|
||||
<xslt:param name="replacement" select="''"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="not($original)" />
|
||||
<xsl:when test="not(string($substring))">
|
||||
<xsl:value-of select="$original" />
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($original, $substring)">
|
||||
<xsl:variable name="before" select="substring-before($original, $substring)" />
|
||||
<xsl:variable name="after" select="substring-after($original, $substring)" />
|
||||
|
||||
<xsl:value-of select="$before" />
|
||||
<xsl:value-of select="$replacement" />
|
||||
<!-- recursion -->
|
||||
<xsl:call-template name="iae:replace-substring">
|
||||
<xsl:with-param name="original" select="$after" />
|
||||
<xsl:with-param name="substring" select="$substring" />
|
||||
<xsl:with-param name="replacement" select="$replacement" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- no substitution -->
|
||||
<xsl:value-of select="$original" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xslt:template>
|
||||
|
||||
|
||||
|
||||
</xslt:stylesheet>
|
File diff suppressed because it is too large
Load Diff
@ -1,55 +0,0 @@
|
||||
<?xml version="1.0" ?><?xar XSLT?>
|
||||
<!-- Implmentation for the Schematron XML Schema Language.
|
||||
http://www.ascc.net/xml/resource/schematron/schematron.html
|
||||
|
||||
Copyright (c) 2000,2001 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from
|
||||
the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim
|
||||
that you wrote the original software. If you use this software in a product,
|
||||
an acknowledgment in the product documentation would be appreciated but is
|
||||
not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
-->
|
||||
|
||||
<!-- Schematron message -->
|
||||
|
||||
<xsl:stylesheet
|
||||
version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
|
||||
|
||||
<xsl:import href="iso_schematron_skeleton_for_xslt1.xsl"/>
|
||||
|
||||
<xsl:template name="process-prolog">
|
||||
<axsl:output method="text" />
|
||||
</xsl:template>
|
||||
|
||||
<!-- use default rule for process-root: copy contens / ignore title -->
|
||||
<!-- use default rule for process-pattern: ignore name and see -->
|
||||
<!-- use default rule for process-name: output name -->
|
||||
<!-- use default rule for process-assert and process-report:
|
||||
call process-message -->
|
||||
|
||||
<xsl:template name="process-message">
|
||||
<xsl:param name="pattern" />
|
||||
<xsl:param name="role" />
|
||||
<axsl:message>
|
||||
<xsl:apply-templates mode="text"
|
||||
/> (<xsl:value-of select="$pattern" />
|
||||
<xsl:if test="$role"> / <xsl:value-of select="$role" />
|
||||
</xsl:if>)</axsl:message>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
File diff suppressed because it is too large
Load Diff
@ -1,588 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!--
|
||||
ISO_SVRL.xsl
|
||||
|
||||
Implementation of Schematron Validation Report Language from ISO Schematron
|
||||
ISO/IEC 19757 Document Schema Definition Languages (DSDL)
|
||||
Part 3: Rule-based validation Schematron
|
||||
Annex D: Schematron Validation Report Language
|
||||
|
||||
This ISO Standard is available free as a Publicly Available Specification in PDF from ISO.
|
||||
Also see www.schematron.com for drafts and other information.
|
||||
|
||||
This implementation of SVRL is designed to run with the "Skeleton" implementation
|
||||
of Schematron which Oliver Becker devised. The skeleton code provides a
|
||||
Schematron implementation but with named templates for handling all output;
|
||||
the skeleton provides basic templates for output using this API, but client
|
||||
validators can be written to import the skeleton and override the default output
|
||||
templates as required. (In order to understand this, you must understand that
|
||||
a named template such as "process-assert" in this XSLT stylesheet overrides and
|
||||
replaces any template with the same name in the imported skeleton XSLT file.)
|
||||
|
||||
The other important thing to understand in this code is that there are different
|
||||
versions of the Schematron skeleton. These track the development of Schematron through
|
||||
Schematron 1.5, Schematron 1.6 and now ISO Schematron. One only skeleton must be
|
||||
imported. The code has templates for the different skeletons commented out for
|
||||
convenience. ISO Schematron has a different namespace than Schematron 1.5 and 1.6;
|
||||
so the ISO Schematron skeleton has been written itself with an optional import
|
||||
statement to in turn import the Schematron 1.6 skeleton. This will allow you to
|
||||
validate with schemas from either namespace.
|
||||
|
||||
|
||||
History:
|
||||
2009-03-18
|
||||
* Fix atrribute with space "see " which generates wrong name in some processors
|
||||
2008-08-11
|
||||
* RJ Fix attribute/@select which saxon allows in XSLT 1
|
||||
2008-08-07
|
||||
* RJ Add output-encoding attribute to specify final encoding to use
|
||||
* Alter allow-foreign functionality so that Schematron span, emph and dir elements make
|
||||
it to the output, for better formatting and because span can be used to mark up
|
||||
semantically interesting information embedded in diagnostics, which reduces the
|
||||
need to extend SVRL itself
|
||||
* Diagnostic-reference had an invalid attribute @id that duplicated @diagnostic: removed
|
||||
2008-08-06
|
||||
* RJ Fix invalid output: svrl:diagnostic-reference is not contained in an svrl:text
|
||||
* Output comment to SVRL file giving filename if available (from command-line parameter)
|
||||
2008-08-04
|
||||
* RJ move sch: prefix to schold: prefix to prevent confusion (we want people to
|
||||
be able to switch from old namespace to new namespace without changing the
|
||||
sch: prefix, so it is better to keep that prefix completely out of the XSLT)
|
||||
* Extra signature fixes (PH)
|
||||
2008-08-03
|
||||
* Repair missing class parameter on process-p
|
||||
2008-07-31
|
||||
* Update skeleton names
|
||||
2007-04-03
|
||||
* Add option generate-fired-rule (RG)
|
||||
2007-02-07
|
||||
* Prefer true|false for parameters. But allow yes|no on some old for compatability
|
||||
* DP Diagnostics output to svrl:text. Diagnosis put out after assertion text.
|
||||
* Removed non-SVRL elements and attributes: better handled as an extra layer that invokes this one
|
||||
* Add more formal parameters
|
||||
* Correct confusion between $schemaVersion and $queryBinding
|
||||
* Indent
|
||||
* Validate against RNC schemas for XSLT 1 and 2 (with regex tests removed)
|
||||
* Validate output with UniversalTest.sch against RNC schema for ISO SVRL
|
||||
|
||||
2007-02-01
|
||||
* DP. Update formal parameters of overriding named templates to handle more attributes.
|
||||
* DP. Refactor handling of rich and linkable parameters to a named template.
|
||||
|
||||
2007-01-22
|
||||
* DP change svrl:ns to svrl:ns-in-attribute-value
|
||||
* Change default when no queryBinding from "unknown" to "xslt"
|
||||
|
||||
2007-01-18:
|
||||
* Improve documentation
|
||||
* KH Add command-line options to generate paths or not
|
||||
* Use axsl:attribute rather than xsl:attribute to shut XSLT2 up
|
||||
* Add extra command-line options to pass to the iso_schematron_skeleton
|
||||
|
||||
2006-12-01: iso_svrl.xsl Rick Jelliffe,
|
||||
* update namespace,
|
||||
* update phase handling,
|
||||
* add flag param to process-assert and process-report & @ flag on output
|
||||
|
||||
2001: Conformance1-5.xsl Rick Jelliffe,
|
||||
* Created, using the skeleton code contributed by Oliver Becker
|
||||
-->
|
||||
<!--
|
||||
Derived from Conformance1-5.xsl.
|
||||
|
||||
Copyright (c) 2001, 2006 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from
|
||||
the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim
|
||||
that you wrote the original software. If you use this software in a product,
|
||||
an acknowledgment in the product documentation would be appreciated but is
|
||||
not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
-->
|
||||
|
||||
<!-- Ideas nabbed from schematrons by Francis N., Miloslav N. and David C. -->
|
||||
|
||||
<!-- The command-line parameters are:
|
||||
phase NMTOKEN | "#ALL" (default) Select the phase for validation
|
||||
allow-foreign "true" | "false" (default) Pass non-Schematron elements and rich markup to the generated stylesheet
|
||||
diagnose= true | false|yes|no Add the diagnostics to the assertion test in reports (yes|no are obsolete)
|
||||
generate-paths=true|false|yes|no generate the @location attribute with XPaths (yes|no are obsolete)
|
||||
sch.exslt.imports semi-colon delimited string of filenames for some EXSLT implementations
|
||||
optimize "visit-no-attributes" Use only when the schema has no attributes as the context nodes
|
||||
generate-fired-rule "true"(default) | "false" Generate fired-rule elements
|
||||
|
||||
-->
|
||||
|
||||
<xsl:stylesheet
|
||||
version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
|
||||
xmlns:schold="http://www.ascc.net/xml/schematron"
|
||||
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
|
||||
xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
|
||||
>
|
||||
|
||||
<!-- Select the import statement and adjust the path as
|
||||
necessary for your system.
|
||||
If not XSLT2 then also remove svrl:active-pattern/@document="{document-uri()}" from process-pattern()
|
||||
-->
|
||||
<!--
|
||||
<xsl:import href="iso_schematron_skeleton_for_saxon.xsl"/>
|
||||
-->
|
||||
|
||||
<xsl:import href="iso_schematron_skeleton_for_xslt1.xsl"/>
|
||||
<!--
|
||||
<xsl:import href="iso_schematron_skeleton.xsl"/>
|
||||
<xsl:import href="skeleton1-5.xsl"/>
|
||||
<xsl:import href="skeleton1-6.xsl"/>
|
||||
-->
|
||||
|
||||
<xsl:param name="diagnose" >true</xsl:param>
|
||||
<xsl:param name="phase" >
|
||||
<xsl:choose>
|
||||
<!-- Handle Schematron 1.5 and 1.6 phases -->
|
||||
<xsl:when test="//schold:schema/@defaultPhase">
|
||||
<xsl:value-of select="//schold:schema/@defaultPhase"/>
|
||||
</xsl:when>
|
||||
<!-- Handle ISO Schematron phases -->
|
||||
<xsl:when test="//iso:schema/@defaultPhase">
|
||||
<xsl:value-of select="//iso:schema/@defaultPhase"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>#ALL</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:param>
|
||||
<xsl:param name="allow-foreign" >false</xsl:param>
|
||||
<xsl:param name="generate-paths" >true</xsl:param>
|
||||
<xsl:param name="generate-fired-rule" >true</xsl:param>
|
||||
<xsl:param name="optimize"/>
|
||||
|
||||
<xsl:param name="output-encoding" ></xsl:param>
|
||||
|
||||
<!-- e.g. saxon file.xml file.xsl "sch.exslt.imports=.../string.xsl;.../math.xsl" -->
|
||||
<xsl:param name="sch.exslt.imports" />
|
||||
|
||||
|
||||
|
||||
<!-- Experimental: If this file called, then must be generating svrl -->
|
||||
<xsl:variable name="svrlTest" select="true()" />
|
||||
|
||||
|
||||
|
||||
<!-- ================================================================ -->
|
||||
|
||||
<xsl:template name="process-prolog">
|
||||
<axsl:output method="xml" omit-xml-declaration="no" standalone="yes"
|
||||
indent="yes">
|
||||
<xsl:if test=" string-length($output-encoding) > 0">
|
||||
<xsl:attribute name="encoding"><xsl:value-of select=" $output-encoding" /></xsl:attribute>
|
||||
</xsl:if>
|
||||
</axsl:output>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Overrides skeleton.xsl -->
|
||||
<xsl:template name="process-root">
|
||||
<xsl:param name="title"/>
|
||||
<xsl:param name="contents" />
|
||||
<xsl:param name="queryBinding" >xslt1</xsl:param>
|
||||
<xsl:param name="schemaVersion" />
|
||||
<xsl:param name="id" />
|
||||
<xsl:param name="version"/>
|
||||
<!-- "Rich" parameters -->
|
||||
<xsl:param name="fpi" />
|
||||
<xsl:param name="icon" />
|
||||
<xsl:param name="lang" />
|
||||
<xsl:param name="see" />
|
||||
<xsl:param name="space" />
|
||||
|
||||
<svrl:schematron-output title="{$title}" schemaVersion="{$schemaVersion}" >
|
||||
<xsl:if test=" string-length( normalize-space( $phase )) > 0 and
|
||||
not( normalize-space( $phase ) = '#ALL') ">
|
||||
<axsl:attribute name="phase">
|
||||
<xsl:value-of select=" $phase " />
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test=" $allow-foreign = 'true'">
|
||||
</xsl:if>
|
||||
<xsl:if test=" $allow-foreign = 'true'">
|
||||
|
||||
<xsl:call-template name='richParms'>
|
||||
<xsl:with-param name="fpi" select="$fpi" />
|
||||
<xsl:with-param name="icon" select="$icon"/>
|
||||
<xsl:with-param name="lang" select="$lang"/>
|
||||
<xsl:with-param name="see" select="$see" />
|
||||
<xsl:with-param name="space" select="$space" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
|
||||
<axsl:comment><axsl:value-of select="$archiveDirParameter"/>  
|
||||
<axsl:value-of select="$archiveNameParameter"/>  
|
||||
<axsl:value-of select="$fileNameParameter"/>  
|
||||
<axsl:value-of select="$fileDirParameter"/></axsl:comment>
|
||||
|
||||
|
||||
<xsl:apply-templates mode="do-schema-p" />
|
||||
<xsl:copy-of select="$contents" />
|
||||
</svrl:schematron-output>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template name="process-assert">
|
||||
<xsl:param name="test"/>
|
||||
<xsl:param name="diagnostics" />
|
||||
<xsl:param name="id" />
|
||||
<xsl:param name="flag" />
|
||||
<!-- "Linkable" parameters -->
|
||||
<xsl:param name="role"/>
|
||||
<xsl:param name="subject"/>
|
||||
<!-- "Rich" parameters -->
|
||||
<xsl:param name="fpi" />
|
||||
<xsl:param name="icon" />
|
||||
<xsl:param name="lang" />
|
||||
<xsl:param name="see" />
|
||||
<xsl:param name="space" />
|
||||
<svrl:failed-assert test="{$test}" >
|
||||
<xsl:if test="string-length( $id ) > 0">
|
||||
<axsl:attribute name="id">
|
||||
<xsl:value-of select=" $id " />
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test=" string-length( $flag ) > 0">
|
||||
<axsl:attribute name="flag">
|
||||
<xsl:value-of select=" $flag " />
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<!-- Process rich attributes. -->
|
||||
<xsl:call-template name="richParms">
|
||||
<xsl:with-param name="fpi" select="$fpi"/>
|
||||
<xsl:with-param name="icon" select="$icon"/>
|
||||
<xsl:with-param name="lang" select="$lang"/>
|
||||
<xsl:with-param name="see" select="$see" />
|
||||
<xsl:with-param name="space" select="$space" />
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name='linkableParms'>
|
||||
<xsl:with-param name="role" select="$role" />
|
||||
<xsl:with-param name="subject" select="$subject"/>
|
||||
</xsl:call-template>
|
||||
<xsl:if test=" $generate-paths = 'true' or $generate-paths= 'yes' ">
|
||||
<!-- true/false is the new way -->
|
||||
<axsl:attribute name="location">
|
||||
<axsl:apply-templates select="." mode="schematron-get-full-path"/>
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<svrl:text>
|
||||
<xsl:apply-templates mode="text" />
|
||||
|
||||
</svrl:text>
|
||||
<xsl:if test="$diagnose = 'yes' or $diagnose= 'true' ">
|
||||
<!-- true/false is the new way -->
|
||||
<xsl:call-template name="diagnosticsSplit">
|
||||
<xsl:with-param name="str" select="$diagnostics"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</svrl:failed-assert>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="process-report">
|
||||
<xsl:param name="id"/>
|
||||
<xsl:param name="test"/>
|
||||
<xsl:param name="diagnostics"/>
|
||||
<xsl:param name="flag" />
|
||||
<!-- "Linkable" parameters -->
|
||||
<xsl:param name="role"/>
|
||||
<xsl:param name="subject"/>
|
||||
<!-- "Rich" parameters -->
|
||||
<xsl:param name="fpi" />
|
||||
<xsl:param name="icon" />
|
||||
<xsl:param name="lang" />
|
||||
<xsl:param name="see" />
|
||||
<xsl:param name="space" />
|
||||
<svrl:successful-report test="{$test}" >
|
||||
<xsl:if test=" string-length( $id ) > 0">
|
||||
<axsl:attribute name="id">
|
||||
<xsl:value-of select=" $id " />
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test=" string-length( $flag ) > 0">
|
||||
<axsl:attribute name="flag">
|
||||
<xsl:value-of select=" $flag " />
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<!-- Process rich attributes. -->
|
||||
<xsl:call-template name="richParms">
|
||||
<xsl:with-param name="fpi" select="$fpi"/>
|
||||
<xsl:with-param name="icon" select="$icon"/>
|
||||
<xsl:with-param name="lang" select="$lang"/>
|
||||
<xsl:with-param name="see" select="$see" />
|
||||
<xsl:with-param name="space" select="$space" />
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name='linkableParms'>
|
||||
<xsl:with-param name="role" select="$role" />
|
||||
<xsl:with-param name="subject" select="$subject"/>
|
||||
</xsl:call-template>
|
||||
<xsl:if test=" $generate-paths = 'yes' or $generate-paths = 'true' ">
|
||||
<!-- true/false is the new way -->
|
||||
<axsl:attribute name="location">
|
||||
<axsl:apply-templates select="." mode="schematron-get-full-path"/>
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<svrl:text>
|
||||
<xsl:apply-templates mode="text" />
|
||||
|
||||
</svrl:text>
|
||||
<xsl:if test="$diagnose = 'yes' or $diagnose='true' ">
|
||||
<!-- true/false is the new way -->
|
||||
<xsl:call-template name="diagnosticsSplit">
|
||||
<xsl:with-param name="str" select="$diagnostics"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</svrl:successful-report>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Overrides skeleton -->
|
||||
<xsl:template name="process-dir" >
|
||||
<xsl:param name="value" />
|
||||
<xsl:choose>
|
||||
<xsl:when test=" $allow-foreign = 'true'">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<!-- We generate too much whitespace rather than risking concatenation -->
|
||||
<axsl:text> </axsl:text>
|
||||
<xsl:apply-templates mode="inline-text"/>
|
||||
<axsl:text> </axsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="process-diagnostic">
|
||||
<xsl:param name="id"/>
|
||||
<!-- Rich parameters -->
|
||||
<xsl:param name="fpi" />
|
||||
<xsl:param name="icon" />
|
||||
<xsl:param name="lang" />
|
||||
<xsl:param name="see" />
|
||||
<xsl:param name="space" />
|
||||
<svrl:diagnostic-reference diagnostic="{$id}" >
|
||||
|
||||
<xsl:call-template name="richParms">
|
||||
<xsl:with-param name="fpi" select="$fpi"/>
|
||||
<xsl:with-param name="icon" select="$icon"/>
|
||||
<xsl:with-param name="lang" select="$lang"/>
|
||||
<xsl:with-param name="see" select="$see" />
|
||||
<xsl:with-param name="space" select="$space" />
|
||||
</xsl:call-template>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
|
||||
<xsl:apply-templates mode="text"/>
|
||||
|
||||
</svrl:diagnostic-reference>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Overrides skeleton -->
|
||||
<xsl:template name="process-emph" >
|
||||
<xsl:param name="class" />
|
||||
<xsl:choose>
|
||||
<xsl:when test=" $allow-foreign = 'true'">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- We generate too much whitespace rather than risking concatenation -->
|
||||
<axsl:text> </axsl:text>
|
||||
<xsl:apply-templates mode="inline-text"/>
|
||||
<axsl:text> </axsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="process-rule">
|
||||
<xsl:param name="id"/>
|
||||
<xsl:param name="context"/>
|
||||
<xsl:param name="flag"/>
|
||||
<!-- "Linkable" parameters -->
|
||||
<xsl:param name="role"/>
|
||||
<xsl:param name="subject"/>
|
||||
<!-- "Rich" parameters -->
|
||||
<xsl:param name="fpi" />
|
||||
<xsl:param name="icon" />
|
||||
<xsl:param name="lang" />
|
||||
<xsl:param name="see" />
|
||||
<xsl:param name="space" />
|
||||
<xsl:if test=" $generate-fired-rule = 'true'">
|
||||
<svrl:fired-rule context="{$context}" >
|
||||
<!-- Process rich attributes. -->
|
||||
<xsl:call-template name="richParms">
|
||||
<xsl:with-param name="fpi" select="$fpi"/>
|
||||
<xsl:with-param name="icon" select="$icon"/>
|
||||
<xsl:with-param name="lang" select="$lang"/>
|
||||
<xsl:with-param name="see" select="$see" />
|
||||
<xsl:with-param name="space" select="$space" />
|
||||
</xsl:call-template>
|
||||
<xsl:if test=" string( $id )">
|
||||
<xsl:attribute name="id">
|
||||
<xsl:value-of select=" $id " />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test=" string-length( $role ) > 0">
|
||||
<xsl:attribute name="role">
|
||||
<xsl:value-of select=" $role " />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</svrl:fired-rule>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="process-ns">
|
||||
<xsl:param name="prefix"/>
|
||||
<xsl:param name="uri"/>
|
||||
<svrl:ns-prefix-in-attribute-values uri="{$uri}" prefix="{$prefix}" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="process-p">
|
||||
<xsl:param name="icon"/>
|
||||
<xsl:param name="class"/>
|
||||
<xsl:param name="id"/>
|
||||
<xsl:param name="lang"/>
|
||||
|
||||
<svrl:text>
|
||||
<xsl:apply-templates mode="text"/>
|
||||
</svrl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="process-pattern">
|
||||
<xsl:param name="name"/>
|
||||
<xsl:param name="id"/>
|
||||
<xsl:param name="is-a"/>
|
||||
|
||||
<!-- "Rich" parameters -->
|
||||
<xsl:param name="fpi" />
|
||||
<xsl:param name="icon" />
|
||||
<xsl:param name="lang" />
|
||||
<xsl:param name="see" />
|
||||
<xsl:param name="space" />
|
||||
<svrl:active-pattern >
|
||||
<xsl:if test=" string( $id )">
|
||||
<axsl:attribute name="id">
|
||||
<xsl:value-of select=" $id " />
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test=" string( $name )">
|
||||
<axsl:attribute name="name">
|
||||
<xsl:value-of select=" $name " />
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:call-template name='richParms'>
|
||||
<xsl:with-param name="fpi" select="$fpi"/>
|
||||
<xsl:with-param name="icon" select="$icon"/>
|
||||
<xsl:with-param name="lang" select="$lang"/>
|
||||
<xsl:with-param name="see" select="$see" />
|
||||
<xsl:with-param name="space" select="$space" />
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- ?? report that this screws up iso:title processing -->
|
||||
<xsl:apply-templates mode="do-pattern-p"/>
|
||||
<!-- ?? Seems that this apply-templates is never triggered DP -->
|
||||
<axsl:apply-templates />
|
||||
</svrl:active-pattern>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Overrides skeleton -->
|
||||
<xsl:template name="process-message" >
|
||||
<xsl:param name="pattern"/>
|
||||
<xsl:param name="role"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Overrides skeleton -->
|
||||
<xsl:template name="process-span" >
|
||||
<xsl:param name="class" />
|
||||
<xsl:choose>
|
||||
<xsl:when test=" $allow-foreign = 'true'">
|
||||
<xsl:copy-of select="."/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- We generate too much whitespace rather than risking concatenation -->
|
||||
<axsl:text> </axsl:text>
|
||||
<xsl:apply-templates mode="inline-text"/>
|
||||
<axsl:text> </axsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- =========================================================================== -->
|
||||
<!-- processing rich parameters. -->
|
||||
<xsl:template name='richParms'>
|
||||
<!-- "Rich" parameters -->
|
||||
<xsl:param name="fpi" />
|
||||
<xsl:param name="icon" />
|
||||
<xsl:param name="lang" />
|
||||
<xsl:param name="see" />
|
||||
<xsl:param name="space" />
|
||||
<!-- Process rich attributes. -->
|
||||
<xsl:if test=" $allow-foreign = 'true'">
|
||||
<xsl:if test="string($fpi)">
|
||||
<axsl:attribute name="fpi">
|
||||
<xsl:value-of select="$fpi"/>
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="string($icon)">
|
||||
<axsl:attribute name="icon">
|
||||
<xsl:value-of select="$icon"/>
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="string($see)">
|
||||
<axsl:attribute name="see">
|
||||
<xsl:value-of select="$see"/>
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
<xsl:if test="string($space)">
|
||||
<axsl:attribute name="xml:space">
|
||||
<xsl:value-of select="$space"/>
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="string($lang)">
|
||||
<axsl:attribute name="xml:lang">
|
||||
<xsl:value-of select="$lang"/>
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- processing linkable parameters. -->
|
||||
<xsl:template name='linkableParms'>
|
||||
<xsl:param name="role"/>
|
||||
<xsl:param name="subject"/>
|
||||
|
||||
<!-- ISO SVRL has a role attribute to match the Schematron role attribute -->
|
||||
<xsl:if test=" string($role )">
|
||||
<axsl:attribute name="role">
|
||||
<xsl:value-of select=" $role " />
|
||||
</axsl:attribute>
|
||||
</xsl:if>
|
||||
<!-- ISO SVRL does not have a subject attribute to match the Schematron subject attribute.
|
||||
Instead, the Schematron subject attribute is folded into the location attribute -->
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -1,84 +0,0 @@
|
||||
ISO SCHEMATRON 2010
|
||||
|
||||
XSLT implementation by Rick Jelliffe with assistance from members of Schematron-love-in maillist.
|
||||
|
||||
2010-04-21
|
||||
|
||||
Two distributions are available. One is for XSLT1 engines.
|
||||
The other is for XSLT2 engines, such as SAXON 9.
|
||||
|
||||
|
||||
This version of Schematron splits the process into a pipeline of several different XSLT stages.
|
||||
|
||||
1) First, preprocess your Schematron schema with iso_dsdl_include.xsl.
|
||||
This is a macro processor to assemble the schema from various parts.
|
||||
If your schema is not in separate parts, you can skip this stage.
|
||||
This stage also generates error messages for some common XPath syntax problems.
|
||||
|
||||
2) Second, preprocess the output from stage 1 with iso_abstract_expand.xsl.
|
||||
This is a macro processor to convert abstract patterns to real patterns.
|
||||
If your schema does not use abstract patterns, you can skip this
|
||||
stage.
|
||||
|
||||
3) Third, compile the Schematron schema into an XSLT script.
|
||||
This will typically use iso_svrl_for_xslt1.xsl or iso_svrl_for_xslt2.xsl
|
||||
(which in turn invoke iso_schematron_skeleton_for_xslt1.xsl or iso_schematron_skeleton_for_saxon.xsl)
|
||||
However, other "meta-stylesheets" are also in common use; the principle of operation is the same.
|
||||
If your schema uses Schematron phases, supply these as command line/invocation parameters
|
||||
to this process.
|
||||
|
||||
4) Fourth, run the script generated by stage 3 against the document being validated.
|
||||
If you are using the SVRL script, then the output of validation will be an XML document.
|
||||
If your schema uses Schematron parameters, supply these as command line/invocation parameters
|
||||
to this process.
|
||||
|
||||
|
||||
The XSLT2 distribution also features several next generation features,
|
||||
such as validating multiple documents. See the source code for details.
|
||||
|
||||
Schematron assertions can be written in any language, of course; the file
|
||||
sch-messages-en.xhtml contains the diagnostics messages from the XSLT2 skeleton
|
||||
in English, and this can be used as template to localize the skeleton's
|
||||
error messages. Note that typically programming errors in Schematron are XPath
|
||||
errors, which requires localized messages from the XSLT engine.
|
||||
|
||||
ANT
|
||||
---
|
||||
To give an example of how to process a document, here is a sample ANT task.
|
||||
|
||||
<target name="schematron-compile-test" >
|
||||
|
||||
<!-- expand inclusions -->
|
||||
<xslt basedir="test/schematron"
|
||||
style="iso_dsdl_include.xsl" in="test.sch" out="test1.sch">
|
||||
<classpath>
|
||||
<pathelement location="${lib.dir}/saxon9.jar"/>
|
||||
</classpath>
|
||||
</xslt>
|
||||
|
||||
<!-- expand abstract patterns -->
|
||||
<xslt basedir="test/schematron"
|
||||
style="iso_abstract_expand.xsl" in="test1.sch" out="test2.sch">
|
||||
<classpath>
|
||||
<pathelement location="${lib.dir}/saxon9.jar"/>
|
||||
</classpath>
|
||||
</xslt>
|
||||
|
||||
|
||||
|
||||
<!-- compile it -->
|
||||
<xslt basedir="test/schematron"
|
||||
style="iso_svrl_for_xslt2.xsl" in="test2.sch" out="test.xsl">
|
||||
<classpath>
|
||||
<pathelement location="${lib.dir}/saxon9.jar"/>
|
||||
</classpath>
|
||||
</xslt>
|
||||
|
||||
<!-- validate -->
|
||||
<xslt basedir="test/schematron"
|
||||
style="test.xsl" in="instance.xml" out="instance.svrlt">
|
||||
<classpath>
|
||||
<pathelement location="${lib.dir}/saxon9.jar"/>
|
||||
</classpath>
|
||||
</xslt>
|
||||
</target>
|
Binary file not shown.
@ -219,6 +219,248 @@ void sendAllPaths(void) // should we sort them by chip? for now, no
|
||||
}
|
||||
}
|
||||
|
||||
void sendXYraw(int chip, int x, int y, int setOrClear)
|
||||
{
|
||||
uint32_t chAddress = 0;
|
||||
chipSelect = chip;
|
||||
|
||||
int chYdata = y;
|
||||
int chXdata = x;
|
||||
|
||||
chYdata = chYdata << 5;
|
||||
chYdata = chYdata & 0b11100000;
|
||||
|
||||
chXdata = chXdata << 1;
|
||||
chXdata = chXdata & 0b00011110;
|
||||
|
||||
chAddress = chYdata | chXdata;
|
||||
|
||||
if (setOrClear == 1)
|
||||
{
|
||||
chAddress = chAddress | 0b00000001; // this last bit determines whether we set or unset the path
|
||||
}
|
||||
|
||||
chAddress = chAddress << 24;
|
||||
|
||||
delayMicroseconds(20);
|
||||
|
||||
pio_sm_put(pio, sm, chAddress);
|
||||
|
||||
delayMicroseconds(40);
|
||||
}
|
||||
|
||||
int readFloatingOrState(int pin, int rowBeingScanned)
|
||||
{
|
||||
|
||||
enum measuredState state = floating;
|
||||
int readingPullup = 0;
|
||||
int readingPullup2 = 0;
|
||||
int readingPullup3 = 0;
|
||||
|
||||
int readingPulldown = 0;
|
||||
int readingPulldown2 = 0;
|
||||
int readingPulldown3 = 0;
|
||||
|
||||
pinMode(pin, INPUT_PULLUP);
|
||||
|
||||
delayMicroseconds(200);
|
||||
|
||||
readingPullup = digitalRead(pin);
|
||||
delayMicroseconds(10);
|
||||
readingPullup2 = digitalRead(pin);
|
||||
delayMicroseconds(5);
|
||||
readingPullup3 = digitalRead(pin);
|
||||
|
||||
pinMode(pin, INPUT_PULLDOWN);
|
||||
delayMicroseconds(200);
|
||||
|
||||
readingPulldown = digitalRead(pin);
|
||||
delayMicroseconds(10);
|
||||
readingPulldown2 = digitalRead(pin);
|
||||
delayMicroseconds(5);
|
||||
readingPulldown3 = digitalRead(pin);
|
||||
|
||||
if (readingPullup != readingPullup2 || readingPullup2 != readingPullup3 && rowBeingScanned != -1)
|
||||
{
|
||||
if (readingPulldown != readingPulldown2 || readingPulldown2 != readingPulldown3)
|
||||
{
|
||||
state = probe;
|
||||
|
||||
leds.setPixelColor(nodesToPixelMap[rowBeingScanned], 45, 0, 45);
|
||||
// Serial.print("probe");
|
||||
leds.show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Serial.print(readingPulldown);
|
||||
// Serial.print("\t");
|
||||
if (readingPullup == 1 && readingPulldown == 0)
|
||||
{
|
||||
// Serial.print("floating");
|
||||
// leds.setPixelColor(nodesToPixelMap[rowBeingScanned], 0, 0, 3);
|
||||
state = floating;
|
||||
}
|
||||
else if (readingPullup == 1 && readingPulldown == 1)
|
||||
{
|
||||
// Serial.print("HIGH");
|
||||
//leds.setPixelColor(nodesToPixelMap[rowBeingScanned], 45, 0, 0);
|
||||
state = high;
|
||||
}
|
||||
else if (readingPullup == 0 && readingPulldown == 0)
|
||||
{
|
||||
// Serial.print("LOW");
|
||||
//leds.setPixelColor(nodesToPixelMap[rowBeingScanned], 0, 45, 0);
|
||||
state = low;
|
||||
}
|
||||
else if (readingPullup == 0 && readingPulldown == 1)
|
||||
{
|
||||
// Serial.print("shorted");
|
||||
}
|
||||
}
|
||||
// Serial.print("\n");
|
||||
leds.show();
|
||||
//delayMicroseconds(100);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void startProbe(void)
|
||||
{
|
||||
pinMode(19, OUTPUT);
|
||||
analogWriteFreq(50000);
|
||||
analogWrite(19, 128);
|
||||
delayMicroseconds(100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int scanRows(int pin, bool clearLastFound)
|
||||
{
|
||||
static int lastFound = -1;
|
||||
int found = -1;
|
||||
|
||||
if (clearLastFound)
|
||||
{
|
||||
lastFound = -1;
|
||||
return -1;
|
||||
}
|
||||
digitalWrite(RESETPIN, HIGH);
|
||||
delayMicroseconds(10);
|
||||
digitalWrite(RESETPIN, LOW);
|
||||
startProbe();
|
||||
int chipToConnect = 0;
|
||||
int rowBeingScanned = 0;
|
||||
|
||||
int xMapRead = 15;
|
||||
|
||||
if (pin == ADC0_PIN)
|
||||
{
|
||||
xMapRead = 2;
|
||||
}
|
||||
else if (pin == ADC1_PIN)
|
||||
{
|
||||
xMapRead = 3;
|
||||
}
|
||||
else if (pin == ADC2_PIN)
|
||||
{
|
||||
xMapRead = 4;
|
||||
}
|
||||
else if (pin == ADC3_PIN)
|
||||
{
|
||||
xMapRead = 5;
|
||||
}
|
||||
|
||||
// Serial.print("xMapRead: ");
|
||||
// Serial.println(xMapRead);
|
||||
|
||||
pinMode(pin, INPUT);
|
||||
for (int chipScan = CHIP_A; chipScan < 8; chipScan++)
|
||||
{
|
||||
|
||||
sendXYraw(CHIP_L, xMapRead, chipScan, 1);
|
||||
|
||||
for (int yToScan = 1; yToScan < 8; yToScan++)
|
||||
{
|
||||
|
||||
sendXYraw(chipScan, 0, 0, 1);
|
||||
sendXYraw(chipScan, 0, yToScan, 1);
|
||||
|
||||
// analogRead(ADC0_PIN);
|
||||
|
||||
rowBeingScanned = ch[chipScan].yMap[yToScan];
|
||||
if (readFloatingOrState(pin, rowBeingScanned) == probe && rowBeingScanned != lastFound)
|
||||
{
|
||||
found = rowBeingScanned;
|
||||
lastFound = found;
|
||||
|
||||
}
|
||||
|
||||
sendXYraw(chipScan, 0, 0, 0);
|
||||
sendXYraw(chipScan, 0, yToScan, 0);
|
||||
|
||||
// if (found != -1)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
sendXYraw(CHIP_L, 2, chipScan, 0);
|
||||
|
||||
|
||||
|
||||
|
||||
if (found != -1)
|
||||
{
|
||||
return found;
|
||||
}
|
||||
}
|
||||
|
||||
int corners[4] = {1, 30, 31, 60};
|
||||
sendXYraw(CHIP_L, xMapRead, 0, 1);
|
||||
for (int cornerScan = 0; cornerScan < 4; cornerScan++)
|
||||
{
|
||||
|
||||
sendXYraw(CHIP_L, cornerScan + 8, 0, 1);
|
||||
|
||||
// analogRead(ADC0_PIN);
|
||||
|
||||
rowBeingScanned = corners[cornerScan];
|
||||
if (readFloatingOrState(pin, rowBeingScanned) == probe && rowBeingScanned != lastFound)
|
||||
{
|
||||
found = rowBeingScanned;
|
||||
lastFound = found;
|
||||
}
|
||||
|
||||
sendXYraw(CHIP_L, cornerScan + 8, 0, 0);
|
||||
|
||||
// if (found != -1)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
sendXYraw(CHIP_L, xMapRead, 0, 0);
|
||||
|
||||
|
||||
pinMode(19, INPUT);
|
||||
delayMicroseconds(400);
|
||||
int probeRead = readFloatingOrState(19, -1);
|
||||
|
||||
if (probeRead == high && lastFound != SUPPLY_3V3)
|
||||
{
|
||||
found = SUPPLY_3V3;
|
||||
lastFound = found;
|
||||
}
|
||||
else if (probeRead == low && lastFound != GND)
|
||||
{
|
||||
found = GND;
|
||||
lastFound = found;
|
||||
}
|
||||
return found;
|
||||
|
||||
//return 0;
|
||||
}
|
||||
|
||||
void sendPath(int i, int setOrClear)
|
||||
{
|
||||
|
||||
@ -241,7 +483,6 @@ void sendPath(int i, int setOrClear)
|
||||
if (debugNTCC)
|
||||
Serial.print("!");
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,20 @@ extern int brightnessC2;
|
||||
extern int hueShiftC2;
|
||||
extern int lightUpNetCore2;
|
||||
|
||||
enum measuredState
|
||||
{
|
||||
floating = 0,
|
||||
high = 1,
|
||||
low = 2,
|
||||
probe = 3
|
||||
};
|
||||
|
||||
|
||||
void initCH446Q(void);
|
||||
|
||||
void sendXYraw(int chip, int x, int y, int setorclear);
|
||||
int readFloatingOrState (int pin = 0, int row = 0);
|
||||
void startProbe (void);
|
||||
int scanRows(int pin = 0, bool clearLastFound = false);
|
||||
void sendAllPaths(void); // should we sort them by chip? for now, no
|
||||
void resetArduino (void);
|
||||
void sendPath(int path, int setOrClear = 1);
|
||||
|
@ -33,7 +33,7 @@ bool debugLEDs = EEPROM.read(DEBUG_LEDSADDRESS);
|
||||
bool debugLEDs = 1;
|
||||
#endif
|
||||
|
||||
uint32_t rawSpecialNetColors[8] =
|
||||
uint32_t rawSpecialNetColors[8] = //dim
|
||||
{0x000000,
|
||||
0x001C04,
|
||||
0x1C0702,
|
||||
@ -917,6 +917,47 @@ uint32_t scaleDownBrightness(uint32_t hexColor, int scaleFactor, int maxBrightne
|
||||
|
||||
}
|
||||
|
||||
uint32_t scaleUpBrightness(uint32_t hexColor, int scaleFactor, int minBrightness)
|
||||
{
|
||||
int minR = minBrightness;
|
||||
int minG = minBrightness;
|
||||
int minB = minBrightness;
|
||||
|
||||
int r = (hexColor >> 16) & 0xFF;
|
||||
int g = (hexColor >> 8) & 0xFF;
|
||||
int b = hexColor & 0xFF;
|
||||
|
||||
int scaledBrightness = hexColor;
|
||||
|
||||
if (r < minR && g < minG && b < minB)
|
||||
{
|
||||
scaledBrightness = 0;
|
||||
r = r * scaleFactor;
|
||||
g = g * scaleFactor;
|
||||
b = b * scaleFactor;
|
||||
|
||||
if (r > 254)
|
||||
{
|
||||
r = 254;
|
||||
}
|
||||
if (g > 254)
|
||||
{
|
||||
g = 254;
|
||||
}
|
||||
if (b > 254)
|
||||
{
|
||||
b = 254;
|
||||
}
|
||||
|
||||
scaledBrightness = scaledBrightness | (r << 16);
|
||||
scaledBrightness = scaledBrightness | (g << 8);
|
||||
scaledBrightness = scaledBrightness | b;
|
||||
}
|
||||
|
||||
|
||||
return scaledBrightness;
|
||||
|
||||
}
|
||||
|
||||
struct rgbColor pcbColorCorrect(rgbColor colorToShift)
|
||||
{
|
||||
@ -1239,7 +1280,7 @@ void lightUpRail(int logo, int rail, int onOff, int brightness2, int switchPosit
|
||||
void showNets(void)
|
||||
{
|
||||
|
||||
for (int i = 0; i < numberOfNets; i++)
|
||||
for (int i = 0; i <= numberOfNets; i++)
|
||||
{
|
||||
//Serial.print(i);
|
||||
|
||||
|
@ -127,7 +127,7 @@ hsvColor RgbToHsv(rgbColor rgb);
|
||||
rgbColor HsvToRgb(hsvColor hsv);
|
||||
void applyBrightness (int brightness);
|
||||
rgbColor unpackRgb(uint32_t color);
|
||||
|
||||
uint32_t scaleUpBrightness(uint32_t hexColor, int scaleFactor = 8, int minBrightness = 0x45);
|
||||
uint32_t scaleDownBrightness(uint32_t hexColor, int scaleFactor = 5, int maxBrightness = 0x45);
|
||||
void turnOffSkippedNodes();
|
||||
|
||||
|
@ -136,6 +136,7 @@ void machineNetlistToNetstruct(void)
|
||||
// char *numbers[MAX_NETS] = {0};
|
||||
// char *colors[MAX_NETS] = {0};
|
||||
// char *nodes[MAX_NETS] = {0};
|
||||
int netIndex = 0;
|
||||
|
||||
if (debugMM)
|
||||
{
|
||||
@ -153,15 +154,16 @@ void machineNetlistToNetstruct(void)
|
||||
|
||||
for (int i = 0; i < MAX_NETS; i++)
|
||||
{
|
||||
int netIndex = 0;
|
||||
|
||||
int nodesIndex = 0;
|
||||
|
||||
if (machineModeJson[i].isNull() == true)
|
||||
{
|
||||
break;
|
||||
continue;
|
||||
//break;
|
||||
}
|
||||
|
||||
netIndex = machineModeJson[i]["index"];
|
||||
netIndex ++;
|
||||
//netIndex = machineModeJson[i]["index"];
|
||||
|
||||
strcpy(names[i], machineModeJson[i]["name"]);
|
||||
|
||||
@ -294,7 +296,8 @@ void populateBridgesFromNodes(void)
|
||||
{
|
||||
if (net[i].nodes[j] == -1 || net[i].nodes[j] == 0)
|
||||
{
|
||||
break;
|
||||
continue;
|
||||
//break;
|
||||
}
|
||||
|
||||
if (net[i].nodes[j] == net[i].nodes[0])
|
||||
@ -727,7 +730,8 @@ void listNetsMachine(void)
|
||||
if (n->number == 0 || n->nodes[0] == -1)
|
||||
{
|
||||
// net not allocated yet
|
||||
break;
|
||||
continue; //this allows us to delete nets and have jumperlab work
|
||||
//break;
|
||||
}
|
||||
|
||||
Serial.print("::net[");
|
||||
@ -758,7 +762,10 @@ void listNetsMachine(void)
|
||||
Serial.print(n->specialFunction ? "true," : "false,");
|
||||
|
||||
// COLOR
|
||||
rgbColor color = unpackRgb(n->rawColor);
|
||||
|
||||
|
||||
|
||||
rgbColor color = unpackRgb(scaleUpBrightness(n->rawColor));
|
||||
char buf[8];
|
||||
snprintf(buf, 8, "%.2x%.2x%.2x,", color.r, color.g, color.b);
|
||||
Serial.print(buf);
|
||||
|
@ -169,6 +169,12 @@ void initINA219(void)
|
||||
Serial.println(INA1.setBusVoltageRange(16));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void dacSine(int resolution)
|
||||
{
|
||||
uint16_t i;
|
||||
|
@ -25,6 +25,8 @@ void initINA219(void);
|
||||
void initADC(void);
|
||||
|
||||
void initDAC(void);
|
||||
|
||||
|
||||
void dacSine (int resolution = 9);
|
||||
|
||||
void dacTriangle (void);
|
||||
|
@ -135,6 +135,8 @@ int serSource = 0;
|
||||
int readInNodesArduino = 0;
|
||||
int baudRate = 115200;
|
||||
|
||||
const char firmwareVersion[] = "1.2.0"; //// remember to update this
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
@ -160,6 +162,7 @@ menu:
|
||||
Serial.print("\tl = LED brightness / test\n\r");
|
||||
Serial.print("\td = toggle debug flags\n\r");
|
||||
Serial.print("\tr = reset Arduino\n\r");
|
||||
Serial.print("\tp = probe connections\n\r");
|
||||
Serial.print("\n\n\r");
|
||||
|
||||
dontshowmenu:
|
||||
@ -194,6 +197,12 @@ dontshowmenu:
|
||||
skipinput:
|
||||
switch (input)
|
||||
{
|
||||
case '?':
|
||||
{
|
||||
Serial.print("Jumperless firmware version: ");
|
||||
Serial.println(firmwareVersion);
|
||||
break;
|
||||
}
|
||||
case 'v':
|
||||
|
||||
if (showReadings >= 3 || (inaConnected == 0 && showReadings >= 1))
|
||||
@ -224,6 +233,46 @@ skipinput:
|
||||
goto dontshowmenu;
|
||||
// break;
|
||||
}
|
||||
case 'p':
|
||||
{
|
||||
//clearLEDs();
|
||||
int lastRow[10];
|
||||
int pokedNumber = 0;
|
||||
Serial.print("Press any key to exit\n\n\r");
|
||||
while(Serial.available() == 0){
|
||||
int row = scanRows(0);
|
||||
|
||||
if (row != -1 )
|
||||
{
|
||||
|
||||
delay(10);
|
||||
lastRow[pokedNumber] = row;
|
||||
pokedNumber++;
|
||||
|
||||
printNodeOrName(row);
|
||||
Serial.print("\r\t");
|
||||
if (pokedNumber >= 2)
|
||||
{
|
||||
Serial.print("\r \r");
|
||||
printNodeOrName(lastRow[0]);
|
||||
Serial.print(" - ");
|
||||
printNodeOrName(lastRow[1]);
|
||||
Serial.print("\n\r");
|
||||
scanRows(0, true);
|
||||
delay(18);
|
||||
|
||||
pokedNumber = 0;
|
||||
}
|
||||
}
|
||||
delayMicroseconds(1000);
|
||||
|
||||
}
|
||||
pinMode(19, INPUT);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
case 'n':
|
||||
|
||||
@ -325,46 +374,46 @@ skipinput:
|
||||
goto menu;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
// case 'p':
|
||||
|
||||
// case '{': //I had this so you could paste a wokwi diagram from the main menu but it kinda makes a mess of other things
|
||||
// // case '{': //I had this so you could paste a wokwi diagram from the main menu but it kinda makes a mess of other things
|
||||
|
||||
digitalWrite(RESETPIN, HIGH);
|
||||
delay(1);
|
||||
#ifdef FSSTUFF
|
||||
clearNodeFile();
|
||||
#endif
|
||||
digitalWrite(RESETPIN, LOW);
|
||||
clearAllNTCC();
|
||||
clearLEDs();
|
||||
// digitalWrite(RESETPIN, HIGH);
|
||||
// delay(1);
|
||||
// #ifdef FSSTUFF
|
||||
// clearNodeFile();
|
||||
// #endif
|
||||
// digitalWrite(RESETPIN, LOW);
|
||||
// clearAllNTCC();
|
||||
// clearLEDs();
|
||||
|
||||
timer = millis();
|
||||
// timer = millis();
|
||||
|
||||
#ifdef FSSTUFF
|
||||
// #ifdef FSSTUFF
|
||||
|
||||
parseWokwiFileToNodeFile();
|
||||
// parseWokwiFileToNodeFile();
|
||||
|
||||
openNodeFile();
|
||||
getNodesToConnect();
|
||||
#endif
|
||||
Serial.println("\n\n\rnetlist\n\n\r");
|
||||
// openNodeFile();
|
||||
// getNodesToConnect();
|
||||
// #endif
|
||||
// Serial.println("\n\n\rnetlist\n\n\r");
|
||||
|
||||
bridgesToPaths();
|
||||
assignNetColors();
|
||||
// bridgesToPaths();
|
||||
// assignNetColors();
|
||||
|
||||
#ifdef PIOSTUFF
|
||||
// #ifdef PIOSTUFF
|
||||
|
||||
sendAllPaths();
|
||||
#endif
|
||||
// sendAllPaths();
|
||||
// #endif
|
||||
|
||||
if (debugNMtime)
|
||||
{
|
||||
Serial.print("\n\n\r");
|
||||
Serial.print("took ");
|
||||
Serial.print(millis() - timer);
|
||||
Serial.print("ms");
|
||||
}
|
||||
break;
|
||||
// if (debugNMtime)
|
||||
// {
|
||||
// Serial.print("\n\n\r");
|
||||
// Serial.print("took ");
|
||||
// Serial.print(millis() - timer);
|
||||
// Serial.print("ms");
|
||||
// }
|
||||
// break;
|
||||
|
||||
case 't':
|
||||
#ifdef FSSTUFF
|
||||
@ -693,19 +742,24 @@ if (millis() - lastTimeCommandRecieved > 100)
|
||||
case setsupplyswitch:
|
||||
|
||||
supplySwitchPosition = setSupplySwitch();
|
||||
//printSupplySwitch(supplySwitchPosition);
|
||||
machineModeRespond(sequenceNumber, true);
|
||||
|
||||
showLEDsCore2 = 1;
|
||||
break;
|
||||
|
||||
case getsupplyswitch:
|
||||
if (millis() - lastTimeNetlistLoaded > 300)
|
||||
{
|
||||
//if (millis() - lastTimeNetlistLoaded > 100)
|
||||
//{
|
||||
|
||||
printSupplySwitch(supplySwitchPosition);
|
||||
}else {
|
||||
//machineModeRespond(sequenceNumber, true);
|
||||
|
||||
// }else {
|
||||
//Serial.print ("\n\rtoo soon bro\n\r");
|
||||
machineModeRespond(0, true);
|
||||
return;
|
||||
}
|
||||
// machineModeRespond(0, true);
|
||||
// return;
|
||||
// }
|
||||
break;
|
||||
|
||||
case getchipstatus:
|
||||
|
Loading…
Reference in New Issue
Block a user