• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(825)  |  Call(812)  |  Derive(0)  |  Import(13)
join(list [,sep]) -> string

Return a string composed of the words in list, with
intervening occurrences of sep.  The default separator is a
single space.

(joinfields and join are synonymous)

        def join(words, sep = ' '):
    """join(list [,sep]) -> string

    Return a string composed of the words in list, with
    intervening occurrences of sep.  The default separator is a
    single space.

    (joinfields and join are synonymous)

    """
    return sep.join(words)
        


src/g/r/grailbrowser-HEAD/src/GrailHTMLParser.py   grailbrowser(Download)
            title = string.join(string.split(attrs['title'] or ''))
            if title:
                url = self.context.get_baseurl(
                    string.joinfields(string.split(href), ''))
                old_title, when = self.app.global_history.lookup_url(url)
                if not old_title:
                    # Only do this if there's not already a title in the
    def list_handle_src(self, attrs):
        if not self.app.prefs.GetBoolean("browser", "load-images"):
            return
        src = string.joinfields(string.split(attrs['src']), '')
        image = self.context.get_async_image(src, self.reload)
        if image: attrs['type'] = image
 

src/g/r/grailbrowser-HEAD/src/sgml/HTMLParser.py   grailbrowser(Download)
                s = string.strip(attrs[k])
                # we really don't want to do this if this is a data: URL
                if len(s) < 5 or string.lower(s[:5]) != "data:":
                    s = string.joinfields(string.split(s), '')
                attrs[k] = s
        method(self, attrs)
        if attrs.has_key('id'):
        fields[0] = 'pi'
        width = len(fields)
        while width >= 2:
            procname = string.joinfields(fields[:width], '_')
            if hasattr(self, procname):
                getattr(self, procname)(fields[width:])
                return

src/e/c/echarts-HEAD/trunk/EChartsEclipsePlugin/org.echarts.edt.sip.core/dk/lib/AbstractMachine.py   echarts(Download)
def toConfigurationImage(config):
	pathImages = []
	for path in config:
		pathImages = pathImages + [ toConfigurationPathImage(path) ]
	return "[" + string.joinfields(pathImages, ", ") + "]"
 
