OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [MW_0_8_9PRE7/] [mw/] [src/] [engine/] [devopen.i] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 673 markom
# 1 "devopen.c"
2
# 1 ""
3
# 1 ""
4
# 1 "devopen.c"
5
# 15 "devopen.c"
6
# 1 "/projects/or32-uclinux/include/stdio.h" 1
7
# 28 "/projects/or32-uclinux/include/stdio.h"
8
# 1 "/projects/or32-uclinux/include/features.h" 1
9
# 292 "/projects/or32-uclinux/include/features.h"
10
# 1 "/projects/or32-uclinux/include/sys/cdefs.h" 1
11
# 293 "/projects/or32-uclinux/include/features.h" 2
12
# 327 "/projects/or32-uclinux/include/features.h"
13
# 1 "/projects/or32-uclinux/include/bits/uClibc_config.h" 1
14
# 328 "/projects/or32-uclinux/include/features.h" 2
15
# 29 "/projects/or32-uclinux/include/stdio.h" 2
16
 
17
 
18
 
19
 
20
 
21
# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h" 1
22
# 201 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h"
23
typedef unsigned int size_t;
24
# 35 "/projects/or32-uclinux/include/stdio.h" 2
25
 
26
# 1 "/projects/or32-uclinux/include/bits/types.h" 1
27
# 29 "/projects/or32-uclinux/include/bits/types.h"
28
# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h" 1
29
# 30 "/projects/or32-uclinux/include/bits/types.h" 2
30
 
31
 
32
typedef unsigned char __u_char;
33
typedef unsigned short __u_short;
34
typedef unsigned int __u_int;
35
typedef unsigned long __u_long;
36
 
37
__extension__ typedef unsigned long long int __u_quad_t;
38
__extension__ typedef long long int __quad_t;
39
# 49 "/projects/or32-uclinux/include/bits/types.h"
40
typedef signed char __int8_t;
41
typedef unsigned char __uint8_t;
42
typedef signed short int __int16_t;
43
typedef unsigned short int __uint16_t;
44
typedef signed int __int32_t;
45
typedef unsigned int __uint32_t;
46
 
47
__extension__ typedef signed long long int __int64_t;
48
__extension__ typedef unsigned long long int __uint64_t;
49
 
50
typedef __quad_t *__qaddr_t;
51
 
52
 
53
 
54
typedef __u_int __dev_t;
55
typedef __u_int __uid_t;
56
typedef __u_int __gid_t;
57
typedef __u_int __ino_t;
58
typedef __u_int __mode_t;
59
typedef __u_short __nlink_t;
60
typedef long int __off_t;
61
typedef __quad_t __loff_t;
62
typedef int __pid_t;
63
typedef int __ssize_t;
64
typedef __u_long __rlim_t;
65
typedef __u_quad_t __rlim64_t;
66
typedef __u_int __id_t;
67
 
68
typedef struct
69
  {
70
    int __val[2];
71
  } __fsid_t;
72
 
73
 
74
typedef int __daddr_t;
75
typedef char *__caddr_t;
76
typedef long int __time_t;
77
typedef unsigned int __useconds_t;
78
typedef long int __suseconds_t;
79
typedef long int __swblk_t;
80
 
81
typedef long int __clock_t;
82
 
83
 
84
typedef int __clockid_t;
85
 
86
 
87
typedef int __timer_t;
88
 
89
 
90
 
91
 
92
 
93
 
94
typedef int __key_t;
95
 
96
 
97
typedef unsigned short int __ipc_pid_t;
98
 
99
 
100
 
101
typedef long int __blksize_t;
102
 
103
 
104
 
105
 
106
typedef long int __blkcnt_t;
107
typedef __quad_t __blkcnt64_t;
108
 
109
 
110
typedef __u_long __fsblkcnt_t;
111
typedef __u_quad_t __fsblkcnt64_t;
112
 
113
 
114
typedef __u_long __fsfilcnt_t;
115
typedef __u_quad_t __fsfilcnt64_t;
116
 
117
 
118
typedef __u_quad_t __ino64_t;
119
 
120
 
121
typedef __loff_t __off64_t;
122
 
123
 
124
typedef long int __t_scalar_t;
125
typedef unsigned long int __t_uscalar_t;
126
 
127
 
128
typedef int __intptr_t;
129
 
130
 
131
typedef unsigned int __socklen_t;
132
 
133
 
134
 
135
 
136
# 1 "/projects/or32-uclinux/include/bits/pthreadtypes.h" 1
137
# 23 "/projects/or32-uclinux/include/bits/pthreadtypes.h"
138
# 1 "/projects/or32-uclinux/include/bits/sched.h" 1
139
# 68 "/projects/or32-uclinux/include/bits/sched.h"
140
struct __sched_param
141
  {
142
    int __sched_priority;
143
  };
144
# 24 "/projects/or32-uclinux/include/bits/pthreadtypes.h" 2
145
 
146
 
147
struct _pthread_fastlock
148
{
149
  long int __status;
150
  int __spinlock;
151
 
152
};
153
 
154
 
155
 
156
typedef struct _pthread_descr_struct *_pthread_descr;
157
 
158
 
159
 
160
 
161
 
162
typedef struct __pthread_attr_s
163
{
164
  int __detachstate;
165
  int __schedpolicy;
166
  struct __sched_param __schedparam;
167
  int __inheritsched;
168
  int __scope;
169
  size_t __guardsize;
170
  int __stackaddr_set;
171
  void *__stackaddr;
172
  size_t __stacksize;
173
} pthread_attr_t;
174
 
175
 
176
 
177
typedef struct
178
{
179
  struct _pthread_fastlock __c_lock;
180
  _pthread_descr __c_waiting;
181
} pthread_cond_t;
182
 
183
 
184
 
185
typedef struct
186
{
187
  int __dummy;
188
} pthread_condattr_t;
189
 
190
 
191
typedef unsigned int pthread_key_t;
192
 
193
 
194
 
195
 
196
 
197
typedef struct
198
{
199
  int __m_reserved;
200
  int __m_count;
201
  _pthread_descr __m_owner;
202
  int __m_kind;
203
  struct _pthread_fastlock __m_lock;
204
} pthread_mutex_t;
205
 
206
 
207
 
208
typedef struct
209
{
210
  int __mutexkind;
211
} pthread_mutexattr_t;
212
 
213
 
214
 
215
typedef int pthread_once_t;
216
# 140 "/projects/or32-uclinux/include/bits/pthreadtypes.h"
217
typedef unsigned long int pthread_t;
218
# 146 "/projects/or32-uclinux/include/bits/types.h" 2
219
# 37 "/projects/or32-uclinux/include/stdio.h" 2
220
 
221
 
222
 
223
# 1 "/projects/or32-uclinux/include/sys/types.h" 1
224
# 28 "/projects/or32-uclinux/include/sys/types.h"
225
 
226
 
227
 
228
 
229
 
230
 
231
typedef __u_char u_char;
232
typedef __u_short u_short;
233
typedef __u_int u_int;
234
typedef __u_long u_long;
235
typedef __quad_t quad_t;
236
typedef __u_quad_t u_quad_t;
237
typedef __fsid_t fsid_t;
238
 
239
 
240
 
241
 
242
typedef __loff_t loff_t;
243
 
244
 
245
 
246
typedef __ino_t ino_t;
247
# 61 "/projects/or32-uclinux/include/sys/types.h"
248
typedef __dev_t dev_t;
249
 
250
 
251
 
252
 
253
typedef __gid_t gid_t;
254
 
255
 
256
 
257
 
258
typedef __mode_t mode_t;
259
 
260
 
261
 
262
 
263
typedef __nlink_t nlink_t;
264
 
265
 
266
 
267
 
268
typedef __uid_t uid_t;
269
 
270
 
271
 
272
 
273
 
274
typedef __off_t off_t;
275
# 99 "/projects/or32-uclinux/include/sys/types.h"
276
typedef __pid_t pid_t;
277
 
278
 
279
 
280
 
281
typedef __id_t id_t;
282
 
283
 
284
 
285
 
286
typedef __ssize_t ssize_t;
287
 
288
 
289
 
290
 
291
 
292
typedef __daddr_t daddr_t;
293
typedef __caddr_t caddr_t;
294
 
295
 
296
 
297
 
298
 
299
typedef __key_t key_t;
300
# 132 "/projects/or32-uclinux/include/sys/types.h"
301
# 1 "/projects/or32-uclinux/include/time.h" 1
302
# 70 "/projects/or32-uclinux/include/time.h"
303
typedef __time_t time_t;
304
# 82 "/projects/or32-uclinux/include/time.h"
305
typedef __clockid_t clockid_t;
306
# 94 "/projects/or32-uclinux/include/time.h"
307
typedef __timer_t timer_t;
308
# 133 "/projects/or32-uclinux/include/sys/types.h" 2
309
# 146 "/projects/or32-uclinux/include/sys/types.h"
310
# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h" 1
311
# 147 "/projects/or32-uclinux/include/sys/types.h" 2
312
 
313
 
314
 
315
typedef unsigned long int ulong;
316
typedef unsigned short int ushort;
317
typedef unsigned int uint;
318
# 190 "/projects/or32-uclinux/include/sys/types.h"
319
typedef int int8_t __attribute__ ((__mode__ (__QI__)));
320
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
321
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
322
typedef int int64_t __attribute__ ((__mode__ (__DI__)));
323
 
324
 
325
typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
326
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
327
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
328
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
329
 
330
typedef int register_t __attribute__ ((__mode__ (__word__)));
331
# 212 "/projects/or32-uclinux/include/sys/types.h"
332
# 1 "/projects/or32-uclinux/include/endian.h" 1
333
# 37 "/projects/or32-uclinux/include/endian.h"
334
# 1 "/projects/or32-uclinux/include/bits/endian.h" 1
335
# 38 "/projects/or32-uclinux/include/endian.h" 2
336
# 213 "/projects/or32-uclinux/include/sys/types.h" 2
337
 
338
 
339
# 1 "/projects/or32-uclinux/include/sys/select.h" 1
340
# 31 "/projects/or32-uclinux/include/sys/select.h"
341
# 1 "/projects/or32-uclinux/include/bits/select.h" 1
342
# 32 "/projects/or32-uclinux/include/sys/select.h" 2
343
 
344
 
345
# 1 "/projects/or32-uclinux/include/bits/sigset.h" 1
346
# 23 "/projects/or32-uclinux/include/bits/sigset.h"
347
typedef int __sig_atomic_t;
348
 
349
 
350
 
351
 
352
typedef struct
353
  {
354
    unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
355
  } __sigset_t;
356
# 35 "/projects/or32-uclinux/include/sys/select.h" 2
357
 
358
 
359
 
360
typedef __sigset_t sigset_t;
361
 
362
 
363
 
364
 
365
# 1 "/projects/or32-uclinux/include/time.h" 1
366
# 106 "/projects/or32-uclinux/include/time.h"
367
struct timespec
368
  {
369
    long int tv_sec;
370
    long int tv_nsec;
371
  };
372
# 44 "/projects/or32-uclinux/include/sys/select.h" 2
373
 
374
# 1 "/projects/or32-uclinux/include/bits/time.h" 1
375
# 63 "/projects/or32-uclinux/include/bits/time.h"
376
struct timeval
377
  {
378
    __time_t tv_sec;
379
    __suseconds_t tv_usec;
380
  };
381
# 46 "/projects/or32-uclinux/include/sys/select.h" 2
382
 
383
 
384
 
385
typedef long int __fd_mask;
386
 
387
 
388
 
389
 
390
 
391
 
392
 
393
typedef struct
394
  {
395
 
396
 
397
 
398
 
399
 
400
 
401
    __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];
402
 
403
 
404
  } fd_set;
405
 
406
 
407
 
408
 
409
 
410
 
411
typedef __fd_mask fd_mask;
412
# 89 "/projects/or32-uclinux/include/sys/select.h"
413
 
414
 
415
 
416
 
417
 
418
 
419
 
420
extern int select (int __nfds, fd_set *__restrict __readfds,
421
                   fd_set *__restrict __writefds,
422
                   fd_set *__restrict __exceptfds,
423
                   struct timeval *__restrict __timeout) ;
424
# 112 "/projects/or32-uclinux/include/sys/select.h"
425
 
426
# 216 "/projects/or32-uclinux/include/sys/types.h" 2
427
 
428
 
429
# 1 "/projects/or32-uclinux/include/sys/sysmacros.h" 1
430
# 219 "/projects/or32-uclinux/include/sys/types.h" 2
431
# 230 "/projects/or32-uclinux/include/sys/types.h"
432
typedef __blkcnt_t blkcnt_t;
433
 
434
 
435
 
436
typedef __fsblkcnt_t fsblkcnt_t;
437
 
438
 
439
 
440
typedef __fsfilcnt_t fsfilcnt_t;
441
# 262 "/projects/or32-uclinux/include/sys/types.h"
442
 
443
# 41 "/projects/or32-uclinux/include/stdio.h" 2
444
# 50 "/projects/or32-uclinux/include/stdio.h"
445
struct _UC_FILE {
446
  unsigned char *bufpos;
447
  unsigned char *bufread;
448
  unsigned char *bufwrite;
449
  unsigned char *bufstart;
450
  unsigned char *bufend;
451
 
452
  struct _UC_FILE * next;
453
 
454
  int fd;
455
 
456
  unsigned char mode;
457
  unsigned char ungot;
458
  char unbuf[2];
459
};
460
 
461
typedef struct _UC_FILE FILE;
462
# 76 "/projects/or32-uclinux/include/stdio.h"
463
typedef struct _UC_FILE __FILE;
464
# 88 "/projects/or32-uclinux/include/stdio.h"
465
# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stdarg.h" 1
466
# 43 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stdarg.h"
467
typedef __builtin_va_list __gnuc_va_list;
468
# 89 "/projects/or32-uclinux/include/stdio.h" 2
469
 
470
 
471
 
472
 
473
typedef __off_t fpos_t;
474
# 151 "/projects/or32-uclinux/include/stdio.h"
475
# 1 "/projects/or32-uclinux/include/bits/stdio_lim.h" 1
476
# 152 "/projects/or32-uclinux/include/stdio.h" 2
477
 
478
 
479
 
480
extern FILE *stdin;
481
extern FILE *stdout;
482
extern FILE *stderr;
483
 
484
 
485
 
486
 
487
 
488
 
489
extern int remove (__const char *__filename) ;
490
 
491
extern int rename (__const char *__old, __const char *__new) ;
492
 
493
 
494
 
495
 
496
extern FILE *tmpfile (void) ;
497
# 183 "/projects/or32-uclinux/include/stdio.h"
498
extern char *tmpnam (char *__s) ;
499
 
500
 
501
 
502
 
503
extern char *tmpnam_r (char *__s) ;
504
# 200 "/projects/or32-uclinux/include/stdio.h"
505
extern char *tempnam (__const char *__dir, __const char *__pfx)
506
     __attribute__ ((__malloc__));
507
 
508
 
509
 
510
 
511
extern int fclose (FILE *__stream) ;
512
 
513
extern int fflush (FILE *__stream) ;
514
 
515
 
516
 
517
extern int fflush_unlocked (FILE *__stream) ;
518
# 224 "/projects/or32-uclinux/include/stdio.h"
519
extern FILE *fopen (__const char *__restrict __filename,
520
                    __const char *__restrict __modes) ;
521
 
522
extern FILE *freopen (__const char *__restrict __filename,
523
                      __const char *__restrict __modes,
524
                      FILE *__restrict __stream) ;
525
# 254 "/projects/or32-uclinux/include/stdio.h"
526
extern FILE *fdopen (int __fd, __const char *__modes) ;
527
# 278 "/projects/or32-uclinux/include/stdio.h"
528
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) ;
529
 
530
 
531
 
532
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
533
                    int __modes, size_t __n) ;
534
 
535
 
536
 
537
 
538
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
539
                       size_t __size) ;
540
 
541
 
542
extern void setlinebuf (FILE *__stream) ;
543
 
544
 
545
 
546
 
547
extern int fprintf (FILE *__restrict __stream,
548
                    __const char *__restrict __format, ...) ;
549
 
550
extern int printf (__const char *__restrict __format, ...) ;
551
 
552
extern int sprintf (char *__restrict __s,
553
                    __const char *__restrict __format, ...) ;
554
 
555
 
556
extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
557
                     __gnuc_va_list __arg) ;
558
 
559
extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
560
     ;
561
 
562
extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
563
                     __gnuc_va_list __arg) ;
564
 
565
 
566
 
567
extern int snprintf (char *__restrict __s, size_t __maxlen,
568
                     __const char *__restrict __format, ...)
569
     __attribute__ ((__format__ (__printf__, 3, 4)));
570
 
571
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
572
                      __const char *__restrict __format, __gnuc_va_list __arg)
573
     __attribute__ ((__format__ (__printf__, 3, 0)));
574
# 349 "/projects/or32-uclinux/include/stdio.h"
575
extern int fscanf (FILE *__restrict __stream,
576
                   __const char *__restrict __format, ...) ;
577
 
578
extern int scanf (__const char *__restrict __format, ...) ;
579
 
580
extern int sscanf (__const char *__restrict __s,
581
                   __const char *__restrict __format, ...) ;
582
# 375 "/projects/or32-uclinux/include/stdio.h"
583
extern int fgetc (FILE *__stream) ;
584
extern int getc (FILE *__stream) ;
585
 
586
 
587
extern int getchar (void) ;
588
# 389 "/projects/or32-uclinux/include/stdio.h"
589
extern int getc_unlocked (FILE *__stream) ;
590
extern int getchar_unlocked (void) ;
591
 
592
 
593
 
594
 
595
extern int fgetc_unlocked (FILE *__stream) ;
596
 
597
 
598
 
599
 
600
extern int fputc (int __c, FILE *__stream) ;
601
extern int putc (int __c, FILE *__stream) ;
602
 
603
 
604
extern int putchar (int __c) ;
605
# 414 "/projects/or32-uclinux/include/stdio.h"
606
extern int fputc_unlocked (int __c, FILE *__stream) ;
607
 
608
 
609
 
610
 
611
extern int putc_unlocked (int __c, FILE *__stream) ;
612
extern int putchar_unlocked (int __c) ;
613
 
614
 
615
 
616
 
617
 
618
extern int getw (FILE *__stream) ;
619
 
620
 
621
extern int putw (int __w, FILE *__stream) ;
622
 
623
 
624
 
625
 
626
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
627
     ;
628
# 446 "/projects/or32-uclinux/include/stdio.h"
629
extern char *gets (char *__s) ;
630
# 470 "/projects/or32-uclinux/include/stdio.h"
631
extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
632
     ;
633
# 481 "/projects/or32-uclinux/include/stdio.h"
634
extern int puts (__const char *__s) ;
635
 
636
 
637
 
638
extern int ungetc (int __c, FILE *__stream) ;
639
 
640
 
641
 
642
extern size_t fread (void *__restrict __ptr, size_t __size,
643
                     size_t __n, FILE *__restrict __stream) ;
644
 
645
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
646
                      size_t __n, FILE *__restrict __s) ;
647
 
648
 
649
 
650
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
651
                              size_t __n, FILE *__restrict __stream) ;
652
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
653
                               size_t __n, FILE *__restrict __stream) ;
654
 
655
 
656
 
657
 
658
extern int fseek (FILE *__stream, long int __off, int __whence) ;
659
 
660
extern long int ftell (FILE *__stream) ;
661
 
662
extern void rewind (FILE *__stream) ;
663
# 525 "/projects/or32-uclinux/include/stdio.h"
664
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
665
     ;
666
 
667
extern int fsetpos (FILE *__stream, __const fpos_t *__pos) ;
668
# 561 "/projects/or32-uclinux/include/stdio.h"
669
extern void clearerr (FILE *__stream) ;
670
 
671
extern int feof (FILE *__stream) ;
672
 
673
extern int ferror (FILE *__stream) ;
674
 
675
 
676
 
677
extern void clearerr_unlocked (FILE *__stream) ;
678
extern int feof_unlocked (FILE *__stream) ;
679
extern int ferror_unlocked (FILE *__stream) ;
680
 
681
 
682
 
683
 
684
extern void perror (__const char *__s) ;
685
 
686
 
687
 
688
 
689
extern int sys_nerr;
690
extern __const char *__const sys_errlist[];
691
# 593 "/projects/or32-uclinux/include/stdio.h"
692
extern int fileno (FILE *__stream) ;
693
 
694
 
695
 
696
 
697
 
698
 
699
extern int fileno_unlocked (FILE *__stream) ;
700
 
701
 
702
 
703
 
704
 
705
 
706
extern FILE *popen (__const char *__command, __const char *__modes) ;
707
 
708
 
709
extern int pclose (FILE *__stream) ;
710
 
711
 
712
 
713
 
714
 
715
extern char *ctermid (char *__s) ;
716
# 643 "/projects/or32-uclinux/include/stdio.h"
717
extern void flockfile (FILE *__stream) ;
718
 
719
 
720
 
721
extern int ftrylockfile (FILE *__stream) ;
722
 
723
 
724
extern void funlockfile (FILE *__stream) ;
725
# 667 "/projects/or32-uclinux/include/stdio.h"
726
 
727
# 16 "devopen.c" 2
728
# 1 "/projects/or32-uclinux/include/stdlib.h" 1
729
# 35 "/projects/or32-uclinux/include/stdlib.h"
730
# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h" 1
731
# 36 "/projects/or32-uclinux/include/stdlib.h" 2
732
 
733
 
734
# 96 "/projects/or32-uclinux/include/stdlib.h"
735
typedef struct
736
  {
737
    int quot;
738
    int rem;
739
  } div_t;
740
 
741
 
742
 
743
typedef struct
744
  {
745
    long int quot;
746
    long int rem;
747
  } ldiv_t;
748
# 135 "/projects/or32-uclinux/include/stdlib.h"
749
extern size_t __ctype_get_mb_cur_max (void) ;
750
 
751
 
752
 
753
extern double atof (__const char *__nptr) __attribute__ ((__pure__));
754
 
755
extern int atoi (__const char *__nptr) __attribute__ ((__pure__));
756
 
757
extern long int atol (__const char *__nptr) __attribute__ ((__pure__));
758
 
759
 
760
 
761
__extension__ extern long long int atoll (__const char *__nptr)
762
     __attribute__ ((__pure__));
763
 
764
 
765
 
766
extern double strtod (__const char *__restrict __nptr,
767
                      char **__restrict __endptr) ;
768
# 165 "/projects/or32-uclinux/include/stdlib.h"
769
extern long int strtol (__const char *__restrict __nptr,
770
                        char **__restrict __endptr, int __base) ;
771
 
772
extern unsigned long int strtoul (__const char *__restrict __nptr,
773
                                  char **__restrict __endptr, int __base)
774
     ;
775
 
776
 
777
 
778
__extension__
779
extern long long int strtoq (__const char *__restrict __nptr,
780
                             char **__restrict __endptr, int __base) ;
781
 
782
__extension__
783
extern unsigned long long int strtouq (__const char *__restrict __nptr,
784
                                       char **__restrict __endptr, int __base)
785
     ;
786
 
787
 
788
 
789
 
790
 
791
 
792
__extension__
793
extern long long int strtoll (__const char *__restrict __nptr,
794
                              char **__restrict __endptr, int __base) ;
795
 
796
__extension__
797
extern unsigned long long int strtoull (__const char *__restrict __nptr,
798
                                        char **__restrict __endptr, int __base)
799
     ;
800
# 253 "/projects/or32-uclinux/include/stdlib.h"
801
extern double __strtod_internal (__const char *__restrict __nptr,
802
                                 char **__restrict __endptr, int __group)
803
     ;
804
extern float __strtof_internal (__const char *__restrict __nptr,
805
                                char **__restrict __endptr, int __group)
806
     ;
807
extern long double __strtold_internal (__const char *__restrict __nptr,
808
                                       char **__restrict __endptr,
809
                                       int __group) ;
810
 
811
extern long int __strtol_internal (__const char *__restrict __nptr,
812
                                   char **__restrict __endptr,
813
                                   int __base, int __group) ;
814
 
815
 
816
 
817
extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
818
                                             char **__restrict __endptr,
819
                                             int __base, int __group) ;
820
 
821
 
822
 
823
 
824
__extension__
825
extern long long int __strtoll_internal (__const char *__restrict __nptr,
826
                                         char **__restrict __endptr,
827
                                         int __base, int __group) ;
828
 
829
 
830
 
831
__extension__
832
extern unsigned long long int __strtoull_internal (__const char *
833
                                                   __restrict __nptr,
834
                                                   char **__restrict __endptr,
835
                                                   int __base, int __group)
836
     ;
837
# 387 "/projects/or32-uclinux/include/stdlib.h"
838
extern char *l64a (long int __n) ;
839
 
840
 
841
extern long int a64l (__const char *__s) __attribute__ ((__pure__));
842
# 400 "/projects/or32-uclinux/include/stdlib.h"
843
extern long int random (void) ;
844
 
845
 
846
extern void srandom (unsigned int __seed) ;
847
 
848
 
849
 
850
 
851
 
852
extern char *initstate (unsigned int __seed, char *__statebuf,
853
                        size_t __statelen) ;
854
 
855
 
856
 
857
extern char *setstate (char *__statebuf) ;
858
 
859
 
860
 
861
 
862
 
863
 
864
 
865
struct random_data
866
  {
867
    int32_t *fptr;
868
    int32_t *rptr;
869
    int32_t *state;
870
    int rand_type;
871
    int rand_deg;
872
    int rand_sep;
873
    int32_t *end_ptr;
874
  };
875
 
876
extern int random_r (struct random_data *__restrict __buf,
877
                     int32_t *__restrict __result) ;
878
 
879
extern int srandom_r (unsigned int __seed, struct random_data *__buf) ;
880
 
881
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
882
                        size_t __statelen,
883
                        struct random_data *__restrict __buf) ;
884
 
885
extern int setstate_r (char *__restrict __statebuf,
886
                       struct random_data *__restrict __buf) ;
887
 
888
 
889
 
890
 
891
 
892
extern int rand (void) ;
893
 
894
extern void srand (unsigned int __seed) ;
895
 
896
 
897
 
898
extern int rand_r (unsigned int *__seed) ;
899
 
900
 
901
 
902
 
903
 
904
 
905
 
906
extern double drand48 (void) ;
907
extern double erand48 (unsigned short int __xsubi[3]) ;
908
 
909
 
910
extern long int lrand48 (void) ;
911
extern long int nrand48 (unsigned short int __xsubi[3]) ;
912
 
913
 
914
extern long int mrand48 (void) ;
915
extern long int jrand48 (unsigned short int __xsubi[3]) ;
916
 
917
 
918
extern void srand48 (long int __seedval) ;
919
extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ;
920
extern void lcong48 (unsigned short int __param[7]) ;
921
 
922
 
923
 
924
 
925
 
926
struct drand48_data
927
  {
928
    unsigned short int __x[3];
929
    unsigned short int __old_x[3];
930
    unsigned short int __c;
931
    unsigned short int __init;
932
    unsigned long long int __a;
933
  };
934
 
935
 
936
extern int drand48_r (struct drand48_data *__restrict __buffer,
937
                      double *__restrict __result) ;
938
extern int erand48_r (unsigned short int __xsubi[3],
939
                      struct drand48_data *__restrict __buffer,
940
                      double *__restrict __result) ;
941
 
942
 
943
extern int lrand48_r (struct drand48_data *__restrict __buffer,
944
                      long int *__restrict __result) ;
945
extern int nrand48_r (unsigned short int __xsubi[3],
946
                      struct drand48_data *__restrict __buffer,
947
                      long int *__restrict __result) ;
948
 
949
 
950
extern int mrand48_r (struct drand48_data *__restrict __buffer,
951
                      long int *__restrict __result) ;
952
extern int jrand48_r (unsigned short int __xsubi[3],
953
                      struct drand48_data *__restrict __buffer,
954
                      long int *__restrict __result) ;
955
 
956
 
957
extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
958
     ;
959
 
960
extern int seed48_r (unsigned short int __seed16v[3],
961
                     struct drand48_data *__buffer) ;
962
 
963
extern int lcong48_r (unsigned short int __param[7],
964
                      struct drand48_data *__buffer) ;
965
# 530 "/projects/or32-uclinux/include/stdlib.h"
966
extern void *malloc (size_t __size) __attribute__ ((__malloc__));
967
 
968
extern void *calloc (size_t __nmemb, size_t __size)
969
     __attribute__ ((__malloc__));
970
 
971
 
972
 
973
 
974
 
975
extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__malloc__));
976
 
977
extern void free (void *__ptr) ;
978
 
979
 
980
 
981
extern void cfree (void *__ptr) ;
982
 
983
 
984
 
985
# 1 "/projects/or32-uclinux/include/alloca.h" 1
986
# 25 "/projects/or32-uclinux/include/alloca.h"
987
# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h" 1
988
# 26 "/projects/or32-uclinux/include/alloca.h" 2
989
 
990
 
991
 
992
 
993
 
994
 
995
 
996
extern void *alloca (size_t __size) ;
997
 
998
 
999
 
1000
 
1001
 
1002
 
1003
# 550 "/projects/or32-uclinux/include/stdlib.h" 2
1004
 
1005
 
1006
 
1007
 
1008
extern void *valloc (size_t __size) __attribute__ ((__malloc__));
1009
# 564 "/projects/or32-uclinux/include/stdlib.h"
1010
extern void abort (void) __attribute__ ((__noreturn__));
1011
 
1012
 
1013
 
1014
extern int atexit (void (*__func) (void)) ;
1015
# 577 "/projects/or32-uclinux/include/stdlib.h"
1016
extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
1017
     ;
1018
 
1019
 
1020
 
1021
 
1022
 
1023
extern void exit (int __status) __attribute__ ((__noreturn__));
1024
# 594 "/projects/or32-uclinux/include/stdlib.h"
1025
extern char *getenv (__const char *__name) ;
1026
 
1027
 
1028
 
1029
extern char *__secure_getenv (__const char *__name) ;
1030
 
1031
 
1032
 
1033
 
1034
 
1035
extern int putenv (char *__string) ;
1036
 
1037
 
1038
 
1039
 
1040
 
1041
extern int setenv (__const char *__name, __const char *__value, int __replace)
1042
     ;
1043
 
1044
 
1045
extern int unsetenv (__const char *__name) ;
1046
 
1047
 
1048
 
1049
 
1050
 
1051
 
1052
extern int clearenv (void) ;
1053
# 630 "/projects/or32-uclinux/include/stdlib.h"
1054
extern char *mktemp (char *__template) ;
1055
 
1056
 
1057
 
1058
 
1059
 
1060
 
1061
 
1062
extern int mkstemp (char *__template) ;
1063
# 657 "/projects/or32-uclinux/include/stdlib.h"
1064
extern char *mkdtemp (char *__template) ;
1065
 
1066
 
1067
 
1068
 
1069
extern int system (__const char *__command) ;
1070
# 680 "/projects/or32-uclinux/include/stdlib.h"
1071
extern char *realpath (__const char *__restrict __name,
1072
                       char *__restrict __resolved) ;
1073
 
1074
 
1075
 
1076
 
1077
 
1078
 
1079
typedef int (*__compar_fn_t) (__const void *, __const void *);
1080
# 697 "/projects/or32-uclinux/include/stdlib.h"
1081
extern void *bsearch (__const void *__key, __const void *__base,
1082
                      size_t __nmemb, size_t __size, __compar_fn_t __compar);
1083
 
1084
 
1085
 
1086
extern void qsort (void *__base, size_t __nmemb, size_t __size,
1087
                   __compar_fn_t __compar);
1088
 
1089
 
1090
 
1091
extern int abs (int __x) __attribute__ ((__const__));
1092
extern long int labs (long int __x) __attribute__ ((__const__));
1093
# 718 "/projects/or32-uclinux/include/stdlib.h"
1094
extern div_t div (int __numer, int __denom)
1095
     __attribute__ ((__const__));
1096
extern ldiv_t ldiv (long int __numer, long int __denom)
1097
     __attribute__ ((__const__));
1098
# 736 "/projects/or32-uclinux/include/stdlib.h"
1099
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
1100
                   int *__restrict __sign) ;
1101
 
1102
 
1103
 
1104
 
1105
extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
1106
                   int *__restrict __sign) ;
1107
 
1108
 
1109
 
1110
 
1111
extern char *gcvt (double __value, int __ndigit, char *__buf) ;
1112
 
1113
 
1114
 
1115
 
1116
extern char *qecvt (long double __value, int __ndigit,
1117
                    int *__restrict __decpt, int *__restrict __sign) ;
1118
extern char *qfcvt (long double __value, int __ndigit,
1119
                    int *__restrict __decpt, int *__restrict __sign) ;
1120
extern char *qgcvt (long double __value, int __ndigit, char *__buf) ;
1121
 
1122
 
1123
 
1124
 
1125
extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
1126
                   int *__restrict __sign, char *__restrict __buf,
1127
                   size_t __len) ;
1128
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
1129
                   int *__restrict __sign, char *__restrict __buf,
1130
                   size_t __len) ;
1131
 
1132
extern int qecvt_r (long double __value, int __ndigit,
1133
                    int *__restrict __decpt, int *__restrict __sign,
1134
                    char *__restrict __buf, size_t __len) ;
1135
extern int qfcvt_r (long double __value, int __ndigit,
1136
                    int *__restrict __decpt, int *__restrict __sign,
1137
                    char *__restrict __buf, size_t __len) ;
1138
# 805 "/projects/or32-uclinux/include/stdlib.h"
1139
extern int rpmatch (__const char *__response) ;
1140
# 867 "/projects/or32-uclinux/include/stdlib.h"
1141
extern int getloadavg (double __loadavg[], int __nelem) ;
1142
 
1143
 
1144
 
1145
 
1146
 
1147
 
1148
# 17 "devopen.c" 2
1149
# 1 "/projects/mw/markom/mw/src/include/device.h" 1
1150
# 10 "/projects/mw/markom/mw/src/include/device.h"
1151
# 1 "/projects/mw/markom/mw/src/include/mwtypes.h" 1
1152
# 160 "/projects/mw/markom/mw/src/include/mwtypes.h"
1153
    typedef unsigned char MWPIXELVAL;
1154
# 176 "/projects/mw/markom/mw/src/include/mwtypes.h"
1155
typedef int MWCOORD;
1156
typedef int MWBOOL;
1157
typedef unsigned char MWUCHAR;
1158
typedef unsigned long MWCOLORVAL;
1159
typedef unsigned short MWIMAGEBITS;
1160
typedef unsigned long MWTIMEOUT;
1161
 
1162
 
1163
typedef struct _mwlist {
1164
        struct _mwlist *next;
1165
        struct _mwlist *prev;
1166
} MWLIST, *PMWLIST;
1167
 
1168
 
1169
typedef struct _mwlisthead {
1170
        struct _mwlist *head;
1171
        struct _mwlist *tail;
1172
} MWLISTHEAD, *PMWLISTHEAD;
1173
 
1174
 
1175
typedef unsigned int MWKEYMOD;
1176
 
1177
 
1178
typedef struct {
1179
        MWCOORD rows;
1180
        MWCOORD cols;
1181
        int xdpcm;
1182
        int ydpcm;
1183
        int planes;
1184
        int bpp;
1185
        long ncolors;
1186
        int fonts;
1187
        int buttons;
1188
        MWKEYMOD modifiers;
1189
        int pixtype;
1190
        int portrait;
1191
        MWBOOL fbdriver;
1192
        unsigned long rmask;
1193
        unsigned long gmask;
1194
        unsigned long bmask;
1195
        MWCOORD xpos;
1196
        MWCOORD ypos;
1197
 
1198
 
1199
        int vs_width;
1200
        int vs_height;
1201
        int ws_width;
1202
        int ws_height;
1203
} MWSCREENINFO, *PMWSCREENINFO;
1204
 
1205
 
1206
typedef struct {
1207
        unsigned char * physpixels;
1208
 
1209
        unsigned char * winpixels;
1210
        int pixtype;
1211
        int bpp;
1212
        int bytespp;
1213
        int pitch;
1214
        int x, y;
1215
        int portrait_mode;
1216
        MWCOORD xres;
1217
        MWCOORD yres;
1218
        MWCOORD xvirtres;
1219
        MWCOORD yvirtres;
1220
} MWWINDOWFBINFO;
1221
 
1222
 
1223
typedef struct {
1224
        int maxwidth;
1225
        int height;
1226
        int baseline;
1227
        int firstchar;
1228
        int lastchar;
1229
        MWBOOL fixed;
1230
        MWUCHAR widths[256];
1231
} MWFONTINFO, *PMWFONTINFO;
1232
 
1233
 
1234
typedef struct {
1235
        char *ttname;
1236
        char *mwname;
1237
} MWFONTLIST, *PMWFONTLIST;
1238
# 311 "/projects/mw/markom/mw/src/include/mwtypes.h"
1239
typedef struct {
1240
        long lfHeight;
1241
        long lfWidth;
1242
        long lfEscapement;
1243
        long lfOrientation;
1244
        long lfWeight;
1245
        MWUCHAR lfItalic;
1246
        MWUCHAR lfUnderline;
1247
        MWUCHAR lfStrikeOut;
1248
        MWUCHAR lfCharSet;
1249
        MWUCHAR lfOutPrecision;
1250
        MWUCHAR lfClipPrecision;
1251
        MWUCHAR lfQuality;
1252
 
1253
 
1254
        MWUCHAR lfRoman;
1255
        MWUCHAR lfSerif;
1256
        MWUCHAR lfSansSerif;
1257
        MWUCHAR lfModern;
1258
        MWUCHAR lfMonospace;
1259
        MWUCHAR lfProportional;
1260
        MWUCHAR lfOblique;
1261
        MWUCHAR lfSmallCaps;
1262
        MWUCHAR lfPitch;
1263
 
1264
        char lfFaceName[64];
1265
} MWLOGFONT, *PMWLOGFONT;
1266
# 402 "/projects/mw/markom/mw/src/include/mwtypes.h"
1267
typedef struct {
1268
        MWCOORD x;
1269
        MWCOORD y;
1270
} MWPOINT;
1271
 
1272
 
1273
typedef struct {
1274
        MWCOORD left;
1275
        MWCOORD top;
1276
        MWCOORD right;
1277
        MWCOORD bottom;
1278
} MWRECT;
1279
 
1280
 
1281
typedef struct {
1282
        int size;
1283
        int numRects;
1284
        int type;
1285
        MWRECT *rects;
1286
        MWRECT extents;
1287
} MWCLIPREGION;
1288
# 440 "/projects/mw/markom/mw/src/include/mwtypes.h"
1289
typedef struct {
1290
        MWUCHAR r;
1291
        MWUCHAR g;
1292
        MWUCHAR b;
1293
} MWPALENTRY;
1294
 
1295
 
1296
 
1297
 
1298
 
1299
 
1300
typedef struct {
1301
        int width;
1302
        int height;
1303
        int planes;
1304
        int bpp;
1305
        int pitch;
1306
        int bytesperpixel;
1307
        int compression;
1308
        int palsize;
1309
        long transcolor;
1310
        MWPALENTRY * palette;
1311
        MWUCHAR * imagebits;
1312
} MWIMAGEHDR, *PMWIMAGEHDR;
1313
 
