Package org.openquark.cal.internal.serialization.RecordInputStream

Examples of org.openquark.cal.internal.serialization.RecordInputStream.RecordHeaderInfo


             * @param msgLogger
             * @return an instance of ErrorInfo
             * @throws IOException
             */
            public static LetDefn load (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
                RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.EXPRESSION_LET_DEFN);
                if (rhi == null) {
                    throw new IOException ("Unable to find record header for LetDefn");
                }
                DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "Expression.Let.LetDefn", msgLogger);
               
                String var = s.readUTF ();
                int useCount = s.readInt ();
                Expression expr = Expression.load(s, mti, msgLogger);
                TypeExpr varType = TypeExpr.load(s, mti, msgLogger);
View Full Code Here


     * @param moduleName the name of the module being loaded
     * @param msgLogger the logger to which to log deserialization messages.
     * @return a CALDocComment instance deserialized from the stream.
     */
    static CALDocComment load(final RecordInputStream s, final ModuleName moduleName, final CompilerMessageLogger msgLogger) throws IOException {
        final RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.CALDOC_COMMENT);
        if (rhi == null) {
            throw new IOException ("Unable to find CALDoc record header.");
        }
       
        // the description block
View Full Code Here

         * @return a Paragraph instance deserialized from the stream.
         */
        static Paragraph loadWithRecordTag(final RecordInputStream s) throws IOException {
            final short[] paragraphRecordTags = PARAGRAPH_RECORD_TAGS;
           
            final RecordHeaderInfo rhi = s.findRecord(paragraphRecordTags);
            if (rhi == null) {
                throw new IOException("Unable to find Paragraph record header.");
            }
           
            Paragraph paragraph;
           
            switch (rhi.getRecordTag()) {
            case ModuleSerializationTags.CALDOC_TEXT_PARAGRAPH:
                paragraph = TextParagraph.load(s);
                break;
           
            case ModuleSerializationTags.CALDOC_LIST_PARAGRAPH:
                paragraph = ListParagraph.load(s);
                break;
           
            default:
                throw new IOException("Unrecognized record tag of " + rhi.getRecordTag() + " for Paragraph.");
            }
           
            s.skipRestOfRecord();
            return paragraph;
        }
View Full Code Here

         * @return a Segment instance deserialized from the stream.
         */
        static Segment loadWithRecordTag(final RecordInputStream s) throws IOException {
            final short[] paragraphRecordTags = SEGMENT_RECORD_TAGS;
           
            final RecordHeaderInfo rhi = s.findRecord(paragraphRecordTags);
            if (rhi == null) {
                throw new IOException("Unable to find Segment record header.");
            }
           
            Segment segment;
           
            switch (rhi.getRecordTag()) {
            case ModuleSerializationTags.CALDOC_PLAIN_TEXT_SEGMENT:
                segment = PlainTextSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_URL_SEGMENT:
                segment = URLSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_MODULE_LINK_SEGMENT:
                segment = ModuleLinkSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_FUNCTION_OR_CLASS_METHOD_LINK_SEGMENT:
                segment = FunctionOrClassMethodLinkSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_TYPE_CONS_LINK_SEGMENT:
                segment = TypeConsLinkSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_DATA_CONS_LINK_SEGMENT:
                segment = DataConsLinkSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_TYPE_CLASS_LINK_SEGMENT:
                segment = TypeClassLinkSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_CODE_SEGMENT:
                segment = CodeSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_EMPHASIZED_SEGMENT:
                segment = EmphasizedSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_STRONGLY_EMPHASIZED_SEGMENT:
                segment = StronglyEmphasizedSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_SUPERSCRIPT_SEGMENT:
                segment = SuperscriptSegment.load(s);
                break;
               
            case ModuleSerializationTags.CALDOC_SUBSCRIPT_SEGMENT:
                segment = SubscriptSegment.load(s);
                break;
               
            default:
                throw new IOException("Unrecognized record tag of " + rhi.getRecordTag() + " for Segment.");
            }
           
            s.skipRestOfRecord();
            return segment;
        }
