FileStream.st
changeset 223 3075043790b8
parent 216 a8abff749575
child 249 810798c5c2e5
equal deleted inserted replaced
222:85fee82884dd 223:3075043790b8
    19 
    19 
    20 FileStream comment:'
    20 FileStream comment:'
    21 COPYRIGHT (c) 1989 by Claus Gittinger
    21 COPYRIGHT (c) 1989 by Claus Gittinger
    22 	      All Rights Reserved
    22 	      All Rights Reserved
    23 
    23 
    24 $Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.17 1995-02-02 12:21:09 claus Exp $
    24 $Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.18 1995-02-05 21:29:58 claus Exp $
    25 '!
    25 '!
    26 
    26 
    27 !FileStream class methodsFor:'documentation'!
    27 !FileStream class methodsFor:'documentation'!
    28 
    28 
    29 copyright
    29 copyright
    40 "
    40 "
    41 !
    41 !
    42 
    42 
    43 version
    43 version
    44 "
    44 "
    45 $Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.17 1995-02-02 12:21:09 claus Exp $
    45 $Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.18 1995-02-05 21:29:58 claus Exp $
    46 "
    46 "
    47 !
    47 !
    48 
    48 
    49 documentation
    49 documentation
    50 "
    50 "
    84 #ifndef SEEK_CUR
    84 #ifndef SEEK_CUR
    85 # define SEEK_CUR       1
    85 # define SEEK_CUR       1
    86 #endif
    86 #endif
    87 #ifndef SEEK_END
    87 #ifndef SEEK_END
    88 # define SEEK_END       2
    88 # define SEEK_END       2
       
    89 #endif
       
    90 
       
    91 /*
       
    92  * on some systems errno is a macro ... check for it here
       
    93  */
       
    94 #ifndef errno
       
    95  extern errno;
    89 #endif
    96 #endif
    90 
    97 
    91 %}
    98 %}
    92 ! !
    99 ! !
    93 
   100 
   387 
   394 
   388     filePointer notNil ifTrue:[^ self errorOpen].
   395     filePointer notNil ifTrue:[^ self errorOpen].
   389 %{
   396 %{
   390     FILE *f;
   397     FILE *f;
   391     OBJ path;
   398     OBJ path;
   392     extern errno;
       
   393 
   399 
   394     if (_INST(filePointer) == nil) {
   400     if (_INST(filePointer) == nil) {
   395 	path = _INST(pathName);
   401 	path = _INST(pathName);
   396 	if (_isNonNilObject(path) && (_qClass(path)==String)) {
   402 	if (_isNonNilObject(path) && (_qClass(path)==String)) {
   397 	    do {
   403 	    do {
   522     }
   528     }
   523 #else
   529 #else
   524     FILE *f;
   530     FILE *f;
   525     struct stat buf;
   531     struct stat buf;
   526     int ret;
   532     int ret;
   527     extern errno;
       
   528     int fd;
   533     int fd;
   529 
   534 
   530     if (_INST(filePointer) != nil) {
   535     if (_INST(filePointer) != nil) {
   531 	f = (FILE *)MKFD(_INST(filePointer));
   536 	f = (FILE *)MKFD(_INST(filePointer));
   532 	fd = fileno(f);
   537 	fd = fileno(f);
   560 
   565 
   561 %{  /* NOCONTEXT */
   566 %{  /* NOCONTEXT */
   562 
   567 
   563     FILE *f;
   568     FILE *f;
   564     long currentPosition;
   569     long currentPosition;
   565     extern errno;
       
   566 
   570 
   567     if (_INST(filePointer) != nil) {
   571     if (_INST(filePointer) != nil) {
   568 	f = (FILE *)MKFD(_INST(filePointer));
   572 	f = (FILE *)MKFD(_INST(filePointer));
   569 	do {
   573 	do {
   570 	    if (_INST(buffered) == true) {
   574 	    if (_INST(buffered) == true) {
   592 
   596 
   593 %{  /* NOCONTEXT */
   597 %{  /* NOCONTEXT */
   594 
   598 
   595     FILE *f;
   599     FILE *f;
   596     int ret;
   600     int ret;
   597     extern errno;
       
   598 
   601 
   599     if (_INST(filePointer) != nil) {
   602     if (_INST(filePointer) != nil) {
   600 	if (_isSmallInteger(newPos)) {
   603 	if (_isSmallInteger(newPos)) {
   601 	    f = (FILE *)MKFD(_INST(filePointer));
   604 	    f = (FILE *)MKFD(_INST(filePointer));
   602 	    /*
   605 	    /*
   630     "set the read/write position in the file to be at the end of the file"
   633     "set the read/write position in the file to be at the end of the file"
   631 
   634 
   632 %{
   635 %{
   633     FILE *f;
   636     FILE *f;
   634     int ret;
   637     int ret;
   635     extern errno;
       
   636 
   638 
   637     if (_INST(filePointer) != nil) {
   639     if (_INST(filePointer) != nil) {
   638 	f = (FILE *)MKFD(_INST(filePointer));
   640 	f = (FILE *)MKFD(_INST(filePointer));
   639 	_INST(position) = nil;
   641 	_INST(position) = nil;
   640 	do {
   642 	do {