Changeset 350

Show
Ignore:
Timestamp:
09/09/09 21:09:28 (11 months ago)
Author:
solar
Message:

Completing the basics.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/stdio_rewrite/functions/_PDCLIB

    • Property svn:ignore changed from
      *.d
      *.t
      *.r
      _Exit.c
      allocpages.c
      flushbuffer.c
      fillbuffer.c
      prepread.c
      prepwrite.c
      seek.c
      close.c
      open.c


      to
      *.d
      *.t
      *.r
      _Exit.c
      allocpages.c
      flushbuffer.c
      fillbuffer.c
      seek.c
      close.c
      open.c

  • branches/stdio_rewrite/functions/_PDCLIB/stdinit.c

    r346 r350  
    2929 
    3030/* FIXME: serr should handle one character. Buffering on out / in? */ 
    31 static struct _PDCLIB_file_t _PDCLIB_serr = { 2, _PDCLIB_serr_buffer, BUFSIZ, 0, 0, 0, 0, _PDCLIB_serr_ungetbuf, _IOLBF, NULL, NULL }; 
    32 static struct _PDCLIB_file_t _PDCLIB_sout = { 1, _PDCLIB_sout_buffer, BUFSIZ, 0, 0, 0, 0, _PDCLIB_sout_ungetbuf, _IOLBF, NULL, &_PDCLIB_serr }; 
    33 static struct _PDCLIB_file_t _PDCLIB_sin  = { 0, _PDCLIB_sin_buffer, BUFSIZ, 0, 0, 0, 0, _PDCLIB_sin_ungetbuf, _IOLBF, NULL, &_PDCLIB_sout }; 
     31static struct _PDCLIB_file_t _PDCLIB_serr = { 2, _PDCLIB_serr_buffer, BUFSIZ, 0, 0, 0, 0, _PDCLIB_serr_ungetbuf, _IONBF | _PDCLIB_FWRITE, NULL, NULL }; 
     32static struct _PDCLIB_file_t _PDCLIB_sout = { 1, _PDCLIB_sout_buffer, BUFSIZ, 0, 0, 0, 0, _PDCLIB_sout_ungetbuf, _IOLBF | _PDCLIB_FWRITE, NULL, &_PDCLIB_serr }; 
     33static struct _PDCLIB_file_t _PDCLIB_sin  = { 0, _PDCLIB_sin_buffer, BUFSIZ, 0, 0, 0, 0, _PDCLIB_sin_ungetbuf, _IOLBF | _PDCLIB_FREAD, NULL, &_PDCLIB_sout }; 
    3434 
    3535struct _PDCLIB_file_t * stdin  = &_PDCLIB_sin; 
  • branches/stdio_rewrite/functions/stdio/fputs.c

    r349 r350  
    1111#ifndef REGTEST 
    1212#include <_PDCLIB_glue.h> 
    13  
    14 extern char const * const _PDCLIB_eol; 
    15  
    16 #define _PDCLIB_FLUSHCONDITION( x, y ) _PDCLIB_FBF_FLUSH( x, y ) 
    1713 
    1814int fputs( const char * s, struct _PDCLIB_file_t * stream ) 
  • branches/stdio_rewrite/functions/stdio/puts.c

    r346 r350  
    1111#ifndef REGTEST 
    1212#include <_PDCLIB_glue.h> 
     13 
     14extern char * _PDCLIB_eol; 
    1315 
    1416int puts( const char * s ) 
     
    2931        } 
    3032    } 
    31     /* TODO: _IOLBF, _IONBF */ 
     33    s = _PDCLIB_eol; 
     34    while ( *s != '\0' ) 
     35    { 
     36        stdout->buffer[ stdout->bufidx++ ] = *s++; 
     37        if ( stdout->bufidx == stdout->bufsize ) 
     38        { 
     39            if ( _PDCLIB_flushbuffer( stdout ) == EOF ) 
     40            { 
     41                return EOF; 
     42            } 
     43        } 
     44    } 
     45    if ( stdout->status & ( _IOLBF | _IONBF ) ) 
     46    { 
     47        return _PDCLIB_flushbuffer( stdout ); 
     48    } 
    3249    return 0; 
    3350} 
     
    4057int main( void ) 
    4158{ 
    42     TESTCASE( puts( "SUCCESS testing puts()" ) >= 0 ); 
     59    TESTCASE( puts( "SUCCESS testing puts()\n" ) >= 0 ); 
    4360    return TEST_RESULTS; 
    4461} 
  • branches/stdio_rewrite/includes/stdio.h

    r333 r350  
    7272int getchar( void ); 
    7373 
     74char * gets( char * s ); 
     75char * fgets( char * s, int n, FILE * stream ); 
     76 
    7477int remove( const char * pathname ); 
    7578