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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [call-rt-st.c] - Blame information for rev 816

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
#include <stdio.h>
2
#include <stdlib.h>
3
#include <string.h>
4
 
5
/**************************************************************************
6
 * TESTS :
7
 * function returning large structures, which go on the stack
8
 * functions returning varied sized structs which go on in the registers.
9
 ***************************************************************************/
10
 
11
 
12
/* A large structure (> 64 bits) used to test passing large structures as
13
 * parameters
14
 */
15
 
16
struct array_rep_info_t {
17
   int   next_index[10];
18
   int   values[10];
19
   int   head;
20
};
21
 
22
/*****************************************************************************
23
 * Small structures ( <= 64 bits). These are used to test passing small
24
 * structures as parameters and test argument size promotion.
25
 *****************************************************************************/
26
 
27
 /* 64 bits
28
  */
29
struct small_rep_info_t {
30
   int   value;
31
   int   head;
32
};
33
 
34
/* 6 bits : really fits in 8 bits and is promoted to 8 bits
35
 */
36
struct bit_flags_char_t {
37
       unsigned char alpha   :1;
38
       unsigned char beta    :1;
39
       unsigned char gamma   :1;
40
       unsigned char delta   :1;
41
       unsigned char epsilon :1;
42
       unsigned char omega   :1;
43
};
44
 
45
/* 6 bits : really fits in 8 bits and is promoted to 16 bits
46
 */
47
struct bit_flags_short_t {
48
       unsigned short alpha   :1;
49
       unsigned short beta    :1;
50
       unsigned short gamma   :1;
51
       unsigned short delta   :1;
52
       unsigned short epsilon :1;
53
       unsigned short omega   :1;
54
};
55
 
56
/* 6 bits : really fits in 8 bits and is promoted to 32 bits
57
 */
58
struct bit_flags_t {
59
       unsigned alpha   :1;
60
       unsigned beta    :1;
61
       unsigned gamma   :1;
62
       unsigned delta   :1;
63
       unsigned epsilon :1;
64
       unsigned omega   :1;
65
};
66
 
67
/* 22 bits : really fits in 40 bits and is promoted to 64 bits
68
 */
69
struct bit_flags_combo_t {
70
       unsigned alpha   :1;
71
       unsigned beta    :1;
72
       char     ch1;
73
       unsigned gamma   :1;
74
       unsigned delta   :1;
75
       char     ch2;
76
       unsigned epsilon :1;
77
       unsigned omega   :1;
78
};
79
 
80
/* 64 bits
81
 */
82
struct one_double_t {
83
       double double1;
84
};
85
 
86
/* 64 bits
87
 */
88
struct two_floats_t {
89
       float float1;
90
       float float2;
91
};
92
 
93
 
94
/* 24 bits : promoted to 32 bits
95
 */
96
struct three_char_t {
97
       char ch1;
98
       char ch2;
99
       char ch3;
100
};
101
 
102
/* 40 bits : promoted to 64 bits
103
 */
104
struct five_char_t {
105
       char ch1;
106
       char ch2;
107
       char ch3;
108
       char ch4;
109
       char ch5;
110
};
111
 
112
/* 40 bits : promoted to 64 bits
113
 */
114
struct int_char_combo_t {
115
       int  int1;
116
       char ch1;
117
};
118
 
119
 
120
/*****************************************************************
121
 * LOOP_COUNT :
122
 * A do nothing function. Used to provide a point at which calls can be made.
123
 *****************************************************************/
124
void loop_count () {
125
 
126
     int index;
127
 
128
     for (index=0; index<4; index++);
129
}
130
 