def toConfigurationPathImage(configPath):
	return string.joinfields(map(toConfigurationNodeImage, configPath), ".")	
	def linkMachine(self):
		compilationUnit = self.getCompilationUnitForFile(self.absoluteMachineFilePath)
		qualifiedMachineName = string.joinfields(getPackage(compilationUnit) + \
												 [ getMachineName(compilationUnit) ], ".")
		# create None entry in dependency dict to indicate that
		# machine is being linked
		AbstractMachine.dependencyDict[self.absoluteMachineFilePath] = None
	def updateImportEntries(self, echartsPath, qualifiedMachineName):
		if qualifiedMachineName[-1] == '*':
			# refers to any machine in specified package
			partialDirPath = string.joinfields(qualifiedMachineName[:-1], os.sep)
			dirPath = string.joinfields([ echartsPath ] +  [ partialDirPath ], os.sep)
			if os.path.isdir(dirPath):
				for filename in os.listdir(dirPath):
					if filename[-4:] == ".ech":
						self.updateImportEntry(qualifiedMachineName[:-1] + [ filename[:-4] ],
											   dirPath + os.sep + filename)
		else:
			# refers to particular machine in specified package
			filePath = echartsPath + os.sep + \
					   string.joinfields(qualifiedMachineName, os.sep) + ".ech"
	def updateImportEntry(self, qualifiedMachineName, filePath):
		dottedMachineName = string.joinfields(qualifiedMachineName, ".")
		absoluteFilePath = os.path.abspath(filePath)
		try:
			machineDict = self.importDict[qualifiedMachineName[-1]]
			# entry exists for this machine name try to add file path
			# to dict for the machine
	def getMachineFilePath(self, submachineName):
		dottedSubmachineName = string.joinfields(submachineName, ".")
		# looking for matching name in import dict keys
		try:
			machineDict = self.importDict[submachineName[-1]]
		except KeyError:
			raise AbstractMachineException, "Unable to locate ECharts file defining machine: " + \
				# name that it declares itself to have
				fileMachineName = getMachineName(compilationUnit)
				filePackage = getPackage(compilationUnit)
				fileDottedMachineName = string.joinfields(filePackage + [ fileMachineName ], ".")
				if fileDottedMachineName == nameKey:
					# they're the same so delete any other
					# filepath entries from the dict
				if string.split(name, ".")[-1] == dottedSubmachineName:
					matchingKeys = matchingKeys + [ name ]
		else:
			dottedSubmachineName = string.joinfields(submachineName, ".")
			# look for a exact match against complete name
			if dottedSubmachineName in dict.keys():
				matchingKeys = [ dottedSubmachineName ]
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				for substate in getStates(submachine):
					self.checkSubmachineModifiers(substate,
												  string.joinfields([ stateName,
																	  getStateName(substate) ], "."))
			elif isAndMachine(submachine) and \
				 getSubmachineType(submachine) == EXTERNAL_SUBMACHINE:
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: inner submachines cannot define constructors: %s" % \
						  (self.absoluteMachineFilePath, line, column, 
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
				else:
					# recursively check this submachine's states
					self.checkSubmachineConstructors(submachine, ancestorStates + [ getStateName(state) ])
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: duplicate access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   mod)
			if "abstract" in mods:
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, \
					  "%s:%s:%s: semantic error: \"abstract\" access modifier not permitted for state %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   reduce(lambda y, z: "%s, " % y + z, mods))
			elif len(mods) > 1: 
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, \
					  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
	def checkTransitionModifiers(self, machine, ancestorStates):
		transitions = getTransitions(machine)
		for index in range(len(transitions)):
			if "constport" in getTransitionModifiers(transitions[index]) and isMessagelessTransition(transitions[index]):
				qualifiedStateName = string.joinfields(ancestorStates, ".")
				(line, column) = getTransitionLineColumn(transitions[index])
				raise AbstractMachineException, \
	def checkStateModifiers(self, machine, machineLine, machineColumn, ancestorStates):
		initialState = None
		for state in getStates(machine):
			submachine = getSubmachine(state)
			stateMods = getStateModifiers(state)
			qualifiedStateName = string.joinfields(ancestorStates + [ getStateName(state) ], ".")
			if "initial" in stateMods:
						  "%s:%s:%s: semantic error: duplicate initial state modifier for %s" % \
						  (self.absoluteMachineFilePath, line, column, qualifiedStateName)
				if initialState != None:
					qualifiedInitialStateName = string.joinfields(ancestorStates + [ initialState ], ".")
					(line, column) = getStateLineColumn(state)
					raise AbstractMachineException, \
						  "%s:%s:%s semantic error: more than one initial state declared: %s, %s" % \
				self.checkStateModifiers(submachine, line, column, ancestorStates + [ getStateName(state) ])
		if isOrMachine(machine) and initialState == None:
			sys.stderr.write("%s:%s:%s: semantic warning: no initial state defined for (sub)machine %s\n" % \
							 (self.absoluteMachineFilePath, machineLine, machineColumn, string.joinfields(ancestorStates, ".")))
 
	# Ensure no inconsistent or duplicate modifiers for a machine.
	def checkMachineAccessModifiers(self, machine):
									package + [ machineName ]):
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal access of machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, string.joinfields(accessedMachine, "."),
						   getStateName(state), string.joinfields(ancestorStates, "."))
				if "abstract" in getMachineAccessModifiers(getMachine(extCompilationUnit)):
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal to reference abstract machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, getMachineName(extCompilationUnit),
						   getStateName(state), string.joinfields(ancestorStates, "."))
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, "%s:%s:%s: semantic error: duplicate states %s declared in (sub)machine %s" % \
					  (self.absoluteMachineFilePath, line, column, getStateName(state),
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
			submachine = getSubmachine(state)
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				self.checkStates(submachine, ancestorStates + [ getStateName(state) ])
					  "%s:%s:%s: semantic error: in transition %s state configuration segment %s of state configuration %s of (sub)machine %s: %s" % \
					  (self.absoluteMachineFilePath, line, column, srctgt, toConfigurationPathImage(path),
					   toConfigurationImage(paths), 
					   string.joinfields(ancestorStates, "."), message)
		return pcfg
 
	# Returns a partial populated tree config for the given path,
					index = map(getStateName, states).index(getConfigurationNodeName(path[0]))
				except ValueError:
					raise AbstractMachineException, "State %s does not exist in machine %s" % \
						  (toConfigurationNodeImage(path[0]), string.joinfields(accessedMachine, "."))
				# check if access to referenced state is permitted
				if not isAccessible(getStateAccessModifiers(states[index]), accessedMachine, accessingMachine):
					raise AbstractMachineException, "Illegal access of state %s declared in machine %s" % \
						  (getStateName(states[index]), string.joinfields(accessedMachine, "."))

src/e/c/echarts-HEAD/trunk/EChartsEclipsePlugin/org.echarts.edt.core/dk/lib/AbstractMachine.py   echarts(Download)
def toConfigurationImage(config):
	pathImages = []
	for path in config:
		pathImages = pathImages + [ toConfigurationPathImage(path) ]
	return "[" + string.joinfields(pathImages, ", ") + "]"
 
def toConfigurationPathImage(configPath):
	return string.joinfields(map(toConfigurationNodeImage, configPath), ".")	
	def linkMachine(self):
		compilationUnit = self.getCompilationUnitForFile(self.absoluteMachineFilePath)
		qualifiedMachineName = string.joinfields(getPackage(compilationUnit) + \
												 [ getMachineName(compilationUnit) ], ".")
		# create None entry in dependency dict to indicate that
		# machine is being linked
		AbstractMachine.dependencyDict[self.absoluteMachineFilePath] = None
	def updateImportEntries(self, echartsPath, qualifiedMachineName):
		if qualifiedMachineName[-1] == '*':
			# refers to any machine in specified package
			partialDirPath = string.joinfields(qualifiedMachineName[:-1], os.sep)
			dirPath = string.joinfields([ echartsPath ] +  [ partialDirPath ], os.sep)
			if os.path.isdir(dirPath):
				for filename in os.listdir(dirPath):
					if filename[-4:] == ".ech":
						self.updateImportEntry(qualifiedMachineName[:-1] + [ filename[:-4] ],
											   dirPath + os.sep + filename)
		else:
			# refers to particular machine in specified package
			filePath = echartsPath + os.sep + \
					   string.joinfields(qualifiedMachineName, os.sep) + ".ech"
	def updateImportEntry(self, qualifiedMachineName, filePath):
		dottedMachineName = string.joinfields(qualifiedMachineName, ".")
		absoluteFilePath = os.path.abspath(filePath)
		try:
			machineDict = self.importDict[qualifiedMachineName[-1]]
			# entry exists for this machine name try to add file path
			# to dict for the machine
	def getMachineFilePath(self, submachineName):
		dottedSubmachineName = string.joinfields(submachineName, ".")
		# looking for matching name in import dict keys
		try:
			machineDict = self.importDict[submachineName[-1]]
		except KeyError:
			raise AbstractMachineException, "Unable to locate ECharts file defining machine: " + \
				# name that it declares itself to have
				fileMachineName = getMachineName(compilationUnit)
				filePackage = getPackage(compilationUnit)
				fileDottedMachineName = string.joinfields(filePackage + [ fileMachineName ], ".")
				if fileDottedMachineName == nameKey:
					# they're the same so delete any other
					# filepath entries from the dict
				if string.split(name, ".")[-1] == dottedSubmachineName:
					matchingKeys = matchingKeys + [ name ]
		else:
			dottedSubmachineName = string.joinfields(submachineName, ".")
			# look for a exact match against complete name
			if dottedSubmachineName in dict.keys():
				matchingKeys = [ dottedSubmachineName ]
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				for substate in getStates(submachine):
					self.checkSubmachineModifiers(substate,
												  string.joinfields([ stateName,
																	  getStateName(substate) ], "."))
			elif isAndMachine(submachine) and \
				 getSubmachineType(submachine) == EXTERNAL_SUBMACHINE:
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: inner submachines cannot define constructors: %s" % \
						  (self.absoluteMachineFilePath, line, column, 
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
				else:
					# recursively check this submachine's states
					self.checkSubmachineConstructors(submachine, ancestorStates + [ getStateName(state) ])
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: duplicate access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   mod)
			if "abstract" in mods:
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, \
					  "%s:%s:%s: semantic error: \"abstract\" access modifier not permitted for state %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   reduce(lambda y, z: "%s, " % y + z, mods))
			elif len(mods) > 1: 
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, \
					  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
	def checkTransitionModifiers(self, machine, ancestorStates):
		transitions = getTransitions(machine)
		for index in range(len(transitions)):
			if "constport" in getTransitionModifiers(transitions[index]) and isMessagelessTransition(transitions[index]):
				qualifiedStateName = string.joinfields(ancestorStates, ".")
				(line, column) = getTransitionLineColumn(transitions[index])
				raise AbstractMachineException, \
	def checkStateModifiers(self, machine, machineLine, machineColumn, ancestorStates):
		initialState = None
		for state in getStates(machine):
			submachine = getSubmachine(state)
			stateMods = getStateModifiers(state)
			qualifiedStateName = string.joinfields(ancestorStates + [ getStateName(state) ], ".")
			if "initial" in stateMods:
						  "%s:%s:%s: semantic error: duplicate initial state modifier for %s" % \
						  (self.absoluteMachineFilePath, line, column, qualifiedStateName)
				if initialState != None:
					qualifiedInitialStateName = string.joinfields(ancestorStates + [ initialState ], ".")
					(line, column) = getStateLineColumn(state)
					raise AbstractMachineException, \
						  "%s:%s:%s semantic error: more than one initial state declared: %s, %s" % \
				self.checkStateModifiers(submachine, line, column, ancestorStates + [ getStateName(state) ])
		if isOrMachine(machine) and initialState == None:
			sys.stderr.write("%s:%s:%s: semantic warning: no initial state defined for (sub)machine %s\n" % \
							 (self.absoluteMachineFilePath, machineLine, machineColumn, string.joinfields(ancestorStates, ".")))
 
	# Ensure no inconsistent or duplicate modifiers for a machine.
	def checkMachineAccessModifiers(self, machine):
									package + [ machineName ]):
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal access of machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, string.joinfields(accessedMachine, "."),
						   getStateName(state), string.joinfields(ancestorStates, "."))
				if "abstract" in getMachineAccessModifiers(getMachine(extCompilationUnit)):
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal to reference abstract machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, getMachineName(extCompilationUnit),
						   getStateName(state), string.joinfields(ancestorStates, "."))
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, "%s:%s:%s: semantic error: duplicate states %s declared in (sub)machine %s" % \
					  (self.absoluteMachineFilePath, line, column, getStateName(state),
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
			submachine = getSubmachine(state)
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				self.checkStates(submachine, ancestorStates + [ getStateName(state) ])
					  "%s:%s:%s: semantic error: in transition %s state configuration segment %s of state configuration %s of (sub)machine %s: %s" % \
					  (self.absoluteMachineFilePath, line, column, srctgt, toConfigurationPathImage(path),
					   toConfigurationImage(paths), 
					   string.joinfields(ancestorStates, "."), message)
		return pcfg
 
	# Returns a partial populated tree config for the given path,
					index = map(getStateName, states).index(getConfigurationNodeName(path[0]))
				except ValueError:
					raise AbstractMachineException, "State %s does not exist in machine %s" % \
						  (toConfigurationNodeImage(path[0]), string.joinfields(accessedMachine, "."))
				# check if access to referenced state is permitted
				if not isAccessible(getStateAccessModifiers(states[index]), accessedMachine, accessingMachine):
					raise AbstractMachineException, "Illegal access of state %s declared in machine %s" % \
						  (getStateName(states[index]), string.joinfields(accessedMachine, "."))

src/e/c/echarts-HEAD/trunk/EChartsCPL/translator/lib/AbstractMachine.py   echarts(Download)
def toConfigurationImage(config):
	pathImages = []
	for path in config:
		pathImages = pathImages + [ toConfigurationPathImage(path) ]
	return "[" + string.joinfields(pathImages, ", ") + "]"
 
def toConfigurationPathImage(configPath):
	return string.joinfields(map(toConfigurationNodeImage, configPath), ".")	
	def linkMachine(self):
		compilationUnit = self.getCompilationUnitForFile(self.absoluteMachineFilePath)
		qualifiedMachineName = string.joinfields(getPackage(compilationUnit) + \
												 [ getMachineName(compilationUnit) ], ".")
		# create None entry in dependency dict to indicate that
		# machine is being linked
		AbstractMachine.dependencyDict[self.absoluteMachineFilePath] = None
	def updateImportEntries(self, echartsPath, qualifiedMachineName):
		if qualifiedMachineName[-1] == '*':
			# refers to any machine in specified package
			partialDirPath = string.joinfields(qualifiedMachineName[:-1], os.sep)
			dirPath = string.joinfields([ echartsPath ] +  [ partialDirPath ], os.sep)
			if os.path.isdir(dirPath):
				for filename in os.listdir(dirPath):
					if filename[-4:] == ".ech":
						self.updateImportEntry(qualifiedMachineName[:-1] + [ filename[:-4] ],
											   dirPath + os.sep + filename)
		else:
			# refers to particular machine in specified package
			filePath = echartsPath + os.sep + \
					   string.joinfields(qualifiedMachineName, os.sep) + ".ech"
	def updateImportEntry(self, qualifiedMachineName, filePath):
		dottedMachineName = string.joinfields(qualifiedMachineName, ".")
		absoluteFilePath = os.path.abspath(filePath)
		try:
			machineDict = self.importDict[qualifiedMachineName[-1]]
			# entry exists for this machine name try to add file path
			# to dict for the machine
	def getMachineFilePath(self, submachineName):
		dottedSubmachineName = string.joinfields(submachineName, ".")
		# looking for matching name in import dict keys
		try:
			machineDict = self.importDict[submachineName[-1]]
		except KeyError:
			raise AbstractMachineException( "unable to locate ECharts file defining machine: " + \
				# name that it declares itself to have
				fileMachineName = getMachineName(compilationUnit)
				filePackage = getPackage(compilationUnit)
				fileDottedMachineName = string.joinfields(filePackage + [ fileMachineName ], ".")
				if fileDottedMachineName == nameKey:
					# they're the same so delete any other
					# filepath entries from the dict
				if string.split(name, ".")[-1] == dottedSubmachineName:
					matchingKeys = matchingKeys + [ name ]
		else:
			dottedSubmachineName = string.joinfields(submachineName, ".")
			# look for a exact match against complete name
			if dottedSubmachineName in dict.keys():
				matchingKeys = [ dottedSubmachineName ]
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				for substate in getStates(submachine):
					self.checkSubmachineModifiers(substate,
												  string.joinfields([ stateName,
																	  getStateName(substate) ], "."))
			elif isAndMachine(submachine) and \
				 getSubmachineType(submachine) == EXTERNAL_SUBMACHINE:
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: inner submachines cannot define constructors: %s" % \
						  (self.absoluteMachineFilePath, line, column, 
						   string.joinfields(ancestorStates + [ getStateName(state) ], ".")) )
				else:
					# recursively check this submachine's states
					self.checkSubmachineConstructors(submachine, ancestorStates + [ getStateName(state) ])
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: duplicate access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   mod) )
			if "abstract" in mods:
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException(
					  "%s:%s:%s: semantic error: \"abstract\" access modifier not permitted for state %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], ".")) )
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   reduce(lambda y, z: "%s, " % y + z, mods)) )
			elif len(mods) > 1: 
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException(
					  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
	def checkTransitionModifiers(self, machine, ancestorStates):
		transitions = getTransitions(machine)
		for index in range(len(transitions)):
			if "constport" in getTransitionModifiers(transitions[index]) and isMessagelessTransition(transitions[index]):
				qualifiedStateName = string.joinfields(ancestorStates, ".")
				(line, column) = getTransitionLineColumn(transitions[index])
				raise AbstractMachineException(
	def checkStateModifiers(self, machine, machineLine, machineColumn, ancestorStates):
		initialState = None
		for state in getStates(machine):
			submachine = getSubmachine(state)
			stateMods = getStateModifiers(state)
			qualifiedStateName = string.joinfields(ancestorStates + [ getStateName(state) ], ".")
			if "initial" in stateMods:
						  "%s:%s:%s: semantic error: duplicate initial state modifier for %s" % \
						  (self.absoluteMachineFilePath, line, column, qualifiedStateName) )
				if initialState != None:
					qualifiedInitialStateName = string.joinfields(ancestorStates + [ initialState ], ".")
					(line, column) = getStateLineColumn(state)
					raise AbstractMachineException(
						  "%s:%s:%s semantic error: more than one initial state declared: %s, %s" % \
				self.checkStateModifiers(submachine, line, column, ancestorStates + [ getStateName(state) ])
		if isOrMachine(machine) and initialState == None:
			sys.stderr.write("%s:%s:%s: semantic warning: no initial state defined for (sub)machine %s\n" % \
							 (self.absoluteMachineFilePath, machineLine, machineColumn, string.joinfields(ancestorStates, ".")))
 
	# Ensure no inconsistent or duplicate modifiers for a machine.
	def checkMachineAccessModifiers(self, machine):
									package + [ machineName ]):
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: illegal access of machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, string.joinfields(accessedMachine, "."),
						   getStateName(state), string.joinfields(ancestorStates, ".")) )
				if "abstract" in getMachineAccessModifiers(getMachine(extCompilationUnit)):
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: illegal to reference abstract machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, getMachineName(extCompilationUnit),
						   getStateName(state), string.joinfields(ancestorStates, ".")) )
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException( "%s:%s:%s: semantic error: duplicate states %s declared in (sub)machine %s" % \
					  (self.absoluteMachineFilePath, line, column, getStateName(state),
					   string.joinfields(ancestorStates + [ getStateName(state) ], ".")) )
			submachine = getSubmachine(state)
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				self.checkStates(submachine, ancestorStates + [ getStateName(state) ])
					  "%s:%s:%s: semantic error: in transition %s state configuration segment %s of state configuration %s of (sub)machine %s: %s" % \
					  (self.absoluteMachineFilePath, line, column, srctgt, toConfigurationPathImage(path),
					   toConfigurationImage(paths), 
					   string.joinfields(ancestorStates, "."), message) )
		return pcfg
 
	# Returns a partial populated tree config for the given path,
					index = map(getStateName, states).index(getConfigurationNodeName(path[0]))
				except ValueError:
					raise AbstractMachineException( "State %s does not exist in machine %s" % \
						  (toConfigurationNodeImage(path[0]), string.joinfields(accessedMachine, ".")) )
				# check if access to referenced state is permitted
				if not isAccessible(getStateAccessModifiers(states[index]), accessedMachine, accessingMachine):
					raise AbstractMachineException( "Illegal access of state %s declared in machine %s" % \
						  (getStateName(states[index]), string.joinfields(accessedMachine, ".")) )
					# can't overwrite a non-variable state
					# reference with basic state reference
					raise AbstractMachineException( "Conflicting access of state %s declared in machine %s" % \
						  (getStateName(states[index]), string.joinfields(accessedMachine, ".")) )
				return pcfg
 
	# Create a dynamic cfg wrapper and then recursively call

