Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6431 → Rev 6432

/programs/develop/ktcc/trunk/libc/include/ctype.h
16,19 → 16,19
#define __UPPER 512
#define __XDIGIT 1024
 
extern char __is[128];
extern unsigned short __is[128];
 
#define isalnum(c)(__is[c] & __ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */
#define isalpha(c)(__is[c] & __ALPHA ) /* 'a'-'z', 'A'-'Z' */
#define iscntrl(c)(__is[c] & __CNTRL ) /* 0-31, 127 */
#define isdigit(c)(__is[c] & __DIGIT ) /* '0'-'9' */
#define isgraph(c)(__is[c] & __GRAPH ) /* '!'-'~' */
#define islower(c)(__is[c] & __LOWER ) /* 'a'-'z' */
#define isprint(c)(__is[c] & __PRINT ) /* ' '-'~' */
#define ispunct(c)(__is[c] & __PUNCT ) /* !alnum && !cntrl && !space */
#define isspace(c)(__is[c] & __BLANK ) /* HT, LF, VT, FF, CR, ' ' */
#define isupper(c)(__is[c] & __UPPER ) /* 'A'-'Z' */
#define isxdigit(c)(__is[c] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */
#define isalnum(c)(__is[c+1] & __ALNUM ) /* 'a'-'z', 'A'-'Z', '0'-'9' */
#define isalpha(c)(__is[c+1] & __ALPHA ) /* 'a'-'z', 'A'-'Z' */
#define iscntrl(c)(__is[c+1] & __CNTRL ) /* 0-31, 127 */
#define isdigit(c)(__is[c+1] & __DIGIT ) /* '0'-'9' */
#define isgraph(c)(__is[c+1] & __GRAPH ) /* '!'-'~' */
#define islower(c)(__is[c+1] & __LOWER ) /* 'a'-'z' */
#define isprint(c)(__is[c+1] & __PRINT ) /* ' '-'~' */
#define ispunct(c)(__is[c+1] & __PUNCT ) /* !alnum && !cntrl && !space */
#define isspace(c)(__is[c+1] & __BLANK ) /* HT, LF, VT, FF, CR, ' ' */
#define isupper(c)(__is[c+1] & __UPPER ) /* 'A'-'Z' */
#define isxdigit(c)(__is[c+1] & __XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */
 
#define isascii(c) (!((c)&(~0x7f)))
#define toascii(c) ((c)&0x7f)
/programs/develop/ktcc/trunk/libc/include/stdio.h
71,5 → 71,12
typedef int (*virtual_getc)(void *sp, const void *obj);
typedef void (*virtual_ungetc)(void *sp, int c, const void *obj);
int format_scan(const void *src, const char *fmt, va_list argp, virtual_getc vgetc, virtual_ungetc vungetc);
int vscanf ( const char * format, va_list arg );
int scanf ( const char * format, ...);
int vsscanf ( const char * s, const char * format, va_list arg );
int sscanf ( const char * s, const char * format, ...);
int vfscanf ( FILE * stream, const char * format, va_list arg );
 
 
 
#endif
/programs/develop/ktcc/trunk/libc/stdio/format_scan.c
18,6 → 18,8
#include <ctype.h>
#include <math.h>
#include <stdarg.h>
typedef int (*virtual_getc)(void *sp, const void *obj);
typedef void (*virtual_ungetc)(void *sp, int c, const void *obj);
 
enum flags_t
{
170,7 → 172,9
{
base = 8;
ch = vgetc(save, src);
if (ch == EOF) return EOF;
if (ch == EOF || isspace(ch))
have_digits++;
else
if (ch == 'x' || ch == 'X')
{
base = 16;
201,6 → 205,8
ch = vgetc(save, src);
if (ch == EOF || isspace(ch)) break; // ok, just finish num
}
else if (ch == EOF || isspace(ch))
break;
else
{
vungetc(save, ch, src);
365,9 → 371,9
arg_str = va_arg(argp, char*);
if (fmt1 == 0) length = 1;
else length = fmt1;
for (i = 0; i < length; i++)
for (i = 0; i < length;)
{
*arg_str++ = ch;
*arg_str++ = ch; i++;
ch = vgetc(&save, src);
if (ch == EOF) break;
}
/programs/develop/ktcc/trunk/libc/stdio/fscanf.c
6,8 → 6,11
// get next chat from file obj, save point is ptr to string char ptr
{
FILE *f = (FILE *)obj;
int ch = fgetc(f);
 
return fgetc(f);
//printf("getc '%c'[%d];", ch, ch);
 
return ch;
}
 
void virtual_ungetc_file(void *sp, int c, const void *obj)
/programs/develop/ktcc/trunk/libc/stdio/ungetc.c
0,0 → 1,16
#include <stdio.h>
// non standard realization - no support for virtually change char
int ungetc(int c,FILE* file)
{
dword res;
 
if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0)) return EOF;
 
if (file->filepos>file->filesize || file->filepos==0)
{
return EOF;
}
file->filepos--;
 
return c;
}
/programs/develop/ktcc/trunk/libc/string/is.c
1,5 → 1,6
#include "ctype.h"
char __is[128] = {
#include <ctype.h>
unsigned short __is[129] = {
0, /* EOF */
0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004,
0x004, 0x104, 0x104, 0x104, 0x104, 0x104, 0x004, 0x004,
0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004,