131
/*****************************************************************
132
 * INIT_BIT_FLAGS_CHAR :
133
 * Initializes a bit_flags_char_t structure. Can call this function see
134
 * the call command behavior when integer arguments do not fit into
135
 * registers and must be placed on the stack.
136
 * OUT struct bit_flags_char_t *bit_flags -- structure to be filled
137
 * IN  unsigned a  -- 0 or 1
138
 * IN  unsigned b  -- 0 or 1
139
 * IN  unsigned g  -- 0 or 1
140
 * IN  unsigned d  -- 0 or 1
141
 * IN  unsigned e  -- 0 or 1
142
 * IN  unsigned o  -- 0 or 1
143
 *****************************************************************/
144
#ifdef PROTOTYPES
145
void init_bit_flags_char (
146
struct bit_flags_char_t *bit_flags,
147
unsigned a,
148
unsigned b,
149
unsigned g,
150
unsigned d,
151
unsigned e,
152
unsigned o)
153
#else
154
void init_bit_flags_char (bit_flags,a,b,g,d,e,o)
155
struct bit_flags_char_t *bit_flags;
156
unsigned a;
157
unsigned b;
158
unsigned g;
159
unsigned d;
160
unsigned e;
161
unsigned o;
162
#endif
163
{
164
 
165
   bit_flags->alpha = a;
166
   bit_flags->beta = b;
167
   bit_flags->gamma = g;
168
   bit_flags->delta = d;
169
   bit_flags->epsilon = e;
170
   bit_flags->omega = o;
171
}
172
 
173
/*****************************************************************
174
 * INIT_BIT_FLAGS_SHORT :
175
 * Initializes a bit_flags_short_t structure. Can call this function see
176
 * the call command behavior when integer arguments do not fit into
177
 * registers and must be placed on the stack.
178
 * OUT struct bit_flags_short_t *bit_flags -- structure to be filled
179
 * IN  unsigned a  -- 0 or 1
180
 * IN  unsigned b  -- 0 or 1
181
 * IN  unsigned g  -- 0 or 1
182
 * IN  unsigned d  -- 0 or 1
183
 * IN  unsigned e  -- 0 or 1
184
 * IN  unsigned o  -- 0 or 1
185
 *****************************************************************/
186
#ifdef PROTOTYPES
187
void init_bit_flags_short (
188
struct bit_flags_short_t *bit_flags,
189
unsigned a,
190
unsigned b,
191
unsigned g,
192
unsigned d,
193
unsigned e,
194
unsigned o)
195
#else
196
void init_bit_flags_short (bit_flags,a,b,g,d,e,o)
197
struct bit_flags_short_t *bit_flags;
198
unsigned a;
199
unsigned b;
200
unsigned g;
201
unsigned d;
202
unsigned e;
203
unsigned o;
204
#endif
205
{
206
 
207
   bit_flags->alpha = a;
208
   bit_flags->beta = b;
209
   bit_flags->gamma = g;
210
   bit_flags->delta = d;
211
   bit_flags->epsilon = e;
212
   bit_flags->omega = o;
213
}
214
 
215
/*****************************************************************
216
 * INIT_BIT_FLAGS :
217
 * Initializes a bit_flags_t structure. Can call this function see
218
 * the call command behavior when integer arguments do not fit into
219
 * registers and must be placed on the stack.
220
 * OUT struct bit_flags_t *bit_flags -- structure to be filled
221
 * IN  unsigned a  -- 0 or 1
222
 * IN  unsigned b  -- 0 or 1
223
 * IN  unsigned g  -- 0 or 1
224
 * IN  unsigned d  -- 0 or 1
225
 * IN  unsigned e  -- 0 or 1
226
 * IN  unsigned o  -- 0 or 1
227
 *****************************************************************/
228
#ifdef PROTOTYPES
229
void init_bit_flags (
230
struct bit_flags_t *bit_flags,
231
unsigned a,
232
unsigned b,
233
unsigned g,
234
unsigned d,
235
unsigned e,
236
unsigned o)
237
#else
238
void init_bit_flags (bit_flags,a,b,g,d,e,o)
239
struct bit_flags_t *bit_flags;
240
unsigned a;
241
unsigned b;
242
unsigned g;
243
unsigned d;
244
unsigned e;
245
unsigned o;
246
#endif
247
{
248
 
249
   bit_flags->alpha = a;
250
   bit_flags->beta = b;
251
   bit_flags->gamma = g;
252
   bit_flags->delta = d;
253
   bit_flags->epsilon = e;
254
   bit_flags->omega = o;
255
}
256
 
