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

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


    static final LocalFunctionIdentifier load (RecordInputStream s, ModuleName moduleName, CompilerMessageLogger msgLogger) throws IOException {
        int nErrorsBeforeLoad = msgLogger.getNErrors();
       
        try {
            // Look for Record header.
            RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.LOCAL_FUNCTION_IDENTIFIER);
            if (rhi == null) {
                throw new IOException("Unable to find LocalFunction record header.");
            }
            DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, moduleName, "LocalFunction", msgLogger);

            int index = s.readIntCompressed();
            String localFunctionName = s.readUTF();
            QualifiedName toplevelFunctionName = s.readQualifiedName();
           
View Full Code Here


     * @param msgLogger the logger to which to log deserialization messages.
     * @throws IOException
     */
    void readContent (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
        // Look for record header.
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.SCOPED_ENTITY);
        if (rhi == null) {
            throw new IOException ("Unable to find ScopedEntity record header.");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "ScopedEntity", msgLogger);
       
        name = s.readQualifiedName();
        scope = Scope.load(s, mti.getModuleName(), msgLogger);
       
        // CALDoc comment
View Full Code Here

     * @param msgLogger the logger to which to log deserialization messages.
     * @throws IOException
     */
    private void readInit (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
        // Look for Record header.
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.TYPE_CLASS);
        if (rhi == null) {
            throw new IOException("Unable to find TypeClass record header.");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "TypeClass", msgLogger);
       
        super.readContent(s, mti, msgLogger);
       
        // Now that we've read/set the name of this TypeClass we can add it to the ModuleTypeInfo.
        mti.addTypeClass(this);
View Full Code Here

     * @param msgLogger the logger to which to log deserialization messages.
     * @throws IOException
     */
    private void readFinal (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
        // Look for Record header.
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.TYPE_CLASS);
        if(rhi == null) {
            throw new IOException("Unable to find TypeClass record header.");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "TypeClass", msgLogger);
       
        // Now get the record header for the parent members and skip the entire record.
        RecordHeaderInfo parentHeader = s.findRecord(ModuleSerializationTags.SCOPED_ENTITY);
        if(parentHeader == null) {
            throw new IOException("Unable to find ScopedEntityImpl record header while loading TypeClass " + getName() + ".");
        }
        s.skipRestOfRecord();
       
View Full Code Here

     * @throws IOException
     */
    @Override
    void readContent (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
        // Look for record header.
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.FUNCTIONAL_AGENT);
        if (rhi == null) {
            throw new IOException ("Unable to find FunctionalAgent record header.");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "FunctionalAgent", msgLogger);

        super.readContent(s, mti, msgLogger);
       
        int nArgs = s.readShortCompressed();
        argumentNames = new String[nArgs];
