⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dword.java

📁 用Java实现的编译器。把源代码编译成SPARC汇编程序
💻 JAVA
字号:
// $Id: dWord.java,v 1.3 2000/10/21 23:18:13 mdeeds Exp $package java6035.tools.ASM;/** * dWord * * represents an .word directive in ASM file. ".word w1, ..., wn" stores * the n 32-bit quantities in successive memory words. wi must either be * a literal or a label. */public class dWord extends ASMDirective{    protected Object[] entries;    /**     * constructs a dWord object using the string array passed in. The     * array is copied (but individual elements are not cloned).     **/    public dWord(String[] dw)    {		super(ASMDirective.WORD);		this.entries = new Object[dw.length];		for (int i=0; i<dw.length; i++) {			this.entries[i] = dw[i];		}    }    /**     * constructs a dWord object using the long array passed in. The     * array is copied (but individual elements are not cloned).     **/    public dWord(Long[] dw)    {		super(ASMDirective.WORD);		this.entries = new Object[dw.length];		for (int i=0; i<dw.length; i++) {		    this.entries[i] = dw[i];		}    }    /**     * constructs a dWord object of the size given. Elements are     * initialized to 0, and will be filled in later.     */    public dWord(int size)    {		super(ASMDirective.WORD);		this.entries = new Object[size];		for(int i=0; i<size; i++) {		    this.entries[i] = new Long(0);		}    }    /**     * Returns the nth element of the dWord object.     */    public Object elementAt(int n)    {		return this.entries[n];    }    /**     * Replaces the @param n th element of the dWord object with new     * value, @param s.  @param n = 0 specifies the first element.     **/    public void setElementAt(int n, String s)    {		this.entries[n] = s;    }        /**     * Replaces the @param n th element of the dWord object with new     * value, @param l.  @param n = 0 specifies the first element.       **/    public void setElementAt(int n, Long l)    {		this.entries[n] = l;    }    /**     * Returns the string representation.     */    public String toString()    {		String s = ".word ";		int length = entries.length;			if (length == 0) return "";			s += entries[0].toString();			for(int i=1; i<length; i++) 		{		   s += ","+entries[i].toString();		}			return s;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -