00001
00002
00003
00004 #include "cddefines.h"
00005 #include "lines.h"
00006 #include "input.h"
00007 #include "parse.h"
00008 #include "lines_service.h"
00009
00010 void ParseNorm(char *chCard)
00011 {
00012 bool lgEOL;
00013 long int i;
00014 char chLabel[INPUT_LINE_LENGTH];
00015
00016 DEBUG_ENTRY( "ParseNorm()" );
00017
00018
00019 LineSave.lgNormSet = true;
00020
00021
00022
00023
00024
00025 if( strchr( chCard , '\"' ) != NULL )
00026 {
00027
00028
00029
00030
00031
00032
00033 GetQuote( chLabel , chCard , true );
00034 if( chLabel[4] !=0 )
00035 {
00036 fprintf( ioQQQ, " The label identifying the line on the normalize command must be exactly 4 char long.\n" );
00037 fprintf( ioQQQ, " The command line was as follows:\n %s\n", input.chCardSav[input.nRead] );
00038 fprintf( ioQQQ, " The label I found was: \"%s\", where were not 4 characters between the quotes.\n", chLabel );
00039 fprintf( ioQQQ, "Sorry.\n" );
00040 puts( "[Stop in ParseNorm]" );
00041 cdEXIT(EXIT_FAILURE);
00042 }
00043
00044
00045 cap4( LineSave.chNormLab, chLabel);
00046 }
00047 else
00048 {
00049 fprintf( ioQQQ, "The normalize command does not have a valid line.\n" );
00050 fprintf( ioQQQ, "A 4 char long line label must also be specified, between double quotes, like \"H 1\" 4861.\n" );
00051 fprintf( ioQQQ, "Sorry.\n" );
00052 puts( "[Stop in ParseNorm]" );
00053 cdEXIT(EXIT_FAILURE);
00054 }
00055
00056
00057 i = 5;
00058 LineSave.WavLNorm = (float)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00059 if( lgEOL )
00060 {
00061 NoNumb(chCard);
00062 }
00063 else if( LineSave.WavLNorm < 0 )
00064 {
00065 fprintf( ioQQQ, "A negative wavelength does not make sense to me.\n" );
00066 fprintf( ioQQQ, "Sorry.\n" );
00067 puts( "[Stop in ParseNorm]" );
00068 cdEXIT(EXIT_FAILURE);
00069 }
00070
00071
00072
00073 if( input.chCARDCAPS[i-1] == 'M' )
00074 {
00075
00076 LineSave.WavLNorm *= 1e4f;
00077 }
00078 else if( input.chCARDCAPS[i-1] == 'C' )
00079 {
00080
00081 LineSave.WavLNorm *= 1e8f;
00082 }
00083
00084
00085
00086 LineSave.errorwave = WavlenErrorGet( LineSave.WavLNorm );
00087
00088 LineSave.ScaleNormLine = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00089
00090 if( lgEOL )
00091 LineSave.ScaleNormLine = 1.;
00092
00093
00094 if( LineSave.ScaleNormLine <= 0. )
00095 {
00096 fprintf( ioQQQ, " The scale factor for relative intensities must be greater than zero.\n" );
00097 fprintf( ioQQQ, "Sorry.\n" );
00098 puts( "[Stop in ParseNorm]" );
00099 cdEXIT(EXIT_FAILURE);
00100 }
00101
00102 DEBUG_EXIT( "ParseNorm()" );
00103 return;
00104 }