[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tyndur-devel] [PATCH 1/3] libc: fgetwc, fputwc und verwandte Funktionen



Am Samstag, 25. April 2009 17:23 schrieb Antoine Kaufmann:
> * libc: wchar.h nach modules/include verschoben, da sie stdio.h
>         inkludieren muss.
> + libc: fgetwc, getwc, getchar: Breite Zeichen aus Datei lesen
> + libc: fputwc, putwc, putwchar: Breite Zeichen in Datei schreiben
> ---
>  src/include/wchar.h              |   37 ----------
>  src/modules/include/wchar.h      |   96 +++++++++++++++++++++++++
>  src/modules/lib/stdlibc/wstdio.c |  142
> ++++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+),
> 37 deletions(-)
>  delete mode 100644 src/include/wchar.h
>  create mode 100644 src/modules/include/wchar.h
>  create mode 100644 src/modules/lib/stdlibc/wstdio.c
>
> diff --git a/src/include/wchar.h b/src/include/wchar.h
> deleted file mode 100644
> index f9cd89b..0000000
> --- a/src/include/wchar.h
> +++ /dev/null
> @@ -1,37 +0,0 @@
> -/*
> - * Copyright (c) 2008 The tyndur Project. All rights reserved.
> - *
> - * This code is derived from software contributed to the tyndur Project
> - * by Antoine Kaufmann.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions
> - * are met:
> - * 1. Redistributions of source code must retain the above copyright
> - *    notice, this list of conditions and the following disclaimer.
> - * 2. Redistributions in binary form must reproduce the above copyright
> - *    notice, this list of conditions and the following disclaimer in the
> - *    documentation and/or other materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
> HOLDERS OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> - */
> -
> -#ifndef _WCHAR_H_
> -#define _WCHAR_H_
> -
> -#include <stddef.h>
> -
> -typedef wchar_t wint_t;
> -
> -#endif //ifndef _WCHAR_H_
> -
> diff --git a/src/modules/include/wchar.h b/src/modules/include/wchar.h
> new file mode 100644
> index 0000000..d173bce
> --- /dev/null
> +++ b/src/modules/include/wchar.h
> @@ -0,0 +1,96 @@
> +/*
> + * Copyright (c) 2008-2009 The tyndur Project. All rights reserved.
> + *
> + * This code is derived from software contributed to the tyndur Project
> + * by Antoine Kaufmann.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
> HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#ifndef _WCHAR_H_
> +#define _WCHAR_H_
> +
> +#include <stddef.h>
> +#include <stdio.h>
> +
> +#define WEOF ((wint_t) -1)
> +
> +typedef wchar_t wint_t;
> +
> +/* WSTDIO */
> +
> +/**
> + * Breites Zeichen aus einer Datei lesen.
> + *
> + * @param stream Die geoeffnete Datei
> + *
> + * @return Das gelesene Zeichen oder WEOF im Fehlerfall.
> + */
> +wint_t fgetwc(FILE* stream);
> +
> +/**
> + * Wie fgetwc, mit dem Unterschied, dass getwc als Makro implementiert
> werden + * darf, das den Parameter mehrmals auswertet
> + *
> + * @see fgetwc
> + */
> +wint_t getwc(FILE* stream);

Blöde Frage: Wenn du das extra so schön im Kommentar erwähnst, warum nicht 
#define getwc(s) fgetwc(s)? Analoges gilt für noch ein paar Funktionen.

Ansonsten sieht das vernünftig aus.