257
/*****************************************************************
258
 * INIT_BIT_FLAGS_COMBO :
259
 * Initializes a bit_flags_combo_t structure. Can call this function
260
 * to see the call command behavior when integer and character arguments
261
 * do not fit into registers and must be placed on the stack.
262
 * OUT struct bit_flags_combo_t *bit_flags_combo -- structure to fill
263
 * IN  unsigned a  -- 0 or 1
264
 * IN  unsigned b  -- 0 or 1
265
 * IN  char     ch1
266
 * IN  unsigned g  -- 0 or 1
267
 * IN  unsigned d  -- 0 or 1
268
 * IN  char     ch2
269
 * IN  unsigned e  -- 0 or 1
270
 * IN  unsigned o  -- 0 or 1
271
 *****************************************************************/
272
#ifdef PROTOTYPES
273
void init_bit_flags_combo (
274
struct bit_flags_combo_t *bit_flags_combo,
275
unsigned a,
276
unsigned b,
277
char ch1,
278
unsigned g,
279
unsigned d,
280
char ch2,
281
unsigned e,
282
unsigned o)
283
#else
284
void init_bit_flags_combo (bit_flags_combo, a, b, ch1, g, d, ch2, e, o)
285
struct bit_flags_combo_t *bit_flags_combo;
286
unsigned a;
287
unsigned b;
288
char ch1;
289
unsigned g;
290
unsigned d;
291
char ch2;
292
unsigned e;
293
unsigned o;
294
#endif
295
{
296
 
297
   bit_flags_combo->alpha = a;
298
   bit_flags_combo->beta = b;
299
   bit_flags_combo->ch1 = ch1;
300
   bit_flags_combo->gamma = g;
301
   bit_flags_combo->delta = d;
302
   bit_flags_combo->ch2 = ch2;
303
   bit_flags_combo->epsilon = e;
304
   bit_flags_combo->omega = o;
305
}
306
 
307
 
308
/*****************************************************************
309
 * INIT_ONE_DOUBLE :
310
 * OUT  struct one_double_t *one_double  -- structure to fill
311
 * IN   double init_val
312
 *****************************************************************/
313
#ifdef PROTOTYPES
314
void init_one_double ( struct one_double_t *one_double, double init_val)
315
#else
316
void init_one_double (one_double, init_val)
317
struct one_double_t *one_double;
318
double init_val;
319
#endif
320
{
321
 
322
     one_double->double1  = init_val;
323
}
324
 
325
/*****************************************************************
326
 * INIT_TWO_FLOATS :
327
 * OUT struct two_floats_t *two_floats -- structure to be filled
328
 * IN  float init_val1
329
 * IN  float init_val2
330
 *****************************************************************/
331
#ifdef PROTOTYPES
332
void init_two_floats (
333
     struct two_floats_t *two_floats,
334
     float init_val1,
335
     float init_val2)
336
#else
337
void init_two_floats (two_floats, init_val1, init_val2)
338
struct two_floats_t *two_floats;
339
float init_val1;
340
float init_val2;
341
#endif
342
{
343
 
344
     two_floats->float1 = init_val1;
345
     two_floats->float2 = init_val2;
346
}
347
 
348
/*****************************************************************
349
 * INIT_THREE_CHARS :
350
 * OUT struct three_char_t *three_char -- structure to be filled
351
 * IN  char init_val1
352
 * IN  char init_val2
353
 * IN  char init_val3
354
 *****************************************************************/
355
#ifdef PROTOTYPES
356
void init_three_chars (
357
struct three_char_t *three_char,
358
char init_val1,
359
char init_val2,
360
char init_val3)
361
#else
362
void init_three_chars ( three_char, init_val1, init_val2, init_val3)
363
struct three_char_t *three_char;
364
char init_val1;
365
char init_val2;
366
char init_val3;
367
#endif
368
{
369
 
370
     three_char->ch1 = init_val1;
371
     three_char->ch2 = init_val2;
372
     three_char->ch3 = init_val3;
373
}
374
 
375
/*****************************************************************
376
 * INIT_FIVE_CHARS :
377
 * OUT struct five_char_t *five_char -- structure to be filled
378
 * IN  char init_val1
379
 * IN  char init_val2
380
 * IN  char init_val3
381
 * IN  char init_val4
382
 * IN  char init_val5
383
 *****************************************************************/
384
#ifdef PROTOTYPES
385
void init_five_chars (
386
struct five_char_t *five_char,
387
char init_val1,
388
char init_val2,
389
char init_val3,
390
char init_val4,
391
char init_val5)
392
#else
393
void init_five_chars ( five_char, init_val1, init_val2, init_val3, init_val4, init_val5)
394
struct five_char_t *five_char;
395
char init_val1;
396
char init_val2;
397
char init_val3;
398
char init_val4;
399
char init_val5;
400
#endif
401
{
402
 
403
     five_char->ch1 = init_val1;
404
     five_char->ch2 = init_val2;
405
     five_char->ch3 = init_val3;
406
     five_char->ch4 = init_val4;
407
     five_char->ch5 = init_val5;
408
}
409
 
410
/*****************************************************************
411
 * INIT_INT_CHAR_COMBO :
412
 * OUT struct int_char_combo_t *combo -- structure to be filled
413
 * IN  int  init_val1
414
 * IN  char init_val2
415
 *****************************************************************/
416
#ifdef PROTOTYPES
417
void init_int_char_combo (
418
struct int_char_combo_t *combo,
419
int init_val1,
420
char init_val2)
421
#else
422
void init_int_char_combo ( combo, init_val1, init_val2)
423
struct int_char_combo_t *combo;
424
int init_val1;
425
char init_val2;
426
#endif
427
{
428
 
429
     combo->int1 = init_val1;
430
     combo->ch1 = init_val2;
431
}
432
 
433
/*****************************************************************
434
 * INIT_STRUCT_REP :
435
 * OUT struct small_rep_into_t *small_struct -- structure to be filled
436
 * IN  int  seed
437
 *****************************************************************/
438
#ifdef PROTOTYPES
439
void init_struct_rep(
440
     struct small_rep_info_t *small_struct,
441
     int seed)
442
#else
443
void init_struct_rep( small_struct, seed)
444
struct small_rep_info_t *small_struct;
445
int    seed;
446
#endif
447
{
448
 
449
      small_struct->value = 2 + (seed*2);
450
      small_struct->head = 0;
451
}
452
 
453
/*****************************************************************
454
 * PRINT_BIT_FLAGS_CHAR :
455
 * IN struct bit_flags_char_t bit_flags
456
 ****************************************************************/
457
#ifdef PROTOTYPES
458
struct bit_flags_char_t print_bit_flags_char (struct bit_flags_char_t bit_flags)
459
#else
460
struct bit_flags_char_t print_bit_flags_char ( bit_flags)
461
struct bit_flags_char_t bit_flags;
462
#endif
463
{
464
 
465
     if (bit_flags.alpha) printf("alpha\n");
466
     if (bit_flags.beta) printf("beta\n");
467
     if (bit_flags.gamma) printf("gamma\n");
468
     if (bit_flags.delta) printf("delta\n");
469
     if (bit_flags.epsilon) printf("epsilon\n");
470
     if (bit_flags.omega) printf("omega\n");
471
     return bit_flags;
472
 
473
}
474
 
475
/*****************************************************************
476
 * PRINT_BIT_FLAGS_SHORT :
477
 * IN struct bit_flags_short_t bit_flags
478
 ****************************************************************/
479
#ifdef PROTOTYPES
480
struct bit_flags_short_t print_bit_flags_short (struct bit_flags_short_t bit_flags)
481
#else
482
struct bit_flags_short_t print_bit_flags_short ( bit_flags)
483
struct bit_flags_short_t bit_flags;
484
#endif
485
{
486
 
487
     if (bit_flags.alpha) printf("alpha\n");
488
     if (bit_flags.beta) printf("beta\n");
489
     if (bit_flags.gamma) printf("gamma\n");
490
     if (bit_flags.delta) printf("delta\n");
491
     if (bit_flags.epsilon) printf("epsilon\n");
492
     if (bit_flags.omega) printf("omega\n");
493
     return bit_flags;
494
 
495
}
496
 
497
/*****************************************************************
498
 * PRINT_BIT_FLAGS :
499
 * IN struct bit_flags_t bit_flags
500
 ****************************************************************/
501
#ifdef PROTOTYPES
502
struct bit_flags_t print_bit_flags (struct bit_flags_t bit_flags)
503
#else
504
struct bit_flags_t print_bit_flags ( bit_flags)
505
struct bit_flags_t bit_flags;
506
#endif
507
{
508
 
509
     if (bit_flags.alpha) printf("alpha\n");
510
     if (bit_flags.beta) printf("beta\n");
511
     if (bit_flags.gamma) printf("gamma\n");
512
     if (bit_flags.delta) printf("delta\n");
513
     if (bit_flags.epsilon) printf("epsilon\n");
514
     if (bit_flags.omega) printf("omega\n");
515
     return bit_flags;
516
 
517
}
518
 
519
/*****************************************************************
520
 * PRINT_BIT_FLAGS_COMBO :
521
 * IN struct bit_flags_combo_t bit_flags_combo
522
 ****************************************************************/
523
#ifdef PROTOTYPES
524
struct bit_flags_combo_t print_bit_flags_combo (struct bit_flags_combo_t bit_flags_combo)
525
#else
526
struct bit_flags_combo_t print_bit_flags_combo ( bit_flags_combo )
527
struct bit_flags_combo_t bit_flags_combo;
528
#endif
529
{
530
 
531
     if (bit_flags_combo.alpha) printf("alpha\n");
532
     if (bit_flags_combo.beta) printf("beta\n");
533
     if (bit_flags_combo.gamma) printf("gamma\n");
534
     if (bit_flags_combo.delta) printf("delta\n");
535
     if (bit_flags_combo.epsilon) printf("epsilon\n");
536
     if (bit_flags_combo.omega) printf("omega\n");
537
     printf("ch1: %c\tch2: %c\n", bit_flags_combo.ch1, bit_flags_combo.ch2);
538
     return bit_flags_combo;
539
 
540
}
541
 
542
/*****************************************************************
543
 * PRINT_ONE_DOUBLE :
544
 * IN struct one_double_t one_double
545
 ****************************************************************/
546
#ifdef PROTOTYPES
547
struct one_double_t print_one_double (struct one_double_t one_double)
548
#else
549
struct one_double_t print_one_double ( one_double )
550
struct one_double_t one_double;
551
#endif
552
{
553
 
554
     printf("Contents of one_double_t: \n\n");
555
     printf("%f\n", one_double.double1);
556
     return one_double;
557
 
558
}
559
 
560
/*****************************************************************
561
 * PRINT_TWO_FLOATS :
562
 * IN struct two_floats_t two_floats
563
 ****************************************************************/
564
#ifdef PROTOTYPES
565
struct two_floats_t print_two_floats (struct two_floats_t two_floats)
566
#else
567
struct two_floats_t print_two_floats ( two_floats )
568
struct two_floats_t two_floats;
569
#endif
570
{
571
 
572
     printf("Contents of two_floats_t: \n\n");
573
     printf("%f\t%f\n", two_floats.float1, two_floats.float2);
574
     return two_floats;
575
 
576
}
577
 
