vms_msg_gen.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * VMS Message Source File Generator.
  3. *
  4. * 2007-01-29 SMS.
  5. *
  6. * Generates a VMS error message source file from data in "ziperr.h".
  7. *
  8. * On a VMS system, the standard builders should do the work. On a
  9. * non-VMS system:
  10. *
  11. * cc -I. vms/vms_msg_gen.c -o vms_msg_gen
  12. * ./vms_msg_gen > vms/zip_msg.msg
  13. * rm ./vms_msg_gen
  14. */
  15. #include <stdio.h>
  16. #include <string.h>
  17. #define GLOBALS /* Include data for ziperrors[] in ziperr.h. */
  18. #include "ziperr.h"
  19. main()
  20. {
  21. int base_prev;
  22. int code_vms;
  23. int code_zip;
  24. int i;
  25. char *sev_str[ 8] = {
  26. "/WARNING",
  27. "/SUCCESS",
  28. "/ERROR",
  29. "/INFORMATIONAL",
  30. "/FATAL",
  31. "/??????",
  32. "/???????",
  33. "/????????"
  34. };
  35. char *text1[] = {
  36. "! VMS Error Message Source File for Zip",
  37. "!",
  38. "! Because the facility code was formally assigned by HP, the .FACILITY",
  39. "! directive below specifies /SYSTEM. Because the messages are, in",
  40. "! general, specific to Zip, this file is not compiled with /SHARED.",
  41. "! For example:",
  42. "!",
  43. "! MESSAGE /OBJECT = [.dest]ZIP_MSG.OBJ /NOSYMBOLS [.VMS]ZIP_MSG.MSG",
  44. "!",
  45. "! LINK /SHAREABLE = [.dest]ZIP_MSG.EXE [.dest]ZIP_MSG.OBJ",
  46. "!",
  47. "!-----------------------------------------------------------------------",
  48. "",
  49. ".TITLE Info-ZIP Zip Error Messages",
  50. ".FACILITY IZ_ZIP, 1955 /SYSTEM",
  51. NULL /* End-of-text marker. */
  52. };
  53. /* Initialize the .BASE counter. */
  54. base_prev = -2;
  55. /* Put out the header text. */
  56. for (i = 0; text1[ i] != NULL; i++)
  57. {
  58. printf( "%s\n", text1[ i]);
  59. }
  60. printf( ".IDENT '%s'\n", VMS_MSG_IDENT);
  61. printf( "\n");
  62. /* Put out the error messages. */
  63. for (code_zip = 0; code_zip <= ZE_MAXERR; code_zip++)
  64. {
  65. if ((ziperrors[ code_zip].string != NULL) &&
  66. (strlen(ziperrors[ code_zip].string) != 0))
  67. {
  68. code_vms = 2* code_zip; /* 4-bit left-shift, not 3. */
  69. if (code_vms != base_prev+ 1)
  70. {
  71. printf( ".BASE %d\n", code_vms);
  72. }
  73. printf( "%-7s %-13s <%s>\n",
  74. ziperrors[ code_zip].name,
  75. sev_str[ ziperrors[ code_zip].severity & 0x07],
  76. ziperrors[ code_zip].string);
  77. base_prev = code_vms;
  78. }
  79. }
  80. /* Put out the .END directive. */
  81. printf( "\n");
  82. printf( ".END\n");
  83. }