1 |   |
2 |   #  1  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\sources\common\doprnt.c" |
3 |   |
4 |   #  4  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\__size_t.h" |
5 |   typedef  unsigned  size_t; |
6 |   |
7 |   #  7  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\stdarg.h" |
8 |   typedef  void  *  va_list[1]; |
9 |   |
10 |   #pragma  intrinsic(__va_start) |
11 |   extern  void  *  __va_start(void); |
12 |   |
13 |   #pragma  intrinsic(__va_arg) |
14 |   extern  void  *  __va_arg(void  *,  ...); |
15 |   |
16 |   #  43  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\stdio.h" |
17 |   struct  __prbuf |
18 |   { |
19 |   char  *  ptr; |
20 |   void  (*  func)(char); |
21 |   }; |
22 |   |
23 |   #  29  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\errno.h" |
24 |   extern  int  errno; |
25 |   |
26 |   #  12  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\conio.h" |
27 |   extern  void  init_uart(void); |
28 |   |
29 |   extern  char  getch(void); |
30 |   extern  char  getche(void); |
31 |   extern  void  putch(char); |
32 |   extern  void  ungetch(char); |
33 |   |
34 |   extern  __bit  kbhit(void); |
35 |   |
36 |   #  23 |
37 |   extern  char  *  cgets(char  *); |
38 |   extern  void  cputs(const  char  *); |
39 |   |
40 |   #  88  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\stdio.h" |
41 |   extern  int  cprintf(char  *,  ...); |
42 |   #pragma  printf_check(cprintf) |
43 |   |
44 |   |
45 |   |
46 |   extern  int  _doprnt(struct  __prbuf  *,  const  register  char  *,  register  va_list); |
47 |   |
48 |   |
49 |   #  180 |
50 |   #pragma  printf_check(vprintf)  const |
51 |   #pragma  printf_check(vsprintf)  const |
52 |   |
53 |   extern  char  *  gets(char  *); |
54 |   extern  int  puts(const  char  *); |
55 |   extern  int  scanf(const  char  *,  ...)  __attribute__((unsupported("scanf()  is  not  supported  by  this  compiler"))); |
56 |   extern  int  sscanf(const  char  *,  const  char  *,  ...)  __attribute__((unsupported("sscanf()  is  not  supported  by  this  compiler"))); |
57 |   extern  int  vprintf(const  char  *,  va_list)  __attribute__((unsupported("vprintf()  is  not  supported  by  this  compiler"))); |
58 |   extern  int  vsprintf(char  *,  const  char  *,  va_list)  __attribute__((unsupported("vsprintf()  is  not  supported  by  this  compiler"))); |
59 |   extern  int  vscanf(const  char  *,  va_list  ap)  __attribute__((unsupported("vscanf()  is  not  supported  by  this  compiler"))); |
60 |   extern  int  vsscanf(const  char  *,  const  char  *,  va_list)  __attribute__((unsupported("vsscanf()  is  not  supported  by  this  compiler"))); |
61 |   |
62 |   #pragma  printf_check(printf)  const |
63 |   #pragma  printf_check(sprintf)  const |
64 |   extern  int  sprintf(char  *,  const  char  *,  ...); |
65 |   extern  int  printf(const  char  *,  ...); |
66 |   |
67 |   #  4  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\ctype.h" |
68 |   extern  __bit  isalpha(char); |
69 |   extern  __bit  isupper(char); |
70 |   extern  __bit  islower(char); |
71 |   extern  __bit  isdigit(char); |
72 |   extern  __bit  isxdigit(char); |
73 |   extern  __bit  isspace(char); |
74 |   extern  __bit  ispunct(char); |
75 |   extern  __bit  isalnum(char); |
76 |   extern  __bit  isprint(char); |
77 |   extern  __bit  isgraph(char); |
78 |   extern  __bit  iscntrl(char); |
79 |   |
80 |   |
81 |   extern  char  toupper(char); |
82 |   extern  char  tolower(char); |
83 |   |
84 |   #  7  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\stdlib.h" |
85 |   typedef  unsigned  short  wchar_t; |
86 |   |
87 |   #  15 |
88 |   typedef  struct  { |
89 |   int  rem; |
90 |   int  quot; |
91 |   }  div_t; |
92 |   typedef  struct  { |
93 |   unsigned  rem; |
94 |   unsigned  quot; |
95 |   }  udiv_t; |
96 |   typedef  struct  { |
97 |   long  quot; |
98 |   long  rem; |
99 |   }  ldiv_t; |
100 |   typedef  struct  { |
101 |   unsigned  long  quot; |
102 |   unsigned  long  rem; |
103 |   }  uldiv_t; |
104 |   |
105 |   #  53 |
106 |   extern  double  atof(const  char  *); |
107 |   extern  double  strtod(const  char  *,  const  char  **); |
108 |   extern  int  atoi(const  char  *); |
109 |   extern  unsigned  xtoi(const  char  *); |
110 |   extern  long  atol(const  char  *); |
111 |   extern  long  strtol(const  char  *,  char  **,  int); |
112 |   |
113 |   extern  int  rand(void); |
114 |   extern  void  srand(unsigned  int); |
115 |   extern  void  *  calloc(size_t,  size_t); |
116 |   extern  div_t  div(int  numer,  int  denom); |
117 |   extern  udiv_t  udiv(unsigned  numer,  unsigned  denom); |
118 |   extern  ldiv_t  ldiv(long  numer,  long  denom); |
119 |   extern  uldiv_t  uldiv(unsigned  long  numer,unsigned  long  denom); |
120 |   extern  unsigned  long  _lrotl(unsigned  long  value,  unsigned  int  shift); |
121 |   extern  unsigned  long  _lrotr(unsigned  long  value,  unsigned  int  shift); |
122 |   extern  unsigned  int  _rotl(unsigned  int  value,  unsigned  int  shift); |
123 |   extern  unsigned  int  _rotr(unsigned  int  value,  unsigned  int  shift); |
124 |   |
125 |   |
126 |   |
127 |   |
128 |   extern  void  *  malloc(size_t); |
129 |   extern  void  free(void  *); |
130 |   extern  void  *  realloc(void  *,  size_t); |
131 |   |
132 |   |
133 |   #  13  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\xc8debug.h" |
134 |   #pragma  intrinsic(__builtin_software_breakpoint) |
135 |   extern  void  __builtin_software_breakpoint(void); |
136 |   |
137 |   #  86  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\stdlib.h" |
138 |   extern  int  atexit(void  (*)(void)); |
139 |   extern  char  *  getenv(const  char  *); |
140 |   extern  char  **  environ; |
141 |   extern  int  system(char  *); |
142 |   extern  void  qsort(void  *,  size_t,  size_t,  int  (*)(const  void  *,  const  void  *)); |
143 |   extern  void  *  bsearch(const  void  *,  void  *,  size_t,  size_t,  int(*)(const  void  *,  const  void  *)); |
144 |   extern  int  abs(int); |
145 |   extern  long  labs(long); |
146 |   |
147 |   extern  char  *  itoa(char  *  buf,  int  val,  int  base); |
148 |   extern  char  *  utoa(char  *  buf,  unsigned  val,  int  base); |
149 |   |
150 |   |
151 |   |
152 |   |
153 |   extern  char  *  ltoa(char  *  buf,  long  val,  int  base); |
154 |   extern  char  *  ultoa(char  *  buf,  unsigned  long  val,  int  base); |
155 |   |
156 |   extern  char  *  ftoa(float  f,  int  *  status); |
157 |   |
158 |   #  14  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\string.h" |
159 |   extern  void  *  memcpy(void  *,  const  void  *,  size_t); |
160 |   extern  void  *  memmove(void  *,  const  void  *,  size_t); |
161 |   extern  void  *  memset(void  *,  int,  size_t); |
162 |   |
163 |   #  36 |
164 |   extern  char  *  strcat(char  *,  const  char  *); |
165 |   extern  char  *  strcpy(char  *,  const  char  *); |
166 |   extern  char  *  strncat(char  *,  const  char  *,  size_t); |
167 |   extern  char  *  strncpy(char  *,  const  char  *,  size_t); |
168 |   extern  char  *  strdup(const  char  *); |
169 |   extern  char  *  strtok(char  *,  const  char  *); |
170 |   |
171 |   |
172 |   extern  int  memcmp(const  void  *,  const  void  *,  size_t); |
173 |   extern  int  strcmp(const  char  *,  const  char  *); |
174 |   extern  int  stricmp(const  char  *,  const  char  *); |
175 |   extern  int  strncmp(const  char  *,  const  char  *,  size_t); |
176 |   extern  int  strnicmp(const  char  *,  const  char  *,  size_t); |
177 |   extern  void  *  memchr(const  void  *,  int,  size_t); |
178 |   extern  size_t  strcspn(const  char  *,  const  char  *); |
179 |   extern  char  *  strpbrk(const  char  *,  const  char  *); |
180 |   extern  size_t  strspn(const  char  *,  const  char  *); |
181 |   extern  char  *  strstr(const  char  *,  const  char  *); |
182 |   extern  char  *  stristr(const  char  *,  const  char  *); |
183 |   extern  char  *  strerror(int); |
184 |   extern  size_t  strlen(const  char  *); |
185 |   extern  char  *  strchr(const  char  *,  int); |
186 |   extern  char  *  strichr(const  char  *,  int); |
187 |   extern  char  *  strrchr(const  char  *,  int); |
188 |   extern  char  *  strrichr(const  char  *,  int); |
189 |   |
190 |   #  22  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\sys.h" |
191 |   extern  int  execl(char  *,  char  *,  ...); |
192 |   extern  int  execv(char  *,  char  **); |
193 |   extern  int  execve(char  *,  char  **,  char  **); |
194 |   extern  int  execle(char  *,  char  *,  ...); |
195 |   extern  int  execvp(char  *,  char  **); |
196 |   extern  int  execlp(char  *,  char  *,  ...); |
197 |   extern  int  getpid(void); |
198 |   extern  char  *  mktemp(char  *); |
199 |   |
200 |   #  43 |
201 |   extern  int  spawnl(char  *,  char  *,  ...); |
202 |   extern  int  spawnv(char  *,  char  **); |
203 |   extern  int  spawnle(char  *,  char  *,  ...); |
204 |   extern  int  spawnve(char  *,  char  **,  char  **); |
205 |   extern  int  spawnlp(char  *,  char  *,  ...); |
206 |   extern  int  spawnvp(char  *,  char  **); |
207 |   |
208 |   extern  int  chdir(char  *); |
209 |   extern  int  chdrv(char  *); |
210 |   extern  int  mkdir(char  *); |
211 |   extern  int  rmdir(char  *); |
212 |   extern  char  *  getcwd(char  *); |
213 |   extern  void  persist_validate(void); |
214 |   extern  int  persist_check(int); |
215 |   extern  char  *  getdrv(void); |
216 |   extern  char  **  _getargs(char  *,  char  *); |
217 |   extern  int  _argc_; |
218 |   |
219 |   #  70 |
220 |   extern  void  *  sbrk(size_t); |
221 |   extern  void  brk(void  *); |
222 |   |
223 |   #  77 |
224 |   extern  int  _pnum(unsigned  long,  signed  char,  signed  char,  unsigned  char,  unsigned  char,  struct  __prbuf  *,  unsigned  char); |
225 |   extern  int  _fnum(double,  short,  short,  short,  struct  __prbuf  *,  short); |
226 |   |
227 |   #  30  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\include\math.h" |
228 |   extern  double  fabs(double); |
229 |   extern  double  floor(double); |
230 |   extern  double  ceil(double); |
231 |   extern  double  modf(double,  double  *); |
232 |   extern  double  sqrt(double); |
233 |   extern  double  atof(const  char  *); |
234 |   extern  double  sin(double)  ; |
235 |   extern  double  cos(double)  ; |
236 |   extern  double  tan(double)  ; |
237 |   extern  double  asin(double)  ; |
238 |   extern  double  acos(double)  ; |
239 |   extern  double  atan(double); |
240 |   extern  double  atan2(double,  double)  ; |
241 |   extern  double  log(double); |
242 |   extern  double  log10(double); |
243 |   extern  double  pow(double,  double)  ; |
244 |   extern  double  exp(double)  ; |
245 |   extern  double  sinh(double)  ; |
246 |   extern  double  cosh(double)  ; |
247 |   extern  double  tanh(double); |
248 |   extern  double  eval_poly(double,  const  double  *,  int); |
249 |   extern  double  frexp(double,  int  *); |
250 |   extern  double  ldexp(double,  int); |
251 |   extern  double  fmod(double,  double); |
252 |   extern  double  trunc(double); |
253 |   extern  double  round(double); |
254 |   |
255 |   |
256 |   #  13  "C:\Program  Files  (x86)\Microchip\xc8\v1.43\sources\common\doprnt.c" |
257 |   #pragma  warning  disable  350 |
258 |   |
259 |   #  354 |
260 |   const  static  unsigned  long  dpowers[]  =  {1,  10,  100,  1000,  10000, |
261 |   |
262 |   100000,  1000000,  10000000,  100000000, |
263 |   1000000000 |
264 |   |
265 |   }; |
266 |   |
267 |   #  455 |
268 |   int |
269 |   |
270 |   #  492 |
271 |   sprintf(char  *  sp,  const  char  *  f,  ...) |
272 |   { |
273 |   va_list  ap; |
274 |   |
275 |   |
276 |   |
277 |   |
278 |   signed  char  c; |
279 |   |
280 |   int  width; |
281 |   |
282 |   |
283 |   int  prec; |
284 |   |
285 |   #  508 |
286 |   unsigned  char  flag; |
287 |   |
288 |   #  523 |
289 |   union  { |
290 |   unsigned  long  vd; |
291 |   double  integ; |
292 |   }  tmpval; |
293 |   |
294 |   unsigned  long  val; |
295 |   unsigned  len; |
296 |   const  char  *  cp; |
297 |   |
298 |   |
299 |   *ap  =  __va_start(); |
300 |   |
301 |   |
302 |   while(c  =  *f++)  { |
303 |   |
304 |   if(c  !=  '%') |
305 |   |
306 |   { |
307 |   ((*sp++  =  (c))); |
308 |   continue; |
309 |   } |
310 |   |
311 |   |
312 |   width  =  0; |
313 |   |
314 |   flag  =  0; |
315 |   |
316 |   #  597 |
317 |   if(isdigit((unsigned)*f))  { |
318 |   width  =  0; |
319 |   do  { |
320 |   width  *=  10; |
321 |   width  +=  *f++  -  '0'; |
322 |   }  while(isdigit((unsigned)*f)); |
323 |   |
324 |   #  608 |
325 |   } |
326 |   |
327 |   |
328 |   if(*f  ==  '.')  { |
329 |   flag  |=  0x4000; |
330 |   f++; |
331 |   |
332 |   #  620 |
333 |   { |
334 |   prec  =  0; |
335 |   while(isdigit((unsigned)*f)) |
336 |   prec  =  prec*10  +  *f++  -  '0'; |
337 |   } |
338 |   }  else  { |
339 |   prec  =  0; |
340 |   |
341 |   #  630 |
342 |   } |
343 |   |
344 |   |
345 |   loop: |
346 |   |
347 |   switch(c  =  *f++)  { |
348 |   |
349 |   case  0: |
350 |   goto  alldone; |
351 |   |
352 |   |
353 |   case  'l': |
354 |   |
355 |   flag  |=  0x10; |
356 |   goto  loop; |
357 |   |
358 |   #  802 |
359 |   default: |
360 |   |
361 |   #  813 |
362 |   continue; |
363 |   |
364 |   |
365 |   |
366 |   case  'u': |
367 |   flag  |=  0xC0; |
368 |   break; |
369 |   |
370 |   |
371 |   } |
372 |   |
373 |   #  1273 |
374 |   { |
375 |   |
376 |   #  1281 |
377 |   if(flag  &  0x10) |
378 |   val  =  (*(unsigned  long  *)__va_arg((*(unsigned  long  **)ap),  (unsigned  long)0)); |
379 |   else |
380 |   |
381 |   |
382 |   val  =  (*(unsigned  *)__va_arg((*(unsigned  **)ap),  (unsigned)0)); |
383 |   } |
384 |   |
385 |   |
386 |   if(prec  ==  0  &&  val  ==  0) |
387 |   prec++; |
388 |   |
389 |   #  1305 |
390 |   for(c  =  1  ;  c  !=  sizeof  dpowers/sizeof  dpowers[0]  ;  c++) |
391 |   if(val &lsaquo   dpowers[c]) |
392 |   break; |
393 |   |
394 |   #  1339 |
395 |   if(c &lsaquo   prec) |
396 |   c  =  prec; |
397 |   else  if(prec &lsaquo   c) |
398 |   prec  =  c; |
399 |   |
400 |   #  1381 |
401 |   if(width &rsaquo   c) |
402 |   width  -=  c; |
403 |   else |
404 |   width  =  0; |
405 |   |
406 |   #  1422 |
407 |   { |
408 |   |
409 |   if(width |
410 |   |
411 |   #  1428 |
412 |   ) |
413 |   do |
414 |   ((*sp++  =  ('  '))); |
415 |   while(--width); |
416 |   |
417 |   #  1469 |
418 |   } |
419 |   |
420 |   #  1474 |
421 |   while(prec--)  { |
422 |   |
423 |   #  1478 |
424 |   { |
425 |   |
426 |   #  1489 |
427 |   c  =  (val  /  dpowers[prec])  %  10  +  '0'; |
428 |   |
429 |   #  1523 |
430 |   } |
431 |   ((*sp++  =  (c))); |
432 |   } |
433 |   |
434 |   #  1533 |
435 |   } |
436 |   |
437 |   alldone: |
438 |   |
439 |   |
440 |   *sp  =  0; |
441 |   |
442 |   return  0; |
443 |   } |
444 |   |