00001
00002
00003
00004
00005
00006
00007
00008
00009 #define NML_OLD_COMPAT
00010
00011
00012 #include "rcs_defs.hh"
00013
00014 #ifdef EXTERN_C_STD_HEADERS
00015 extern "C"
00016 {
00017 #endif
00018 #include <string.h>
00019
00020 #ifdef EXTERN_C_STD_HEADERS
00021 }
00022 #endif
00023
00024
00025 #include "cms.hh"
00026 #include "nmlmsg.hh"
00027 #include "rcs_prnt.hh"
00028
00029
00030
00031 int
00032 NMLmsg::automatically_clear = 1;
00033
00034
00035 NMLmsg::NMLmsg (NMLTYPE t, long s)
00036 {
00037 type = t;
00038 size = s;
00039 if (automatically_clear)
00040 {
00041 clear ();
00042 }
00043 if (size < ((long) sizeof (NMLmsg)))
00044 {
00045 rcs_print_error ("NMLmsg: size(=%d) must be atleast %d\n", size,
00046 sizeof (NMLmsg));
00047 size = sizeof (NMLmsg);
00048 }
00049 if (type <= 0)
00050 {
00051 rcs_print_error ("NMLmsg: type(=%d) should be greater than zero.\n",
00052 type);
00053 }
00054 };
00055
00056 NMLmsg::NMLmsg (NMLTYPE t, size_t s)
00057 {
00058 type = t;
00059 size = s;
00060 if (automatically_clear)
00061 {
00062 clear ();
00063 }
00064 if (size < ((long) sizeof (NMLmsg)))
00065 {
00066 rcs_print_error ("NMLmsg: size(=%d) must be atleast %d\n", size,
00067 sizeof (NMLmsg));
00068 size = sizeof (NMLmsg);
00069 }
00070 if (type <= 0)
00071 {
00072 rcs_print_error ("NMLmsg: type(=%d) should be greater than zero.\n",
00073 type);
00074 }
00075 }
00076
00077
00078
00079 NMLmsg::NMLmsg (NMLTYPE t, long s, int noclear)
00080 {
00081 if (automatically_clear && !noclear)
00082 {
00083 clear ();
00084 }
00085 type = t;
00086 size = s;
00087 if (size < ((long) sizeof (NMLmsg)))
00088 {
00089 rcs_print_error ("NMLmsg: size(=%d) must be atleast %d\n", size,
00090 sizeof (NMLmsg));
00091 size = sizeof (NMLmsg);
00092 }
00093 if (type <= 0)
00094 {
00095 rcs_print_error ("NMLmsg: type(=%d) should be greater than zero.\n",
00096 type);
00097 }
00098 };
00099
00100
00101 void
00102 NMLmsg::clear ()
00103 {
00104 long temp_size;
00105 NMLTYPE temp_type;
00106 temp_size = size;
00107 temp_type = type;
00108 memset ((void *) this, 0, size);
00109 size = temp_size;
00110 type = temp_type;
00111 if (size < ((long) sizeof (NMLmsg)))
00112 {
00113 rcs_print_error ("NMLmsg: size(=%d) must be atleast %d\n", size,
00114 sizeof (NMLmsg));
00115 size = sizeof (NMLmsg);
00116 }
00117 }
00118
00119
00120
00121
00122 void
00123 NMLmsg::update (CMS * cms)
00124 {
00125 rcs_print_error ("update called for NMLmsg base class.");
00126 rcs_print_error ("(This is an error.)\n");
00127 cms->status = CMS_MISC_ERROR;
00128 }