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