home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / wvhtm064.zip / notes / convert-to-struct / wv-copy-c.awk < prev    next >
Text File  |  2000-09-02  |  1KB  |  50 lines

  1. #!/bin/awk -f
  2. {
  3. if ((dup == $5) && (dup != "Bitfield"))
  4.     printf("/*error, dup offset of above line*/ ");
  5. dup = $5
  6. if (match($2,":"))
  7.     {
  8.     split($2,a,"[:]");
  9.     if (bitmode != 1)
  10.         {
  11.         if ((type == "U16") || (type == "S16"))
  12.             printf("dest->"a[1]" = src->"a[1]";\n");
  13.         else if ((type == "U8") || (type == "S8"))
  14.             printf("dest->"a[1]" = src->"a[1]";\n");
  15.         else if ((type == "U32") || (type == "S32"))
  16.             printf("dest->"a[1]" = src->"a[1]";\n");
  17.         apple = a[2] + 0;
  18.         }
  19.     else
  20.         {
  21.         if ((type == "U16") || (type == "S16"))
  22.             printf("dest->"a[1]" = src->"a[1]";\n");
  23.         else if ((type == "U8") || (type == "S8"))
  24.             printf("dest->"a[1]" = src->"a[1]";\n");
  25.         else if ((type == "U32") || (type == "S32"))
  26.             printf("dest->"a[1]" = src->"a[1]";\n");
  27.         apple = apple + a[2];
  28.         }
  29.     bitmode=1;
  30.     }
  31. else
  32.     {
  33.     bitmode=0;
  34.     if ($1 == "U16")
  35.         printf("dest->"$2" = src->"$2";\n")
  36.     else if ($1 == "U32")
  37.         printf("dest->"$2" = src->"$2";\n")
  38.     else if ($1 == "U8")
  39.         printf("dest->"$2" = src->"$2";\n")
  40.     else if ($1 == "S16")
  41.         printf("dest->"$2" = src->"$2";\n")
  42.     else if ($1 == "S32")
  43.         printf("dest->"$2" = src->"$2";\n")
  44.     else if ($1 == "S8")
  45.         printf("dest->"$2" = src->"$2";\n")
  46.     else
  47.         printf("wvCopy"$1"(&dest->"$2",&src->"$2");\n")
  48.     }
  49. }
  50.