Initial commit of main compiler sources (or should I say ... SAUCES!)
This commit is contained in:
29
slangc/api/BytecodeOutput.sauce
Normal file
29
slangc/api/BytecodeOutput.sauce
Normal file
@ -0,0 +1,29 @@
|
||||
package slangc.api;
|
||||
|
||||
public abstract class BytecodeOutput {
|
||||
protected int count = 0;
|
||||
public abstract void endOfFile();
|
||||
public abstract void processByte(byte b);
|
||||
|
||||
public final void write8(byte b) {
|
||||
processByte(b);
|
||||
count++;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void write16(short w) {
|
||||
write8((byte)w);
|
||||
write8((byte)(w >> 8));
|
||||
}
|
||||
public void write32(int w) {
|
||||
write16((short)w);
|
||||
write16((short)(w >> 16));
|
||||
}
|
||||
public void write64(long w) {
|
||||
write32((int)w);
|
||||
write32((int)(w >> 32));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user