39 #define TF_GSEXX_CM6_CC_VERSION \ 40 "TF_GSEXX_CM6_CC V1.1 " 41 #define TF_GSEXX_CM6_CC_CVSID \ 103 " +-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
107 long expo_2[] = { 0, 32, 1024, 32768, 1048576, 33554432, 134217728 };
111 long expo_2m1_o[] = { 01, 037, 01777, 077777, 03777777, 0177777777 };
122 { nflag += 16; value = -value; }
128 if (value >= expo_2[6])
130 std::cerr <<
"ERROR (CM6::encode): " 131 <<
"sample value exceeds largest value which can be handled\n" 132 <<
"Error is triggered by absolute value being ";
133 std::cerr.setf(std::ios_base::hex,std::ios_base::basefield);
134 std::cerr <<
"0x0" << value <<
">=" <<
"0x0" << expo_2[6] << std::endl;
135 std::cerr <<
"The input value passed to the encoder is " 136 <<
"0x0" << invalue << std::endl;
137 throw Terror(
"ERROR (CM6::encode): illegal value");
141 std::frexp (
double(value), &case_expo);
143 case_expo = case_expo/5;
146 if (case_expo > 5 || case_expo < 0)
148 std::cerr <<
"ERROR (CM6::encode): exponent is " 149 << case_expo << std::endl;
150 std::cerr <<
"ERROR (CM6::encode): sample value is is " 151 << invalue << std::endl;
152 throw Terror(
"ERROR (CM6::encode): illegal exponent");
155 for ( ; case_expo > 0; case_expo--)
158 jc = value/expo_2[case_expo] + nflag + mflag;
161 value = value & expo_2m1_o[case_expo];
209 static int ichar[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
210 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,3,4,5,6,7,
211 8,9,10,11,0,0,0,0,0,0,0,12,13,14,15,16,17,18,19,20,21,22,
212 23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,0,0,0,0,0,0,
213 38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,
214 57,58,59,60,61,62,63,0,0,0,0,0,0},
215 isign=020, ioflow=040, mask1=017, mask2=037, m127=0177;
217 int k, inn, jsign=0, joflow=0;
223 while (inchar ==
'\n') { is.get(inchar); }
225 throw Terror(
"ERROR (CM6::decode): illegal whitespace");
227 throw Terror(
"ERROR (CM6::decode): illegal end of file");
232 k = int(
int(inchar) & m127);
235 jsign = (inn & isign);
236 joflow = (inn & ioflow);
237 retval = (long)(inn & mask1);
245 while (inchar ==
'\n') { is.get(inchar); }
247 throw Terror(
"ERROR (CM6::decode): illegal whitespace");
249 throw Terror(
"ERROR (CM6::decode): illegal end of file");
252 k = int(
int(inchar) & m127);
254 joflow = (inn & ioflow);
255 retval = retval +
intT(inn & mask2);
259 if (jsign != 0) retval = -retval;
GSE++ library: read and write GSE waveform data (prototypes).
All stuff defined by the GSE2 standard.
helper function prototypes for TDAT2 (prototypes)
Base class for all exceptions in this module.