Subversion Repositories Krakow BASIC

Rev

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

Rev 37 Rev 38
Line 1... Line 1...
1
/* $Id: basic.c 37 2024-09-05 15:59:22Z nishi $ */
1
/* $Id: basic.c 38 2024-09-05 16:02:53Z nishi $ */
2
 
2
 
3
/* Krakow BASIC - Multi-platform simple BASIC */
3
/* Krakow BASIC - Multi-platform simple BASIC */
4
 
4
 
5
#if defined(PLATFORM_SHIROI)
5
#if defined(PLATFORM_SHIROI)
6
 
6
 
Line 209... Line 209...
209
#define LINES (32)
209
#define LINES (32)
210
#undef putchar
210
#undef putchar
211
#define putchar uart_putchar
211
#define putchar uart_putchar
212
#elif defined(PLATFORM_UNIX)
212
#elif defined(PLATFORM_UNIX)
213
#include <termios.h>
213
#include <termios.h>
-
 
214
#include <sys/ioctl.h>
214
#elif defined(PLATFORM_PET)
215
#elif defined(PLATFORM_PET)
215
#define BUFFER_SIZE (4 * 1024)
216
#define BUFFER_SIZE (4 * 1024)
216
#undef killcursor
217
#undef killcursor
217
#undef cursor
218
#undef cursor
218
#define killcursor(x) cursor(0)
219
#define killcursor(x) cursor(0)
Line 258... Line 259...
258
#define agetch() oggetch(0)
259
#define agetch() oggetch(0)
259
char oggetch(char wait) {
260
char oggetch(char wait) {
260
	int c;
261
	int c;
261
#if defined(PLATFORM_WINDOWS)
262
#if defined(PLATFORM_WINDOWS)
262
rescan:
263
rescan:
-
 
264
	if(!wait){
-
 
265
		if(!_kbhit()) return 0;
-
 
266
	}
263
	c = _getch();
267
	c = _getch();
264
	if(c == '\r') return '\n';
268
	if(c == '\r') return '\n';
265
	if(c == '\n') goto rescan;
269
	if(c == '\n') goto rescan;
266
#elif defined(PLATFORM_UNIX)
270
#elif defined(PLATFORM_UNIX)
-
 
271
	if(!wait){
-
 
272
		int b;
-
 
273
		ioctl(0, FIONREAD, &b);
-
 
274
		if(b == 0) return 0;
-
 
275
	}
267
	c = getchar();
276
	c = getchar();
268
	if(c == EOF) return -1;
277
	if(c == EOF) return -1;
269
	if(c == '\r') return '\n';
278
	if(c == '\r') return '\n';
270
#elif defined(PLATFORM_ARDUINO)
279
#elif defined(PLATFORM_ARDUINO)
271
rescan:
280
rescan: