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 cdEXIT(EXIT_FAILURE);
00041 }
00042
00043
00044 cap4( LineSave.chNormLab, chLabel);
00045 }
00046 else
00047 {
00048 fprintf( ioQQQ, "The normalize command does not have a valid line.\n" );
00049 fprintf( ioQQQ, "A 4 char long line label must also be specified, between double quotes, like \"H 1\" 4861.\n" );
00050 fprintf( ioQQQ, "Sorry.\n" );
00051 cdEXIT(EXIT_FAILURE);
00052 }
00053
00054
00055 i = 5;
00056 LineSave.WavLNorm = (realnum)FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00057 if( lgEOL )
00058 {
00059 NoNumb(chCard);
00060 }
00061 else if( LineSave.WavLNorm < 0 )
00062 {
00063 fprintf( ioQQQ, "A negative wavelength does not make sense to me.\n" );
00064 fprintf( ioQQQ, "Sorry.\n" );
00065 cdEXIT(EXIT_FAILURE);
00066 }
00067
00068
00069
00070 if( input.chCARDCAPS[i-1] == 'M' )
00071 {
00072
00073 LineSave.WavLNorm *= 1e4f;
00074 }
00075 else if( input.chCARDCAPS[i-1] == 'C' )
00076 {
00077
00078 LineSave.WavLNorm *= 1e8f;
00079 }
00080
00081
00082
00083 LineSave.errorwave = WavlenErrorGet( LineSave.WavLNorm );
00084
00085 LineSave.ScaleNormLine = FFmtRead(chCard,&i,INPUT_LINE_LENGTH,&lgEOL);
00086
00087 if( lgEOL )
00088 LineSave.ScaleNormLine = 1.;
00089
00090
00091 if( LineSave.ScaleNormLine <= 0. )
00092 {
00093 fprintf( ioQQQ, " The scale factor for relative intensities must be greater than zero.\n" );
00094 fprintf( ioQQQ, "Sorry.\n" );
00095 cdEXIT(EXIT_FAILURE);
00096 }
00097 return;
00098 }