mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	19990920
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									656cbdf2b7
								
							
						
					
					
						commit
						70a444b0cc
					
				
					 6 changed files with 45 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,10 @@
 | 
			
		|||
Mon Sep 20 01:08:02 1999  Yukihiro Matsumoto  <matz@netlab.co.jp>
 | 
			
		||||
 | 
			
		||||
	* io.c (io_fread): should not block other threads.
 | 
			
		||||
 | 
			
		||||
	* io.c (rb_io_synchronized): renamed from rb_io_unbuffered(); do
 | 
			
		||||
	  not call setbuf(NULL) any more.
 | 
			
		||||
 | 
			
		||||
Sat Sep 18 13:45:43 1999  Yukihiro Matsumoto  <matz@netlab.co.jp>
 | 
			
		||||
 | 
			
		||||
	* stable version 1.4.2 released.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								ToDo
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								ToDo
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -34,6 +34,7 @@ Standard Libraries
 | 
			
		|||
* Stream or Port, abstract superclass of IO ?
 | 
			
		||||
* String#{pred,prev}, String#downto
 | 
			
		||||
* optional stepsize argument for succ()
 | 
			
		||||
* Dir.glob(pat){|f|...}
 | 
			
		||||
 | 
			
		||||
Extension Libraries
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -115,7 +115,7 @@ sock_new(class, fd)
 | 
			
		|||
#endif
 | 
			
		||||
    fp->f2 = rb_fdopen(fd, "w");
 | 
			
		||||
    fp->mode = FMODE_READWRITE;
 | 
			
		||||
    rb_io_unbuffered(fp);
 | 
			
		||||
    rb_io_synchronized(fp);
 | 
			
		||||
 | 
			
		||||
    return (VALUE)sock;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										45
									
								
								io.c
									
										
									
									
									
								
							
							
						
						
									
										45
									
								
								io.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -442,6 +442,29 @@ read_all(port)
 | 
			
		|||
    return str;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static size_t
 | 
			
		||||
io_fread(ptr, len, f)
 | 
			
		||||
    char *ptr;
 | 
			
		||||
    size_t len;
 | 
			
		||||
    FILE *f;
 | 
			
		||||
{
 | 
			
		||||
    size_t n = len;
 | 
			
		||||
 | 
			
		||||
    while (n--) {
 | 
			
		||||
	*ptr = getc(f);
 | 
			
		||||
	if (*ptr == EOF) {
 | 
			
		||||
	    *ptr = '\0';
 | 
			
		||||
	    break;
 | 
			
		||||
	}
 | 
			
		||||
	ptr++;
 | 
			
		||||
	if (!READ_DATA_PENDING(f)) {
 | 
			
		||||
	    rb_thread_wait_fd(fileno(f));
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return len - n - 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
io_read(argc, argv, io)
 | 
			
		||||
    int argc;
 | 
			
		||||
| 
						 | 
				
			
			@ -465,9 +488,7 @@ io_read(argc, argv, io)
 | 
			
		|||
    str = rb_str_new(0, len);
 | 
			
		||||
 | 
			
		||||
    READ_CHECK(fptr->f);
 | 
			
		||||
    TRAP_BEG;
 | 
			
		||||
    n = fread(RSTRING(str)->ptr, 1, len, fptr->f);
 | 
			
		||||
    TRAP_END;
 | 
			
		||||
    n = io_fread(RSTRING(str)->ptr, len, fptr->f);
 | 
			
		||||
    if (n == 0) {
 | 
			
		||||
	if (feof(fptr->f)) return Qnil;
 | 
			
		||||
	rb_sys_fail(fptr->path);
 | 
			
		||||
| 
						 | 
				
			
			@ -564,9 +585,7 @@ rb_io_gets_internal(argc, argv, io)
 | 
			
		|||
	}
 | 
			
		||||
	else {
 | 
			
		||||
	    READ_CHECK(f);
 | 
			
		||||
	    TRAP_BEG;
 | 
			
		||||
	    cnt = fread(buf, 1, sizeof(buf), f);
 | 
			
		||||
	    TRAP_END;
 | 
			
		||||
	    cnt = io_fread(buf, sizeof(buf), f);
 | 
			
		||||
	    if (cnt == 0) {
 | 
			
		||||
		if (ferror(f)) rb_sys_fail(fptr->path);
 | 
			
		||||
		c = EOF;
 | 
			
		||||
| 
						 | 
				
			
			@ -1388,14 +1407,18 @@ pipe_finalize(fptr)
 | 
			
		|||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
rb_io_synchronized(fptr)
 | 
			
		||||
    OpenFile *fptr;
 | 
			
		||||
{
 | 
			
		||||
    fptr->mode |= FMODE_SYNC;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
rb_io_unbuffered(fptr)
 | 
			
		||||
    OpenFile *fptr;
 | 
			
		||||
{
 | 
			
		||||
    if (fptr->f2 == 0) rb_raise(rb_eTypeError, "non-writable fptr");
 | 
			
		||||
    if (fptr->f != 0) setbuf(fptr->f, NULL);
 | 
			
		||||
    setbuf(fptr->f2, NULL);
 | 
			
		||||
    fptr->mode |= FMODE_SYNC;
 | 
			
		||||
    rb_io_synchronized(fptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -1421,7 +1444,7 @@ pipe_open(pname, mode)
 | 
			
		|||
	if (modef & FMODE_READABLE) fptr->f  = f;
 | 
			
		||||
	if (modef & FMODE_WRITABLE) {
 | 
			
		||||
	    fptr->f2 = f;
 | 
			
		||||
	    rb_io_unbuffered(fptr);
 | 
			
		||||
	    rb_io_synchronized(fptr);
 | 
			
		||||
	}
 | 
			
		||||
	return (VALUE)port;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,7 @@
 | 
			
		|||
	    ruby-block-end-re "\\)\\>\\|\\}\\|\\]\\)")
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
(defconst ruby-operator-chars ",.+*/%-&|^~=<>:")
 | 
			
		||||
(defconst ruby-operator-chars "-,.+*/%&|^~=<>:")
 | 
			
		||||
(defconst ruby-operator-re (concat "[" ruby-operator-chars "]"))
 | 
			
		||||
 | 
			
		||||
(defconst ruby-symbol-chars "a-zA-Z0-9_")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								rubyio.h
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								rubyio.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -54,7 +54,7 @@ int  rb_io_mode_flags _((const char*));
 | 
			
		|||
void rb_io_check_writable _((OpenFile*));
 | 
			
		||||
void rb_io_check_readable _((OpenFile*));
 | 
			
		||||
void rb_io_fptr_finalize _((OpenFile*));
 | 
			
		||||
void rb_io_unbuffered _((OpenFile*));
 | 
			
		||||
void rb_io_synchronized _((OpenFile*));
 | 
			
		||||
void rb_io_check_closed _((OpenFile*));
 | 
			
		||||
void rb_eof_error _((void));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue