INTEGER RD(884) INTEGER T INTEGER ROW1(500),ROW2(500) INTEGER GETROW,CMPROW,LOADRD,ISATTY IF((LOADRD(RD,-10).EQ.-2))GOTO 10000 CALL ERROR('Can''t access input relation.') 10000 CALL SAVERD(RD,-11) IF((ISATTY(-11).NE.1))GOTO 10001 CALL PRINT0(RD,-11) 10001 T=GETROW(RD,-10,ROW1) 10002 IF((T.EQ.-1))GOTO 10003 T=GETROW(RD,-10,ROW2) GOTO 10006 10004 T=GETROW(RD,-10,ROW2) 10006 IF((T.EQ.-1))GOTO 10005 IF((CMPROW(RD,ROW1,ROW2).NE.1))GOTO 10005 GOTO 10004 10005 CALL PUTROW(RD,-11,ROW1) IF((T.NE.-1))GOTO 10007 GOTO 10003 10007 T=GETROW(RD,-10,ROW1) GOTO 10010 10008 T=GETROW(RD,-10,ROW1) 10010 IF((T.EQ.-1))GOTO 10009 IF((CMPROW(RD,ROW1,ROW2).NE.1))GOTO 10009 GOTO 10008 10009 CALL PUTROW(RD,-11,ROW2) GOTO 10002 10003 IF((ISATTY(-11).NE.1))GOTO 10011 CALL PRINU0(RD,-11) 10011 CALL SWT END INTEGER FUNCTION CMPROW(RD,ROW1,ROW2) INTEGER RD(884) INTEGER ROW1(500),ROW2(500) INTEGER I I=RD(3) GOTO 10014 10012 I=I-(1) 10014 IF((I.LE.0))GOTO 10013 IF((ROW1(I).EQ.ROW2(I)))GOTO 10015 CMPROW=0 RETURN 10015 GOTO 10012 10013 CMPROW=1 RETURN END INTEGER FUNCTION LOADRD(RD,FD) INTEGER RD(884) INTEGER FD INTEGER ISATTY,READF IF((ISATTY(FD).NE.1))GOTO 10016 CALL REMARK('Sorry, a relation can''t be read from the terminal. *') LOADRD=-3 RETURN 10016 IF((READF(RD(1),1,FD).NE.-1))GOTO 10017 LOADRD=-3 RETURN 10017 IF((READF(RD(2),RD(1)-1,FD).NE.-1))GOTO 10018 CALL REMARK('relation is corrupted!!.') LOADRD=-3 RETURN 10018 LOADRD=-2 RETURN END SUBROUTINE SAVERD(RD,FD) INTEGER RD(884) INTEGER FD INTEGER ISATTY IF((ISATTY(FD).NE.1))GOTO 10019 CALL PRINV0(RD,FD) GOTO 10020 10019 CALL WRITEF(RD,RD(1),FD) 10020 RETURN END SUBROUTINE PRINV0(RD,FD) INTEGER RD(884) INTEGER FD INTEGER I INTEGER TYPE(102) INTEGER AAAAA0(10) INTEGER AAAAB0(33) INTEGER AAAAC0(10) INTEGER AAAAD0 INTEGER AAAAE0(8) INTEGER AAAAF0(5) INTEGER AAAAG0(7) INTEGER AAAAH0(24) INTEGER AAAAI0(10) DATA AAAAA0/170,179,185,172,172,173,248,170,238,0/ DATA AAAAB0/252,160,244,249,240,229,160,160,160,160,252,160,236,22 *9,238,231,244,232,160,252,160,238,225,237,229,170,177,179,248,252, *170,238,0/ DATA AAAAC0/170,179,185,172,172,173,248,170,238,0/ DATA AAAAE0/233,238,244,229,231,229,242,0/ DATA AAAAF0/242,229,225,236,0/ DATA AAAAG0/243,244,242,233,238,231,0/ DATA AAAAH0/252,160,170,183,243,160,252,160,170,181,233,160,160,25 *2,160,170,177,182,243,160,252,170,238,0/ DATA AAAAI0/170,179,185,172,172,173,248,170,238,0/ CALL PRINT(FD,AAAAA0) CALL PRINT(FD,AAAAB0) CALL PRINT(FD,AAAAC0) I=3+1 GOTO 10023 10021 I=I+22 10023 IF((I.GT.RD(2)))GOTO 10022 AAAAD0=RD(I) GOTO 10024 10025 CALL CTOC(AAAAE0,TYPE,102) GOTO 10026 10027 CALL CTOC(AAAAF0,TYPE,102) GOTO 10026 10028 CALL CTOC(AAAAG0,TYPE,102) GOTO 10026 10024 GOTO(10025,10027,10028),AAAAD0 10026 CALL PRINT(FD,AAAAH0,TYPE,RD(I+1),RD(I+5)) GOTO 10021 10022 CALL PRINT(FD,AAAAI0) RETURN END INTEGER FUNCTION ADDFI0(RD,TYPE,LEN,NAME) INTEGER RD(884) INTEGER TYPE,LEN INTEGER NAME(1) INTEGER I INTEGER AAAAJ0 I=RD(2)+22 IF((I+22-1.LE.884))GOTO 10029 ADDFI0=0 RETURN 10029 RD(I)=TYPE RD(I+4)=LENGTH(NAME) AAAAJ0=TYPE GOTO 10030 10031 RD(I+1)=2 RD(I+4)=MAX0(RD(I+4),10) GOTO 10032 10033 RD(I+1)=4 RD(I+4)=MAX0(RD(I+4),15) GOTO 10032 10034 RD(I+1)=LEN RD(I+4)=MAX0(RD(I+4),LEN) GOTO 10032 10030 GOTO(10031,10033,10034),AAAAJ0 CALL ERROR('in add_field_to_rd: bogus type passed.') 10032 RD(I+2)=RD(3)+1 RD(I+3)=RD(3)+RD(I+1) CALL CTOC(NAME,RD(I+5),17) RD(1)=RD(1)+(22) RD(2)=RD(2)+(22) RD(3)=RD(3)+(RD(I+1)) IF((RD(3).LE.500))GOTO 10035 ADDFI0=0 RETURN 10035 ADDFI0=I RETURN END INTEGER FUNCTION FINDF0(RD,NAME) INTEGER RD(884) INTEGER NAME(1) INTEGER I INTEGER EQUAL I=3+1 GOTO 10038 10036 I=I+22 10038 IF((I.GT.RD(2)))GOTO 10037 IF((EQUAL(RD(I+5),NAME).NE.1))GOTO 10039 FINDF0=I RETURN 10039 GOTO 10036 10037 FINDF0=0 RETURN END INTEGER FUNCTION COMPA0(TYPE,BUF1,BUF2) INTEGER TYPE INTEGER BUF1(500),BUF2(500) INTEGER R INTEGER COMPB0,COMPC0,COMPD0 INTEGER AAAAK0 INTEGER AAAAL0(34) DATA AAAAL0/233,238,160,227,239,237,240,225,242,229,223,230,233,22 *9,236,228,186,160,226,239,231,245,243,160,244,249,240,229,160,170, *233,170,238,0/ AAAAK0=TYPE GOTO 10040 10041 R=COMPB0(BUF1,BUF2) GOTO 10042 10043 R=COMPC0(BUF1,BUF2) GOTO 10042 10044 R=COMPD0(BUF1,BUF2) GOTO 10042 10040 GOTO(10041,10043,10044),AAAAK0 CALL PRINT(-15,AAAAL0,TYPE) R=2 10042 COMPA0=R RETURN END INTEGER FUNCTION COMPB0(I1,I2) INTEGER * 4 I1,I2 IF((I1.GE.I2))GOTO 10045 COMPB0=1 RETURN 10045 IF((I1.LE.I2))GOTO 10046 COMPB0=3 RETURN 10046 COMPB0=2 RETURN END INTEGER FUNCTION COMPC0(D1,D2) REAL * 8 D1,D2 IF((D1.GE.D2))GOTO 10047 COMPC0=1 RETURN 10047 IF((D1.LE.D2))GOTO 10048 COMPC0=3 RETURN 10048 COMPC0=2 RETURN END INTEGER FUNCTION COMPD0(S1,S2) INTEGER S1(1),S2(1) INTEGER I I=1 GOTO 10051 10049 I=I+(1) 10051 IF((S1(I).NE.S2(I)))GOTO 10050 IF((S1(I).EQ.0))GOTO 10050 GOTO 10049 10050 IF((S1(I).NE.S2(I)))GOTO 10052 COMPD0=2 RETURN 10052 IF((S1(I).EQ.0))GOTO 10054 IF((S1(I).LT.S2(I)))GOTO 10054 GOTO 10053 10054 COMPD0=1 RETURN 10053 COMPD0=3 RETURN END SUBROUTINE PRINT0(RD,FD) INTEGER RD(884) INTEGER FD INTEGER I INTEGER AAAAM0(2) INTEGER AAAAN0(7) INTEGER AAAAO0(3) INTEGER AAAAP0(2) INTEGER AAAAQ0(7) INTEGER AAAAR0(3) INTEGER AAAAS0(2) INTEGER AAAAT0(7) INTEGER AAAAU0(3) DATA AAAAM0/173,0/ DATA AAAAN0/170,163,172,172,173,248,0/ DATA AAAAO0/170,238,0/ DATA AAAAP0/252,0/ DATA AAAAQ0/160,170,163,243,160,252,0/ DATA AAAAR0/170,238,0/ DATA AAAAS0/173,0/ DATA AAAAT0/170,163,172,172,173,248,0/ DATA AAAAU0/170,238,0/ CALL PRINT(FD,AAAAM0) I=3+1 GOTO 10057 10055 I=I+22 10057 IF((I.GT.RD(2)))GOTO 10056 CALL PRINT(FD,AAAAN0,RD(I+4)+3) GOTO 10055 10056 CALL PRINT(FD,AAAAO0) CALL PRINT(FD,AAAAP0) I=3+1 GOTO 10060 10058 I=I+22 10060 IF((I.GT.RD(2)))GOTO 10059 CALL PRINT(FD,AAAAQ0,RD(I+4),RD(I+5)) GOTO 10058 10059 CALL PRINT(FD,AAAAR0) CALL PRINT(FD,AAAAS0) I=3+1 GOTO 10063 10061 I=I+22 10063 IF((I.GT.RD(2)))GOTO 10062 CALL PRINT(FD,AAAAT0,RD(I+4)+3) GOTO 10061 10062 CALL PRINT(FD,AAAAU0) RETURN END SUBROUTINE PRINU0(RD,FD) INTEGER RD(884) INTEGER FD INTEGER I INTEGER AAAAV0(2) INTEGER AAAAW0(7) INTEGER AAAAX0(3) DATA AAAAV0/173,0/ DATA AAAAW0/170,163,172,172,173,248,0/ DATA AAAAX0/170,238,0/ CALL PRINT(FD,AAAAV0) I=3+1 GOTO 10066 10064 I=I+22 10066 IF((I.GT.RD(2)))GOTO 10065 CALL PRINT(FD,AAAAW0,RD(I+4)+3) GOTO 10064 10065 CALL PRINT(FD,AAAAX0) RETURN END SUBROUTINE PRINW0(RD,FD,BUF) INTEGER RD(884) INTEGER FD INTEGER BUF(500) INTEGER I INTEGER AAAAY0(2) INTEGER AAAAZ0 INTEGER AAABA0(7) INTEGER AAABB0(7) INTEGER AAABC0(9) INTEGER AAABD0(3) DATA AAAAY0/252,0/ DATA AAABA0/160,170,163,236,160,252,0/ DATA AAABB0/160,170,163,228,160,252,0/ DATA AAABC0/160,170,163,172,163,243,160,252,0/ DATA AAABD0/170,238,0/ CALL PRINT(FD,AAAAY0) I=3+1 GOTO 10069 10067 I=I+22 10069 IF((I.GT.RD(2)))GOTO 10068 AAAAZ0=RD(I) GOTO 10070 10071 CALL PRINT(FD,AAABA0,RD(I+4),BUF(RD(I+2))) GOTO 10072 10073 CALL PRINT(FD,AAABB0,RD(I+4),BUF(RD(I+2))) GOTO 10072 10074 CALL PRINT(FD,AAABC0,RD(I+4),RD(I+1),BUF(RD(I+2))) GOTO 10072 10070 GOTO(10071,10073,10074),AAAAZ0 10072 GOTO 10067 10068 CALL PRINT(FD,AAABD0) RETURN END INTEGER FUNCTION GETROW(RD,FD,BUF) INTEGER RD(884) INTEGER FD INTEGER BUF(500),I INTEGER READF I=READF(BUF,RD(3),FD) GETROW=I RETURN END SUBROUTINE PUTROW(RD,FD,BUF) INTEGER RD(884) INTEGER FD INTEGER BUF(500) INTEGER ISATTY IF((ISATTY(FD).NE.1))GOTO 10075 CALL PRINW0(RD,FD,BUF) GOTO 10076 10075 CALL WRITEF(BUF,RD(3),FD) 10076 RETURN END SUBROUTINE GETDA0(RD,I,BUF,DEST) INTEGER RD(884) INTEGER I,BUF(1),DEST(102) INTEGER J,K INTEGER AAABE0 AAABE0=RD(I) GOTO 10077 10078 J=RD(I+2) DEST(1)=BUF(J) DEST(2)=BUF(J+1) GOTO 10079 10080 J=RD(I+2) DEST(1)=BUF(J) DEST(2)=BUF(J+1) DEST(3)=BUF(J+2) DEST(4)=BUF(J+3) GOTO 10079 10081 J=RD(I+3) K=RD(I+1) GOTO 10084 10082 J=J-(1) K=K-(1) 10084 IF((K.LE.0))GOTO 10083 IF((BUF(J).NE.160))GOTO 10083 GOTO 10082 10083 DEST(K+1)=0 GOTO 10087 10085 J=J-(1) K=K-(1) 10087 IF((K.LE.0))GOTO 10086 DEST(K)=BUF(J) GOTO 10085 10086 GOTO 10079 10077 GOTO(10078,10080,10081),AAABE0 10079 RETURN END SUBROUTINE PUTDA0(RD,I,BUF,SRC) INTEGER RD(884) INTEGER I,BUF(1),SRC(102) INTEGER J,K INTEGER AAABF0 AAABF0=RD(I) GOTO 10088 10089 J=RD(I+2) BUF(J)=SRC(1) BUF(J+1)=SRC(2) GOTO 10090 10091 J=RD(I+2) BUF(J)=SRC(1) BUF(J+1)=SRC(2) BUF(J+2)=SRC(3) BUF(J+3)=SRC(4) GOTO 10090 10092 J=RD(I+2) K=1 GOTO 10095 10093 J=J+(1) K=K+(1) 10095 IF((SRC(K).EQ.0))GOTO 10094 IF((K.GT.RD(I+1)))GOTO 10094 BUF(J)=SRC(K) GOTO 10093 10094 GOTO 10098 10096 K=K+(1) J=J+(1) 10098 IF((K.GT.RD(I+1)))GOTO 10097 BUF(J)=160 GOTO 10096 10097 GOTO 10090 10088 GOTO(10089,10091,10092),AAABF0 10090 RETURN END INTEGER FUNCTION COMPE0(RD,ROW1,ROW2) INTEGER RD(884) INTEGER ROW1(500),ROW2(500) INTEGER BUF1(500),BUF2(500) INTEGER R,I INTEGER COMPA0 I=3+1 GOTO 10101 10099 I=I+22 10101 IF((I.GT.RD(2)))GOTO 10100 CALL GETDA0(RD,I,ROW1,BUF1) CALL GETDA0(RD,I,ROW2,BUF2) R=COMPA0(RD(I),BUF1,BUF2) IF((R.EQ.2))GOTO 10102 COMPE0=R RETURN 10102 GOTO 10099 10100 COMPE0=2 RETURN END C ---- Long Name Map ---- C comparefield compa0 C printheader print0 C comparerow compe0 C printtrailer prinu0 C compareinteger compb0 C comparestring compd0 C putdata putda0 C findfield findf0 C printrd prinv0 C printrow prinw0 C comparereal compc0 C getdata getda0 C addfieldtord addfi0