View Full Code Here

         * @param s RecordOutputStream to deserialize from
         * @return GeneratedCodeInfo deserialized from s
         * @throws IOException
         */
        static GeneratedCodeInfo load(RecordInputStream s) throws IOException {
            RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.LECC_GENERATED_CODE_INFO);
            if (rhi == null) {
                throw new IOException ("Unable to find generated module info record.");
            }
            return load(s, rhi.getSchema());
        }
View Full Code Here

     * @throws IOException
     */
    @Override
    protected MachineFunction loadMachineFunction(RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
        // Load the record header and determine which actual class we are loading.
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.LECC_MACHINE_FUNCTION);
        if (rhi == null) {
            throw new IOException ("Unable to find record header for LECCMachineFunction.");
        }
       
        LECCMachineFunction mf = new LECCMachineFunction();
        mf.readContent(s, rhi.getSchema(), mti, msgLogger);
        s.skipRestOfRecord();
       
        return mf;
    }
View Full Code Here

             * @param msgLogger the logger to which to log deserialization messages.
             * @return an instance of SwitchAlt
             * @throws IOException
             */
            public static SwitchAlt load (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
                RecordHeaderInfo rhi = s.findRecord(SWITCH_ALT_RECORD_TAGS);
                if (rhi == null) {
                    throw new IOException ("Unable to find SwitchAlt record header.");
                }
                DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "Expression.Switch.SwitchAlt", msgLogger);
               
                if (rhi.getRecordTag() == ModuleSerializationTags.EXPRESSION_SWITCHALT_MATCHING) {
                    return SwitchAlt.Matching.load(s, rhi.getSchema(), mti, msgLogger);
                } else
                if (rhi.getRecordTag() == ModuleSerializationTags.EXPRESSION_SWITCHALT_POSITIONAL) {
                    return SwitchAlt.Positional.load(s, rhi.getSchema(), mti, msgLogger);
                } else {
                    throw new IOException ("Unhandled SwitchAlt record tag " + rhi.getRecordTag() + ".");
                }
            }
View Full Code Here

                    throw new IOException ("Unhandled SwitchAlt record tag " + rhi.getRecordTag() + ".");
                }
            }
           
            private void readContent (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
                RecordHeaderInfo rhi = s.findRecord (ModuleSerializationTags.EXPRESSION_SWITCHALT);
                if (rhi == null) {
                    throw new IOException ("Unable to find SwitchAltRecordHeader.");
                }
                DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "Expression.Switch.SwitchAlt", msgLogger);
               
                int nTags = s.readIntCompressed();
                altTags = new ArrayList<Object> ();
                for (int i = 0; i < nTags; ++i) {
                    byte tagType = s.readByte();
View Full Code Here

        s.endRecord();
    }
   
    static ModuleSourceMetrics load(RecordInputStream s, ModuleTypeInfo moduleTypeInfo, CompilerMessageLogger msgLogger) throws IOException {
        // Look for Record header.
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.MODULE_SOURCE_METRICS);
        if(rhi == null) {
           throw new IOException("Unable to find ForeignFunctionInfo record header.");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, moduleTypeInfo.getModuleName(), "ModuleSourceMetrics", msgLogger);
       
        ModuleSourceMetrics metrics = new ModuleSourceMetrics();
       
        // moduleTypeInfo
        metrics.moduleTypeInfo = moduleTypeInfo;
View Full Code Here

     * @return and instance of KindExpr.
     * @throws IOException
     */
    static KindExpr load (RecordInputStream s, ModuleName moduleName, CompilerMessageLogger msgLogger) throws IOException {
       
        RecordHeaderInfo rhi = s.findRecord(KIND_EXPR_RECORD_TAGS);
       
        switch (rhi.getRecordTag()) {
            case ModuleSerializationTags.KIND_EXPR_KIND_CONSTANT:          
                return KindConstant.load(s, rhi.getSchema(), moduleName, msgLogger);
           
            case ModuleSerializationTags.KIND_EXPR_KIND_FUNCTION:
                return KindFunction.load(s, rhi.getSchema(), moduleName, msgLogger);
                          
            default:
                throw new IOException ("Unexpected record tag while loading KindExpr: " + rhi.getRecordTag());
        }
    }
View Full Code Here

TOP

Related Classes of org.openquark.cal.internal.serialization.RecordInputStream.RecordHeaderInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.