src/e/c/echarts-HEAD/EChartsEclipsePlugin/org.echarts.edt.sip.core/dk/lib/AbstractMachine.py   echarts(Download)
def toConfigurationImage(config):
	pathImages = []
	for path in config:
		pathImages = pathImages + [ toConfigurationPathImage(path) ]
	return "[" + string.joinfields(pathImages, ", ") + "]"
 
def toConfigurationPathImage(configPath):
	return string.joinfields(map(toConfigurationNodeImage, configPath), ".")	
	def linkMachine(self):
		compilationUnit = self.getCompilationUnitForFile(self.absoluteMachineFilePath)
		qualifiedMachineName = string.joinfields(getPackage(compilationUnit) + \
												 [ getMachineName(compilationUnit) ], ".")
		# create None entry in dependency dict to indicate that
		# machine is being linked
		AbstractMachine.dependencyDict[self.absoluteMachineFilePath] = None
	def updateImportEntries(self, echartsPath, qualifiedMachineName):
		if qualifiedMachineName[-1] == '*':
			# refers to any machine in specified package
			partialDirPath = string.joinfields(qualifiedMachineName[:-1], os.sep)
			dirPath = string.joinfields([ echartsPath ] +  [ partialDirPath ], os.sep)
			if os.path.isdir(dirPath):
				for filename in os.listdir(dirPath):
					if filename[-4:] == ".ech":
						self.updateImportEntry(qualifiedMachineName[:-1] + [ filename[:-4] ],
											   dirPath + os.sep + filename)
		else:
			# refers to particular machine in specified package
			filePath = echartsPath + os.sep + \
					   string.joinfields(qualifiedMachineName, os.sep) + ".ech"
	def updateImportEntry(self, qualifiedMachineName, filePath):
		dottedMachineName = string.joinfields(qualifiedMachineName, ".")
		absoluteFilePath = os.path.abspath(filePath)
		try:
			machineDict = self.importDict[qualifiedMachineName[-1]]
			# entry exists for this machine name try to add file path
			# to dict for the machine
	def getMachineFilePath(self, submachineName):
		dottedSubmachineName = string.joinfields(submachineName, ".")
		# looking for matching name in import dict keys
		try:
			machineDict = self.importDict[submachineName[-1]]
		except KeyError:
			raise AbstractMachineException, "Unable to locate ECharts file defining machine: " + \
				# name that it declares itself to have
				fileMachineName = getMachineName(compilationUnit)
				filePackage = getPackage(compilationUnit)
				fileDottedMachineName = string.joinfields(filePackage + [ fileMachineName ], ".")
				if fileDottedMachineName == nameKey:
					# they're the same so delete any other
					# filepath entries from the dict
				if string.split(name, ".")[-1] == dottedSubmachineName:
					matchingKeys = matchingKeys + [ name ]
		else:
			dottedSubmachineName = string.joinfields(submachineName, ".")
			# look for a exact match against complete name
			if dottedSubmachineName in dict.keys():
				matchingKeys = [ dottedSubmachineName ]
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				for substate in getStates(submachine):
					self.checkSubmachineModifiers(substate,
												  string.joinfields([ stateName,
																	  getStateName(substate) ], "."))
			elif isAndMachine(submachine) and \
				 getSubmachineType(submachine) == EXTERNAL_SUBMACHINE:
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: inner submachines cannot define constructors: %s" % \
						  (self.absoluteMachineFilePath, line, column, 
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
				else:
					# recursively check this submachine's states
					self.checkSubmachineConstructors(submachine, ancestorStates + [ getStateName(state) ])
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: duplicate access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   mod)
			if "abstract" in mods:
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, \
					  "%s:%s:%s: semantic error: \"abstract\" access modifier not permitted for state %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   reduce(lambda y, z: "%s, " % y + z, mods))
			elif len(mods) > 1: 
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, \
					  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
	def checkTransitionModifiers(self, machine, ancestorStates):
		transitions = getTransitions(machine)
		for index in range(len(transitions)):
			if "constport" in getTransitionModifiers(transitions[index]) and isMessagelessTransition(transitions[index]):
				qualifiedStateName = string.joinfields(ancestorStates, ".")
				(line, column) = getTransitionLineColumn(transitions[index])
				raise AbstractMachineException, \
	def checkStateModifiers(self, machine, machineLine, machineColumn, ancestorStates):
		initialState = None
		for state in getStates(machine):
			submachine = getSubmachine(state)
			stateMods = getStateModifiers(state)
			qualifiedStateName = string.joinfields(ancestorStates + [ getStateName(state) ], ".")
			if "initial" in stateMods:
						  "%s:%s:%s: semantic error: duplicate initial state modifier for %s" % \
						  (self.absoluteMachineFilePath, line, column, qualifiedStateName)
				if initialState != None:
					qualifiedInitialStateName = string.joinfields(ancestorStates + [ initialState ], ".")
					(line, column) = getStateLineColumn(state)
					raise AbstractMachineException, \
						  "%s:%s:%s semantic error: more than one initial state declared: %s, %s" % \
				self.checkStateModifiers(submachine, line, column, ancestorStates + [ getStateName(state) ])
		if isOrMachine(machine) and initialState == None:
			sys.stderr.write("%s:%s:%s: semantic warning: no initial state defined for (sub)machine %s\n" % \
							 (self.absoluteMachineFilePath, machineLine, machineColumn, string.joinfields(ancestorStates, ".")))
 
	# Ensure no inconsistent or duplicate modifiers for a machine.
	def checkMachineAccessModifiers(self, machine):
									package + [ machineName ]):
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal access of machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, string.joinfields(accessedMachine, "."),
						   getStateName(state), string.joinfields(ancestorStates, "."))
				if "abstract" in getMachineAccessModifiers(getMachine(extCompilationUnit)):
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal to reference abstract machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, getMachineName(extCompilationUnit),
						   getStateName(state), string.joinfields(ancestorStates, "."))
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, "%s:%s:%s: semantic error: duplicate states %s declared in (sub)machine %s" % \
					  (self.absoluteMachineFilePath, line, column, getStateName(state),
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
			submachine = getSubmachine(state)
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				self.checkStates(submachine, ancestorStates + [ getStateName(state) ])
					  "%s:%s:%s: semantic error: in transition %s state configuration segment %s of state configuration %s of (sub)machine %s: %s" % \
					  (self.absoluteMachineFilePath, line, column, srctgt, toConfigurationPathImage(path),
					   toConfigurationImage(paths), 
					   string.joinfields(ancestorStates, "."), message)
		return pcfg
 
	# Returns a partial populated tree config for the given path,
					index = map(getStateName, states).index(getConfigurationNodeName(path[0]))
				except ValueError:
					raise AbstractMachineException, "State %s does not exist in machine %s" % \
						  (toConfigurationNodeImage(path[0]), string.joinfields(accessedMachine, "."))
				# check if access to referenced state is permitted
				if not isAccessible(getStateAccessModifiers(states[index]), accessedMachine, accessingMachine):
					raise AbstractMachineException, "Illegal access of state %s declared in machine %s" % \
						  (getStateName(states[index]), string.joinfields(accessedMachine, "."))

src/e/c/echarts-HEAD/EChartsEclipsePlugin/org.echarts.edt.core/dk/lib/AbstractMachine.py   echarts(Download)
def toConfigurationImage(config):
	pathImages = []
	for path in config:
		pathImages = pathImages + [ toConfigurationPathImage(path) ]
	return "[" + string.joinfields(pathImages, ", ") + "]"
 
def toConfigurationPathImage(configPath):
	return string.joinfields(map(toConfigurationNodeImage, configPath), ".")	
	def linkMachine(self):
		compilationUnit = self.getCompilationUnitForFile(self.absoluteMachineFilePath)
		qualifiedMachineName = string.joinfields(getPackage(compilationUnit) + \
												 [ getMachineName(compilationUnit) ], ".")
		# create None entry in dependency dict to indicate that
		# machine is being linked
		AbstractMachine.dependencyDict[self.absoluteMachineFilePath] = None
	def updateImportEntries(self, echartsPath, qualifiedMachineName):
		if qualifiedMachineName[-1] == '*':
			# refers to any machine in specified package
			partialDirPath = string.joinfields(qualifiedMachineName[:-1], os.sep)
			dirPath = string.joinfields([ echartsPath ] +  [ partialDirPath ], os.sep)
			if os.path.isdir(dirPath):
				for filename in os.listdir(dirPath):
					if filename[-4:] == ".ech":
						self.updateImportEntry(qualifiedMachineName[:-1] + [ filename[:-4] ],
											   dirPath + os.sep + filename)
		else:
			# refers to particular machine in specified package
			filePath = echartsPath + os.sep + \
					   string.joinfields(qualifiedMachineName, os.sep) + ".ech"
	def updateImportEntry(self, qualifiedMachineName, filePath):
		dottedMachineName = string.joinfields(qualifiedMachineName, ".")
		absoluteFilePath = os.path.abspath(filePath)
		try:
			machineDict = self.importDict[qualifiedMachineName[-1]]
			# entry exists for this machine name try to add file path
			# to dict for the machine
	def getMachineFilePath(self, submachineName):
		dottedSubmachineName = string.joinfields(submachineName, ".")
		# looking for matching name in import dict keys
		try:
			machineDict = self.importDict[submachineName[-1]]
		except KeyError:
			raise AbstractMachineException, "Unable to locate ECharts file defining machine: " + \
				# name that it declares itself to have
				fileMachineName = getMachineName(compilationUnit)
				filePackage = getPackage(compilationUnit)
				fileDottedMachineName = string.joinfields(filePackage + [ fileMachineName ], ".")
				if fileDottedMachineName == nameKey:
					# they're the same so delete any other
					# filepath entries from the dict
				if string.split(name, ".")[-1] == dottedSubmachineName:
					matchingKeys = matchingKeys + [ name ]
		else:
			dottedSubmachineName = string.joinfields(submachineName, ".")
			# look for a exact match against complete name
			if dottedSubmachineName in dict.keys():
				matchingKeys = [ dottedSubmachineName ]
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				for substate in getStates(submachine):
					self.checkSubmachineModifiers(substate,
												  string.joinfields([ stateName,
																	  getStateName(substate) ], "."))
			elif isAndMachine(submachine) and \
				 getSubmachineType(submachine) == EXTERNAL_SUBMACHINE:
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: inner submachines cannot define constructors: %s" % \
						  (self.absoluteMachineFilePath, line, column, 
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
				else:
					# recursively check this submachine's states
					self.checkSubmachineConstructors(submachine, ancestorStates + [ getStateName(state) ])
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: duplicate access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   mod)
			if "abstract" in mods:
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, \
					  "%s:%s:%s: semantic error: \"abstract\" access modifier not permitted for state %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   reduce(lambda y, z: "%s, " % y + z, mods))
			elif len(mods) > 1: 
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, \
					  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
	def checkTransitionModifiers(self, machine, ancestorStates):
		transitions = getTransitions(machine)
		for index in range(len(transitions)):
			if "constport" in getTransitionModifiers(transitions[index]) and isMessagelessTransition(transitions[index]):
				qualifiedStateName = string.joinfields(ancestorStates, ".")
				(line, column) = getTransitionLineColumn(transitions[index])
				raise AbstractMachineException, \
	def checkStateModifiers(self, machine, machineLine, machineColumn, ancestorStates):
		initialState = None
		for state in getStates(machine):
			submachine = getSubmachine(state)
			stateMods = getStateModifiers(state)
			qualifiedStateName = string.joinfields(ancestorStates + [ getStateName(state) ], ".")
			if "initial" in stateMods:
						  "%s:%s:%s: semantic error: duplicate initial state modifier for %s" % \
						  (self.absoluteMachineFilePath, line, column, qualifiedStateName)
				if initialState != None:
					qualifiedInitialStateName = string.joinfields(ancestorStates + [ initialState ], ".")
					(line, column) = getStateLineColumn(state)
					raise AbstractMachineException, \
						  "%s:%s:%s semantic error: more than one initial state declared: %s, %s" % \
				self.checkStateModifiers(submachine, line, column, ancestorStates + [ getStateName(state) ])
		if isOrMachine(machine) and initialState == None:
			sys.stderr.write("%s:%s:%s: semantic warning: no initial state defined for (sub)machine %s\n" % \
							 (self.absoluteMachineFilePath, machineLine, machineColumn, string.joinfields(ancestorStates, ".")))
 
	# Ensure no inconsistent or duplicate modifiers for a machine.
	def checkMachineAccessModifiers(self, machine):
									package + [ machineName ]):
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal access of machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, string.joinfields(accessedMachine, "."),
						   getStateName(state), string.joinfields(ancestorStates, "."))
				if "abstract" in getMachineAccessModifiers(getMachine(extCompilationUnit)):
					raise AbstractMachineException, \
						  "%s:%s:%s: semantic error: illegal to reference abstract machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, getMachineName(extCompilationUnit),
						   getStateName(state), string.joinfields(ancestorStates, "."))
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException, "%s:%s:%s: semantic error: duplicate states %s declared in (sub)machine %s" % \
					  (self.absoluteMachineFilePath, line, column, getStateName(state),
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."))
			submachine = getSubmachine(state)
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				self.checkStates(submachine, ancestorStates + [ getStateName(state) ])
					  "%s:%s:%s: semantic error: in transition %s state configuration segment %s of state configuration %s of (sub)machine %s: %s" % \
					  (self.absoluteMachineFilePath, line, column, srctgt, toConfigurationPathImage(path),
					   toConfigurationImage(paths), 
					   string.joinfields(ancestorStates, "."), message)
		return pcfg
 
	# Returns a partial populated tree config for the given path,
					index = map(getStateName, states).index(getConfigurationNodeName(path[0]))
				except ValueError:
					raise AbstractMachineException, "State %s does not exist in machine %s" % \
						  (toConfigurationNodeImage(path[0]), string.joinfields(accessedMachine, "."))
				# check if access to referenced state is permitted
				if not isAccessible(getStateAccessModifiers(states[index]), accessedMachine, accessingMachine):
					raise AbstractMachineException, "Illegal access of state %s declared in machine %s" % \
						  (getStateName(states[index]), string.joinfields(accessedMachine, "."))

src/e/c/echarts-HEAD/trunk/EChartsEclipsePlugin/org.echarts.edt.sip.core/dk/lib/dotmachine/dotmachine.py   echarts(Download)
	submachineName = getStateName(state)
	submachineStatePath = statePath + [ submachineName ]
	href = ""
	nodeName = string.joinfields(submachineStatePath, ".")
	NODE_STATES[ "cluster_" + nodeName ] = nodeName
	if external:
		EXTERNAL_STATES.append(nodeName)
def dotsubmachine(submachine, submachineStatePath, external):
	# add invisible nodes to subgraph in order to connect transitions
	# to node representing parent state
	rv = ""
	key = string.joinfields(submachineStatePath, ".")
	try:
		refs = BASICSTATE_REFS[ key ] 
def dotpstates(machine, statePath):
	global PSTATE_REFS
	key = string.joinfields(statePath, ".")
	# obtain list of pstate refs for this machine
	try:
		pstateRefs = PSTATE_REFS[ key ]
	except KeyError:
	(joinspec, joinstate) = dotjoin(i, machineClass, srcrefs)									
	xnlabel = LABEL_FORMATTER.dotportreceive(xn)
	xntooltip = TOOLTIP_FORMATTER.dotportreceive(xn)
	TRANSITION_COMMENTS[ string.joinfields(machineClass + [ str(i) ], ".") ] = COMMENT_FORMATTER.dotportreceive(xn)
	return joinspec + dotxntgt(i, [], machineClass, [], getTransitionTargets(xn), joinstate, xnlabel, xntooltip)
 
# Generates dot code for joined transition or transition with empty
	else:
		nodeShape = 'style=filled, color=black, shape=circle, width=".05", height=".05", fixedsize=true'
	joinName = "JOIN.%s" % i
	joinNodeName = string.joinfields(machineClass + [ joinName ], ".")
	# join node declaration
	rv = '"%s" [label="", %s];\n' % (joinNodeName, nodeShape)
	joinRef = [ [], joinNodeName, "", "" ]
	key = string.joinfields(machineClass + [ str(i) ], ".")
		nodeShape = 'shape=box, width=".05", height=".05", fixedsize=true'
	else:
		nodeShape = 'style=filled, color=black, shape=circle, width=".05", height=".05", fixedsize=true'
	forkName = "FORK.%s" % string.joinfields(map(str, [ i ] + b), "_")
	forkNodeName = string.joinfields(machineClass + [ forkName ], ".")
	# fork node declaration
	rv = '"%s" [label="", %s];\n' % (forkNodeName, nodeShape)
	forkRef = [ [], forkNodeName, "", "" ] 
	key = string.joinfields(machineClass + [ str(i) ], ".")
		refs = []
	elif cfgType == BASIC_CONFIG:
		global BASICSTATE_REFS
		lht = "cluster_%s" % string.joinfields(machineClass + ancestorPath, ".")
		nodeName = "stub_%s.%s" % (string.joinfields(machineClass + ancestorPath, "."),
								   string.joinfields(map(str, [ i ] + b), "_"))
		htlabel = ""
		key = string.joinfields(machineClass + ancestorPath, ".")
		# pstate reference
		pstateName = cfgType
		newAncestorPath = ancestorPath + [ pstateName ]
		nodeName = string.joinfields(machineClass + newAncestorPath, ".")
		nodeName = nodeName + "." + string.joinfields(map(str, [ i ] + b), "_")
		htlabel = ""
		lht = ""
		# update global table of pstate ref's for referenced machine
		key = string.joinfields(machineClass + ancestorPath, ".")
			if not newrefs == []:
				subrefs = subrefs + [ getConfigurationTreeParentStateName(subcfg) ] 
		# add subrefs to table of subrefs for parent state
		key = string.joinfields(machineClass + ancestorPath, ".")
		try:
			oldsubrefs = SUBSTATE_REFS[ key ]
		except KeyError:
		else:
			# add auxilliary node and connect it to original source
			# node
			newsrcstateName = "BRANCH.%s" % string.joinfields(map(str, [ i ] + b), "_")
			# create new state path by replacing old parent state name
			# in src state ancestor state path with new aux state name
			newsrcstateAncestorPath = srcstate[0][:-1] + [ newsrcstateName ] 
			newsrcstateNode = string.joinfields(machineClass + newsrcstateAncestorPath, ".")
			newsrcstate = [ newsrcstateAncestorPath, newsrcstateNode, "", "", newsrcstateName ]
			rv = rv + '"%s" [label="", shape="circle", style="solid", height="0.05", width="0.05", fixedsize="true"];\n' % newsrcstateNode
			rv = rv + '"%s" -> "%s" [ltail="%s", taillabel="%s", label="%s", tooltip="%s"];\n' % \
				 (srcstate[1], newsrcstateNode, srcstate[3], srcstate[2], xnlabel, xntooltip)
			key = string.joinfields(machineClass + [ str(i) ], ".")
			 (srcstate[1], forkstate[1], srcstate[3], forkstate[3], srcstate[2], forkstate[2], \
			  LABEL_FORMATTER.dotxn(xnlabel, LABEL_FORMATTER.dotxnaction(getTargetAction(tgt))), \
			  TOOLTIP_FORMATTER.dotxn(xntooltip, TOOLTIP_FORMATTER.dotxnaction(getTargetAction(tgt))))
		key = string.joinfields(machineClass + [ str(i) ], ".")
		try:
			arcs = TRANSITION_ARCS[key]
			nodes = TRANSITION_NODES[key]
		nodeStyle = defaultNodeStyle + 'pencolor="LightGrey";\n'
		# get set of states in this machine that have been referenced
		# by transitions
		key = string.joinfields(statePath, ".")
		try:
			subrefs = SUBSTATE_REFS[ key ]
		except KeyError:
def dotFormatterInstance(qualifiedClassName):
	splitClassName = string.split(qualifiedClassName, ".")
	className = splitClassName[-1]
	moduleName = string.joinfields(splitClassName[:-1], ".")
	try:
		module = sys.modules[moduleName]
	except KeyError:

src/e/c/echarts-HEAD/trunk/EChartsEclipsePlugin/org.echarts.edt.core/dk/lib/dotmachine/dotmachine.py   echarts(Download)
	submachineName = getStateName(state)
	submachineStatePath = statePath + [ submachineName ]
	href = ""
	nodeName = string.joinfields(submachineStatePath, ".")
	NODE_STATES[ "cluster_" + nodeName ] = nodeName
	if external:
		EXTERNAL_STATES.append(nodeName)
def dotsubmachine(submachine, submachineStatePath, external):
	# add invisible nodes to subgraph in order to connect transitions
	# to node representing parent state
	rv = ""
	key = string.joinfields(submachineStatePath, ".")
	try:
		refs = BASICSTATE_REFS[ key ] 
def dotpstates(machine, statePath):
	global PSTATE_REFS
	key = string.joinfields(statePath, ".")
	# obtain list of pstate refs for this machine
	try:
		pstateRefs = PSTATE_REFS[ key ]
	except KeyError:
	(joinspec, joinstate) = dotjoin(i, machineClass, srcrefs)									
	xnlabel = LABEL_FORMATTER.dotportreceive(xn)
	xntooltip = TOOLTIP_FORMATTER.dotportreceive(xn)
	TRANSITION_COMMENTS[ string.joinfields(machineClass + [ str(i) ], ".") ] = COMMENT_FORMATTER.dotportreceive(xn)
	return joinspec + dotxntgt(i, [], machineClass, [], getTransitionTargets(xn), joinstate, xnlabel, xntooltip)
 
# Generates dot code for joined transition or transition with empty
	else:
		nodeShape = 'style=filled, color=black, shape=circle, width=".05", height=".05", fixedsize=true'
	joinName = "JOIN.%s" % i
	joinNodeName = string.joinfields(machineClass + [ joinName ], ".")
	# join node declaration
	rv = '"%s" [label="", %s];\n' % (joinNodeName, nodeShape)
	joinRef = [ [], joinNodeName, "", "" ]
	key = string.joinfields(machineClass + [ str(i) ], ".")
		nodeShape = 'shape=box, width=".05", height=".05", fixedsize=true'
	else:
		nodeShape = 'style=filled, color=black, shape=circle, width=".05", height=".05", fixedsize=true'
	forkName = "FORK.%s" % string.joinfields(map(str, [ i ] + b), "_")
	forkNodeName = string.joinfields(machineClass + [ forkName ], ".")
	# fork node declaration
	rv = '"%s" [label="", %s];\n' % (forkNodeName, nodeShape)
	forkRef = [ [], forkNodeName, "", "" ] 
	key = string.joinfields(machineClass + [ str(i) ], ".")
		refs = []
	elif cfgType == BASIC_CONFIG:
		global BASICSTATE_REFS
		lht = "cluster_%s" % string.joinfields(machineClass + ancestorPath, ".")
		nodeName = "stub_%s.%s" % (string.joinfields(machineClass + ancestorPath, "."),
								   string.joinfields(map(str, [ i ] + b), "_"))
		htlabel = ""
		key = string.joinfields(machineClass + ancestorPath, ".")
		# pstate reference
		pstateName = cfgType
		newAncestorPath = ancestorPath + [ pstateName ]
		nodeName = string.joinfields(machineClass + newAncestorPath, ".")
		nodeName = nodeName + "." + string.joinfields(map(str, [ i ] + b), "_")
		htlabel = ""
		lht = ""
		# update global table of pstate ref's for referenced machine
		key = string.joinfields(machineClass + ancestorPath, ".")
			if not newrefs == []:
				subrefs = subrefs + [ getConfigurationTreeParentStateName(subcfg) ] 
		# add subrefs to table of subrefs for parent state
		key = string.joinfields(machineClass + ancestorPath, ".")
		try:
			oldsubrefs = SUBSTATE_REFS[ key ]
		except KeyError:
		else:
			# add auxilliary node and connect it to original source
			# node
			newsrcstateName = "BRANCH.%s" % string.joinfields(map(str, [ i ] + b), "_")
			# create new state path by replacing old parent state name
			# in src state ancestor state path with new aux state name
			newsrcstateAncestorPath = srcstate[0][:-1] + [ newsrcstateName ] 
			newsrcstateNode = string.joinfields(machineClass + newsrcstateAncestorPath, ".")
			newsrcstate = [ newsrcstateAncestorPath, newsrcstateNode, "", "", newsrcstateName ]
			rv = rv + '"%s" [label="", shape="circle", style="solid", height="0.05", width="0.05", fixedsize="true"];\n' % newsrcstateNode
			rv = rv + '"%s" -> "%s" [ltail="%s", taillabel="%s", label="%s", tooltip="%s"];\n' % \
				 (srcstate[1], newsrcstateNode, srcstate[3], srcstate[2], xnlabel, xntooltip)
			key = string.joinfields(machineClass + [ str(i) ], ".")
			 (srcstate[1], forkstate[1], srcstate[3], forkstate[3], srcstate[2], forkstate[2], \
			  LABEL_FORMATTER.dotxn(xnlabel, LABEL_FORMATTER.dotxnaction(getTargetAction(tgt))), \
			  TOOLTIP_FORMATTER.dotxn(xntooltip, TOOLTIP_FORMATTER.dotxnaction(getTargetAction(tgt))))
		key = string.joinfields(machineClass + [ str(i) ], ".")
		try:
			arcs = TRANSITION_ARCS[key]
			nodes = TRANSITION_NODES[key]
		nodeStyle = defaultNodeStyle + 'pencolor="LightGrey";\n'
		# get set of states in this machine that have been referenced
		# by transitions
		key = string.joinfields(statePath, ".")
		try:
			subrefs = SUBSTATE_REFS[ key ]
		except KeyError:
def dotFormatterInstance(qualifiedClassName):
	splitClassName = string.split(qualifiedClassName, ".")
	className = splitClassName[-1]
	moduleName = string.joinfields(splitClassName[:-1], ".")
	try:
		module = sys.modules[moduleName]
	except KeyError:

src/e/c/echarts-HEAD/EChartsCPL/translator/lib/AbstractMachine.py   echarts(Download)
def toConfigurationImage(config):
	pathImages = []
	for path in config:
		pathImages = pathImages + [ toConfigurationPathImage(path) ]
	return "[" + string.joinfields(pathImages, ", ") + "]"
 
def toConfigurationPathImage(configPath):
	return string.joinfields(map(toConfigurationNodeImage, configPath), ".")	
	def linkMachine(self):
		compilationUnit = self.getCompilationUnitForFile(self.absoluteMachineFilePath)
		qualifiedMachineName = string.joinfields(getPackage(compilationUnit) + \
												 [ getMachineName(compilationUnit) ], ".")
		# create None entry in dependency dict to indicate that
		# machine is being linked
		AbstractMachine.dependencyDict[self.absoluteMachineFilePath] = None
	def updateImportEntries(self, echartsPath, qualifiedMachineName):
		if qualifiedMachineName[-1] == '*':
			# refers to any machine in specified package
			partialDirPath = string.joinfields(qualifiedMachineName[:-1], os.sep)
			dirPath = string.joinfields([ echartsPath ] +  [ partialDirPath ], os.sep)
			if os.path.isdir(dirPath):
				for filename in os.listdir(dirPath):
					if filename[-4:] == ".ech":
						self.updateImportEntry(qualifiedMachineName[:-1] + [ filename[:-4] ],
											   dirPath + os.sep + filename)
		else:
			# refers to particular machine in specified package
			filePath = echartsPath + os.sep + \
					   string.joinfields(qualifiedMachineName, os.sep) + ".ech"
	def updateImportEntry(self, qualifiedMachineName, filePath):
		dottedMachineName = string.joinfields(qualifiedMachineName, ".")
		absoluteFilePath = os.path.abspath(filePath)
		try:
			machineDict = self.importDict[qualifiedMachineName[-1]]
			# entry exists for this machine name try to add file path
			# to dict for the machine
	def getMachineFilePath(self, submachineName):
		dottedSubmachineName = string.joinfields(submachineName, ".")
		# looking for matching name in import dict keys
		try:
			machineDict = self.importDict[submachineName[-1]]
		except KeyError:
			raise AbstractMachineException( "unable to locate ECharts file defining machine: " + \
				# name that it declares itself to have
				fileMachineName = getMachineName(compilationUnit)
				filePackage = getPackage(compilationUnit)
				fileDottedMachineName = string.joinfields(filePackage + [ fileMachineName ], ".")
				if fileDottedMachineName == nameKey:
					# they're the same so delete any other
					# filepath entries from the dict
				if string.split(name, ".")[-1] == dottedSubmachineName:
					matchingKeys = matchingKeys + [ name ]
		else:
			dottedSubmachineName = string.joinfields(submachineName, ".")
			# look for a exact match against complete name
			if dottedSubmachineName in dict.keys():
				matchingKeys = [ dottedSubmachineName ]
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				for substate in getStates(submachine):
					self.checkSubmachineModifiers(substate,
												  string.joinfields([ stateName,
																	  getStateName(substate) ], "."))
			elif isAndMachine(submachine) and \
				 getSubmachineType(submachine) == EXTERNAL_SUBMACHINE:
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: inner submachines cannot define constructors: %s" % \
						  (self.absoluteMachineFilePath, line, column, 
						   string.joinfields(ancestorStates + [ getStateName(state) ], ".")) )
				else:
					# recursively check this submachine's states
					self.checkSubmachineConstructors(submachine, ancestorStates + [ getStateName(state) ])
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: duplicate access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   mod) )
			if "abstract" in mods:
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException(
					  "%s:%s:%s: semantic error: \"abstract\" access modifier not permitted for state %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], ".")) )
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
						  (self.absoluteMachineFilePath, line, column,
						   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
						   reduce(lambda y, z: "%s, " % y + z, mods)) )
			elif len(mods) > 1: 
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException(
					  "%s:%s:%s: semantic error: illegal combination of access modifiers for state %s: %s" % \
					  (self.absoluteMachineFilePath, line, column,
					   string.joinfields(ancestorStates + [ getStateName(state) ], "."),
	def checkTransitionModifiers(self, machine, ancestorStates):
		transitions = getTransitions(machine)
		for index in range(len(transitions)):
			if "constport" in getTransitionModifiers(transitions[index]) and isMessagelessTransition(transitions[index]):
				qualifiedStateName = string.joinfields(ancestorStates, ".")
				(line, column) = getTransitionLineColumn(transitions[index])
				raise AbstractMachineException(
	def checkStateModifiers(self, machine, machineLine, machineColumn, ancestorStates):
		initialState = None
		for state in getStates(machine):
			submachine = getSubmachine(state)
			stateMods = getStateModifiers(state)
			qualifiedStateName = string.joinfields(ancestorStates + [ getStateName(state) ], ".")
			if "initial" in stateMods:
						  "%s:%s:%s: semantic error: duplicate initial state modifier for %s" % \
						  (self.absoluteMachineFilePath, line, column, qualifiedStateName) )
				if initialState != None:
					qualifiedInitialStateName = string.joinfields(ancestorStates + [ initialState ], ".")
					(line, column) = getStateLineColumn(state)
					raise AbstractMachineException(
						  "%s:%s:%s semantic error: more than one initial state declared: %s, %s" % \
				self.checkStateModifiers(submachine, line, column, ancestorStates + [ getStateName(state) ])
		if isOrMachine(machine) and initialState == None:
			sys.stderr.write("%s:%s:%s: semantic warning: no initial state defined for (sub)machine %s\n" % \
							 (self.absoluteMachineFilePath, machineLine, machineColumn, string.joinfields(ancestorStates, ".")))
 
	# Ensure no inconsistent or duplicate modifiers for a machine.
	def checkMachineAccessModifiers(self, machine):
									package + [ machineName ]):
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: illegal access of machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, string.joinfields(accessedMachine, "."),
						   getStateName(state), string.joinfields(ancestorStates, ".")) )
				if "abstract" in getMachineAccessModifiers(getMachine(extCompilationUnit)):
					raise AbstractMachineException(
						  "%s:%s:%s: semantic error: illegal to reference abstract machine %s from state %s of (sub)machine %s" % \
						  (self.absoluteMachineFilePath, line, column, getMachineName(extCompilationUnit),
						   getStateName(state), string.joinfields(ancestorStates, ".")) )
				(line, column) = getStateLineColumn(state)
				raise AbstractMachineException( "%s:%s:%s: semantic error: duplicate states %s declared in (sub)machine %s" % \
					  (self.absoluteMachineFilePath, line, column, getStateName(state),
					   string.joinfields(ancestorStates + [ getStateName(state) ], ".")) )
			submachine = getSubmachine(state)
			if getSubmachineType(submachine) == INNER_SUBMACHINE:
				self.checkStates(submachine, ancestorStates + [ getStateName(state) ])
					  "%s:%s:%s: semantic error: in transition %s state configuration segment %s of state configuration %s of (sub)machine %s: %s" % \
					  (self.absoluteMachineFilePath, line, column, srctgt, toConfigurationPathImage(path),
					   toConfigurationImage(paths), 
					   string.joinfields(ancestorStates, "."), message) )
		return pcfg
 
	# Returns a partial populated tree config for the given path,
					index = map(getStateName, states).index(getConfigurationNodeName(path[0]))
				except ValueError:
					raise AbstractMachineException( "State %s does not exist in machine %s" % \
						  (toConfigurationNodeImage(path[0]), string.joinfields(accessedMachine, ".")) )
				# check if access to referenced state is permitted
				if not isAccessible(getStateAccessModifiers(states[index]), accessedMachine, accessingMachine):
					raise AbstractMachineException( "Illegal access of state %s declared in machine %s" % \
						  (getStateName(states[index]), string.joinfields(accessedMachine, ".")) )
					# can't overwrite a non-variable state
					# reference with basic state reference
					raise AbstractMachineException( "Conflicting access of state %s declared in machine %s" % \
						  (getStateName(states[index]), string.joinfields(accessedMachine, ".")) )
				return pcfg
 
	# Create a dynamic cfg wrapper and then recursively call

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next