Subversion Repositories FlightCtrl

Rev

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

Rev 624 Rev 683
Line 1... Line 1...
1
// Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist nicht von der Lizenz für den MikroKopter-Teil unterstellt
1
// Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist nicht von der Lizenz für den MikroKopter-Teil unterstellt
Line 2... Line 2...
2
 
2
 
3
/*
3
/*
Line 4... Line 4...
4
Copyright (C) 1993 Free Software Foundation
4
Copyright (C) 1993 Free Software Foundation
5
 
5
 
6
This file is part of the GNU IO Library.  This library is free
6
This file is part of the GNU IO Library.  This library is free
Line 98... Line 98...
98
 if(PrintZiel == OUT_LCD) { DisplayBuff[DispPtr++] = zeichen; return(1);}
98
 if(PrintZiel == OUT_LCD) { DisplayBuff[DispPtr++] = zeichen; return(1);}
99
 else                       return(uart_putchar(zeichen));
99
 else                       return(uart_putchar(zeichen));
100
}
100
}
Line 101... Line 101...
101
 
101
 
102
 
102
 
103
void PRINT(const char * ptr, unsigned int len)
103
void PRINT(const char * ptr, unsigned int len)
104
{
104
{
105
 for(;len;len--) Putchar(*ptr++);
105
 for(;len;len--) Putchar(*ptr++);
106
}
106
}
107
 
107
 
108
void PRINTP(const char * ptr, unsigned int len)
108
void PRINTP(const char * ptr, unsigned int len)
109
{
109
{
Line 110... Line 110...
110
 for(;len;len--) Putchar(pgm_read_byte(ptr++));
110
 for(;len;len--) Putchar(pgm_read_byte(ptr++));
111
}
111
}
112
 
112
 
113
void PAD_SP(signed char howmany)
113
void PAD_SP(signed char howmany)
Line 114... Line 114...
114
{
114
{
115
        for(;howmany>0;howmany--) Putchar(' ');
115
        for(;howmany>0;howmany--) Putchar(' ');
116
}
116
}
117
 
117
 
Line 118... Line 118...
118
void PAD_0(signed char howmany)
118
void PAD_0(signed char howmany)
Line 167... Line 167...
167
        char buf[BUF];          /* space for %c, %[diouxX], %[eEfgG] */
167
        char buf[BUF];          /* space for %c, %[diouxX], %[eEfgG] */
168
        char ox[2];                     /* space for 0x hex-prefix */
168
        char ox[2];                     /* space for 0x hex-prefix */
Line 169... Line 169...
169
 
169
 
170
    PrintZiel = ziel;  // bestimmt, LCD oder UART
170
    PrintZiel = ziel;  // bestimmt, LCD oder UART
171
        va_start(ap, fmt0);
171
        va_start(ap, fmt0);
172
       
172
 
Line 173... Line 173...
173
        fmt = fmt0;
173
        fmt = fmt0;
174
 
174
 
175
        /*
175
        /*
Line 204... Line 204...
204
                        register unsigned int _d;
204
                        register unsigned int _d;
205
                        _d=va_arg(ap, unsigned int);
205
                        _d=va_arg(ap, unsigned int);
206
                        _ulong = flags&SHORTINT ? (unsigned long)(unsigned short)_d : (unsigned long)_d;
206
                        _ulong = flags&SHORTINT ? (unsigned long)(unsigned short)_d : (unsigned long)_d;
207
                }
207
                }
208
        }
208
        }
209
       
209
 
210
#ifndef LIGHTPRINTF
210
#ifndef LIGHTPRINTF
211
                if(ch==' ') {
211
                if(ch==' ') {
212
                        /*
212
                        /*
213
                         * ``If the space and + flags both appear, the space
213
                         * ``If the space and + flags both appear, the space
214
                         * flag will be ignored.''
214
                         * flag will be ignored.''
Line 288... Line 288...
288
                        } else {
288
                        } else {
289
                                register int _d;
289
                                register int _d;
290
                                _d=va_arg(ap, int);
290
                                _d=va_arg(ap, int);
291
                                _ulong = flags&SHORTINT ? (long)(short)_d : (long)_d;
291
                                _ulong = flags&SHORTINT ? (long)(short)_d : (long)_d;
292
                        }
292
                        }
293
                       
293
 
294
                        if ((long)_ulong < 0) {
294
                        if ((long)_ulong < 0) {
295
                                _ulong = -_ulong;
295
                                _ulong = -_ulong;
296
                                sign = '-';
296
                                sign = '-';
297
                        }
297
                        }
298
                        base = DEC;
298
                        base = DEC;
299
                        goto number;
299
                        goto number;
300
                } else
300
                } else
301
/*             
301
/*
302
                if (ch=='n') {
302
                if (ch=='n') {
303
                        if (flags & LONGINT)
303
                        if (flags & LONGINT)
304
                                *va_arg(ap, long *) = ret;
304
                                *va_arg(ap, long *) = ret;
305
                        else if (flags & SHORTINT)
305
                        else if (flags & SHORTINT)
306
                                *va_arg(ap, short *) = ret;
306
                                *va_arg(ap, short *) = ret;
307
                        else
307
                        else
308
                                *va_arg(ap, int *) = ret;
308
                                *va_arg(ap, int *) = ret;
309
                        continue;       // no output
309
                        continue;       // no output
310
                } else
310
                } else
311
*/
311
*/
312
#ifndef LIGHTPRINTF                     
312
#ifndef LIGHTPRINTF
313
                if (ch=='O'||ch=='o') {
313
                if (ch=='O'||ch=='o') {
314
                        if (ch=='O')
314
                        if (ch=='O')
315
                                flags |= LONGINT;
315
                                flags |= LONGINT;
316
                        base = OCT;
316
                        base = OCT;
317
                        goto nosign;
317
                        goto nosign;
Line 355... Line 355...
355
                                        size = prec;
355
                                        size = prec;
356
                        } else
356
                        } else
357
                                size = strlen(cp);
357
                                size = strlen(cp);
358
                        sign = '\0';
358
                        sign = '\0';
359
                } else
359
                } else
360
#endif /* LIGHTPRINTF */                        
360
#endif /* LIGHTPRINTF */
361
                if(ch=='U'||ch=='u') {
361
                if(ch=='U'||ch=='u') {
362
                        if (ch=='U')
362
                        if (ch=='U')
363
                                flags |= LONGINT;
363
                                flags |= LONGINT;
364
                        base = DEC;
364
                        base = DEC;
365
                        goto nosign;
365
                        goto nosign;
Line 399... Line 399...
399
                                        }
399
                                        }
400
                                        *--cp=_d;
400
                                        *--cp=_d;
401
                                        _ulong /= base;
401
                                        _ulong /= base;
402
                                } while (notlastdigit);
402
                                } while (notlastdigit);
403
#ifndef LIGHTPRINTF
403
#ifndef LIGHTPRINTF
404
                                // handle octal leading 0 
404
                                // handle octal leading 0
405
                                if (base==OCT && flags & ALT && *cp != '0')
405
                                if (base==OCT && flags & ALT && *cp != '0')
406
                                        *--cp = '0';
406
                                        *--cp = '0';
407
#endif
407
#endif
408
                        }
408
                        }