* device/include/pic16/stdio.h, device/lib/pic16/libc/stdio/streams.c,
[fw/sdcc] / device / include / pic16 / stdio.h
index f4b4e4f5d0f98c8d9a353aa3e02b70b92e685b5c..3c81810a028ed1075dd2b4e7ab1080fc2486ff6c 100644 (file)
@@ -2,7 +2,7 @@
   stdio.h - ANSI functions forward declarations
 
    Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
-   
+
              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
 
    This program is free software; you can redistribute it and/or modify it
    In other words, you are welcome to use, share and improve this program.
    You are forbidden to forbid anyone else to use, share and improve
    what you give them.   Help stamp out software-hoarding!
--------------------------------------------------------------------------*/
 
-/*
-** $Id$
-*/
+   As a special exception, if you link this library with other files,
+   some of which are compiled with SDCC, to produce an executable,
+   this library does not by itself cause the resulting executable
+   to be covered by the GNU General Public License.
+   This exception does not however invalidate any other reasons why
+   the executable file might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
 
 #ifndef __STDIO_H
 #define __STDIO_H 1
   typedef unsigned int size_t;
 #endif
 
-
 /* stream descriptor definition */
 typedef char *FILE;
 
-
 /* USART and MSSP module stream descriptors */
 
 /* since FILE is declared as a generic pointer,
@@ -61,7 +62,7 @@ typedef char *FILE;
  * Descriptors are denoted by an 1 in bit 5,
  * further dereference is made for:
  * <stream>     <3:0> bits
- *     USART    0 (0x0)
+ *     USART     0 (0x0)
  *     MSSP      1 (0x1)
  *     USER     15 (0xf)
  *
@@ -74,15 +75,13 @@ typedef char *FILE;
  * bits of the upper byte can be used
  */
 
+#define USART_DEREF     0x0
+#define MSSP_DEREF      0x1
+#define USER_DEREF      0xf
 
-#define USART_DEREF    0x0
-#define MSSP_DEREF     0x1
-#define USER_DEREF     0xf
-
-#define STREAM_USART   ((FILE *)(0x00200000UL))
-#define STREAM_MSSP    ((FILE *)(0x00210000UL))
-#define STREAM_USER    ((FILE *)(0x002f0000UL))
-
+#define STREAM_USART    ((FILE *)(0x00200000UL))
+#define STREAM_MSSP     ((FILE *)(0x00210000UL))
+#define STREAM_USER     ((FILE *)(0x002f0000UL))
 
 /* this is a custom dereference which points to a custom
  * port of GPSIM simulator. This port redirects characters
@@ -90,41 +89,35 @@ typedef char *FILE;
  * NOTICE: This feature is not part of the official gpsim
  * distribution. Contact vrokas AT users.sourceforge.net
  * for more info */
-#define GPSIM_DEREF    0xe
-#define STREAM_GPSIM   ((FILE *)(0x002e0000UL))
+#define GPSIM_DEREF     0xe
+#define STREAM_GPSIM    ((FILE *)(0x002e0000UL))
 
 extern FILE * stdin;
 extern FILE * stdout;
 
-//typedef void (*pfn_outputchar)(char c, void* p) _REENTRANT;
-//extern int _print_format (pfn_outputchar pfn, void* pvoid, const char *format, va_list ap);
-
 /* printf_small() supports float print */
-void printf_small(char *, ...);
+void printf_small (const char *, ...);
 
 /* printf_tiny() does not support float print */
-void printf_tiny(char *, ...);  // __reentrant;
-
-extern unsigned int printf (char *,...);
-extern unsigned int sprintf (char *, char *, ...);
-extern unsigned int fprintf(FILE *, char *, ...);
+void printf_tiny (const char *, ...);  // __reentrant;
 
-extern unsigned int vsprintf (char *, char *, va_list);
-extern unsigned int vprintf (char *, va_list);
-extern unsigned int vfprintf(FILE *, char *, va_list);
+extern int printf (const char *,...);
+extern int fprintf (FILE *, const char *,...);
+extern int sprintf (char *, const char *, ...);
 
-extern int puts(char *);
+extern int vprintf (const char *, va_list);
+extern int vfprintf (FILE * stream, const char *fmt, va_list ap);
+extern int vsprintf (char *, const char *, va_list);
 
-extern void __stream_putchar(FILE *, unsigned char);
+extern void putchar (char) __wparam __naked;
 
-#define PUTCHAR(arg)   void putchar(unsigned char arg) __wparam
-extern PUTCHAR(c);
+extern void __stream_putchar (FILE *, char);
 
-extern void __stream_usart_putchar(unsigned char c) __wparam __naked;
-extern void __stream_mssp_putchar(unsigned char c) __wparam __naked;
-extern void __stream_gpsim_putchar(unsigned char c) __wparam __naked;
+extern void __stream_usart_putchar (char c) __wparam __naked;
+extern void __stream_mssp_putchar (char c) __wparam __naked;
+extern void __stream_gpsim_putchar (char c) __wparam __naked;
 
-extern char *gets(char *);
-extern char getchar(void);
+extern char *gets (char *);
+extern char getchar (void);
 
 #endif /* __STDIO_H */