View Full Code Here

     * @param msgLogger the logger to which to log deserialization messages.
     * @return an instance of ForeignTypeInfo.
     * @throws IOException
     */
    final static ForeignTypeInfo load (RecordInputStream s, ModuleName moduleName, final ClassLoader foreignClassLoader, CompilerMessageLogger msgLogger) throws IOException {
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.FOREIGN_TYPE_INFO);
        if (rhi == null) {
            throw new IOException("Unable to find record header for ForeignTypeInfo.");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, moduleName, "ForeignTypeInfo", msgLogger);

        final QualifiedName calName = s.readQualifiedName();
        Scope implementationVisibility = Scope.load(s, moduleName, msgLogger);
        final String className = s.readUTF();
        try {
View Full Code Here

     * @throws IOException
     */
    static final TypeExpr load (RecordInputStream s, ModuleTypeInfo mti, Map<Short, TypeExpr> visitedTypeExpr, Map<Short, RecordVar> visitedRecordVar, CompilerMessageLogger msgLogger) throws IOException {
       
        // Determine which specific class this serialized instance is.
        RecordHeaderInfo rhi = s.findRecord(TYPE_EXPR_RECORD_TAGS);
        if (rhi == null) {
            throw new IOException ("Unable to find TypeExpr record header.");
        }
       
        // Based on the record tag load the actual instance.
        switch (rhi.getRecordTag()) {
       
            case ModuleSerializationTags.STATIC_CONSTANT_TYPE_EXPR:
            {
                if (rhi.getSchema() > staticConstantTypeExprSerializationSchema) {
                    throw new IOException("Stored schema " + rhi.getSchema() " is greater than current schema " + staticConstantTypeExprSerializationSchema + " when loading a static constant TypeExpr.");
                }
                String constName = s.readUTF();
                s.skipRestOfRecord();
                                                         
                if (constName.equals ("EMPTY_RECORD")) {
                    return EMPTY_RECORD;
                } else {
                   
                }
            }
           
            case ModuleSerializationTags.ALREADY_VISITED_TYPE_EXPR:
            {
                // This is a reference to an existing instance.  The instance should be
                // in the visitedTypeExpr map.
                if (rhi.getSchema() > alreadyVisitedTypeExprSerializationSchema) {
                    throw new IOException("Stored schema " + rhi.getSchema() " is greater than current schema " + alreadyVisitedTypeExprSerializationSchema + " loading an already visited TypeExpr.");
                }
               
                // Read the key and do the lookup.
                short id = s.readShortCompressed();
                TypeExpr te = visitedTypeExpr.get(new Short(id));
                if (te == null) {
                    throw new IOException ("Unable to resolve previously encountered TypeExpr instance in TypeExpr.");
                }
                s.skipRestOfRecord();
                return te;
            }
           
            case ModuleSerializationTags.TYPE_CONSTRUCTOR:
            {
                return TypeConsApp.load(s, rhi.getSchema(), mti, visitedTypeExpr, visitedRecordVar, msgLogger);            
            }
           
            case ModuleSerializationTags.TYPE_APP:
            {
                return TypeApp.load(s, rhi.getSchema(), mti, visitedTypeExpr, visitedRecordVar, msgLogger);
            }
           
            case ModuleSerializationTags.TYPE_VAR:
            case ModuleSerializationTags.TYPE_VAR_WITH_INSTANCE:
            {
                return TypeVar.load(s, rhi.getRecordTag(), rhi.getSchema(), mti, visitedTypeExpr, visitedRecordVar, msgLogger);               
            }
           
            case ModuleSerializationTags.RECORD_TYPE:
            {
                return RecordType.load(s, rhi.getSchema(), mti, visitedTypeExpr, visitedRecordVar, msgLogger);              
            }
           
            default:
            {
                throw new IOException("Unexpected record tag " + rhi.getRecordTag() + " found when looking for TypeExpr.");
            }
        }
    }
View Full Code Here

     * @param msgLogger the logger to which to log deserialization messages.
     * @throws IOException
     */
    public void readContent (RecordInputStream s, Map<ModuleName, Module> otherModules, CompilerMessageLogger msgLogger) throws IOException {
        // The first thing should be the record header for the type info.
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.MODULE_TYPE_INFO);
        if (rhi == null) {
            throw new IOException ("Unable to find record for ModuleTypeInfo for Module " + getModuleName() + ".");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, getModuleName(), "ModuleTypeInfo", msgLogger);

        try {
            // Module name.
            // No need to set, that was done when the ModuleTypeInfo instance was created.
            s.readUTF();
View Full Code Here

     * @return an instance of DataConstructor.
     * @throws IOException
     */
    static final DataConstructor load (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
        // Look for Record header.
        RecordHeaderInfo rhi = s.findRecord(ModuleSerializationTags.DATA_CONSTRUCTOR);
        if(rhi == null) {
           throw new IOException("Unable to find DataConstructor record header.");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "DataConstructor", msgLogger);

        DataConstructor dc = new DataConstructor();
        try {
            dc.read(s, mti, msgLogger);
        } catch (IOException e) {
View Full Code Here

     * @param msgLogger the logger to which to log deserialization messages.
     * @return the instance of TypeConstructor with members of the ScopedEntityImpl base class loaded
     * @throws IOException
     */
    static TypeConstructor loadInit (RecordInputStream s, ModuleTypeInfo mti, CompilerMessageLogger msgLogger) throws IOException {
        RecordHeaderInfo rhi = s.findRecord(TYPE_CONSTRUCTOR_ENTITY_RECORD_TAGS);
        if (rhi == null) {
            throw new IOException ("Unable to find TypeConstructor record.");
        }
        DeserializationHelper.checkSerializationSchema(rhi.getSchema(), serializationSchema, mti.getModuleName(), "TypeConstructor", msgLogger);

        TypeConstructor typeCons = new TypeConstructor();
        try {
            // Note we must do a reassignment of the local variable tce since readInitContent
            // may return a different TypeConstructor if this is a built-in type.
            typeCons = typeCons.readInitContent(s, rhi.getSchema(), mti, msgLogger);
        } catch (IOException e) {
            QualifiedName qn = typeCons.getName();
            throw new IOException ("Error loading TypeConstructor " + (qn == null ? "" : qn.getQualifiedName()) + ": " + e.getLocalizedMessage());
        }
       
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.