578
/*****************************************************************
579
 * PRINT_THREE_CHARS :
580
 * IN struct three_char_t three_char
581
 ****************************************************************/
582
#ifdef PROTOTYPES
583
struct three_char_t print_three_chars (struct three_char_t three_char)
584
#else
585
struct three_char_t print_three_chars ( three_char )
586
struct three_char_t three_char;
587
#endif
588
{
589
 
590
     printf("Contents of three_char_t: \n\n");
591
     printf("%c\t%c\t%c\n", three_char.ch1, three_char.ch2, three_char.ch3);
592
     return three_char;
593
 
594
}
595
 
596
/*****************************************************************
597
 * PRINT_FIVE_CHARS :
598
 * IN struct five_char_t five_char
599
 ****************************************************************/
600
#ifdef PROTOTYPES
601
struct five_char_t print_five_chars (struct five_char_t five_char)
602
#else
603
struct five_char_t print_five_chars ( five_char )
604
struct five_char_t five_char;
605
#endif
606
{
607
 
608
     printf("Contents of five_char_t: \n\n");
609
     printf("%c\t%c\t%c\t%c\t%c\n", five_char.ch1, five_char.ch2,
610
                                    five_char.ch3, five_char.ch4,
611
                                    five_char.ch5);
612
     return five_char;
613
 
614
}
615
 
616
/*****************************************************************
617
 * PRINT_INT_CHAR_COMBO :
618
 * IN struct int_char_combo_t int_char_combo
619
 ****************************************************************/
620
#ifdef PROTOTYPES
621
struct int_char_combo_t print_int_char_combo (struct int_char_combo_t int_char_combo)
622
#else
623
struct int_char_combo_t print_int_char_combo ( int_char_combo )
624
struct int_char_combo_t int_char_combo;
625
#endif
626
{
627
 
628
     printf("Contents of int_char_combo_t: \n\n");
629
     printf("%d\t%c\n", int_char_combo.int1, int_char_combo.ch1);
630
     return int_char_combo;
631
 
632
}
633
 
634
/*****************************************************************
635
 * PRINT_STRUCT_REP :
636
 ****************************************************************/
637
#ifdef PROTOTYPES
638
struct small_rep_info_t print_struct_rep(struct small_rep_info_t struct1)
639
#else
640
struct small_rep_info_t print_struct_rep( struct1 )
641
struct small_rep_info_t struct1;
642
#endif
643
{
644
 
645
  printf("Contents of struct1: \n\n");
646
  printf("%10d%10d\n", struct1.value, struct1.head);
647
  struct1.value =+5;
648
 
649
  return struct1;
650
 
651
 
652
}
653
 
654
 
655
#ifdef PROTOTYPES
656
struct array_rep_info_t print_one_large_struct(struct array_rep_info_t linked_list1)
657
#else
658
struct array_rep_info_t print_one_large_struct( linked_list1 )
659
struct array_rep_info_t linked_list1;
660
#endif
661
{
662
 
663
 
664
      printf("%10d%10d\n", linked_list1.values[0],
665
                           linked_list1.next_index[0]);
666
 
667
      return linked_list1;
668
 
669
}
670
 
671
/*****************************************************************
672
 * INIT_ARRAY_REP :
673
 * IN struct array_rep_info_t *linked_list
674
 * IN int    seed
675
 ****************************************************************/
676
#ifdef PROTOTYPES
677
void init_array_rep(struct array_rep_info_t *linked_list, int seed)
678
#else
679
void init_array_rep( linked_list, seed )
680
struct array_rep_info_t *linked_list;
681
int    seed;
682
#endif
683
{
684
 
685
  int index;
686
 
687
  for (index = 0; index < 10; index++) {
688
 
689
      linked_list->values[index] = (2*index) + (seed*2);
690
      linked_list->next_index[index] = index + 1;
691
  }
692
  linked_list->head = 0;
693
}
694
 
