00001 /* 00002 * This file is part of the ESO UVES Pipeline 00003 * Copyright (C) 2004,2005 European Southern Observatory 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA 00018 */ 00019 00020 /* 00021 * $Author: amodigli $ 00022 * $Date: 2008/03/28 08:56:19 $ 00023 * $Revision: 1.13 $ 00024 * $Name: uves-4_2_2 $ 00025 * $Log: uves_recipe.h,v $ 00026 * Revision 1.13 2008/03/28 08:56:19 amodigli 00027 * IRPLIB_RECIPE_DEFINE-->UVES_IRPLIB_RECIPE_DEFINE IRPLIB_CONCAT2X UVES_CONCAT2X irplib_plugin-->uves_plugin 00028 * 00029 * Revision 1.12 2007/06/06 08:17:33 amodigli 00030 * replace tab with 4 spaces 00031 * 00032 * Revision 1.11 2007/02/09 15:10:42 jmlarsen 00033 * Show recipe name correctly 00034 * 00035 * Revision 1.10 2007/02/09 13:40:11 jmlarsen 00036 * Added year 2007 00037 * 00038 * Revision 1.9 2007/01/10 12:39:44 jmlarsen 00039 * Replace UVES_TFLAT_ID with recipe name parameter 00040 * 00041 * Revision 1.8 2006/11/16 14:10:49 jmlarsen 00042 * Fixed usage of recipe name string in error message 00043 * 00044 * Revision 1.7 2006/11/15 15:02:15 jmlarsen 00045 * Implemented const safe workarounds for CPL functions 00046 * 00047 * Revision 1.5 2006/11/15 14:04:08 jmlarsen 00048 * Removed non-const version of parameterlist_get_first/last/next which is already 00049 * in CPL, added const-safe wrapper, unwrapper and deallocator functions 00050 * 00051 * Revision 1.4 2006/10/24 14:01:21 jmlarsen 00052 * include uves_msg.h 00053 * 00054 * Revision 1.3 2006/10/17 12:33:08 jmlarsen 00055 * Added semicolon at UVES_RECIPE_DEFINE invocation 00056 * 00057 * Revision 1.2 2006/10/10 14:43:48 jmlarsen 00058 * Add semicolon at invocation of IRPLIB_RECIPE_DEFINE 00059 * 00060 * Revision 1.1 2006/10/09 13:01:33 jmlarsen 00061 * Use macro to define recipe interface functions 00062 * 00063 * Revision 1.3 2005/12/19 16:17:55 jmlarsen 00064 * Replaced bool -> int 00065 * 00066 */ 00067 00068 #ifndef UVES_RECIPE_H 00069 #define UVES_RECIPE_H 00070 00071 #include <uves_msg.h> 00072 #include <uves_error.h> 00073 #include <uves_plugin.h> 00074 #include <cpl.h> 00075 00076 /*----------------------------------------------------------------------------- 00077 Defines 00078 -----------------------------------------------------------------------------*/ 00079 #define UVES_RECIPE_DEFINE(NAME, MSG_DOMAIN, FILL_PARAMS_FUNC, \ 00080 AUTHOR, AUTHOR_EMAIL, \ 00081 SYNOPSIS, DESCRIPTION) \ 00082 UVES_IRPLIB_RECIPE_DEFINE(NAME, UVES_BINARY_VERSION, \ 00083 FILL_PARAMS_FUNC(recipe->parameters), \ 00084 AUTHOR, AUTHOR_EMAIL, "2004, 2005, 2006, 2007", SYNOPSIS, DESCRIPTION); \ 00085 \ 00086 static void UVES_CONCAT2X(NAME,exe)(cpl_frameset *, \ 00087 const cpl_parameterlist *, \ 00088 const char *starttime); \ 00089 \ 00090 /* This is the UVES pipeline specific (but common to all recipes) \ 00091 code to run before/after executing each recipe. It calls the function \ 00092 uves_rrrecipe_exe(frames, parameters, starttime) declared above. */ \ 00093 \ 00094 static int NAME(cpl_frameset *frames, \ 00095 const cpl_parameterlist *parameters) \ 00096 { \ 00097 char *starttime = NULL; \ 00098 \ 00099 /* Error handling (irplib) was already initialized */ \ 00100 \ 00101 /* Initialize messaging */ \ 00102 uves_msg_init(-1, MSG_DOMAIN); /* -1 = max level */ \ 00103 \ 00104 /* Initialize recipe */ \ 00105 check( (uves_msg_louder(), \ 00106 starttime = uves_initialize(frames, parameters, make_str(NAME), \ 00107 SYNOPSIS), \ 00108 uves_msg_softer()), \ 00109 "Initialization failed"); \ 00110 \ 00111 /* Recipe specific actions */ \ 00112 check( (uves_msg_louder(), \ 00113 UVES_CONCAT2X(NAME,exe)(frames, parameters, starttime), \ 00114 uves_msg_softer()), \ 00115 MSG_DOMAIN " execution failed"); \ 00116 \ 00117 /* Terminate recipe */ \ 00118 check( uves_end(make_str(NAME), frames), "Termination failed"); \ 00119 \ 00120 cleanup: \ 00121 cpl_free(starttime); \ 00122 \ 00123 return (cpl_error_get_code() == CPL_ERROR_NONE) ? 0 : 1; \ 00124 } \ 00125 /* This dummy declaration requires the macro to be invoked as if it was \ 00126 a kind of function declaration, with a terminating ; */ \ 00127 extern int uves_recipe_end 00128 00129 00130 #endif
1.5.1