1314
 
1315
typedef struct {
1316
        int id;
1317
        int width;
1318
        int height;
1319
        int planes;
1320
        int bpp;
1321
        int pitch;
1322
        int bytesperpixel;
1323
        int compression;
1324
        int palsize;
1325
        MWPALENTRY palette[256];
1326
} MWIMAGEINFO, *PMWIMAGEINFO;
1327
 
1328
 
1329
 
1330
 
1331
typedef struct {
1332
        int width;
1333
        int height;
1334
        MWCOORD hotx;
1335
        MWCOORD hoty;
1336
        MWCOLORVAL fgcolor;
1337
        MWCOLORVAL bgcolor;
1338
        MWIMAGEBITS image[16];
1339
        MWIMAGEBITS mask[16];
1340
} MWCURSOR, *PMWCURSOR;
1341
 
1342
typedef struct _mwfont * PMWFONT;
1343
# 534 "/projects/mw/markom/mw/src/include/mwtypes.h"
1344
typedef unsigned short MWKEY;
1345
typedef unsigned char MWSCANCODE;
1346
# 660 "/projects/mw/markom/mw/src/include/mwtypes.h"
1347
typedef struct {
1348
        int led;
1349
        int led_mode;
1350
} MWKBINFO, *PMWKBINFO;
1351
# 11 "/projects/mw/markom/mw/src/include/device.h" 2
1352
# 30 "/projects/mw/markom/mw/src/include/device.h"
1353
typedef struct _mwscreendevice *PSD;
1354
 
1355
 
1356
typedef struct {
1357
        char * name;
1358
        int maxwidth;
1359
        int height;
1360
        int ascent;
1361
        int firstchar;
1362
        int size;
1363
        MWIMAGEBITS * bits;
1364
        unsigned short *offset;
1365
        unsigned char * width;
1366
} MWCFONT, *PMWCFONT;
1367
 
1368
 