695
 
696
int main ()  {
697
 
698
  /* variables for large structure testing
699
   */
700
  int number = 10;
701
  struct array_rep_info_t *list1;
702
 
703
  /* variables for testing a small structures and a very long argument list
704
   */
705
   struct small_rep_info_t  *struct1;
706
   struct bit_flags_char_t  *cflags;
707
   struct bit_flags_short_t *sflags;
708
   struct bit_flags_t       *flags;
709
   struct bit_flags_combo_t *flags_combo;
710
   struct three_char_t      *three_char;
711
   struct five_char_t       *five_char;
712
   struct int_char_combo_t  *int_char_combo;
713
   struct one_double_t      *d1;
714
   struct two_floats_t      *f3;
715
 
716
 
717
  /* Allocate space for large structures
718
   */
719
  list1 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
720
 
721
  /* Initialize large structures
722
   */
723
  init_array_rep(list1, 2);
724
 
725
  /* Print large structures
726
   */
727
  print_one_large_struct(*list1);
728
 
729
  /* Allocate space for small structures
730
   */
731
  struct1     = (struct small_rep_info_t  *)malloc(sizeof(struct small_rep_info_t));
732
  cflags       = (struct bit_flags_char_t *)malloc(sizeof(struct bit_flags_char_t));
733
  sflags       = (struct bit_flags_short_t *)malloc(sizeof(struct bit_flags_short_t));
734
  flags       = (struct bit_flags_t *)malloc(sizeof(struct bit_flags_t));
735
  flags_combo = (struct bit_flags_combo_t *)malloc(sizeof(struct bit_flags_combo_t));
736
  three_char  = (struct three_char_t *)malloc(sizeof(struct three_char_t));
737
  five_char   = (struct five_char_t *)malloc(sizeof(struct five_char_t));
738
  int_char_combo = (struct int_char_combo_t *)malloc(sizeof(struct int_char_combo_t));
739
 
740
  d1 = (struct one_double_t *)malloc(sizeof(struct one_double_t));
741
  f3 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));
742
 
743
  /* Initialize small structures
744
   */
745
  init_one_double ( d1, 1.11111);
746
  init_two_floats ( f3, -2.345, 1.0);
747
  init_bit_flags_char(cflags, (unsigned)1, (unsigned)0, (unsigned)1,
748
                      (unsigned)0, (unsigned)1, (unsigned)0 );
749
  init_bit_flags_short(sflags, (unsigned)1, (unsigned)0, (unsigned)1,
750
                       (unsigned)0, (unsigned)1, (unsigned)0 );
751
  init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1,
752
                 (unsigned)0, (unsigned)1, (unsigned)0 );
753
  init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y',
754
                                     (unsigned)1, (unsigned)0, 'n',
755
                                     (unsigned)1, (unsigned)0 );
756
  init_three_chars(three_char, 'x', 'y', 'z');
757
  init_five_chars(five_char, 'h', 'e', 'l', 'l', 'o');
758
  init_int_char_combo(int_char_combo, 13, '!');
759
  init_struct_rep(struct1, 10);
760
 
761
 
762
  /* Print small structures
763
   */
764
  print_one_double(*d1);
765
  print_two_floats(*f3);
766
  print_bit_flags_char(*cflags);
767
  print_bit_flags_short(*sflags);
768
  print_bit_flags(*flags);
769
  print_bit_flags_combo(*flags_combo);
770
  print_three_chars(*three_char);
771
  print_five_chars(*five_char);
772
  print_int_char_combo(*int_char_combo);
773
  print_struct_rep(*struct1);
774
 
775
  loop_count();
776
 
777
  return 0;
778
}
779
 
780
 
781
 
782
 
783
 
784
 
785
 
786
 
787
 
788
 
789
 
790
 
791
 
792
 
793
 

powered by: WebSVN 2.1.0

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