[ZPT] CVS: Packages/TAL - TALDefs.py:1.16
guido@digicool.com
guido@digicool.com
Mon, 9 Apr 2001 22:07:29 -0400 (EDT)
Update of /cvs-repository/Packages/TAL
In directory korak:/tmp/cvs-serv22125
Modified Files:
TALDefs.py
Log Message:
Bump version to 1.1.
Added three new inquiries for TALcode programs: isCurrentVersion(),
getProgramVersion(), and getProgramMode().
--- Updated File TALDefs.py in package Packages/TAL --
--- TALDefs.py 2001/04/07 19:25:03 1.15
+++ TALDefs.py 2001/04/10 02:07:28 1.16
@@ -86,7 +86,7 @@
Common definitions used by TAL and METAL compilation an transformation.
"""
-TAL_VERSION = "1.0.1"
+TAL_VERSION = "1.1"
XML_NS = "http://www.w3.org/XML/1998/namespace" # URI for XML namespace
XMLNS_NS = "http://www.w3.org/2000/xmlns/" # URI for XML NS declarations
@@ -189,6 +189,27 @@
if len(parts) > 1 and not string.strip(parts[-1]):
del parts[-1] # It ended in a semicolon
return parts
+
+def isCurrentVersion(program):
+ version = getProgramVersion(program)
+ return version == TAL_VERSION
+
+def getProgramMode(program):
+ version = getProgramVersion(program)
+ if (version == TAL_VERSION and isinstance(program[1], type(())) and
+ len(program[1]) == 2):
+ opcode, mode = program[1]
+ if opcode == "mode":
+ return mode
+ return None
+
+def getProgramVersion(program):
+ if (isinstance(program, type([])) and len(program) >= 2 and
+ isinstance(program[0], type(())) and len(program[0]) == 2):
+ opcode, version = program[0]
+ if opcode == "version":
+ return version
+ return None
import cgi
_cgi = cgi