1369
typedef struct {
1370
        int encoding;
1371
        MWBOOL (*GetFontInfo)(PMWFONT pfont, PMWFONTINFO pfontinfo);
1372
        void (*GetTextSize)(PMWFONT pfont, const void *text, int cc,
1373
                        MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
1374
        void (*GetTextBits)(PMWFONT pfont, int ch, MWIMAGEBITS *retmap,
1375
                        MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
1376
        void (*DestroyFont)(PMWFONT pfont);
1377
        void (*DrawText)(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
1378
                        const void *str, int count, int flags);
1379
        void (*SetFontSize)(PMWFONT pfont, MWCOORD fontsize);
1380
        void (*SetFontRotation)(PMWFONT pfont, int tenthdegrees);
1381
        void (*SetFontAttr)(PMWFONT pfont, int setflags, int clrflags);
1382
} MWFONTPROCS, *PMWFONTPROCS;
1383
 
1384
 
1385
typedef struct _mwfont {
1386
        PMWFONTPROCS fontprocs;
1387
        MWCOORD fontsize;
1388
        int fontrotation;
1389
        int fontattr;
1390
 
1391
} MWFONT;
1392
 
1393
 
1394
 
1395
 
1396
 
1397
typedef struct {
1398
        PMWFONTPROCS fontprocs;
1399
        MWCOORD fontsize;
1400
        int fontrotation;
1401
        int fontattr;
1402
 
1403
        char * name;
1404
        PMWCFONT cfont;
1405
} MWCOREFONT, *PMWCOREFONT;
1406
 
1407
 
1408
 
1409
 
1410
typedef struct {
1411
        MWCOORD dstx, dsty, dstw, dsth, dst_linelen;
1412
        MWCOORD srcx, srcy, src_linelen;
1413
        void *pixels, *misc;
1414
        MWPIXELVAL bg_color, fg_color;
1415
        int gr_usebg;
1416
} driver_gc_t;
1417
# 104 "/projects/mw/markom/mw/src/include/device.h"
1418
typedef struct {
1419
        PSD dstpsd;
1420
        MWCOORD dstx, dsty;
1421
        MWCOORD dstw, dsth;
1422
        MWCOORD srcx, srcy;
1423
        MWCOORD srcw, srch;
1424
        PSD srcpsd;
1425
        unsigned long rop;
1426
        PSD alphachan;
1427
        MWPIXELVAL fgcolor;
1428
        MWPIXELVAL bgcolor;
1429
        MWPIXELVAL transcolor;
1430
} MWBLITARGS, *PMWBLITARGS;
1431
 
1432
 
1433
 
1434
typedef struct {
1435
        int (*Init)(PSD psd);
1436
        void (*DrawPixel)(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c);
1437
        MWPIXELVAL (*ReadPixel)(PSD psd, MWCOORD x, MWCOORD y);
1438
        void (*DrawHorzLine)(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y,
1439
                        MWPIXELVAL c);
1440
        void (*DrawVertLine)(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2,
1441
                        MWPIXELVAL c);
1442
        void (*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,
1443
                        MWCOORD y2,MWPIXELVAL c);
1444
        void (*Blit)(PSD destpsd, MWCOORD destx, MWCOORD desty, MWCOORD w,
1445
                        MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
1446
        void (*DrawArea)(PSD psd, driver_gc_t *gc, int op);
1447
        void (*StretchBlit)(PSD destpsd, MWCOORD destx, MWCOORD desty,
1448
                        MWCOORD dstw, MWCOORD dsth, PSD srcpsd, MWCOORD srcx,
1449
                        MWCOORD srcy, MWCOORD srcw, MWCOORD srch, long op);
1450
} SUBDRIVER, *PSUBDRIVER;
1451
 
1452
 
1453
 
1454
 
1455
 
1456
typedef struct _mwscreendevice {
1457
        MWCOORD xres;
1458
        MWCOORD yres;
1459
        MWCOORD xvirtres;
1460
        MWCOORD yvirtres;
1461
        int planes;
1462
        int bpp;
1463
        int linelen;
1464
 
1465
        int size;
1466
        long ncolors;
1467
        int pixtype;
1468
        int flags;
1469
        void * addr;
1470
 
1471
        PSD (*Open)(PSD psd);
1472
        void (*Close)(PSD psd);
1473
        void (*GetScreenInfo)(PSD psd,PMWSCREENINFO psi);
1474
        void (*SetPalette)(PSD psd,int first,int count,MWPALENTRY *pal);
1475
        void (*DrawPixel)(PSD psd,MWCOORD x,MWCOORD y,MWPIXELVAL c);
1476
        MWPIXELVAL (*ReadPixel)(PSD psd,MWCOORD x,MWCOORD y);
1477
        void (*DrawHorzLine)(PSD psd,MWCOORD x1,MWCOORD x2,MWCOORD y,
1478
                        MWPIXELVAL c);
1479
        void (*DrawVertLine)(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2,
1480
                        MWPIXELVAL c);
1481
        void (*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
1482
                        MWPIXELVAL c);
1483
        PMWCOREFONT builtin_fonts;
1484
 
1485
 
1486
 
1487
 
1488
        void (*Blit)(PSD destpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,
1489
                        MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
1490
        void (*PreSelect)(PSD psd);
1491
        void (*DrawArea)(PSD psd, driver_gc_t *gc, int op);
1492
        int (*SetIOPermissions)(PSD psd);
1493
        PSD (*AllocateMemGC)(PSD psd);
1494
        MWBOOL (*MapMemGC)(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
1495
                        int linelen,int size,void *addr);
1496
        void (*FreeMemGC)(PSD mempsd);
1497
        void (*StretchBlit)(PSD destpsd,MWCOORD destx,MWCOORD desty,
1498
                        MWCOORD destw,MWCOORD desth,PSD srcpsd,MWCOORD srcx,
1499
                        MWCOORD srcy,MWCOORD srcw,MWCOORD srch,long op);
1500
        void (*SetPortrait)(PSD psd,int portraitmode);
1501
        int portrait;
1502
        PSUBDRIVER orgsubdriver;
1503
} SCREENDEVICE;
1504
# 200 "/projects/mw/markom/mw/src/include/device.h"
1505
typedef struct _mousedevice {
1506
        int (*Open)(struct _mousedevice *);
1507
        void (*Close)(void);
1508
        int (*GetButtonInfo)(void);
1509
        void (*GetDefaultAccel)(int *pscale,int *pthresh);
1510
        int (*Read)(MWCOORD *dx,MWCOORD *dy,MWCOORD *dz,int *bp);
1511
        int (*Poll)(void);
1512
} MOUSEDEVICE;
1513
 
1514
 
1515
typedef struct _kbddevice {
1516
        int (*Open)(struct _kbddevice *pkd);
1517
        void (*Close)(void);
1518
        void (*GetModifierInfo)(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
1519
        int (*Read)(MWKEY *buf,MWKEYMOD *modifiers,MWSCANCODE *scancode);
1520
        int (*Poll)(void);
1521
} KBDDEVICE;
1522
 
1523
 
1524
 
1525
 
1526
 
1527
 
1528
 
1529
typedef struct {
1530
        MWCOORD x;
1531
        MWCOORD y;
1532
        MWCOORD width;
1533
        MWCOORD height;
1534
} MWCLIPRECT;
1535
# 422 "/projects/mw/markom/mw/src/include/device.h"
1536
PSD GdOpenScreen(void);
1537
void GdCloseScreen(PSD psd);
1538
int GdSetPortraitMode(PSD psd, int portraitmode);
1539
int GdSetMode(int mode);
1540
MWBOOL GdSetUseBackground(MWBOOL flag);
1541
MWPIXELVAL GdSetForeground(MWPIXELVAL fg);
1542
MWPIXELVAL GdSetBackground(MWPIXELVAL bg);
1543
void GdResetPalette(void);
1544
void GdSetPalette(PSD psd,int first, int count, MWPALENTRY *palette);
1545
int GdGetPalette(PSD psd,int first, int count, MWPALENTRY *palette);
1546
MWPIXELVAL GdFindColor(MWCOLORVAL c);
1547
MWPIXELVAL GdFindNearestColor(MWPALENTRY *pal, int size, MWCOLORVAL cr);
1548
int GdCaptureScreen(char *path);
1549
void GdGetScreenInfo(PSD psd,PMWSCREENINFO psi);
1550
void GdPoint(PSD psd,MWCOORD x, MWCOORD y);
1551
void GdLine(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
1552
                MWBOOL bDrawLastPoint);
1553
void GdRect(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height);
1554
void GdFillRect(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height);
1555
void GdBitmap(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
1556
                MWIMAGEBITS *imagebits);
1557
MWBOOL GdColorInPalette(MWCOLORVAL cr,MWPALENTRY *palette,int palsize);
1558
void GdMakePaletteConversionTable(PSD psd,MWPALENTRY *palette,int palsize,
1559
                MWPIXELVAL *convtable,int fLoadType);
1560
void GdDrawImage(PSD psd,MWCOORD x, MWCOORD y, PMWIMAGEHDR pimage);
1561
void GdPoly(PSD psd,int count, MWPOINT *points);
1562
void GdFillPoly(PSD psd,int count, MWPOINT *points);
1563
void GdReadArea(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
1564
                MWPIXELVAL *pixels);
1565
void GdArea(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
1566
                void *pixels, int pixtype);
1567
void GdTranslateArea(MWCOORD width, MWCOORD height, void *in, int inpixtype,
1568
                MWCOORD inpitch, void *out, int outpixtype, int outpitch);
1569
void GdCopyArea(PSD psd,MWCOORD srcx,MWCOORD srcy,MWCOORD width,
1570
                MWCOORD height, MWCOORD destx, MWCOORD desty);
1571
void GdBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD width,
1572
                MWCOORD height,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long rop);
1573
void GdStretchBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD dstw,
1574
                MWCOORD dsth, PSD srcpsd, MWCOORD srcx, MWCOORD srcy,
1575
                MWCOORD srcw, MWCOORD srch, long rop);
1576
int GdCalcMemGCAlloc(PSD psd, unsigned int width, unsigned int height,
1577
                int planes, int bpp, int *size, int *linelen);
1578
extern SCREENDEVICE scrdev;
1579
 
1580
 
1581
 
1582
void GdArcAngle(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry,
1583
                MWCOORD angle1, MWCOORD angle2, int type);
1584
 
1585
void GdArc(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry,
1586
                MWCOORD ax, MWCOORD ay, MWCOORD bx, MWCOORD by, int type);
1587
void GdEllipse(PSD psd,MWCOORD x, MWCOORD y, MWCOORD rx, MWCOORD ry,
1588
                MWBOOL fill);
1589
 
1590
 
1591
void GdClearFontList(void);
1592
int GdAddFont(char *fndry, char *family, char *fontname, PMWLOGFONT lf,
1593
                  unsigned int flags);
1594
PMWFONT GdSetFont(PMWFONT pfont);
1595
PMWFONT GdCreateFont(PSD psd, const char *name, MWCOORD height,
1596
                const PMWLOGFONT plogfont);
1597
MWCOORD GdSetFontSize(PMWFONT pfont, MWCOORD fontsize);
1598
void GdGetFontList(MWFONTLIST ***list, int *num);
1599
void GdFreeFontList(MWFONTLIST ***list, int num);
1600
int GdSetFontRotation(PMWFONT pfont, int tenthdegrees);
1601
int GdSetFontAttr(PMWFONT pfont, int setflags, int clrflags);
1602
void GdDestroyFont(PMWFONT pfont);
1603
MWBOOL GdGetFontInfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
1604
int GdConvertEncoding(const void *istr, int iflags, int cc, void *ostr,
1605
                int oflags);
1606
void GdGetTextSize(PMWFONT pfont, const void *str, int cc, MWCOORD *pwidth,
1607
                MWCOORD *pheight, MWCOORD *pbase, int flags);
1608
int GdGetTextSizeEx(PMWFONT pfont, const void *str, int cc,
1609
                int nMaxExtent, int *lpnFit, int *alpDx, MWCOORD *pwidth,
1610
                MWCOORD *pheight, MWCOORD *pbase, int flags);
1611
void GdText(PSD psd,MWCOORD x,MWCOORD y,const void *str,int count,int flags);
1612
 
1613
 
1614
void GdSetClipRects(PSD psd,int count,MWCLIPRECT *table);
1615
MWBOOL GdClipPoint(PSD psd,MWCOORD x,MWCOORD y);
1616
int GdClipArea(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2);
1617
extern MWCOORD clipminx, clipminy, clipmaxx, clipmaxy;
1618
 
1619
 
1620
void GdSetClipRegion(PSD psd, MWCLIPREGION *reg);
1621
 
1622
 
1623
MWBOOL GdPtInRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y);
1624
int GdRectInRegion(MWCLIPREGION *rgn, const MWRECT *rect);
1625
MWBOOL GdEqualRegion(MWCLIPREGION *r1, MWCLIPREGION *r2);
1626
MWBOOL GdEmptyRegion(MWCLIPREGION *rgn);
1627
MWCLIPREGION *GdAllocRegion(void);
1628
MWCLIPREGION *GdAllocRectRegion(MWCOORD left,MWCOORD top,MWCOORD right,MWCOORD bottom);
1629
MWCLIPREGION *GdAllocRectRegionIndirect(MWRECT *prc);
1630
void GdSetRectRegion(MWCLIPREGION *rgn, MWCOORD left, MWCOORD top,
1631
                MWCOORD right, MWCOORD bottom);
1632
void GdSetRectRegionIndirect(MWCLIPREGION *rgn, MWRECT *prc);
1633
void GdDestroyRegion(MWCLIPREGION *rgn);
1634
void GdOffsetRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y);
1635
int GdGetRegionBox(MWCLIPREGION *rgn, MWRECT *prc);
1636
void GdUnionRectWithRegion(const MWRECT *rect, MWCLIPREGION *rgn);
1637
void GdSubtractRectFromRegion(const MWRECT *rect, MWCLIPREGION *rgn);
1638
void GdCopyRegion(MWCLIPREGION *d, MWCLIPREGION *s);
1639
void GdIntersectRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
1640
void GdUnionRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
1641
void GdSubtractRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
1642
void GdXorRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
1643
 
1644
 
1645
MWCLIPREGION *GdAllocPolygonRegion(MWPOINT *points, int count, int mode);
1646
MWCLIPREGION *GdAllocPolyPolygonRegion(MWPOINT *points, int *count,
1647
                int nbpolygons, int mode);
1648
 
1649
 
1650
int GdOpenMouse(void);
1651
void GdCloseMouse(void);
1652
void GdGetButtonInfo(int *buttons);
1653
void GdRestrictMouse(MWCOORD newminx,MWCOORD newminy,MWCOORD newmaxx,
1654
                MWCOORD newmaxy);
1655
void GdSetAccelMouse(int newthresh, int newscale);
1656
void GdMoveMouse(MWCOORD newx, MWCOORD newy);
1657
int GdReadMouse(MWCOORD *px, MWCOORD *py, int *pb);
1658
void GdMoveCursor(MWCOORD x, MWCOORD y);
1659
MWBOOL GdGetCursorPos(MWCOORD *px, MWCOORD *py);
1660
void GdSetCursor(PMWCURSOR pcursor);
1661
int GdShowCursor(PSD psd);
1662
int GdHideCursor(PSD psd);
1663
void GdCheckCursor(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2);
1664
void GdFixCursor(PSD psd);
1665
extern MOUSEDEVICE mousedev;
1666
 
1667
 
1668
int GdOpenKeyboard(void);
1669
void GdCloseKeyboard(void);
1670
void GdGetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
1671
int GdReadKeyboard(MWKEY *buf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
1672
extern KBDDEVICE kbddev;
1673
 
1674
 
1675
 
1676
int GdLoadImageFromBuffer(PSD psd, void *buffer, int size, int flags);
1677
void GdDrawImageFromBuffer(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
1678
                 MWCOORD height, void *buffer, int size, int flags);
1679
void GdDrawImageFromFile(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
1680
                MWCOORD height, char *path, int flags);
1681
int GdLoadImageFromFile(PSD psd, char *path, int flags);
1682
void GdDrawImageToFit(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
1683
                MWCOORD height, int id);
1684
void GdFreeImage(int id);
1685
MWBOOL GdGetImageInfo(int id, PMWIMAGEINFO pii);
1686
void GdStretchImage(PMWIMAGEHDR src, MWCLIPRECT *srcrect, PMWIMAGEHDR dst,
1687
                MWCLIPRECT *dstrect);
1688
 
1689
 
1690
 
1691
 
1692
 
1693
void * GdItemAlloc(unsigned int size);
1694
void GdListAdd(PMWLISTHEAD pHead,PMWLIST pItem);
1695
void GdListInsert(PMWLISTHEAD pHead,PMWLIST pItem);
1696
void GdListRemove(PMWLISTHEAD pHead,PMWLIST pItem);
1697
# 591 "/projects/mw/markom/mw/src/include/device.h"
1698
# 1 "/projects/or32-uclinux/include/sys/time.h" 1
1699
# 26 "/projects/or32-uclinux/include/sys/time.h"
1700
# 1 "/projects/or32-uclinux/include/time.h" 1
1701
# 27 "/projects/or32-uclinux/include/sys/time.h" 2
1702
 
1703
# 1 "/projects/or32-uclinux/include/bits/time.h" 1
1704
# 29 "/projects/or32-uclinux/include/sys/time.h" 2
1705
 
1706
 
1707
 
1708
 
1709
typedef __suseconds_t suseconds_t;
1710
 
1711
 
1712
 
1713
 
1714
 
1715
# 56 "/projects/or32-uclinux/include/sys/time.h"
1716
struct timezone
1717
  {
1718
    int tz_minuteswest;
1719
    int tz_dsttime;
1720
  };
1721
 
1722
typedef struct timezone *__restrict __timezone_ptr_t;
1723
# 72 "/projects/or32-uclinux/include/sys/time.h"
1724
extern int gettimeofday (struct timeval *__restrict __tv,
1725
                         __timezone_ptr_t __tz) ;
1726
 
1727
 
1728
 
1729
 
1730
extern int settimeofday (__const struct timeval *__tv,
1731
                         __const struct timezone *__tz) ;
1732
 
1733
 
1734
 
1735
 
1736
 
1737
extern int adjtime (__const struct timeval *__delta,
1738
                    struct timeval *__olddelta) ;
1739
 
1740
 
1741
 
1742
 
1743
enum __itimer_which
1744
  {
1745
 
1746
    ITIMER_REAL = 0,
1747
 
1748
 
1749
    ITIMER_VIRTUAL = 1,
1750
 
1751
 
1752
 
1753
    ITIMER_PROF = 2
1754
 
1755
  };
1756
 
1757
 
1758
 
1759
struct itimerval
1760
  {
1761
 
1762
    struct timeval it_interval;
1763
 
1764
    struct timeval it_value;
1765
  };
1766
 
1767
 
1768
 
1769
 
1770
 
1771
 
1772
typedef int __itimer_which_t;
1773
 
1774
 
1775
 
1776
 
1777
extern int getitimer (__itimer_which_t __which,
1778
                      struct itimerval *__value) ;
1779
 
1780
 
1781
 
1782
 
1783
extern int setitimer (__itimer_which_t __which,
1784
                      __const struct itimerval *__restrict __new,
1785
                      struct itimerval *__restrict __old) ;
1786
 
1787
 
1788
 
1789
extern int utimes (__const char *__file, __const struct timeval __tvp[2])
1790
     ;
1791
# 171 "/projects/or32-uclinux/include/sys/time.h"
1792
 
1793
# 592 "/projects/mw/markom/mw/src/include/device.h" 2
1794
 
1795
typedef void (*MWTIMERCB)(void *);
1796
 
1797
 
1798
 
1799
 
1800
typedef struct mw_timer MWTIMER;
1801
struct mw_timer {
1802
        struct timeval timeout;
1803
        MWTIMERCB callback;
1804
        void *arg;
1805
        MWTIMER *next;
1806
        MWTIMER *prev;
1807
    int type;
1808
    MWTIMEOUT period;
1809
};
1810
 
1811
MWTIMER *GdAddTimer(MWTIMEOUT timeout, MWTIMERCB callback, void *arg);
1812
MWTIMER *GdAddPeriodicTimer(MWTIMEOUT timeout, MWTIMERCB callback, void *arg);
1813
void GdDestroyTimer(MWTIMER *timer);
1814
MWTIMER *GdFindTimer(void *arg);
1815
MWBOOL GdGetNextTimeout(struct timeval *tv, MWTIMEOUT timeout);
1816
MWBOOL GdTimeout(void);
1817
 
1818
 
1819
 
1820
 
1821
int GdError(const char *format, ...);
1822
int GdErrorNull(const char *format, ...);
1823
# 18 "devopen.c" 2
1824
# 1 "/projects/mw/markom/mw/src/include/swap.h" 1
1825
 
1826
 
1827
 
1828
 
1829
 
1830
 
1831
 
1832
# 1 "/projects/or32-uclinux/include/byteswap.h" 1
1833
# 23 "/projects/or32-uclinux/include/byteswap.h"
1834
# 1 "/projects/or32-uclinux/include/bits/byteswap.h" 1
1835
# 24 "/projects/or32-uclinux/include/byteswap.h" 2
1836
# 9 "/projects/mw/markom/mw/src/include/swap.h" 2
1837
# 19 "devopen.c" 2
1838
# 32 "devopen.c"
1839
       MWPIXELVAL gr_foreground;
1840
       MWPIXELVAL gr_background;
1841
       MWBOOL gr_usebg;
1842
       int gr_mode = 0;
1843
           MWPALENTRY gr_palette[256];
1844
           int gr_firstuserpalentry;
1845
           int gr_nextpalentry;
1846
static int gr_pixtype;
1847
static long gr_ncolors;
1848
 
1849
 
1850
 
1851
 
1852
PSD
1853
GdOpenScreen(void)
1854
{
1855
        PSD psd;
1856
        MWPALENTRY * stdpal;
1857
        MWSCREENINFO sinfo;
1858
 
1859
        psd = scrdev.Open(&scrdev);
1860
        if (!psd)
1861
                return ((void *)0);
1862
        GdGetScreenInfo(psd, &sinfo);
1863
        gr_pixtype = sinfo.pixtype;
1864
        gr_ncolors = sinfo.ncolors;
1865
 
1866
 
1867
        gr_firstuserpalentry = (int)psd->ncolors;
1868
 
1869
 
1870
        switch((int)psd->ncolors) {
1871
 
1872
 
1873
        case 2:
1874
        {
1875
                extern MWPALENTRY mwstdpal1[2];
1876
                stdpal = mwstdpal1;
1877
        }
1878
        break;
1879
 
1880
 
1881
 
1882
        case 4:
1883
        {
1884
                extern MWPALENTRY mwstdpal2[4];
1885
                stdpal = mwstdpal2;
1886
        }
1887
        break;
1888
 
1889
 
1890
 
1891
 
1892
        case 8:
1893
        case 16:
1894
        {
1895
                extern MWPALENTRY mwstdpal4[16];
1896
                stdpal = mwstdpal4;
1897
        }
1898
        break;
1899
 
1900
 
1901
 
1902
        case 256:
1903
        {
1904
                extern MWPALENTRY mwstdpal8[256];
1905
 
1906
 
1907
 
1908
 
1909
 
1910
                gr_firstuserpalentry = 24;
1911
 
1912
                stdpal = mwstdpal8;
1913
        }
1914
        break;
1915
 
1916
 
1917
        default:
1918
 
1919
                gr_firstuserpalentry = 0;
1920
                stdpal = ((void *)0);
1921
        }
1922
 
1923
 
1924
        GdResetPalette();
1925
        GdSetPalette(psd, 0, (int)psd->ncolors, stdpal);
1926
# 127 "devopen.c"
1927
        GdSetMode(0);
1928
        GdSetForeground(GdFindColor(((MWCOLORVAL)(((unsigned char)(255)| ((unsigned short)((unsigned char)(255))<<8))| (((unsigned long)(unsigned char)(255))<<16)))));
1929
        GdSetBackground(GdFindColor(((MWCOLORVAL)(((unsigned char)(0)| ((unsigned short)((unsigned char)(0))<<8))| (((unsigned long)(unsigned char)(0))<<16)))));
1930
        GdSetUseBackground(1);
1931
        GdSetFont(GdCreateFont(psd, "System", 0, ((void *)0)));
1932
 
1933
        GdSetClipRegion(psd,
1934
                GdAllocRectRegion(0, 0, psd->xvirtres, psd->yvirtres));
1935
 
1936
 
1937
 
1938
 
1939
 
1940
 
1941
        psd->FillRect(psd, 0, 0, psd->xvirtres-1, psd->yvirtres-1, 0);
1942
        return psd;
1943
}
1944
 
1945
 
1946
 
1947
 
1948
void
1949
GdCloseScreen(PSD psd)
1950
{
1951
        psd->Close(psd);
1952
}
1953
 
1954
 
1955
int
1956
GdSetPortraitMode(PSD psd, int portraitmode)
1957
{
1958
 
1959
        if (psd->SetPortrait)
1960
                psd->SetPortrait(psd, portraitmode);
1961
        return psd->portrait;
1962
}
1963
 
1964
 
1965
 
1966
 
1967
void
1968
GdGetScreenInfo(PSD psd, PMWSCREENINFO psi)
1969
{
1970
        psd->GetScreenInfo(psd, psi);
1971
        GdGetButtonInfo(&psi->buttons);
1972
        GdGetModifierInfo(&psi->modifiers, ((void *)0));
1973
        GdGetCursorPos(&psi->xpos, &psi->ypos);
1974
}
1975
 
1976
 
1977
void
1978
GdResetPalette(void)
1979
{
1980
 
1981
 
1982
 
1983
        gr_nextpalentry = gr_firstuserpalentry;
1984
}
1985
 
1986
 
1987
void
1988
GdSetPalette(PSD psd, int first, int count, MWPALENTRY *palette)
1989
{
1990
        int i;
1991
 
1992
 
1993
        if(psd->pixtype != 2)
1994
                return;
1995
 
1996
 
1997
        if(first + count > (int)psd->ncolors)
1998
                count = (int)psd->ncolors - first;
1999
        if(count >= 0 && first < (int)psd->ncolors) {
2000
                psd->SetPalette(psd, first, count, palette);
2001
 
2002
 
2003
                for(i=0; i
2004
                        gr_palette[i+first] = palette[i];
2005
        }
2006
}
2007
 
2008
 
2009
int
2010
GdGetPalette(PSD psd, int first, int count, MWPALENTRY *palette)
2011
{
2012
        int i;
2013
 
2014
 
2015
        if(psd->pixtype != 2)
2016
                return 0;
2017
 
2018
 
2019
        if(first + count > (int)psd->ncolors)
2020
                if( (count = (int)psd->ncolors - first) <= 0)
2021
                        return 0;
2022
 
2023
        for(i=0; i
2024
                *palette++ = gr_palette[i+first];
2025
 
2026
        return count;
2027
}
2028
 
2029
 
2030
 
2031
 
2032
MWPIXELVAL
2033
GdFindColor(MWCOLORVAL c)
2034
{
2035
 
2036
 
2037
 
2038
 
2039
        switch(gr_pixtype) {
2040
        case 3:
2041
        case 4:
2042
 
2043
 
2044
                return ((((c) & 0xff) << 16) | ((c) & 0xff00) | (((c) & 0xff0000) >> 16));
2045
 
2046
        case 5:
2047
 
2048
 
2049
                return ((((c) & 0xf8) << 8) | (((c) & 0xfc00) >> 5) | (((c) & 0xf80000) >> 19));
2050
 
2051
        case 6:
2052
 
2053
 
2054
                return ((((c) & 0xf8) << 7) | (((c) & 0xf800) >> 6) | (((c) & 0xf80000) >> 19));
2055
 
2056
        case 7:
2057
 
2058
 
2059
                return (((c) & 0xe0) | (((c) & 0xe000) >> 11) | (((c) & 0xc00000) >> 22));
2060
        }
2061
 
2062
 
2063
 
2064
 
2065
 
2066
 
2067
 
2068
        if(c & 0x01000000)
2069
                return (c & 0xff);
2070
 
2071
 
2072
        return GdFindNearestColor(gr_palette, (int)gr_ncolors, c);
2073
}
2074
 
2075
 
2076
 
2077
 
2078
 
2079
MWPIXELVAL
2080
GdFindNearestColor(MWPALENTRY *pal, int size, MWCOLORVAL cr)
2081
{
2082
        MWPALENTRY * rgb;
2083
        int r, g, b;
2084
        int R, G, B;
2085
        long diff = 0x7fffffffL;
2086
        long sq;
2087
        int best = 0;
2088
 
2089
        r = ((cr) & 0xff);
2090
        g = (((cr) >> 8) & 0xff);
2091
        b = (((cr) >> 16) & 0xff);
2092
        for(rgb=pal; diff && rgb < &pal[size]; ++rgb) {
2093
                R = rgb->r - r;
2094
                G = rgb->g - g;
2095
                B = rgb->b - b;
2096
 
2097
 
2098
                sq = abs(R) + abs(G) + abs(B);
2099
 
2100
 
2101
 
2102
 
2103
 
2104
 
2105
 
2106
                if(sq < diff) {
2107
                        best = rgb - pal;
2108
                        if((diff = sq) == 0)
2109
                                return best;
2110
                }
2111
        }
2112
        return best;
2113
}
2114
 
2115
 
2116
# 1 "/projects/or32-uclinux/include/unistd.h" 1
2117
# 28 "/projects/or32-uclinux/include/unistd.h"
2118
 
2119
# 175 "/projects/or32-uclinux/include/unistd.h"
2120
# 1 "/projects/or32-uclinux/include/bits/posix_opt.h" 1
2121
# 176 "/projects/or32-uclinux/include/unistd.h" 2
2122
# 199 "/projects/or32-uclinux/include/unistd.h"
2123
# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h" 1
2124
# 200 "/projects/or32-uclinux/include/unistd.h" 2
2125
# 240 "/projects/or32-uclinux/include/unistd.h"
2126
typedef __intptr_t intptr_t;
2127
 
2128
 
2129
 
2130
 
2131
 
2132
 
2133
typedef __socklen_t socklen_t;
2134
# 260 "/projects/or32-uclinux/include/unistd.h"
2135
extern int access (__const char *__name, int __type) ;
2136
# 291 "/projects/or32-uclinux/include/unistd.h"
2137
extern __off_t lseek (int __fd, __off_t __offset, int __whence) ;
2138
# 307 "/projects/or32-uclinux/include/unistd.h"
2139
extern int close (int __fd) ;
2140
 
2141
 
2142
 
2143
extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ;
2144
 
2145
 
2146
extern ssize_t write (int __fd, __const void *__buf, size_t __n) ;
2147
# 354 "/projects/or32-uclinux/include/unistd.h"
2148
extern int pipe (int __pipedes[2]) ;
2149
# 363 "/projects/or32-uclinux/include/unistd.h"
2150
extern unsigned int alarm (unsigned int __seconds) ;
2151
# 372 "/projects/or32-uclinux/include/unistd.h"
2152
extern unsigned int sleep (unsigned int __seconds) ;
2153
 
2154
 
2155
 
2156
 
2157
 
2158
 
2159
extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
2160
     ;
2161
 
2162
 
2163
 
2164
extern int usleep (__useconds_t __useconds) ;
2165
 
2166
 
2167
 
2168
 
2169
 
2170
extern int pause (void) ;
2171
 
2172
 
2173
 
2174
extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
2175
     ;
2176
 
2177
 
2178
 
2179
extern int fchown (int __fd, __uid_t __owner, __gid_t __group) ;
2180
 
2181
 
2182
 
2183
 
2184
extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
2185
     ;
2186
 
2187
 
2188
 
2189
 
2190
extern int chdir (__const char *__path) ;
2191
 
2192
 
2193
 
2194
extern int fchdir (int __fd) ;
2195
# 424 "/projects/or32-uclinux/include/unistd.h"
2196
extern char *getcwd (char *__buf, size_t __size) ;
2197
# 438 "/projects/or32-uclinux/include/unistd.h"
2198
extern char *getwd (char *__buf) ;
2199
 
2200
 
2201
 
2202
 
2203
extern int dup (int __fd) ;
2204
 
2205
 
2206
extern int dup2 (int __fd, int __fd2) ;
2207
 
2208
 
2209
extern char **__environ;
2210
 
2211
 
2212
 
2213
 
2214
 
2215
 
2216
 
2217
extern int execve (__const char *__path, char *__const __argv[],
2218
                   char *__const __envp[]) ;
2219
# 470 "/projects/or32-uclinux/include/unistd.h"
2220
extern int execv (__const char *__path, char *__const __argv[]) ;
2221
 
2222
 
2223
 
2224
extern int execle (__const char *__path, __const char *__arg, ...) ;
2225
 
2226
 
2227
 
2228
extern int execl (__const char *__path, __const char *__arg, ...) ;
2229
 
2230
 
2231
 
2232
extern int execvp (__const char *__file, char *__const __argv[]) ;
2233
 
2234
 
2235
 
2236
 
2237
extern int execlp (__const char *__file, __const char *__arg, ...) ;
2238
 
2239
 
2240
 
2241
 
2242
extern int nice (int __inc) ;
2243
 
2244
 
2245
 
2246
 
2247
extern void _exit (int __status) __attribute__ ((__noreturn__));
2248
 
2249
 
2250
 
2251
 
2252
 
2253
# 1 "/projects/or32-uclinux/include/bits/confname.h" 1
2254
# 25 "/projects/or32-uclinux/include/bits/confname.h"
2255
enum
2256
  {
2257
    _PC_LINK_MAX,
2258
 
2259
    _PC_MAX_CANON,
2260
 
2261
    _PC_MAX_INPUT,
2262
 
2263
    _PC_NAME_MAX,
2264
 
2265
    _PC_PATH_MAX,
2266
 
2267
    _PC_PIPE_BUF,
2268
 
2269
    _PC_CHOWN_RESTRICTED,
2270
 
2271
    _PC_NO_TRUNC,
2272
 
2273
    _PC_VDISABLE,
2274
 
2275
    _PC_SYNC_IO,
2276
 
2277
    _PC_ASYNC_IO,
2278
 
2279
    _PC_PRIO_IO,
2280
 
2281
    _PC_SOCK_MAXBUF,
2282
 
2283
    _PC_FILESIZEBITS,
2284
 
2285
    _PC_REC_INCR_XFER_SIZE,
2286
 
2287
    _PC_REC_MAX_XFER_SIZE,
2288
 
2289
    _PC_REC_MIN_XFER_SIZE,
2290
 
2291
    _PC_REC_XFER_ALIGN,
2292
 
2293
    _PC_ALLOC_SIZE_MIN,
2294
 
2295
    _PC_SYMLINK_MAX
2296
 
2297
  };
2298
 
2299
 
2300
enum
2301
  {
2302
    _SC_ARG_MAX,
2303
 
2304
    _SC_CHILD_MAX,
2305
 
2306
    _SC_CLK_TCK,
2307
 
2308
    _SC_NGROUPS_MAX,
2309
 
2310
    _SC_OPEN_MAX,
2311
 
2312
    _SC_STREAM_MAX,
2313
 
2314
    _SC_TZNAME_MAX,
2315
 
2316
    _SC_JOB_CONTROL,
2317
 
2318
    _SC_SAVED_IDS,
2319
 
2320
    _SC_REALTIME_SIGNALS,
2321
 
2322
    _SC_PRIORITY_SCHEDULING,
2323
 
2324
    _SC_TIMERS,
2325
 
2326
    _SC_ASYNCHRONOUS_IO,
2327
 
2328
    _SC_PRIORITIZED_IO,
2329
 
2330
    _SC_SYNCHRONIZED_IO,
2331
 
2332
    _SC_FSYNC,
2333
 
2334
    _SC_MAPPED_FILES,
2335
 
2336
    _SC_MEMLOCK,
2337
 
2338
    _SC_MEMLOCK_RANGE,
2339
 
2340
    _SC_MEMORY_PROTECTION,
2341
 
2342
    _SC_MESSAGE_PASSING,
2343
 
2344
    _SC_SEMAPHORES,
2345
 
2346
    _SC_SHARED_MEMORY_OBJECTS,
2347
 
2348
    _SC_AIO_LISTIO_MAX,
2349
 
2350
    _SC_AIO_MAX,
2351
 
2352
    _SC_AIO_PRIO_DELTA_MAX,
2353
 
2354
    _SC_DELAYTIMER_MAX,
2355
 
2356
    _SC_MQ_OPEN_MAX,
2357
 
2358
    _SC_MQ_PRIO_MAX,
2359
 
2360
    _SC_VERSION,
2361
 
2362
    _SC_PAGESIZE,
2363
 
2364
 
2365
    _SC_RTSIG_MAX,
2366
 
2367
    _SC_SEM_NSEMS_MAX,
2368
 
2369
    _SC_SEM_VALUE_MAX,
2370
 
2371
    _SC_SIGQUEUE_MAX,
2372
 
2373
    _SC_TIMER_MAX,
2374
 
2375
 
2376
 
2377
 
2378
    _SC_BC_BASE_MAX,
2379
 
2380
    _SC_BC_DIM_MAX,
2381
 
2382
    _SC_BC_SCALE_MAX,
2383
 
2384
    _SC_BC_STRING_MAX,
2385
 
2386
    _SC_COLL_WEIGHTS_MAX,
2387
 
2388
    _SC_EQUIV_CLASS_MAX,
2389
 
2390
    _SC_EXPR_NEST_MAX,
2391
 
2392
    _SC_LINE_MAX,
2393
 
2394
    _SC_RE_DUP_MAX,
2395
 
2396
    _SC_CHARCLASS_NAME_MAX,
2397
 
2398
 
2399
    _SC_2_VERSION,
2400
 
2401
    _SC_2_C_BIND,
2402
 
2403
    _SC_2_C_DEV,
2404
 
2405
    _SC_2_FORT_DEV,
2406
 
2407
    _SC_2_FORT_RUN,
2408
 
2409
    _SC_2_SW_DEV,
2410
 
2411
    _SC_2_LOCALEDEF,
2412
 
2413
 
2414
    _SC_PII,
2415
 
2416
    _SC_PII_XTI,
2417
 
2418
    _SC_PII_SOCKET,
2419
 
2420
    _SC_PII_INTERNET,
2421
 
2422
    _SC_PII_OSI,
2423
 
2424
    _SC_POLL,
2425
 
2426
    _SC_SELECT,
2427
 
2428
    _SC_UIO_MAXIOV,
2429
 
2430
    _SC_IOV_MAX = _SC_UIO_MAXIOV,
2431
 
2432
    _SC_PII_INTERNET_STREAM,
2433
 
2434
    _SC_PII_INTERNET_DGRAM,
2435
 
2436
    _SC_PII_OSI_COTS,
2437
 
2438
    _SC_PII_OSI_CLTS,
2439
 
2440
    _SC_PII_OSI_M,
2441
 
2442
    _SC_T_IOV_MAX,
2443
 
2444
 
2445
 
2446
    _SC_THREADS,
2447
 
2448
    _SC_THREAD_SAFE_FUNCTIONS,
2449
 
2450
    _SC_GETGR_R_SIZE_MAX,
2451
 
2452
    _SC_GETPW_R_SIZE_MAX,
2453
 
2454
    _SC_LOGIN_NAME_MAX,
2455
 
2456
    _SC_TTY_NAME_MAX,
2457
 
2458
    _SC_THREAD_DESTRUCTOR_ITERATIONS,
2459
 
2460
    _SC_THREAD_KEYS_MAX,
2461
 
2462
    _SC_THREAD_STACK_MIN,
2463
 
2464
    _SC_THREAD_THREADS_MAX,
2465
 
2466
    _SC_THREAD_ATTR_STACKADDR,
2467
 
2468
    _SC_THREAD_ATTR_STACKSIZE,
2469
 
2470
    _SC_THREAD_PRIORITY_SCHEDULING,
2471
 
2472
    _SC_THREAD_PRIO_INHERIT,
2473
 
2474
    _SC_THREAD_PRIO_PROTECT,
2475
 
2476
    _SC_THREAD_PROCESS_SHARED,
2477
 
2478
 
2479
    _SC_NPROCESSORS_CONF,
2480
 
2481
    _SC_NPROCESSORS_ONLN,
2482
 
2483
    _SC_PHYS_PAGES,
2484
 
2485
    _SC_AVPHYS_PAGES,
2486
 
2487
    _SC_ATEXIT_MAX,
2488
 
2489
    _SC_PASS_MAX,
2490
 
2491
 
2492
    _SC_XOPEN_VERSION,
2493
 
2494
    _SC_XOPEN_XCU_VERSION,
2495
 
2496
    _SC_XOPEN_UNIX,
2497
 
2498
    _SC_XOPEN_CRYPT,
2499
 
2500
    _SC_XOPEN_ENH_I18N,
2501
 
2502
    _SC_XOPEN_SHM,
2503
 
2504
 
2505
    _SC_2_CHAR_TERM,
2506
 
2507
    _SC_2_C_VERSION,
2508
 
2509
    _SC_2_UPE,
2510
 
2511
 
2512
    _SC_XOPEN_XPG2,
2513
 
2514
    _SC_XOPEN_XPG3,
2515
 
2516
    _SC_XOPEN_XPG4,
2517
 
2518
 
2519
    _SC_CHAR_BIT,
2520
 
2521
    _SC_CHAR_MAX,
2522
 
2523
    _SC_CHAR_MIN,
2524
 
2525
    _SC_INT_MAX,
2526
 
2527
    _SC_INT_MIN,
2528
 
2529
    _SC_LONG_BIT,
2530
 
2531
    _SC_WORD_BIT,
2532
 
2533
    _SC_MB_LEN_MAX,
2534
 
2535
    _SC_NZERO,
2536
 
2537
    _SC_SSIZE_MAX,
2538
 
2539
    _SC_SCHAR_MAX,
2540
 
2541
    _SC_SCHAR_MIN,
2542
 
2543
    _SC_SHRT_MAX,
2544
 
2545
    _SC_SHRT_MIN,
2546
 
2547
    _SC_UCHAR_MAX,
2548
 
2549
    _SC_UINT_MAX,
2550
 
2551
    _SC_ULONG_MAX,
2552
 
2553
    _SC_USHRT_MAX,
2554
 
2555
 
2556
    _SC_NL_ARGMAX,
2557
 
2558
    _SC_NL_LANGMAX,
2559
 
2560
    _SC_NL_MSGMAX,
2561
 
2562
    _SC_NL_NMAX,
2563
 
2564
    _SC_NL_SETMAX,
2565
 
2566
    _SC_NL_TEXTMAX,
2567
 
2568
 
2569
    _SC_XBS5_ILP32_OFF32,
2570
 
2571
    _SC_XBS5_ILP32_OFFBIG,
2572
 
2573
    _SC_XBS5_LP64_OFF64,
2574
 
2575
    _SC_XBS5_LPBIG_OFFBIG,
2576
 
2577
 
2578
    _SC_XOPEN_LEGACY,
2579
 
2580
    _SC_XOPEN_REALTIME,
2581
 
2582
    _SC_XOPEN_REALTIME_THREADS,
2583
 
2584
 
2585
    _SC_ADVISORY_INFO,
2586
 
2587
    _SC_BARRIERS,
2588
 
2589
    _SC_BASE,
2590
 
2591
    _SC_C_LANG_SUPPORT,
2592
 
2593
    _SC_C_LANG_SUPPORT_R,
2594
 
2595
    _SC_CLOCK_SELECTION,
2596
 
2597
    _SC_CPUTIME,
2598
 
2599
    _SC_THREAD_CPUTIME,
2600
 
2601
    _SC_DEVICE_IO,
2602
 
2603
    _SC_DEVICE_SPECIFIC,
2604
 
2605
    _SC_DEVICE_SPECIFIC_R,
2606
 
2607
    _SC_FD_MGMT,
2608
 
2609
    _SC_FIFO,
2610
 
2611
    _SC_PIPE,
2612
 
2613
    _SC_FILE_ATTRIBUTES,
2614
 
2615
    _SC_FILE_LOCKING,
2616
 
2617
    _SC_FILE_SYSTEM,
2618
 
2619
    _SC_MONOTONIC_CLOCK,
2620
 
2621
    _SC_MULTI_PROCESS,
2622
 
2623
    _SC_SINGLE_PROCESS,
2624
 
2625
    _SC_NETWORKING,
2626
 
2627
    _SC_READER_WRITER_LOCKS,
2628
 
2629
    _SC_SPIN_LOCKS,
2630
 
2631
    _SC_REGEXP,
2632
 
2633
    _SC_REGEX_VERSION,
2634
 
2635
    _SC_SHELL,
2636
 
2637
    _SC_SIGNALS,
2638
 
2639
    _SC_SPAWN,
2640
 
2641
    _SC_SPORADIC_SERVER,
2642
 
2643
    _SC_THREAD_SPORADIC_SERVER,
2644
 
2645
    _SC_SYSTEM_DATABASE,
2646
 
2647
    _SC_SYSTEM_DATABASE_R,
2648
 
2649
    _SC_TIMEOUTS,
2650
 
2651
    _SC_TYPED_MEMORY_OBJECTS,
2652
 
2653
    _SC_USER_GROUPS,
2654
 
2655
    _SC_USER_GROUPS_R,
2656
 
2657
    _SC_2_PBS,
2658
 
2659
    _SC_2_PBS_ACCOUNTING,
2660
 
2661
    _SC_2_PBS_LOCATE,
2662
 
2663
    _SC_2_PBS_MESSAGE,
2664
 
2665
    _SC_2_PBS_TRACK,
2666
 
2667
    _SC_SYMLOOP_MAX,
2668
 
2669
    _SC_STREAMS,
2670
 
2671
    _SC_2_PBS_CHECKPOINT,
2672
 
2673
 
2674
    _SC_V6_ILP32_OFF32,
2675
 
2676
    _SC_V6_ILP32_OFFBIG,
2677
 
2678
    _SC_V6_LP64_OFF64,
2679
 
2680
    _SC_V6_LPBIG_OFFBIG,
2681
 
2682
 
2683
    _SC_HOST_NAME_MAX,
2684
 
2685
    _SC_TRACE,
2686
 
2687
    _SC_TRACE_EVENT_FILTER,
2688
 
2689
    _SC_TRACE_INHERIT,
2690
 
2691
    _SC_TRACE_LOG
2692
 
2693
  };
2694
 
2695
 
2696
 
2697
 
2698
 
2699
enum
2700
  {
2701
    _CS_PATH,
2702
# 563 "/projects/or32-uclinux/include/bits/confname.h"
2703
    _CS_V6_WIDTH_RESTRICTED_ENVS
2704
 
2705
  };
2706
# 504 "/projects/or32-uclinux/include/unistd.h" 2
2707
 
2708
 
2709
extern long int pathconf (__const char *__path, int __name) ;
2710
 
2711
 
2712
extern long int fpathconf (int __fd, int __name) ;
2713
 
2714
 
2715
extern long int sysconf (int __name) __attribute__ ((__const__));
2716
 
2717
 
2718
 
2719
extern size_t confstr (int __name, char *__buf, size_t __len) ;
2720
 
2721
 
2722
 
2723
 
2724
extern __pid_t getpid (void) ;
2725
 
2726
 
2727
extern __pid_t getppid (void) ;
2728
 
2729
 
2730
 
2731
 
2732
extern __pid_t getpgrp (void) ;
2733
# 539 "/projects/or32-uclinux/include/unistd.h"
2734
extern __pid_t __getpgid (__pid_t __pid) ;
2735
# 548 "/projects/or32-uclinux/include/unistd.h"
2736
extern int setpgid (__pid_t __pid, __pid_t __pgid) ;
2737
# 565 "/projects/or32-uclinux/include/unistd.h"
2738
extern int setpgrp (void) ;
2739
# 583 "/projects/or32-uclinux/include/unistd.h"
2740
extern __pid_t setsid (void) ;
2741
 
2742
 
2743
 
2744
 
2745
 
2746
 
2747
 
2748
extern __uid_t getuid (void) ;
2749
 
2750
 
2751
extern __uid_t geteuid (void) ;
2752
 
2753
 
2754
extern __gid_t getgid (void) ;
2755
 
2756
 
2757
extern __gid_t getegid (void) ;
2758
 
2759
 
2760
 
2761
 
2762
extern int getgroups (int __size, __gid_t __list[]) ;
2763
# 617 "/projects/or32-uclinux/include/unistd.h"
2764
extern int setuid (__uid_t __uid) ;
2765
 
2766
 
2767
 
2768
 
2769
extern int setreuid (__uid_t __ruid, __uid_t __euid) ;
2770
 
2771
 
2772
 
2773
 
2774
extern int seteuid (__uid_t __uid) ;
2775
 
2776
 
2777
 
2778
 
2779
 
2780
 
2781
extern int setgid (__gid_t __gid) ;
2782
 
2783
 
2784
 
2785
 
2786
extern int setregid (__gid_t __rgid, __gid_t __egid) ;
2787
 
2788
 
2789
 
2790
 
2791
extern int setegid (__gid_t __gid) ;
2792
 
2793
 
2794
 
2795
 
2796
 
2797
 
2798
extern __pid_t fork (void) ;
2799
 
2800
 
2801
 
2802
 
2803
 
2804
 
2805
extern __pid_t vfork (void) ;
2806
 
2807
 
2808
 
2809
 
2810
 
2811
extern char *ttyname (int __fd) ;
2812
 
2813
 
2814
 
2815
extern int ttyname_r (int __fd, char *__buf, size_t __buflen) ;
2816
 
2817
 
2818
 
2819
extern int isatty (int __fd) ;
2820
 
2821
 
2822
 
2823
 
2824
 
2825
extern int ttyslot (void) ;
2826
 
2827
 
2828
 
2829
 
2830
extern int link (__const char *__from, __const char *__to) ;
2831
 
2832
 
2833
 
2834
extern int symlink (__const char *__from, __const char *__to) ;
2835
 
2836
 
2837
 
2838
 
2839
extern int readlink (__const char *__restrict __path, char *__restrict __buf,
2840
                     size_t __len) ;
2841
 
2842
 
2843
 
2844
extern int unlink (__const char *__name) ;
2845
 
2846
 
2847
extern int rmdir (__const char *__path) ;
2848
 
2849
 
2850
 
2851
extern __pid_t tcgetpgrp (int __fd) ;
2852
 
2853
 
2854
extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) ;
2855
 
2856
 
2857
 
2858
extern char *getlogin (void) ;
2859
# 721 "/projects/or32-uclinux/include/unistd.h"
2860
extern int setlogin (__const char *__name) ;
2861
# 730 "/projects/or32-uclinux/include/unistd.h"
2862
# 1 "/projects/or32-uclinux/include/getopt.h" 1
2863
# 47 "/projects/or32-uclinux/include/getopt.h"
2864
extern char *optarg;
2865
# 61 "/projects/or32-uclinux/include/getopt.h"
2866
extern int optind;
2867
 
2868
 
2869
 
2870
 
2871
extern int opterr;
2872
 
2873
 
2874
 
2875
extern int optopt;
2876
# 145 "/projects/or32-uclinux/include/getopt.h"
2877
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
2878
# 731 "/projects/or32-uclinux/include/unistd.h" 2
2879
 
2880
 
2881
 
2882
 
2883
 
2884
 
2885
 
2886
extern int gethostname (char *__name, size_t __len) ;
2887
 
2888
 
2889
 
2890
 
2891
 
2892
 
2893
extern int sethostname (__const char *__name, size_t __len) ;
2894
 
2895
 
2896
 
2897
extern int sethostid (long int __id) ;
2898
 
2899
 
2900
 
2901
 
2902
 
2903
extern int getdomainname (char *__name, size_t __len) ;
2904
extern int setdomainname (__const char *__name, size_t __len) ;
2905
 
2906
 
2907
 
2908
 
2909
 
2910
extern int vhangup (void) ;
2911
 
2912
 
2913
extern int revoke (__const char *__file) ;
2914
 
2915
 
2916
 
2917
 
2918
 
2919
 
2920
 
2921
extern int profil (unsigned short int *__sample_buffer, size_t __size,
2922
                   size_t __offset, unsigned int __scale) ;
2923
 
2924
 
2925
 
2926
 
2927
 
2928
extern int acct (__const char *__name) ;
2929
 
2930
 
2931
 
2932
extern char *getusershell (void) ;
2933
extern void endusershell (void) ;
2934
extern void setusershell (void) ;
2935
 
2936
 
2937
 
2938
 
2939
 
2940
extern int daemon (int __nochdir, int __noclose) ;
2941
 
2942
 
2943
 
2944
 
2945
 
2946
 
2947
extern int chroot (__const char *__path) ;
2948
 
2949
 
2950
 
2951
extern char *getpass (__const char *__prompt) ;
2952
 
2953
 
2954
 
2955
 
2956
 
2957
extern int fsync (int __fd) ;
2958
 
2959
 
2960
 
2961
 
2962
 
2963
 
2964
extern long int gethostid (void) ;
2965
 
2966
 
2967
extern void sync (void) ;
2968
 
2969
 
2970
 
2971
 
2972
extern int getpagesize (void) __attribute__ ((__const__));
2973
 
2974
 
2975
 
2976
 
2977
extern int truncate (__const char *__file, __off_t __length) ;
2978
# 845 "/projects/or32-uclinux/include/unistd.h"
2979
extern int ftruncate (int __fd, __off_t __length) ;
2980
# 861 "/projects/or32-uclinux/include/unistd.h"
2981
extern int getdtablesize (void) ;
2982
# 870 "/projects/or32-uclinux/include/unistd.h"
2983
extern int brk (void *__addr) ;
2984
 
2985
 
2986
 
2987
 
2988
 
2989
extern void *sbrk (intptr_t __delta) ;
2990
# 891 "/projects/or32-uclinux/include/unistd.h"
2991
extern long int syscall (long int __sysno, ...) ;
2992
# 911 "/projects/or32-uclinux/include/unistd.h"
2993
extern int lockf (int __fd, int __cmd, __off_t __len) ;
2994
# 942 "/projects/or32-uclinux/include/unistd.h"
2995
extern int fdatasync (int __fildes) ;
2996
# 987 "/projects/or32-uclinux/include/unistd.h"
2997
extern int pthread_atfork (void (*__prepare) (void),
2998
                           void (*__parent) (void),
2999
                           void (*__child) (void)) ;
3000
 
3001
 
3002
 
3003
# 317 "devopen.c" 2
3004
# 1 "/projects/or32-uclinux/include/fcntl.h" 1
3005
# 29 "/projects/or32-uclinux/include/fcntl.h"
3006
 
3007
 
3008
 
3009
 
3010
# 1 "/projects/or32-uclinux/include/bits/fcntl.h" 1
3011
# 137 "/projects/or32-uclinux/include/bits/fcntl.h"
3012
struct flock
3013
  {
3014
    short int l_type;
3015
    short int l_whence;
3016
 
3017
    __off_t l_start;
3018
    __off_t l_len;
3019
 
3020
 
3021
 
3022
 
3023
    __pid_t l_pid;
3024
  };
3025
# 34 "/projects/or32-uclinux/include/fcntl.h" 2
3026
# 61 "/projects/or32-uclinux/include/fcntl.h"
3027
extern int fcntl (int __fd, int __cmd, ...) ;
3028
# 75 "/projects/or32-uclinux/include/fcntl.h"
3029
extern int open (__const char *__file, int __oflag, ...) ;
3030
# 92 "/projects/or32-uclinux/include/fcntl.h"
3031
extern int creat (__const char *__file, __mode_t __mode) ;
3032
# 174 "/projects/or32-uclinux/include/fcntl.h"
3033
 
3034
# 318 "devopen.c" 2
3035
# 328 "devopen.c"
3036
typedef unsigned char BYTE;
3037
typedef unsigned short WORD;
3038
typedef unsigned long DWORD;
3039
typedef long LONG;
3040
 
3041
#pragma pack(1)
3042
 
3043
typedef struct {
3044
 
3045
        BYTE bfType[2];
3046
        DWORD bfSize;
3047
        WORD bfReserved1;
3048
        WORD bfReserved2;
3049
        DWORD bfOffBits;
3050
 
3051
        DWORD BiSize;
3052
        LONG BiWidth;
3053
        LONG BiHeight;
3054
        WORD BiPlanes;
3055
        WORD BiBitCount;
3056
        DWORD BiCompression;
3057
        DWORD BiSizeImage;
3058
        LONG BiXpelsPerMeter;
3059
        LONG BiYpelsPerMeter;
3060
        DWORD BiClrUsed;
3061
        DWORD BiClrImportant;
3062
} BMPHEAD;
3063
#pragma pack()
3064
# 372 "devopen.c"
3065
static void
3066
putsw(unsigned long dw, FILE *ofp)
3067
{
3068
 
3069
        (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc(((unsigned char)dw), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = ((unsigned char)dw)) );
3070
        dw >>= 8;
3071
        (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc(((unsigned char)dw), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = ((unsigned char)dw)) );
3072
}
3073
 
3074
static void
3075
putdw(unsigned long dw, FILE *ofp)
3076
{
3077
 
3078
        (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc(((unsigned char)dw), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = ((unsigned char)dw)) );
3079
        dw >>= 8;
3080
        (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc(((unsigned char)dw), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = ((unsigned char)dw)) );
3081
        dw >>= 8;
3082
        (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc(((unsigned char)dw), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = ((unsigned char)dw)) );
3083
        dw >>= 8;
3084
        (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc(((unsigned char)dw), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = ((unsigned char)dw)) );
3085
}
3086
 
3087
 
3088
 
3089
int
3090
GdCaptureScreen(char *path)
3091
{
3092
 
3093
        int ifd, i, j;
3094
        FILE * ofp;
3095
        int cx, cy, extra, bpp, bytespp, ncolors, sizecolortable;
3096
        unsigned long rmask, gmask, bmask;
3097
        unsigned char *cptr;
3098
        unsigned short *sptr;
3099
        unsigned long *lptr;
3100
        BMPHEAD bmp;
3101
        unsigned char buf[2048*4];
3102
 
3103
        ofp = fopen(path, "wb");
3104
        if (!ofp)
3105
                return 1;
3106
        ifd = open("/dev/fb0", 0);
3107
 
3108
        cx = scrdev.xvirtres;
3109
        cy = scrdev.yvirtres;
3110
        bpp = scrdev.bpp;
3111
        bytespp = (bpp+7)/8;
3112
 
3113
 
3114
        extra = (cx*bytespp) & 3;
3115
        if (extra)
3116
                extra = 4 - extra;
3117
        ncolors = (bpp <= 8)? (1<
3118
 
3119
        sizecolortable = ncolors? ncolors*4: 3*4;
3120
        if (bpp == 24)
3121
                sizecolortable = 0;
3122
 
3123
 
3124
        memset(&bmp, 0, sizeof(bmp));
3125
        bmp.bfType[0] = 'B';
3126
        bmp.bfType[1] = 'M';
3127
        bmp.bfSize = (__extension__ ({ unsigned int __bsx = (sizeof(bmp) + sizecolortable + (long)(cx+extra)*cy*bytespp); ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }));
3128
        bmp.bfOffBits = (__extension__ ({ unsigned int __bsx = (sizeof(bmp) + sizecolortable); ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }));
3129
        bmp.BiSize = (__extension__ ({ unsigned int __bsx = (40); ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }));
3130
        bmp.BiWidth = (__extension__ ({ unsigned int __bsx = (cx); ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }));
3131
        bmp.BiHeight = (__extension__ ({ unsigned int __bsx = (cy); ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }));
3132
        bmp.BiPlanes = (__extension__ ({ unsigned short int __bsx = (1); ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }));
3133
        bmp.BiBitCount = (__extension__ ({ unsigned short int __bsx = (bpp); ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }));
3134
        bmp.BiCompression = (__extension__ ({ unsigned int __bsx = ((bpp==16 || bpp==32)? 3L: 0L); ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }));
3135
        bmp.BiSizeImage = (__extension__ ({ unsigned int __bsx = ((long)(cx+extra)*cy*bytespp); ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }));
3136
        bmp.BiClrUsed = (__extension__ ({ unsigned int __bsx = ((bpp <= 8)? ncolors: 0); ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); }));
3137
 
3138
 
3139
 
3140
        fwrite(&bmp, sizeof(bmp), 1, ofp);
3141
 
3142
 
3143
        if (sizecolortable) {
3144
                if(bpp <= 8) {
3145
 
3146
                        for(i=0; i
3147
                                (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((gr_palette[i].b), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (gr_palette[i].b)) );
3148
                                (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((gr_palette[i].g), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (gr_palette[i].g)) );
3149
                                (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((gr_palette[i].r), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (gr_palette[i].r)) );
3150
                                (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((0), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (0)) );
3151
                        }
3152
                } else {
3153
 
3154
                        switch (gr_pixtype) {
3155
                        case 3:
3156
                        default:
3157
                                rmask = 0xff0000;
3158
                                gmask = 0x00ff00;
3159
                                bmask = 0x0000ff;
3160
                                break;
3161
                        case 5:
3162
                                rmask = 0xf800;
3163
                                gmask = 0x07e0;
3164
                                bmask = 0x001f;
3165
                                break;
3166
                        case 6:
3167
                                rmask = 0x7c00;
3168
                                gmask = 0x03e0;
3169
                                bmask = 0x001f;
3170
                                break;
3171
                        case 7:
3172
                                rmask = 0xe0;
3173
                                gmask = 0x1c;
3174
                                bmask = 0x03;
3175
                                break;
3176
                        }
3177
                        putdw(rmask, ofp);
3178
                        putdw(gmask, ofp);
3179
                        putdw(bmask, ofp);
3180
                }
3181
        }
3182
 
3183
 
3184
        for(i=cy-1; i>=0; --i) {
3185
                long base = sizeof(bmp) + sizecolortable + (long)i*cx*bytespp;
3186
                fseek(ofp, base, 0);
3187
                read(ifd, buf, cx*bytespp);
3188
                switch (bpp) {
3189
                case 32:
3190
                        lptr = (unsigned long *)buf;
3191
                        for(j=0; j
3192
                                putdw(*lptr++, ofp);
3193
                        break;
3194
                case 24:
3195
                        cptr = (unsigned char *)buf;
3196
                        for(j=0; j
3197
                                (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((*cptr++), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (*cptr++)) );
3198
                                (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((*cptr++), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (*cptr++)) );
3199
                                (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((*cptr++), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (*cptr++)) );
3200
                        }
3201
                        break;
3202
                case 16:
3203
                        sptr = (unsigned short *)buf;
3204
                        for(j=0; j
3205
                                putsw(*sptr++, ofp);
3206
                        break;
3207
                default:
3208
                        cptr = (unsigned char *)buf;
3209
                        for(j=0; j
3210
                                (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((*cptr++), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (*cptr++)) );
3211
                        break;
3212
                }
3213
                for(j=0; j
3214
                        (((ofp)->bufpos >= (ofp)->bufwrite) ? fputc((0), (ofp)) : (unsigned char) (*(ofp)->bufpos++ = (0)) );
3215
        }
3216
 
3217
        fclose(ofp);
3218
        close(ifd);
3219
 
3220
        return 0;
3221
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.