00001
00002
00003
00004 #include "cddefines.h"
00005 #include "lines.h"
00006 #include "input.h"
00007 #include "parser.h"
00008 #include "lines_service.h"
00009
00010 void ParseNorm(Parser &p)
00011 {
00012 char chLabel[INPUT_LINE_LENGTH];
00013
00014 DEBUG_ENTRY( "ParseNorm()" );
00015
00016
00017 LineSave.lgNormSet = true;
00018
00019
00020
00021
00022
00023 if( p.nMatch( "\"" ) )
00024 {
00025
00026
00027
00028
00029
00030
00031 p.GetQuote( chLabel , true );
00032 if( chLabel[4] != '\0' || strlen(chLabel) != 4 )
00033 {
00034 fprintf( ioQQQ, " The label identifying the line on the normalize command must be exactly 4 char long.\n" );
00035 fprintf( ioQQQ, " The command line was as follows:\n %s\n", input.chCardSav[input.nRead] );
00036 fprintf( ioQQQ, " The label I found was: \"%s\", where were not 4 characters between the quotes.\n", chLabel );
00037 fprintf( ioQQQ, "Sorry.\n" );
00038 cdEXIT(EXIT_FAILURE);
00039 }
00040
00041
00042 cap4( LineSave.chNormLab, chLabel);
00043 }
00044 else
00045 {
00046 fprintf( ioQQQ, "The normalize command does not have a valid line.\n" );
00047 fprintf( ioQQQ, "A 4 char long line label must also be specified, between double quotes, like \"H 1\" 4861.\n" );
00048 fprintf( ioQQQ, "Sorry.\n" );
00049 cdEXIT(EXIT_FAILURE);
00050 }
00051
00052
00053 LineSave.WavLNorm = (realnum)p.getWave();
00054
00055 if( LineSave.WavLNorm < 0 )
00056 {
00057 fprintf( ioQQQ, "A negative wavelength does not make sense to me.\n" );
00058 fprintf( ioQQQ, "Sorry.\n" );
00059 cdEXIT(EXIT_FAILURE);
00060 }
00061
00062
00063
00064 LineSave.errorwave = WavlenErrorGet( LineSave.WavLNorm );
00065
00066 LineSave.ScaleNormLine = p.FFmtRead();
00067
00068 if( p.lgEOL() )
00069 LineSave.ScaleNormLine = 1.;
00070
00071
00072 if( LineSave.ScaleNormLine <= 0. )
00073 {
00074 fprintf( ioQQQ, " The scale factor for relative intensities must be greater than zero.\n" );
00075 fprintf( ioQQQ, "Sorry.\n" );
00076 cdEXIT(EXIT_FAILURE);
00077 }
00078 return;
00079 }