欢迎来到课桌文档! | 帮助中心 课桌文档-建筑工程资料库
课桌文档
全部分类
  • 党建之窗>
  • 感悟体会>
  • 百家争鸣>
  • 教育整顿>
  • 文笔提升>
  • 热门分类>
  • 计划总结>
  • 致辞演讲>
  • 在线阅读>
  • ImageVerifierCode 换一换
    首页 课桌文档 > 资源分类 > DOCX文档下载  

    jpl0cproject的所有源文件.docx

    • 资源ID:1415509       资源大小:690.59KB        全文页数:151页
    • 资源格式: DOCX        下载积分:5金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要5金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    jpl0cproject的所有源文件.docx

    * Code.java*Createdon2005Ae2A22E0zEltl0z33*1.astmodify:2005-2-27.*Author:WAngNan(BHU32060601)* Thisprogramisfreesoftware;youcanredistributeitand/ormodify* itunderthetermsoftheGNUGeneralPublic1.icenseaspublishedby* theFreeSoftwareFoundation;eitherversion2ofthe1.icense,or* (atyouroption)anylaterversion.packageattributesincompile;importInstructionsused.*;importjava.util.*;/* 0authorwn*/Code1.ength=0;maxstack=1;currentstack=1;/ifmysolutioniswrong,thispublicclassCodepublicintpublicintpublicint1mayletitgo.newpublicVector<Instruction>Instructions1.istVector<Instruction>();publicvoidappend(InstructionOP)Instructions1.ist.add(OP);Code1.ength+=OP.get1.ength();currentstack+=OP.getStackUsed();if(currentstack>maxstack)maxstack=currentstack;)publicvoidappendAll(Codefrag)for(inti=0;i<frag.Instructions1.ist.size();i+)append(frag.Instructions1.ist.get(i);)*for(Instructioni:frag.Instructions1.ist)append(i);)*/*CreatesanewinstanceofCode*/publicCode()* Var1.ist.java*Createdon2005Ae2A21EzIAtl247*1.astmodify:2005-2-21.*Author:WAngNan(BHU32060601)* Thisprogramisfreesoftware;youcanredistributeitand/ormodify* itunderthetermsoftheGNUGeneralPublic1.icenseaspublishedby* theFreeSoftwareFoundation;eitherversion2ofthe1.icense,or* (atyouroption)anylaterversion.packageattributesincompile;importjava.util.*;importglobal.*;*authorwn*/publicclassVar1.istWithTypepublicVector<String>VarsName=newVector<String>();publicTAB1.E_NODE_TYPESVarsType=null;publicbooleanisArray=false;*CreatesanewinstanceofVar1.ist*/publicVar1.istWithType()(CreateClassFile.javaCreatedon2005Ae20A24EzIAt2rO81.astmodify:2005-3-2.*Author:WAngNan(BHU32060601)* Thisprogramisfreesoftware;youcanredistributeitand/ormodify* itunderthetermsoftheGNUGeneralPublic1.icenseaspublishedby* theFreeSoftwareFoundation;eitherversion2ofthe1.icense,or* (atyouroption)anylaterversion.packagedumpper;importtables.*;importglobal.*;importtables.*;importattributesincompile.*;importinstructionsused.*;importjava.io.;importjava.util.*;* ©authorwn* /publicclassCreateClassFilepublicvoidWriteHeader()throwsIOExceptionOut.writelnt(OxCAFEBABE);/magicOut.WriteShort(O);/minor_versionOut.WriteShort(49);/major_version)publicvoidCountconstantPoolNum()CompileTimeCPCTCP=newCompileTimeCP();for(CompileTimeCPNodeNode:CTCP.Pool)if(Node.Type=CONSTANT_POO1._NODE_TYPE.STRING)ConstantPoolNum+=2;elseConstantPoolNum+=1;)for(ObjectNode:Table.dump()if(GlobalTableNode)(Node).KindTAB1.E_NODE_KINDS.CONSTANT)if(GlobalTableNode)Node).KindTAB1.E_NODE_KINDS.FUNCTION)ConstantPoolNum+=4;elseConstantPoolNum+=3;publicvoidWriteMethodref(intC1.ASS,intNameAndType)throwsIOExceptionOut.writeByte(10);Out.writeShort(C1.ASS);Out.writeShort(NameAndType);publicvoidWriteFieldref(intC1.ASS,intNameAndType)throwsIOExceptionOut.writeByte(9);Out.writeShort(C1.ASS);Out.writeShort(NameAndType);publicvoidWriteClass(intName)throwsIOExceptionOut.writeByte(7);Out.writeShort(Name);publicvoidWriteNameAndType(intName,intType)throwsIOExceptionOut.WriteByte(12);Out.writeShort(Name);Out.writeShort(Type);)publicvoidwriteUTF8(StringS)throwsIOExceptionfOut.WriteByte(1);Out.WriteShort(S.length();Out.writeBytes(三);publicvoidWriteConstantString(intIndex)throwsIOExceptionOut.writeByte(8);Out.WriteShort(Index);)publicvoidWriteConstantInt(intBytes)throwsIOExceptionOut.writeByte(3);Out.writelnt(Bytes);)publicvoidWriteConstantFloat(floatBytes)throwsIOExceptionOut.writeByte(4);Out.writeFloat(Bytes);)publicvoidWriteStartOfCP()throwsIOException9);/l10);/2ll);/312);/413);/514);/6WriteMethodref(8,WriteMethodref(7,WriteMethodref(7,WriteMethodref(7,WriteMethodref(7,WriteMethodref(7,WriteClass(40);/7WriteClass(39);/8WriteNameAndType(15,16);/9WriteNameAndType(17,18);/10WriteNameAndType(19,20);/11WriteNameAndType(21,22);/12WriteNameAndType(23,24);/13WriteNameAndType(25,26);/14writeUTF8(,<init>");/15writeUTF8(,()Vn);/16writeUTF8(nWRITEINTn);/17writeUTF8(n(I)V11);/18writeUTF8(nWRITECHARu);/19writeUTF8("(C)V11);/20writeUTF8(nWRITEBOO1.EANn);/21writeUTF8(11(Z)V11);/22writeUTF8(nWRITESTRINGn);/23writeUTF8(,(1.java/lang/String;)Vn);/24writeUTF8(nWRITEF1.OATn);/25writeUTF8(,(F)V");/26writeUTF8("main'*);/27writeUTF8(,(1.java/lang/String;V11);/28writeUTF8(,I11);/29writeUTF8("F11);/30writeUTF8(,Z11);/31writeUTF8(,'C,)32writeUTF8(,javalangString11);/33writeUTF8(,I,');/34writeUTF8(nFn);/35writeUTF8(nZn);/36writeUTF8(,C");/37writeUTF8(nCoden);/38writeUTF8(,jplOlangProgram,');/39writeUTF8(Table.ProgName);/40*Out.writeShort(0x0021);/ACCESSF1.AGOut.writeShort(7);/ThisClassOut.writeShort(8);/Superclass;Out.WriteShort(O);/InterfaceCount;*/publicvoidWriteConstTable()throwsIOExceptionCompileTimeCPCTCP=newCompileTimeCP();for(CompileTimeCPNodeNode:CTCP.Pool)ConstantPoolIndex+;if(Node.Type=CONSTANT_POO1._NODE_TYPE.STRING)writeUTF8(Node.getStringVlue();ConstantPoolIndex+;WriteConstantString(ConstantPoolIndex-1);Node.Index=ConstantPoolIndex;elseNode.Index=ConstantPoolIndex;if(Node.Type=CONSTANT_POO1._NODE_TYPE.F1.OAT)WriteConstantFloat(Node.getFloatValue();elseWriteConstantInt(Node.getlntValue();)publicvoidWriteGlobalTable()throwsIOExceptionfintNameindex,NameAndTypeIndex,Index;for(ObjectNode:Table.dump()GlobalTableNodeCNode=(GlobalTableNode)(Node);if(CNode.Kind!=TAB1.E_NODE_KINDS.CONSTANT)ConstantPoolIndex+;if(CNode.Kind=TAB1.E_NODE_KINDS.FUNCTION)writeUTF8(FunctionNode)(CNode).OrgiName);(FunctionNode)(CNode).name_index=ConstantPoolIndex;ConstantPoolIndex+;writeUTF8(FunctionNode)(CNode).FullDescirptor);(FunctionNode)(CNode).descriptor_index=ConstantPoolIndex;ConstantPoolIndex+;WriteNameAndType(ConstantPoolIndex-2,ConstantPoolIndex-I);ConstantPoolIndex+;WriteMethodref(7,ConstantPoolIndex-I);(FunctionNode)(CNode).method_ref_index=ConstantPoolIndex;(FunctionNode)(CNode).IndexInCP=ConstantPoolIndex;Methods.add(CNode);elseinttype;switch(CNode.Type)caseCHAR:type=37;break;caseBOO1.EAN:type=36;break;caseF1.OAT:type=35;break;caseINTEGER:type=34;break;default:type=33;)if(CNode.Kind=TAB1.E_NODE_KINDS.ARRAY)type=type-5;/ConstantPoolIndex+;writeUTF8(CNOde.getName();(GlobalVarNode)CNode).name_index=ConstantPoolIndex;ConstantPoolIndex+;WriteNameAndType(ConstantPoolIndex-Iztype);(GlobalVarNode)CNode).descriptor_index=type;ConstantPoolIndex+;WriteFieldref(7,ConstantPoolIndex-I);CNode.IndexInCP=ConstantPoolIndex;FieldsCount+;Fields.add(CNode);)GlobalTableTable;DataOutputStreamOut;intConstantPoolNum=40;intConstantPoolIndex=40;intFieldsCount=O;Vector<GlobalTableNode>Fields=newVector<GlobalTableNode>();Vector<GlobalTableNode>Methods=newVector<GlobalTableNode>();*CreatesanewinstanceofCreateClassFile*/publicCreateClassFile(GlobalTableTable)throwsIOExceptionthis.Table=Table;try(Out=newDataOutputStream(newFileOutputStream(Table.ProgName+,.class'1);WriteHeader();CountconstantPoolNuin();/Out.writeShort(ConstantPoolNum);Out.WriteShort(ConstantPoolNum+!);WriteStartOfCP();WriteConstTable();WriteGlobalTable();Out.writeShort(0x21);Out.writeShort(0x07);Out.writeShort(0x08);Out.WriteShort(OxOO);Out.WriteShort(FieldsCount);for(inti=0;KFieldsCount;i+)Out.writeShort(0x0009);Out.WriteShort(GlobalVarNode)(Fields.get(i).name_index);Out.WriteShort(GlobalVarNode)(Fields.get(i).descriptor_index)Out.writeShort(OxOOOO);)Out.WriteShort(Methods.size()÷2);Out.WriteShort(OxOOOl);/Method<init>accessflagOut.writeShort(15);/UTF8<init>Out.writeShort(16);/()VOut.writeShort(1);/attributecountOut.WriteShort(38);/attribute_name_index:CodeOut.writelnt(17);/?Out.WriteShort(1);Out.WriteShort(1);Out.writelnt(5);/5Out.writeByte(0x2a);/aload_0Out.WriteByte(0xb7);/InvokespecialOut.WriteShort(1);/#1Out.writeByte(Oxbl);/returnOut.writeShort(O);Out.writeShort(O);for(inti=O;i<Methods.size();i+)Out.WriteShort(0x0009);/accessflagOut.writeShort(FunctionNode)(Methods.get(i).name_index);Out.WriteShort(FunctionNode)(Methods.get(i).descriptor_index)9Out.WriteShort(1);/attributecountOut.writeShort(38);/attribute_name_index:CodeOut.writelnt(FunctionNode)(Methods.get(i).code.Code1.ength12);FunctionNodeFunc=(FunctionNode)(Methods.get(i);Out.WriteShort(Func,code.maxstack);Out.writeShort(Func.1.ocalVars);/Out.WriteShort(100);/Out.writeShort(100);Out.writelnt(FunctionNode)(Methods.get(i).code.Code1.ength);for(intj=O;j<Func.code.Instructions1.ist.size();j+)(Out.write(Func.code.Instructions1.ist.get(j).dump();)Out.writeShort(O);/exception_table_lengthOut.writeShort(O);/attributes_count)Out.writeShort(0x0009);/accessflagOut.writeShort(27);/mainOut.writeShort(28);/(1.java/lang/String;)VOut.writeShort(1);/attributecountOut.writeShort(38);/attribute_name_index:CodeOut.writelnt(Table.MainProg.Code1.ength+12);/Out.writeShort(100);Out.writeShort(Table.MainProg.maxstack);Out.writeShort(1);Out.writelnt(Table,MainProg.Code1.ength);for(intj=O;j<Table.MainProg.Instructions1.ist.size();j+)/C1.+=Func.code.Instructions1.ist.get(j).dump().length;Out.write(Table,MainProg.Instructions1.ist.get(j).dump();)Out.writeShort(O);Out.writeShort(O);Out.writeShort(O);/attributes_count/Out.writeShort(O);catch(FileNotFoundExceptionE)util.println(nCannotWriteToFile.,);finallyOut.close();)*CompileCannotContinue.java*Createdon2005Ae2A21EOzEIIq1:14*1.astmodify:2005-3-2.*Author:WAngNan(BHU32060601)* Thisprogramisfreesoftware;youcanredistributeitand/ormodifyThisprogramisfreesoftware;youcanredistributeitand/ormodify*itunderthetermsoftheGNUGeneralPublic1.icenseaspublishedby*theFreeSoftwareFoundation;eitherversion2ofthe1.icense,* itunderthetermsoftheGNUGeneralPublic1.icenseaspublishedby* theFreeSoftwareFoundation;eitherversion2ofthe1.icense,or* (atyouroption)anylaterversion.packageexceptions;* authorwn* /publicclassCompileCannotContinueextendsExceptionpublicint1.ine;publicintChars;publicCompileCannotContinue(StringDescription,int1.ine,intChars)super(Description);this.1.ine=1.ine;this.Chars=Chars;)* ExperssionFail.java*Createdon2005Ae20A22EzIAI526*1.astmodify:2005-2-22.*Author:WAngNan(BHU32060601)oryouroption)anylaterversion.packageexceptions;* 0authorwn*/publicclassExpressionFailextendsException)Thisprogramisfreesoftware;youcanredistributeitand/ormodify*itunderthetermsoftheGNUGeneralPublic1.icenseaspublishedby*theFreeSoftwareFoundation;eitherversion2ofthe1.icense,or*(atyouroption)anylaterversion.* PhraserError.java*Createdon2005Ae2A21Ez6ltl15*1.astmodify:2005-2-21.*Author:WAngNan(BHU32060601)packageexceptions;* ©authorwn*/publicclassPhraserErrorextendsException*TypeConfict.java*Createdon2005Ae20A21EzEIIll6*1.astmodify:2005-2-23.*Author:WAngNan(BHU32060601)* Thisprogramisfreesoftware;youcanredistributeitand/ormodify* itunderthetermsoftheGNUGeneralPublic1.icenseaspublishedby* theFreeSoftwareFoundation;eitherversion2ofthe1.icense,or* (atyouroption)anylaterversion.packageexceptions;importglobal.*;/* 0authorwn* /publicclassTypeConflictextendsExceptionpublicTAB1.E_NODEJrYPESwant;publicTAB1.ElNoDElTYPESmet;*CreatesanewinstanceofTypeConfilit*/publicTypeConflict(TAB1.E_NODE_TYPESwant,TAB1.E_NODE_TYPESmet)this.want=want;this.met=met;)* CodeGener.java* Createdon2005Ae2A22E0z!Atllj54* 1.astmodify:2005-2-26.* Author:WAngNan(BHU32060601)* Thisprogramisfreesoftware;youcanredistributeitand/ormodify* itunderthetermsoftheGNUGeneralPublic1.icenseaspublishedby* theFreeSoftwareFoundation;eitherversion2ofthe1.icense,or* (atyouroption)anylaterversion.packagegencodes;importattributesincomile.*;importexceptions.*;importglobal.*;importInstructionsused.*;importtables.*;importtokens.*;* 0authorwn* /publicclassCodeGenerprivateCodeGener()publicstaticvoid1.oadIntConst(Codecode,intValue)if(Value<=255)if(Value=O)code.append(newICONST(O);/Gen:iconst_0elseif(Value=1)code.append(newICONST(1);/Gen:iconst_lelseif(Value=2)code.append(newICONST(2);/Gen:iconst_2elseif(Value=3)code.append(newICONST(3);/Gen:iconst_3elseif(Value=4)code.append(newICONST(4);/Gen:iconst_4elseif(Value=5)code.append(newICONST(5);/Gen:iconst_5elsecode.append(newBIPUSH(Value);)/elseif(Value<=65535)code.append(newSIPUSH(Value);)elseCompileTimeCPNodeNode=(newCompileTimeCP().get(CONSTANT_POO1._NODE_TYPE.INTEGER,newInteger(Value);code.append(new1.DC_W(Node);publicstaticvoid1.oadFloatConst(Codecode,floatValue)CompileTimeCPNodeNode=(newCompileTimeCPO).get(CONSTANT_POO1._NODE_TYPE.F1.OAT,newFloat(Value);code.append(new1.DC_W(Node);publicstaticvoid1.oadStringConst(Codecode.StringValue)ConipileTimeCPNodeNode=(newCompileTimeCPO).get(CONSTANT_POO1._NODE_TYPE.STRING,Value);code.append(new1.DC_W(Node);)publicstaticvoid1.oadFrom1.ocalVar(Codecode,1.ocalTableNodeVar)if(Var.Type=TAB1.E_NODE_TYPES.CHAR)(Var.Type=TAB1.E_NODE_TYPES.INTEGER)II(Var.Type=TAB1.E_NODE_TYPES.BOO1.EAN)code.append(newI1.OAD(Var.Index);elsecode.append(newF1.OAD(Var.Index);publicstaticvoid1.oaclFromGloblVar(Codecode,GlobalTableNodeVar)code.append(newGETSTATIC(Var);publicstaticvoid1.oadFromGloblArrayStart(Codecode,GlobalTableNodeArray)1.oadFromGloblVar(code,Array);publicstaticvoid1.oadFrom1.ocalArrayStart(Codecode,1.ocalTableNodearray)code.append(newA1.OAD(array.Index);publicstaticvoidStoreTo1.ocalArrayStart(Codecode,1.ocalTableNodearray)code.append(newA1.OAD(array.Index);)publicstaticvoid1.oadFromArrayOver(Codecode,TableNodearray)/util.debug_report(,genaload,+array);if(array.getType()=TAB1.E_NODE_TYPES.INTEGER)(array.getType()=TAB1.E_NODE_TYPES.CHAR)(array.getType()=TAB1.ElNODEiTYPES.BOO1.EAN)code.append(newIA1.OAD();elsecode.append(newFA1.OAD();)Var)publicstaticvoidStoreToGlobalVar(Codecode,GlobalTableNodecode.append(newPUTSTATIC(Var);)publicstaticvoidStoreTo1.ocalVar(Codecode,1.ocalTableNodeVar)if(Var.Type=TAB1.E_NODE_TYPES.INTEGER)(Var.Type=TAB1.E_NODE_TYPES.CHAR)(Var.Type=TAB1.ElNODETYPES.Boo1.EAN)code.append(newISTORE(Var.Index);elsecode.append(newFSTORE(Var.Index);)publicstaticvoidStoreToGlobalArrayStart(Codecode,GlobalTableNodeArray)1.oadFrom

    注意事项

    本文(jpl0cproject的所有源文件.docx)为本站会员(夺命阿水)主动上传,课桌文档仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知课桌文档(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-1

    经营许可证:宁B2-20210002

    宁公网安备 64010402000986号

    课桌文档
    收起
    展开