Пример #1
0
static  bool    IsVariable( void ) {
//============================

    unsigned_16 flags;

    if( !RecName() )
        return( false );
    LkSym();
    flags = CITNode->flags;
    if( ( flags & SY_CLASS ) == SY_VARIABLE ) {
        if( flags & SY_SUBSCRIPTED )
            return( false );
        return( true );
    }
    if( ( flags & SY_CLASS ) == SY_SUBPROGRAM ) {
        if( ( flags & SY_SUBPROG_TYPE ) != SY_FUNCTION )
            return( false );
        if( !(flags & SY_PS_ENTRY) )
            return( false );
        GetFunctionShadow();
        return( true );
    }
    return( false );
}
Пример #2
0
static  void    SubProg( void ) {
//=========================

// Make sure subprograms are used correctly.

    unsigned_16 sp_type;

    sp_type = CITNode->flags & SY_SUBPROG_TYPE;
    if( ( sp_type == SY_REMOTE_BLOCK ) || ( sp_type == SY_PROGRAM ) ) {
        IllName( CITNode->sym_ptr );
    } else if( sp_type == SY_STMT_FUNC ) {
        if( RecNWL() ) {
            if( ASType & AST_ASF ) { // if defining s. f.
                if( CITNode->sym_ptr == SFSymId ) {
                    Error( SR_TRIED_RECURSION ); // check recursion
                }
            }
        } else {
            if( ( ASType & AST_ASF ) == 0 ) { // if not defining s. f.
                IllName( CITNode->sym_ptr );
            }
        }
    } else if( sp_type == SY_SUBROUTINE ) {
        if( RecNWL() ) {
            if( ( StmtProc == PR_CALL ) && RecTrmOpr() ) {
                if( ( CITNode->flags & SY_PS_ENTRY ) != 0 ) {
                    Extension( SR_TRIED_RECURSION );
                }
            } else {
                IllName( CITNode->sym_ptr );
            }
        } else if( ( ASType & AST_CNA ) == 0 ) {
            CkNameNoList();
        } else if( ( CITNode->flags & SY_PS_ENTRY ) != 0 ) {
            Extension( SR_TRIED_RECURSION );
        }
    } else if( sp_type == SY_FUNCTION ) {
        if( RecNWL() && SubStrung() && (CITNode->typ == FT_CHAR) &&
            (CITNode->flags & SY_PS_ENTRY) ) {
            GetFunctionShadow();
        } else if( !RecNWL() && !(ASType & AST_CNA) ) {
            if( CITNode->flags & SY_PS_ENTRY ) {
                GetFunctionShadow();
            } else {
                CkNameNoList();
            }
        } else if( ( CITNode->flags & SY_PS_ENTRY ) != 0 ) {
            Extension( SR_TRIED_RECURSION );
        } else if( CITNode->flags & SY_INTRINSIC ) {
            if( CITNode->sym_ptr->ns.si.fi.index == IF_ISIZEOF ) {
                ASType |= AST_ISIZEOF;
            }
        }
    } else if( sp_type == SY_FN_OR_SUB ) {
        if( RecNWL() ) {                        // if it's in a CALL statement
            CITNode->flags |= SY_FUNCTION;      // the class will already be
            SetTypeUsage( SY_TYPE | SY_USAGE ); // SUBROUTINE and we won't
        } else {                                // be in this part of the code
            CkNameNoList();
        }
    }
}