Beispiel #1
0
NODE *lreadchar(NODE *args) {
#ifdef WIN32
    MSG msg;
#endif /* WIN32 */
    char c;

    if (readchar_lookahead_buf >= 0) {
	c = (char)readchar_lookahead_buf;
	readchar_lookahead_buf = -1;
	return(make_strnode((char *)&c, (struct string_block *)NULL, 1,
		(getparity(c) ? BACKSLASH_STRING : STRING), strnzcpy));
    }
    charmode_on();
    input_blocking++;
#ifdef HAVE_WX
	if (interactive && readstream==stdin) {
	    reading_char_now = 1;
	    c = getFromWX();
	    reading_char_now = 0;
	}
	else
	    c = (char)getc(readstream);
#else
#ifndef TIOCSTI
    if (!setjmp(iblk_buf))
#endif
    {
#ifdef mac
	csetmode(C_RAW, stdin);
	while ((c = (char)getc(readstream)) == EOF && readstream == stdin);
	csetmode(C_ECHO, stdin);
#else /* !mac */
#ifdef ibm
	if (interactive && readstream==stdin)
#ifndef WIN32
		c = (char)getch();
#else /* WIN32 */
	{
	  win32_update_text();
	  if (!char_avail)
	    while(GetMessage(&msg, NULL, 0, 0))
	    {
	      TranslateMessage(&msg);
	      DispatchMessage(&msg);
	      if (char_avail)
		break;
	    }
	  c = buffered_char;
	  char_avail = 0;
	}
#endif /* WIN32 */	
	else
Beispiel #2
0
int F2C_ungetc( int c, FILE *f )
{
	int i;
	if ( f == stdin )
	{
		csetmode(C_ECHO, stdin); 
		i = ungetc( c, f );
		csetmode(C_RAW, stdin);
	}
	else
		i = ungetc( c, f );

	return  i;
}
Beispiel #3
0
size_t F2C_fread( void *ptr, size_t size, size_t n, FILE *f )
{
	size_t  nr;
	if ( f == stdin )
	{
		csetmode(C_ECHO, stdin); 
		nr = fread( ptr, size, n, f );
		csetmode(C_RAW, stdin);
	}
	else
		nr = fread( ptr, size, n, f );

	return  nr;
}
Beispiel #4
0
int F2C_getc( FILE * f)
{
	int i;
	if ( f == stdin )
	{
		csetmode(C_ECHO, stdin); 
		i = __getc( f );
		csetmode(C_RAW, stdin);
	}
	else
		i = __getc( f );

	return  i;
}
Beispiel #5
0
Datei: kblib.c Projekt: 8l/bcpl
int init_keyb(void)
{ console_options.title = "\pBCPL Cintcode";
  console_options.pause_atexit = 0;
  cshow(stdin);
  csetmode(C_RAW, stdin);
  return 0;
}
Beispiel #6
0
void InitMultiTask( long sliceInTicks ) 
{
	if ( sliceInTicks > 0 )
		gTickSlice = sliceInTicks;	
	
	/* Set console so we can interogate for input (to trigger WNE) without waiting for input */
	csetmode( C_RAW, stdin );

	/* Start the tick count */
	gNextCheck = TickCount() + gTickSlice;
}
NODE *lkeyp()
{
    long nc;
#ifdef mac
    int c;
#endif

    if (readstream == stdin && interactive) {
	charmode_on();
	fflush(stdout);
#ifdef __ZTC__
	zflush();
#endif
#if defined(mac)
	csetmode(C_RAW, stdin);
	c = ungetc(getc(readstream), readstream);
	csetmode(C_ECHO, stdin);
	return(c == EOF ? False : True);
#elif defined(ibm)
	return(kbhit() ? True : False);
#else
#ifdef FIONREAD
	ioctl(0,FIONREAD,(char *)(&nc));
#else
	ndprintf(stdout,"Can't KEYP, no FIONREAD on this system\n");
	nc = 1;    /* pretend there's a char so we don't loop */
#endif
	if (nc > 0)
	    return(True);
	else
	    return(False);
#endif
    }
    ungetc(getc(readstream),readstream);
    if (feof(readstream))
	return(True);
    else
	return(False);
}
NODE *lreadchar()
{
    char c;

    charmode_on();
    input_blocking++;
#ifndef TIOCSTI
    if (!setjmp(iblk_buf))
#endif
#ifdef mac
    csetmode(C_RAW, stdin);
    while ((c = (char)getc(readstream)) == EOF && readstream == stdin);
    csetmode(C_ECHO, stdin);
#else
#ifdef ibm
    if (interactive && readstream==stdin)
	c = (char)getch();
    else
	c = (char)getc(readstream);

    if (c == 17) { /* control-q */
	to_pending = 0;
	err_logo(STOP_ERROR,NIL);
    }
    if (c == 23) { /* control-w */
	logo_pause();
	return(lreadchar());
    }
#else
    c = (char)getc(readstream);
#endif
#endif
    input_blocking = 0;
    if (feof(readstream)) {
	return(NIL);
    }
    return(make_strnode(&c, (char *)NULL, 1,
	    (getparity(c) ? STRING : BACKSLASH_STRING), strnzcpy));
}
Beispiel #9
0
void unblock_input(void) {
    if (input_blocking) {
	input_blocking = 0;
#ifdef mac
	csetmode(C_ECHO, stdin);
	fflush(stdin);
#endif
#ifdef TIOCSTI
	ioctl(0,TIOCSTI,"\n");
#else
	longjmp(iblk_buf,1);
#endif
    }
}
Beispiel #10
0
void EndMultiTask( void )
{
    csetmode(C_ECHO, stdin); 	/* Restore standard, buffered mode (not really required :) */
}