Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Editor cannot be initialized/Unresolved proxy(Noob)
Editor cannot be initialized/Unresolved proxy [message #1179177] Sun, 10 November 2013 05:00 Go to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
I am getting inconsistent behavior in my DSL editor in the second instance of Eclipse Kepler.

Sometimes when I open a DSL source file, it works fine. Other times, it won't open and I get an "Editor cannot be initialized" error. The issue follows specific files (it may be related to a specific instruction). If I restart the Eclipse session it might work OK or be a different set of files. So, some will open and other's won't within the same session.

At the same time, in the console of the first Eclipse instance, I see:

Caused by: java.lang.IllegalStateException: Unresolved proxy http://www.holycityaudio.com/spincad/SpinCAD#//Clr. Make sure the EPackage has been registered.


"Clr" is one of the parser rules. Sometimes it is one of the other parser rules, e.g. "absa". If I quit and restart the second instance of Eclipse, it might work on a file which had been problematic, or it might have a problem with one of the other parser rules.

Here are those rules in my Xtext grammar:

// zero argument instructions
Clr: {Clr} 'clr';
Not: {Not} 'not';
Absa: {Absa} 'absa';


Using Windows 7, 32 bit, 4 GB of RAM (3 GB that is).

So far, all I can tell you is that the rules which seem to be causing problems are the DSL instructions which take zero arguments, such as "clr" and "absa".

I restarted the second Eclipse again and it worked OK. However I get this exception in the console of the first Eclipse:

!MESSAGE com.holycityaudio.spincad.spinCAD.impl.SpinCADFactoryImpl cannot be cast to com.holycityaudio.spincad.spinCADMenu.SpinCADMenuFactory


Note that I have two DSLs in the same project (I ran "Create Xtext project" wizard twice). One is called "SpinCAD" and the other is called "SpinCADMenu". The above message implies to me that there is some confusion having the 2 DSLs side by side.

[Updated on: Sun, 10 November 2013 16:30]

Report message to a moderator

Re: Editor cannot be initialized/Unresolved proxy [message #1179188 is a reply to message #1179177] Sun, 10 November 2013 05:09 Go to previous messageGo to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Sorry, duplicate post.

[Updated on: Sun, 10 November 2013 16:21]

Report message to a moderator

Re: Editor cannot be initialized/Unresolved proxy [message #1179189 is a reply to message #1179177] Sun, 10 November 2013 05:09 Go to previous messageGo to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Now I broke the forum!
Re: Editor cannot be initialized/Unresolved proxy [message #1179220 is a reply to message #1179177] Sun, 10 November 2013 05:41 Go to previous messageGo to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Xtend code generator:

/*
 * generated by Xtext
 */
package com.holycityaudio.spincad.generator

//import com.google.inject.Inject
import com.holycityaudio.spincad.spinCAD.And
import com.holycityaudio.spincad.spinCAD.ChorusReadDelay
import com.holycityaudio.spincad.spinCAD.ChorusReadValue
import com.holycityaudio.spincad.spinCAD.ReadDelayPointer
import com.holycityaudio.spincad.spinCAD.Element
import com.holycityaudio.spincad.spinCAD.Equate
import com.holycityaudio.spincad.spinCAD.Exp
import com.holycityaudio.spincad.spinCAD.Instruction
import com.holycityaudio.spincad.spinCAD.Jam
import com.holycityaudio.spincad.spinCAD.Label
import com.holycityaudio.spincad.spinCAD.Ldax
import com.holycityaudio.spincad.spinCAD.LoadRampLFO
import com.holycityaudio.spincad.spinCAD.LoadSinLFO
import com.holycityaudio.spincad.spinCAD.Log
import com.holycityaudio.spincad.spinCAD.Mem
import com.holycityaudio.spincad.spinCAD.Mulx
import com.holycityaudio.spincad.spinCAD.Or
import com.holycityaudio.spincad.spinCAD.Program
import com.holycityaudio.spincad.spinCAD.ReadDelay
import com.holycityaudio.spincad.spinCAD.ReadRegister
import com.holycityaudio.spincad.spinCAD.ReadRegisterFilter
import com.holycityaudio.spincad.spinCAD.ScaleOffset
import com.holycityaudio.spincad.spinCAD.Skip
import com.holycityaudio.spincad.spinCAD.WriteAllpass
import com.holycityaudio.spincad.spinCAD.WriteDelay
import com.holycityaudio.spincad.spinCAD.WriteRegister
import com.holycityaudio.spincad.spinCAD.WriteRegisterHighshelf
import com.holycityaudio.spincad.spinCAD.WriteRegisterLowshelf
import com.holycityaudio.spincad.spinCAD.Xor
import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.xtext.generator.IFileSystemAccess
import org.eclipse.xtext.generator.IGenerator
//import org.eclipse.xtext.naming.IQualifiedNameProvider
import com.holycityaudio.spincad.spinCAD.Absa
import com.holycityaudio.spincad.spinCAD.Not
import com.holycityaudio.spincad.spinCAD.Clr
import com.holycityaudio.spincad.spinCAD.Pin
import com.holycityaudio.spincad.spinCAD.AudioInput
import com.holycityaudio.spincad.spinCAD.AudioOutput
import com.holycityaudio.spincad.spinCAD.ControlOutput
import com.holycityaudio.spincad.spinCAD.ControlInput
import com.holycityaudio.spincad.spinCAD.InputPin
import com.holycityaudio.spincad.spinCAD.OutputPin

class SpinCADGenerator implements IGenerator {
 
  // @Inject extension IQualifiedNameProvider
 
	override void doGenerate(Resource resource, IFileSystemAccess fsa) {
		var pkage = "\\com\\holycityaudio\\SpinCAD\\CADBlocks\\"
		fsa.generateFile(pkage + resource.className+"CADBlock"+".java", toCADBlockCode(resource.contents.head as Program))
	}
	
	def className(Resource res) {
		var name = res.URI.lastSegment
		println(name)
		return name.substring(0, name.indexOf('.'))
	}
	
	def toCADBlockCode(Program pr) '''
		package com.holycityaudio.SpinCAD.CADBlocks;
	
		import com.holycityaudio.SpinCAD.SpinCADBlock;
		import com.holycityaudio.SpinCAD.SpinCADPin;
		import com.holycityaudio.SpinCAD.fxblocks.basic.SpinFXBlock;
		
		public class «pr.eResource.className+"CADBlock"» extends SpinCADBlock {

			private static final long serialVersionUID = 1L;

			public «pr.eResource.className+"CADBlock"»(int x, int y) {
				super(x, y);
				setName("«pr.name»");	
				// Iterate through pin definitions and allocate or assign as needed
				«FOR Pin p : pr.pins»
					«switch p {
						AudioInput:{genAudioInput(p)}
						AudioOutput:{genAudioOutput(p)}
						ControlOutput:{genControlOutput(p)}
						ControlInput:{genControlInput(p)}
					}»
				«ENDFOR»
			}
		
			// In the event there are parameters editable by control panel
			public void editBlock(){ 
	//			new «pr.eResource.className+"ControlPanel"»(this);
			}	
				
			public void generateCode(SpinFXBlock sfxb) {
	
			// Iterate through mem and equ statements, allocate accordingly
			«FOR Element e : pr.elements»
				«switch e {
					Mem:{genMem(e)}
					Equate:{genEquate(e)}
				}»
			«ENDFOR»
			
			sfxb.comment(getName());
			
			SpinCADPin sp = null;
					
			// Iterate through pin definitions and connect or assign as needed
			«FOR Pin p : pr.pins»
			«switch p {
				InputPin: {connect(p)}
				OutputPin: {setOutput(p)}
			}»
			«ENDFOR»
			// finally, generate the instructions
			«FOR Element e : pr.elements»
				«switch e {
					Instruction:{genInstruction(e)}
				}»
			«ENDFOR»

			// Say 'bye-bye'
			System.out.println("«pr.getName»" + " code gen!");
			}
		}	
	'''
	
	def genAudioInput(Pin p) ''' 
		addInputPin(this, "«p.name»");
	'''
	def genAudioOutput(Pin p) '''
		addOutputPin(this, "«p.name»");
	'''

	def genControlInput(Pin p) '''
		addControlInputPin(this, "«p.name»");
	'''
	def genControlOutput(Pin p) '''
		addControlOutputPin(this, "«p.name»");
	'''
// now connect them pins		
	def connect(Pin p) '''
		sp = this.getPin("«p.name»").getPinConnection();
		int «p.varName» = -1;
		if(sp != null) {
			«p.varName» = sp.getRegister();
		}

	'''
// now connect them pins		
	def setOutput(Pin p) '''
		this.getPin("«p.name»").setRegister(«p.varName»);
	'''

// try to figure out a way to distinguish REGx equates from INT or DOUBLE
	def genEquate(Equate e) '''
		«IF e.getValue.toUpperCase.startsWith("REG",0)»
		int «e.getEname» = sfxb.allocateReg();
		«ELSE»
		double «e.getEname» = «e.getValue»;
		«ENDIF»
	'''

	def genMem(Mem m) '''
		sfxb.FXallocDelayMem("«m.getBuffer»", «m.getLength»); 
	'''

	def genLabel(Label l) '''
		«l.name» 
	'''

	def genInstruction(Instruction inst) '''
		«switch inst {
			Jam: genJam(inst)
			ReadRegister: genReadRegister(inst)
			ReadRegisterFilter: genReadRegisterFilter(inst)
			WriteRegister: genWriteRegister(inst)
			WriteRegisterLowshelf: genWriteRegisterLowshelf(inst)
			WriteRegisterHighshelf: genWriteRegisterHighshelf(inst)
			ScaleOffset: genScaleOffset(inst)
			Mulx: genMulx(inst)
			Ldax: genLdax(inst)
			Not: genNot(inst)
			Absa: genAbsa(inst)
			Clr: genClr(inst)
			Or: genOr(inst)			
			Log: genLog(inst)
			Exp: genExp(inst)
			Skip: genSkip(inst)
			Xor: genXor(inst)
			And: genAnd(inst)
			LoadRampLFO: genWldr(inst) 
			LoadSinLFO: genWlds(inst)
			WriteDelay: genWriteDelay(inst)
			ReadDelay: genReadDelay(inst)
			WriteAllpass: genWriteAllpass(inst)
			ChorusReadDelay: genChorusReadDelay(inst)
			ChorusReadValue: genChorusReadValue(inst)
			ReadDelayPointer: genReadDelayPointer(inst)
		}»
	'''	

	def genAbsa(Absa inst) '''
	sfxb.absa();
	'''

	def genNot(Not inst) '''
	sfxb.not();
	'''

	def genClr(Clr inst) '''
	sfxb.clear();
	'''

	def genLog(Log inst) '''
	sfxb.log(«inst.getArg1», «inst.getArg2»);
	'''

	def genExp(Exp inst) '''
	sfxb.exp(«inst.getArg1», «inst.getArg2»);
	'''

	def genSkip(Skip inst) {
	'''
	sfxb.skip(«inst.getFlags().toUpperCase()», «UtilSC::getDiff(inst)»);
	'''}

	def genJam(Jam inst) '''
	sfxb.jam(«inst.getArg1»);
	'''

	def genScaleOffset(ScaleOffset inst) '''
	sfxb.scaleOffset(«inst.getArg1», «inst.getArg2»);
	'''

	def genOr(Or inst) '''
	sfxb.or(«inst.getArg1.toJavaBinary»);
	'''

	def genAnd(And inst) '''
	sfxb.and(«inst.getArg1.toJavaBinary»);
	'''

	def genXor(Xor inst) '''
	sfxb.xor(«inst.getArg1.toJavaBinary»);
	'''

	def genWldr(LoadRampLFO inst) '''
	sfxb.loadRampLFO(«inst.getArg1.spinRegs», «inst.getArg2», «inst.getArg3»);
	'''

	def genWlds(LoadSinLFO inst) '''
	sfxb.loadSinLFO(«inst.getArg1.spinRegs», «inst.getArg2», «inst.getArg3»);
	'''

	def genReadDelay(ReadDelay inst) '''
	sfxb.FXreadDelay("«inst.getArg1»", «inst.getArg2»);
	'''

	def genReadDelayPointer(ReadDelayPointer inst) '''
	sfxb.readDelayPointer(«inst.getArg1.spinRegs»);
	'''

	def genWriteDelay(WriteDelay inst) '''
	sfxb.FXwriteDelay("«inst.getArg1»", «inst.getArg2»);
	'''

	def genWriteAllpass(WriteAllpass inst) '''
	sfxb.FXwriteAllpass("«inst.getArg1»", «inst.getArg2»);
	'''

	def genReadRegisterFilter(ReadRegisterFilter inst) '''
	sfxb.readRegisterFilter(«inst.getArg1», «inst.getArg2»);
	'''
	
	def genReadRegister(ReadRegister inst) '''
	sfxb.readRegister(«inst.getArg1.spinRegs», «inst.getArg2»);
	'''
	
	def genWriteRegister(WriteRegister inst) '''
	sfxb.writeRegister(«inst.getArg1.spinRegs», «inst.getArg2»);
	'''
	
	def genWriteRegisterHighshelf(WriteRegisterHighshelf inst) '''
	sfxb.writeRegisterHighshelf(«inst.getArg1», «inst.getArg2»);
	'''
	
	def genWriteRegisterLowshelf(WriteRegisterLowshelf inst) '''
	sfxb.writeRegisterLowshelf(«inst.getArg1», «inst.getArg2»);
	'''
	
	def genMulx(Mulx inst) '''
	sfxb.mulx(«inst.getArg1.spinRegs»);
	'''

	def genLdax(Ldax inst) '''
	sfxb.loadAccumulator(«inst.getArg1»);
	'''
	
	def genChorusReadDelay(ChorusReadDelay inst) ''' 
	sfxb.FXchorusReadDelay(«inst.getArg1.toUpperCase()», «inst.getArg2.toUpperCase()», "«inst.getArg3»");
	'''

	def genChorusReadValue(ChorusReadValue inst) '''
	sfxb.chorusReadValue(«inst.getArg1.spinRegs»);
	'''
	
	def toJavaBinary(String spinBinary) {
		if (spinBinary.startsWith('%')) {
			spinBinary.replace("%", "0b")
		}	
		else if (spinBinary.startsWith('$')) {
			spinBinary.replace("$", "0x")
		}	
		else {
			spinBinary;
		}
}
	
	
	def spinRegs(String reg) { 
		if (reg == "pot0") return "input0";
		if (reg == "pot1") return "input1";
		if (reg == "pot2") return "input2";
		if (reg == "sin0") return "SIN0";
		if (reg == "sin1") return "SIN1";
		if (reg == "rmp0") return "RMP0";
		if (reg == "rmp1") return "RMP1";
		if (reg == "sin0_rate") return "SIN0_RATE";
		if (reg == "sin1_rate") return "SIN1_RATE";
		if (reg == "rmp0_rate") return "RMP0_RATE";
		if (reg == "rmp1_rate") return "RMP1_RATE";
		if (reg == "sin0_range") return "SIN0_RANGE";
		if (reg == "sin1_range") return "SIN1_RANGE";
		if (reg == "cos0") return "COS0";
		if (reg == "cos1") return "COS1";
		if (reg == "neg") return "NEG";
		if (reg == "zrc") return "ZRC";
		if (reg == "run") return "RUN";
		if (reg == "gez") return "GEZ";
		if (reg == "addr_ptr") return "ADDR_PTR";
		return reg;
	}
}
Re: Editor cannot be initialized/Unresolved proxy [message #1179231 is a reply to message #1179177] Sun, 10 November 2013 05:49 Go to previous messageGo to next message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Xtext grammar:

grammar com.holycityaudio.spincad.SpinCAD with org.eclipse.xtext.common.Terminals

generate spinCAD "http://www.holycityaudio.com/spincad/SpinCAD"

Program:
	'@name' name = ID
	(pins += Pin)+
	(elements += Element)+
	;
	
Element:
	Equate | Mem | Instruction | Label | Comment;
	
Pin:
	InputPin | OutputPin
;

InputPin:
	AudioInput | ControlInput	
;

OutputPin:
	AudioOutput | ControlOutput	
;

AudioInput:
	'@audioInput' varName = ID name = ID
;

AudioOutput:
	'@audioOutput' varName = ID name = ID
;

ControlInput:
	'@controlInput' varName = ID name = ID
;

ControlOutput:
	'@controlOutput' varName = ID name = ID
;

//-----------------------------------------------------------------------------	

Equate:
	'equ' ename = ID value = SPINDOUBLE 
;

Mem:
	'mem' buffer = ID length = INT 
;

Comment:
	remark = SC_COMMENT
;

Label:
	name = ID ':'
;

Instruction:
	Inst_B15_S1_9 |
	Inst_B6_S1_14 |
	Inst_S1_14_S1_10 |
	Inst_B6 |
	Inst_B24  |
	Skip |
	Jam |
	Inst_X0 |
	LoadSinLFO |
	LoadRampLFO |
	ChorusReadDelay |
	ChorusReadValue |
	ChorusScaleOffset | 
	Log | 
	ReadDelayPointer
	;

Inst_B6_S1_14:
	ReadRegister |
	WriteRegister |
	ReadRegisterFilter |
	Maxx |
	WriteRegisterHighshelf |
	WriteRegisterLowshelf
;

Inst_B15_S1_9:
	ReadDelay |
	WriteDelay |
	WriteAllpass
;

Inst_B6:
	Mulx |
	Ldax
;

Inst_B24:
	And |
	Or |
	Xor
;

Inst_X0:  Clr | Not | Absa
;

Inst_S1_14_S1_10:
	Exp | ScaleOffset
;


ReadRegister: 'rdax' arg1 = SPINREGISTER ',' arg2 = SPINDOUBLE;
WriteRegisterLowshelf: 'wrlx' arg1 = SPINREGISTER ',' arg2 = SPINDOUBLE;
WriteRegisterHighshelf: 'wrhx' arg1 = SPINREGISTER ',' arg2 = SPINDOUBLE ;
WriteRegister: 'wrax' arg1 = SPINREGISTER ',' arg2 = SPINDOUBLE ;
Maxx: 'maxx' arg1 = SPINREGISTER ',' arg2 = SPINDOUBLE ;
ReadRegisterFilter: 'rdfx' arg1 = SPINREGISTER ',' arg2 = SPINDOUBLE ;
Mulx: 'mulx' arg1 = ID ;
Ldax: 'ldax' arg1 = ID ;
Exp: 'exp' arg1 = SPINDOUBLE ',' arg2 = SPINDOUBLE ;
Log: 'log' arg1 = SPINDOUBLE ',' arg2 = SPINDOUBLE ;
ScaleOffset: 'sof' arg1 = SPINDOUBLE ',' arg2 = SPINDOUBLE ;
WriteDelay: 'wra' arg1 = SPINMEM ',' arg2 = SPINDOUBLE;
WriteAllpass: 'wrap' arg1 = SPINMEM ',' arg2 = SPINDOUBLE;
ReadDelay: 'rda' arg1 = SPINMEM ',' arg2 = SPINDOUBLE;
LoadSinLFO: 'wlds' arg1 = SPINREGISTER ',' arg2 = INT ',' arg3 = INT;
LoadRampLFO: 'wldr' arg1 = SPINREGISTER ',' arg2 = INT ',' arg3 = INT;

// Chorus instructions
ChorusReadDelay: 'cho rda' ',' arg1 = SPINREGISTER ',' arg2 = SPINCHOREGFLAGS ',' arg3 = SPINMEM;
ChorusReadValue: 'cho rdal' ',' arg1 = SPINREGISTER;
ChorusScaleOffset: 'cho sof' ','  arg1 = ID ',' arg2 = SPINCHOREGFLAGS ',' arg3 = SPINDOUBLE;
ReadDelayPointer: 'rmpa' arg1 = SPINDOUBLE;

// single argument instructions
And: 'and' arg1 = BINARY24;
Or: 'or' arg1 = BINARY24;
Xor: 'xor' arg1 = BINARY24;
Jam: 'jam' arg1=ID;

// zero argument instructions
Clr: {Clr} 'clr';
Not: {Not} 'not';
Absa: {Absa} 'absa';

//Then there's Skip
Skip: 'skp' flags = ID ',' label = [Label];

//------------------------
terminal SC_COMMENT: ';' !('\n'|'\r')* ('\r'? '\n');

// data type rules

SPINDOUBLE: 
	'-'? (ID | (INT ( '.' INT)?))
;
SPINREGISTER: 
	(ID | INT )
;
SPINCHOREGFLAGS: 
	(INT | (ID ('|' ID)*)?)
;
SPINMEM: 
	ID ('#' | '^')? (('+' | '-') (INT | ID))?
;
BINARY24: 
	((('%' INT) (ID) * ) | ('$' (INT)* (ID)*))
;

QualifiedName : 
  ID ('.' ID)*
;

Re: Editor cannot be initialized/Unresolved proxy [message #1179247 is a reply to message #1179177] Sun, 10 November 2013 06:01 Go to previous message
Gary Worsham is currently offline Gary WorshamFriend
Messages: 176
Registered: September 2013
Senior Member
Also get this upon launch of second Eclipse:

!ENTRY org.eclipse.emf.ecore 2 0 2013-11-09 22:00:12.776
!MESSAGE Both 'spincadmenu' and 'spincad' register a package for 'http://www.holycityaudio.com/spincad/SpinCAD'

!ENTRY org.eclipse.ui 4 4 2013-11-09 22:00:16.751
!MESSAGE Unable to find Action Set: org.eclipse.emf.facet.common.editor.actionSet
Previous Topic:Embarrassing Data Type rule question [solved]
Next Topic:How to accessing resources on the classpath
Goto Forum:
  


Current Time: Thu Nov 26 10:46:03 GMT 2020

Powered by FUDForum. Page generated in 0.02313 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top