extractprototype.awk 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. BEGIN {
  2. curfile = FILENAME;
  3. s = ""; for (i = 0; i < 60; i++) s = s "*";
  4. printf("/*\n *\n * PRIVATE MOTIF FUNCTIONS\n");
  5. printf(" * Declarations extracted from Open Motif header files\n *\n */\n\n", s);
  6. printf("#include <Xm/TextStrSoP.h>\n");
  7. printf("#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
  8. }
  9. END {
  10. printf("#ifdef __cplusplus\n}\n#endif\n");
  11. printf("/*%s\n * END OF EXTRACTED DATA\n *%s/\n", s, s);
  12. }
  13. function proto() {
  14. if ($0 ~ /extern/) {
  15. pattern = 0;
  16. do {
  17. line = $0;
  18. if (line ~ /#if/) {
  19. pattern = 1;
  20. }
  21. if (curfile != FILENAME) {
  22. n = FILENAME;
  23. sub(/.*\//, "", n);
  24. printf("/* Extracted from %s */\n", n);
  25. curfile = FILENAME;
  26. }
  27. sub(/[ \t]*$/, "", line);
  28. print line;
  29. getline;
  30. if ( pattern == 0) {
  31. terminate = (line ~ /;/);
  32. } else {
  33. terminate = (line ~ /^#.*endif/);
  34. }
  35. } while (!terminate);
  36. }
  37. }
  38. /_XmClearShadowType/ { proto(); }
  39. /_XmShellIsExclusive/ { proto(); }
  40. /_XmGrabKeyboard/ { proto(); }
  41. /_XmFocusIsHere/ { proto(); }
  42. /_XmAddGrab/ { proto(); }
  43. /_XmGrabPointer/ { proto(); }
  44. /_XmRemoveGrab/ { proto(); }
  45. /_XmEnterGadget/ { proto(); }
  46. /_XmLeaveGadget/ { proto(); }
  47. /_XmPushWidgetExtData/ { proto(); }
  48. /_XmPopWidgetExtData/ { proto(); }
  49. /_XmGetWidgetExtData/ { proto(); }
  50. /_XmGadgetImportSecondaryArgs/ { proto(); }
  51. /_XmExtImportArgs/ { proto(); }
  52. /_XmExtGetValuesHook/ { proto(); }
  53. /_XmSocorro/ { proto(); }
  54. /_XmFocusInGadget/ { proto(); }
  55. /_XmFocusOutGadget/ { proto(); }
  56. /_XmIsEventUnique/ { proto(); }
  57. /_XmRecordEvent/ { proto(); }
  58. /_XmSetInDragMode/ { proto(); }
  59. /_XmStringSourceGetString/ { proto(); }
  60. /_XmStringUngenerate/ { proto(); }
  61. /_XmShellIsExclusive/ { proto(); }
  62. /_XmTextFieldSetDestination/ { proto(); }
  63. /_XmGetActiveTopLevelMenu/ { proto(); }
  64. /_XmGetFocusPolicy/ { proto(); }
  65. /_XmPrimitiveEnter/ { proto(); }
  66. /_XmPrimitiveLeave/ { proto(); }
  67. /_XmPrimitiveFocusOut/ { proto(); }
  68. /_XmPrimitiveFocusIn\(/ { proto(); }
  69. /_XmBulletinBoardSetDynDefaultButton/ { proto(); }
  70. /_XmBulletinBoardSizeUpdate/ { proto(); }
  71. /_XmManagerHelp/ { proto(); }
  72. /_XmPutScaledImage/ { proto(); }
  73. /_XmGeoSetupKid/ { proto(); }
  74. /XmeFlushIconFileCache/ { proto(); }