diff --git a/reactos/include/conio.h b/reactos/include/conio.h index 60733bb48f7..349d6ce6f18 100644 --- a/reactos/include/conio.h +++ b/reactos/include/conio.h @@ -1,127 +1,67 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#ifndef __dj_include_conio_h_ -#define __dj_include_conio_h_ +/* + * conio.h + * + * Low level console I/O functions. Pretty please try to use the ANSI + * standard ones if you are writing new code. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/02/21 17:43:45 $ + * + */ -#ifdef __cplusplus +#ifndef __STRICT_ANSI__ + +#ifndef _CONIO_H_ +#define _CONIO_H_ + +#ifdef __cplusplus extern "C" { #endif -#ifndef __dj_ENFORCE_ANSI_FREESTANDING -#ifndef __STRICT_ANSI__ +char* _cgets (char* szBuffer); +int _cprintf (const char* szFormat, ...); +int _cputs (const char* szString); +int _cscanf (char* szFormat, ...); -#ifndef _POSIX_SOURCE +int _getch (); +int _getche (); +int _kbhit (); +int _putch (int cPut); +int _ungetch (int cUnget); -extern int directvideo; /* ignored by gppconio */ -extern int _wscroll; +#ifndef _NO_OLDNAMES -#define _NOCURSOR 0 -#define _SOLIDCURSOR 1 -#define _NORMALCURSOR 2 +int getch (); +int getche (); +int kbhit (); +int putch (int cPut); +int ungetch (int cUnget); -struct text_info { - unsigned char winleft; - unsigned char wintop; - unsigned char winright; - unsigned char winbottom; - unsigned char attribute; - unsigned char normattr; - unsigned char currmode; - unsigned char screenheight; - unsigned char screenwidth; - unsigned char curx; - unsigned char cury; -}; - -enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 }; - -enum COLORS { - /* dark colors */ - BLACK, - BLUE, - GREEN, - CYAN, - RED, - MAGENTA, - BROWN, - LIGHTGRAY, - /* light colors */ - DARKGRAY, - LIGHTBLUE, - LIGHTGREEN, - LIGHTCYAN, - LIGHTRED, - LIGHTMAGENTA, - YELLOW, - WHITE -}; - -#define BLINK 0x80 /* blink bit */ - -//void blinkvideo(void); -char * _cgets(char *_str); -//void clreol(void); -//void clrscr(void); -int _kbhit(void); /* checks for ungetch char */ -int _cprintf(const char *_format, ...) __attribute__((format(printf,1,2))); -int _cputs(const char *_str); -int _cscanf(const char *_format, ...) __attribute__((format(scanf,1,2))); -//void delline(void); -int _getch(void); -int _getche(void); -//int gettext(int _left, int _top, int _right, int _bottom, void *_destin); -//void gettextinfo(struct text_info *_r); -//void gotoxy(int _x, int _y); -//void gppconio_init(void); -//void highvideo(void); -//void insline(void); -//void intensevideo(void); -//void lowvideo(void); -//int movetext(int _left, int _top, int _right, int _bottom, int _destleft, int _desttop); -//void normvideo(void); -int _putch(int _c); -//int puttext(int _left, int _top, int _right, int _bottom, void *_source); -//void _setcursortype(int _type); -//void _set_screen_lines(int _nlines); -//void textattr(int _attr); -//void textbackground(int _color); -//void textcolor(int _color); -//void textmode(int _mode); -int _ungetch(int); -//unsigned int wherex(void); -//unsigned int wherey(void); -//void window(int _left, int _top, int _right, int _bottom); +#endif /* Not _NO_OLDNAMES */ -int _inp(unsigned short p); -unsigned short _inpw(unsigned short p); -unsigned long _inpd(unsigned short p); -int _outp(unsigned short p, int i); -unsigned short _outpw(unsigned short p, unsigned short w); -unsigned long _outpd(unsigned short p, unsigned long d); - -#define cgets _cgets -#define cprintf _cprintf -#define cputs _cputs -#define cscanf _cscanf -#define getch _getch -#define getche _getche -#define kbhit _kbhit -#define putch _putch -#define ungetch _ungetch - - - -#endif /* !_POSIX_SOURCE */ -#endif /* !__STRICT_ANSI__ */ -#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ - -#ifndef __dj_ENFORCE_FUNCTION_CALLS -#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ - -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* !__dj_include_conio_h_ */ +#endif /* Not _CONIO_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/ctype.h b/reactos/include/ctype.h new file mode 100644 index 00000000000..3f3e10001c8 --- /dev/null +++ b/reactos/include/ctype.h @@ -0,0 +1,142 @@ +/* + * ctype.h + * + * Functions for testing character types and converting characters. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/02/21 17:43:45 $ + * + */ +#ifndef _LINUX_CTYPE_H +#define _LINUX_CTYPE_H + +#ifndef _CTYPE_H_ +#define _CTYPE_H_ + +#define __need_wchar_t +#define __need_wint_t +#include + + +/* + * The following flags are used to tell iswctype and _isctype what character + * types you are looking for. + */ +#define _UPPER 0x0001 +#define _LOWER 0x0002 +#define _DIGIT 0x0004 +#define _SPACE 0x0008 +#define _PUNCT 0x0010 +#define _CONTROL 0x0020 +#define _BLANK 0x0040 +#define _HEX 0x0080 +#define _LEADBYTE 0x8000 + +#define _ALPHA 0x0103 + + +#ifdef __cplusplus +extern "C" { +#endif + +int isalnum(int c); +int isalpha(int c); +int iscntrl(int c); +int isdigit(int c); +int isgraph(int c); +int islower(int c); +int isprint(int c); +int ispunct(int c); +int isspace(int c); +int isupper(int c); +int isxdigit(int c); + +#ifndef __STRICT_ANSI__ +int _isctype (int c, int ctypeFlags); +#endif + +int tolower(int c); +int toupper(int c); + +/* + * NOTE: The above are not old name type wrappers, but functions exported + * explicitly by CRTDLL. However, underscored versions are also exported. + */ +#ifndef __STRICT_ANSI__ +int _tolower(int c); +int _toupper(int c); +#endif + +#ifndef WEOF +#define WEOF (wchar_t)(0xFFFF) +#endif + +/* + * TODO: MB_CUR_MAX should be defined here (if not already defined, since + * it should also be defined in stdlib.h). It is supposed to be the + * maximum number of bytes in a multi-byte character in the current + * locale. Perhaps accessible through the __mb_curr_max_dll entry point, + * but I think (again) that that is a variable pointer, which leads to + * problems under the current Cygwin compiler distribution. + */ + +typedef int wctype_t; + +/* Wide character equivalents */ +int iswalnum(wint_t wc); +int iswalpha(wint_t wc); +int iswascii(wint_t wc); +int iswcntrl(wint_t wc); +int iswctype(wint_t wc, wctype_t wctypeFlags); +int is_wctype(wint_t wc, wctype_t wctypeFlags); /* Obsolete! */ +int iswdigit(wint_t wc); +int iswgraph(wint_t wc); +int iswlower(wint_t wc); +int iswprint(wint_t wc); +int iswpunct(wint_t wc); +int iswspace(wint_t wc); +int iswupper(wint_t wc); +int iswxdigit(wint_t wc); + +wchar_t towlower(wchar_t c); +wchar_t towupper(wchar_t c); + +int isleadbyte (int c); + +#ifndef __STRICT_ANSI__ +int __isascii (int c); +int __toascii (int c); +int __iscsymf (int c); /* Valid first character in C symbol */ +int __iscsym (int c); /* Valid character in C symbol (after first) */ + +#ifndef _NO_OLDNAMES +int isascii (int c); +int toascii (int c); +int iscsymf (int c); +int iscsym (int c); +#endif /* Not _NO_OLDNAMES */ + +#endif /* Not __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif + +#endif +#endif diff --git a/reactos/include/stddef.h b/reactos/include/stddef.h index 7f48c914923..a787605820e 100644 --- a/reactos/include/stddef.h +++ b/reactos/include/stddef.h @@ -28,12 +28,13 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * $Author: ariadne $ - * $Date: 1999/02/21 13:29:56 $ + * $Date: 1999/02/21 17:43:45 $ * */ + #ifndef _STDDEF_H_ /* @@ -82,6 +83,9 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; * Unsigned type of `sizeof' something. */ +#ifndef _LINUX_TYPES_H +#define _LINUX_TYPES_H + /* Define this type if we are doing the whole job, * or if we want this type in particular. */ #if defined (_STDDEF_H_) || defined (__need_size_t) @@ -100,7 +104,7 @@ typedef __SIZE_TYPE__ size_t; #endif /* _STDDEF_H_ or __need_size_t. */ - +#endif /* Wide character type. Locale-writers should change this as necessary to be big enough to hold unique values not between 0 and 127, diff --git a/reactos/include/string.h b/reactos/include/string.h index f0a2118c7b6..1ceaa6d3405 100644 --- a/reactos/include/string.h +++ b/reactos/include/string.h @@ -18,13 +18,16 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * $Author: ariadne $ - * $Date: 1999/02/21 13:29:57 $ + * $Date: 1999/02/21 17:43:45 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ /* changed prototype for _strerror */ +#ifndef _LINUX_STRING_H_ +#define _LINUX_STRING_H_ + #ifndef _STRING_H_ #define _STRING_H_ @@ -123,7 +126,7 @@ size_t wcsxfrm(wchar_t* wsTransformed, const wchar_t *wsSource, /* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */ #define _wcscmpi _wcsicmp -wchar_t* _wcsdup (wchar_t* wsToDuplicate); +wchar_t* _wcsdup (const wchar_t* wsToDuplicate); int _wcsicmp (const wchar_t* ws1, const wchar_t* ws2); int _wcsicoll (const wchar_t* ws1, const wchar_t* ws2); wchar_t* _wcslwr (wchar_t* wsToConvert); @@ -165,7 +168,7 @@ void swab (const char* caFrom, char* caTo, size_t sizeToCopy); /* NOTE: There is no _wcscmpi, but this is for compatibility. */ int wcscmpi (const wchar_t* ws1, const wchar_t* ws2); -wchar_t* wcsdup (wchar_t* wsToDuplicate); +wchar_t* wcsdup (const wchar_t* wsToDuplicate); int wcsicmp (const wchar_t* ws1, const wchar_t* ws2); int wcsicoll (const wchar_t* ws1, const wchar_t* ws2); wchar_t* wcslwr (wchar_t* wsToConvert); @@ -185,3 +188,4 @@ wchar_t* wcsupr (wchar_t* wsToConvert); #endif #endif /* _STRING_H_ */ +#endif diff --git a/reactos/include/wchar.h b/reactos/include/wchar.h index 785dad00589..94866a4f9e9 100644 --- a/reactos/include/wchar.h +++ b/reactos/include/wchar.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * $Author: ariadne $ - * $Date: 1999/02/21 13:29:57 $ + * $Date: 1999/02/21 17:43:45 $ * */ @@ -29,4 +29,3 @@ #include #include #include - diff --git a/reactos/include/wstring.h b/reactos/include/wstring.h index 59c1888349a..021016120a7 100644 --- a/reactos/include/wstring.h +++ b/reactos/include/wstring.h @@ -1,3 +1,81 @@ -// this file is obsolete -#include +/* + * Adapted from linux for the reactos kernel, march 1998 -- David Welch + * Added wide character string functions, june 1998 -- Boudewijn Dekker + * Removed extern specifier from ___wcstok, june 1998 -- Boudewijn Dekker + * Added wcsicmp and wcsnicmp -- Boudewijn Dekker + */ + +#include + +#ifndef _LINUX_WSTRING_H_ +#define _LINUX_WSTRING_H_ + + + +#ifndef _WCHAR_T_ +#define _WCHAR_T_ +#define _WCHAR_T + typedef unsigned short wchar_t; +#endif +#define Aa_Difference (L'A'-L'a') + +#define towupper(c) (((c>=L'a') && (c<=L'z')) ? c+Aa_Difference : c) +#define towlower(c) (((c>=L'A') && (c<=L'Z')) ? c-Aa_Difference : c) + +//obsolete +wchar_t wtolower(wchar_t c ); +wchar_t wtoupper(wchar_t c ); + + +#define iswlower(c) ((c) >= L'a' && (c) <= L'z') +#define iswupper(c) ((c) >= L'A' && (c) <= L'Z') + +#define iswdigit(c) ((c) >= L'0' && (c) <= L'9') +#define iswxdigit(c) (((c) >= L'0' && (c) <= L'9') || ((c) >= L'A' && (c) <= L'F') || ((c) >= L'a' && (c) <= L'f') ) + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +//wchar_t * ___wcstok = NULL; +wchar_t * wcscpy(wchar_t *,const wchar_t *); +wchar_t * wcsncpy(wchar_t *,const wchar_t *, size_t); +wchar_t * wcscat(wchar_t *, const wchar_t *); +wchar_t * wcsncat(wchar_t *, const wchar_t *, size_t); +int wcscmp(const wchar_t *,const wchar_t *); +int wcsncmp(const wchar_t *,const wchar_t *,size_t); +wchar_t* wcschr(const wchar_t* str, wchar_t ch); +wchar_t * wcsrchr(const wchar_t *,wchar_t); +wchar_t * wcspbrk(const wchar_t *,const wchar_t *); +wchar_t * wcstok(wchar_t *,const wchar_t *); +wchar_t * wcsstr(const wchar_t *,const wchar_t *); +size_t wcslen(const wchar_t * s); +size_t wcsnlen(const wchar_t * s, size_t count); +int wcsicmp(const wchar_t* cs,const wchar_t * ct); +int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count); +size_t wcsspn(const wchar_t *str,const wchar_t *accept); +size_t wcscspn(const wchar_t *str,const wchar_t *reject); +wchar_t *wcsrev(wchar_t *s); +wchar_t *wcsstr(const wchar_t *s,const wchar_t *b); +wchar_t *wcsdup(const wchar_t *ptr); +wchar_t *wcsupr(wchar_t *x); +wchar_t * wcslwr(wchar_t *x); + +//obsolete +size_t wstrlen(const wchar_t * s); +int wcscmpi (const wchar_t* ws1, const wchar_t* ws2); + + + + + +#ifdef __cplusplus +} +#endif + +#endif