home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / test / initstructtest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-24  |  1.2 KB  |  65 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: initstructtest.c,v 1.4 1996/10/23 14:06:54 aros Exp $
  4.     $Log: initstructtest.c,v $
  5.     Revision 1.4  1996/10/23 14:06:54  aros
  6.     Missing include
  7.  
  8.     Revision 1.3  1996/10/19 17:07:31  aros
  9.     Include <aros/machine.h> instead of machine.h
  10.  
  11.     Revision 1.2  1996/08/01 17:41:39  digulla
  12.     Added standard header for all files
  13.  
  14.     Desc:
  15.     Lang:
  16. */
  17. #include <clib/exec_protos.h>
  18. #include <aros/machine.h>
  19. #include "initstruct.h"
  20. #include <stdio.h>
  21. #include <stddef.h>
  22.  
  23. struct demo
  24. {
  25.     LONG a[3];
  26.     BYTE b[7];
  27.     BYTE dummy1[2];
  28.     LONG c[3];
  29.     WORD d;
  30. };
  31.  
  32. #define O(n) offsetof(struct demo,n)
  33.  
  34. struct init
  35. {
  36.     S_CPY   (1,3,L); /* 3 LONGs */
  37.     S_REP   (2,7,B); /* 7 BYTEs */
  38.     S_CPYO  (3,3,L); /* 3 LONGs */
  39.     S_CPYO24(4,1,W); /* 1 WORD  */
  40.     S_END   (end);
  41. } inittable=
  42. {
  43.     { { I_CPY    (3,L),      { 1, 2, 3 } } },
  44.     { { I_REP    (7,B),        4         } },
  45.     { { I_CPYO    (3,L,O(c)), { 5, 6, 7 } } },
  46.     { { I_CPYO24(1,W,O(d)), { 8 }       } },
  47.     I_END    ()
  48. };
  49.  
  50. #undef O
  51.  
  52. int main(int argc,char *argv[])
  53. {
  54.     struct demo d;
  55.     int i;
  56.  
  57.     InitStruct(&inittable,&d,sizeof(d));
  58.  
  59.     for(i=0;i<sizeof(d);i++)
  60.       printf("%02x ",((UBYTE *)&d)[i]);
  61.  
  62.     return 0;
  63. }
  64.  
  65.