head 1.1; branch 1.1.1; access; symbols SFIO_1999:1.1.1.3 SFIO_1998:1.1.1.2 SFIO_1997:1.1.1.1 ATT:1.1.1; locks; strict; comment @# @; 1.1 date 96.12.05.22.23.21; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 96.12.05.22.23.21; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 97.04.08.18.29.18; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 98.11.03.14.57.28; author rse; state Exp; branches; next ; desc @@ 1.1 log @Initial revision @ text @################################################################ ## Need to hide certain names such as _doprnt, _doscan ################################################################ #pragma weak note{ compile system supports symbol transform }end link{ # main() { return _xyz(); } # #pragma weak _xyz = __xyz # #define _xyz __xyz # _xyz() { return 0; } #}end ################################################################ ## To emulate old-style stdio at binary level ################################################################ tst - output{ #include main() { printf("#define _siz_fpos_t %d\\n", sizeof(fpos_t)); exit(0); } }end FILE cnt note{ field FILE._cnt exists }end compile{ #include main() { return (stdin->_cnt == 0) ? 0 : -1; } }end FILE ptr note{ field FILE._ptr exists }end compile{ #include main() { return (stdin->_ptr == 0) ? 0 : -1; } }end FILE file note{ field FILE._file exists }end compile{ #include main() { return (stdin->_file == 0) ? 0 : -1; } }end FILE flag note{ field FILE._flag exists }end compile{ #include main() { return (stdin->_flag != 0) ? 0 : -1; } }end ############################################################################ # To emulate Linux-stdio at binary level ############################################################################ FILE readptr note{ fields FILE._IO_read_ptr/end exist }end execute{ #include main() { if(sizeof(stdin->_IO_read_ptr) != sizeof(char*) ) return 1; if(sizeof(stdin->_IO_read_end) != sizeof(char*) ) return 1; return 0; } }end FILE writeptr note{ fields FILE._IO_write_ptr/end exist }end execute{ #include main() { if(sizeof(stdin->_IO_write_ptr) != sizeof(char*) ) return 1; if(sizeof(stdin->_IO_write_end) != sizeof(char*) ) return 1; return 0; } }end FILE flags note{ field FILE._flags exists }end compile{ #include main() { return stdin->_flags == 0 ? 1 : 0; } }end FILE fileno note{ field FILE._fileno exists }end compile{ #include main() { return stdin->_fileno == 0 ? 1 : 0; } }end u flow note{ uflow() does bump buffer }end excute{ #include #if _STD_ main(int argc, char** argv) #else main(argc,argv) int argc; char** argv; #endif { FILE* f; char file[BUFSIZ]; sprintf(file,"%s.D",argv[0]); if(!(f = fopen(file,"w+")) ) exit(1); unlink(file); setbuf(f,file); fputs("123456789",f); fseek(f,0L,0); if(__uflow(f) == EOF) exit(1); if(*f->_IO_read_ptr == '1') exit(1); else exit(0); } }end under flow note{ underflow() does not bump buffer }end excute{ #include #if _STD_ main(int argc, char** argv) #else main(argc,argv) int argc; char** argv; #endif { FILE* f; char file[BUFSIZ]; sprintf(file,"%s.D",argv[0]); if(!(f = fopen(file,"w+")) ) exit(1); unlink(file); setbuf(f,file); fputs("123456789",f); fseek(f,0L,0); if(__underflow(f) == EOF) exit(1); if(*f->_IO_read_ptr == '1') exit(0); else exit(1); } }end ###################################################################### # To emulate BSD-style stdio ###################################################################### FILE p note{ FILE._p field }end compile{ #include main() { return stdin->_p == 0 ? 0 : 1; } }end FILE r note{ FILE._r field }end compile{ #include main() { return stdin->_r == 0 ? 0 : 1; } }end FILE w note{ FILE._w field }end compile{ #include main() { return stdout->_w == 0 ? 0 : 1; } }end @ 1.1.1.1 log @Import of Sfio1997 @ text @@ 1.1.1.2 log @Import of Sfio1998 @ text @a20 17 FILE _cnt note{ field FILE.__cnt exists }end compile{ #include main() { return (stdin->__cnt == 0) ? 0 : -1; } }end FILE _ptr note{ field FILE.__ptr exists }end compile{ #include main() { return (stdin->__ptr == 0) ? 0 : -1; } }end FILE _file note{ field FILE.__file exists }end compile{ #include main() { return (stdin->__file == 0) ? 0 : -1; } }end FILE _flag note{ field FILE.__flag exists }end compile{ #include main() { return (stdin->__flag == 0) ? 0 : -1; } }end d35 1 a35 20 main() { return (stdin->_flag == 0) ? 0 : -1; } }end cat{ #if _FILE__cnt && ! _FILE_cnt #define _FILE_cnt 1 #define _cnt __cnt #endif #if _FILE__ptr && ! _FILE_ptr #define _FILE_ptr 1 #define _ptr __ptr #endif #if _FILE__flag && ! _FILE_flag #define _FILE_flag 1 #define _flag __flag #endif #if _FILE__file && ! _FILE_file #define _FILE_file 1 #define _file __file #endif a134 3 lib __swbuf lib __srget @ 1.1.1.3 log @Import of Sfio1999 @ text @a173 7 lib __uflow lib __underflow lib __overflow lib _IO_getc lib _IO_putc @