The R Project SVN R

Rev

Rev 19761 | Rev 31166 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19761 Rev 27774
Line 99... Line 99...
99
   *q = c;
99
   *q = c;
100
   strcat(s, q);
100
   strcat(s, q);
101
   return s;
101
   return s;
102
}
102
}
103
 
103
 
104
/* 
104
/*
105
   finput is either NULL or the name of a file from which to
105
   finput is either NULL or the name of a file from which to
106
     redirect stdin for the child.
106
     redirect stdin for the child.
107
   newconsole != 0 to use a new console (if not waiting)
107
   newconsole != 0 to use a new console (if not waiting)
108
   visible = -1, 0, 1 for hide, minimized, default
108
   visible = -1, 0, 1 for hide, minimized, default
109
   inpipe != 0 to duplicate I/O handles 
109
   inpipe != 0 to duplicate I/O handles
110
*/
110
*/
111
 
111
 
112
static HANDLE pcreate(char* cmd, char *finput,
112
static HANDLE pcreate(char* cmd, char *finput,
113
		      int newconsole, int visible, int inpipe)
113
		      int newconsole, int visible, int inpipe)
114
{
114
{
115
    DWORD ret;
115
    DWORD ret;
116
    SECURITY_ATTRIBUTES sa;
116
    SECURITY_ATTRIBUTES sa;
117
    PROCESS_INFORMATION pi;
117
    PROCESS_INFORMATION pi;
118
    STARTUPINFO si;
118
    STARTUPINFO si;
119
    HANDLE hIN = INVALID_HANDLE_VALUE, 
119
    HANDLE hIN = INVALID_HANDLE_VALUE,
120
	hSAVED = INVALID_HANDLE_VALUE, hTHIS;
120
	hSAVED = INVALID_HANDLE_VALUE, hTHIS;
121
    char *ecmd;
121
    char *ecmd;
122
 
122
 
123
    sa.nLength = sizeof(sa);
123
    sa.nLength = sizeof(sa);
124
    sa.lpSecurityDescriptor = NULL;
124
    sa.lpSecurityDescriptor = NULL;
Line 260... Line 260...
260
	if (res == FALSE) {
260
	if (res == FALSE) {
261
	    rpipeClose(r);
261
	    rpipeClose(r);
262
	    strcpy(RunError, "Impossible to create pipe");
262
	    strcpy(RunError, "Impossible to create pipe");
263
	    return NULL;
263
	    return NULL;
264
	}
264
	}
265
	hTHIS = GetCurrentProcess();	
265
	hTHIS = GetCurrentProcess();
266
	hIN = GetStdHandle(STD_INPUT_HANDLE);
266
	hIN = GetStdHandle(STD_INPUT_HANDLE);
267
	DuplicateHandle(hTHIS, hTemp, hTHIS, &r->write,
267
	DuplicateHandle(hTHIS, hTemp, hTHIS, &r->write,
268
			0, FALSE, DUPLICATE_SAME_ACCESS);
268
			0, FALSE, DUPLICATE_SAME_ACCESS);
269
	CloseHandle(hTemp);
269
	CloseHandle(hTemp);
270
	CloseHandle(hTHIS);
270
	CloseHandle(hTHIS);
Line 418... Line 418...
418
 
418
 
419
static int Wpipe_fgetc(Rconnection con)
419
static int Wpipe_fgetc(Rconnection con)
420
{
420
{
421
    rpipe *rp = ((RWpipeconn)con->private) ->rp;
421
    rpipe *rp = ((RWpipeconn)con->private) ->rp;
422
    int c;
422
    int c;
423
    
423
 
424
    c = rpipeGetc(rp);
424
    c = rpipeGetc(rp);
425
    return c == NOLAUNCH ? R_EOF : c;
425
    return c == NOLAUNCH ? R_EOF : c;
426
}
426
}
427
 
427
 
428
 
428
 
Line 521... Line 521...
521
    new->description = (char *) malloc(strlen(description) + 1);
521
    new->description = (char *) malloc(strlen(description) + 1);
522
    if(!new->description) {
522
    if(!new->description) {
523
	free(new->class); free(new);
523
	free(new->class); free(new);
524
	error("allocation of pipe connection failed");
524
	error("allocation of pipe connection failed");
525
    }
525
    }
526
    strcpy(new->description, description);
526
    init_con(new, description, mode);
527
    strncpy(new->mode, mode, 4); new->mode[4] = '\0';
-
 
528
    new->isopen = new->incomplete = FALSE;
-
 
529
    new->canread = new->canwrite = TRUE; /* in principle */
-
 
530
    new->canseek = FALSE;
-
 
531
    new->text = TRUE;
-
 
532
    new->open = &Wpipe_open;
527
    new->open = &Wpipe_open;
533
    new->close = &Wpipe_close;
528
    new->close = &Wpipe_close;
534
    new->destroy = &Wpipe_destroy;
529
    new->destroy = &Wpipe_destroy;
535
    new->vfprintf = &Wpipe_vfprintf;
530
    new->vfprintf = &Wpipe_vfprintf;
536
    new->fgetc = &Wpipe_fgetc;
531
    new->fgetc = &Wpipe_fgetc;
537
    new->seek = &null_seek;
532
    new->seek = &null_seek;
538
    new->truncate = &null_truncate;
533
    new->truncate = &null_truncate;
539
    new->fflush = &Wpipe_fflush;
534
    new->fflush = &Wpipe_fflush;
540
    new->read = &Wpipe_read;
535
    new->read = &Wpipe_read;
541
    new->write = &Wpipe_write;
536
    new->write = &Wpipe_write;
542
    new->nPushBack = 0;
-
 
543
    new->private = (void *) malloc(sizeof(struct Wpipeconn));
537
    new->private = (void *) malloc(sizeof(struct Wpipeconn));
544
    if(!new->private) {
538
    if(!new->private) {
545
	free(new->description); free(new->class); free(new);
539
	free(new->description); free(new->class); free(new);
546
	error("allocation of pipe connection failed");
540
	error("allocation of pipe connection failed");
547
    }
541
    }