| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2007 European Southern Observatory (ESO) |
| 3 |
|
| 4 |
This program is free software; you can redistribute it and/or |
| 5 |
modify it under the terms of the GNU General Public License as |
| 6 |
published by the Free Software Foundation; either version 2 of |
| 7 |
the License, or (at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public |
| 15 |
License along with this program; if not, write to the Free |
| 16 |
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, |
| 17 |
MA 02139, USA. |
| 18 |
|
| 19 |
Correspondence concerning ESO-MIDAS should be addressed as follows: |
| 20 |
Internet e-mail: [email protected] |
| 21 |
Postal address: European Southern Observatory |
| 22 |
Data Management Division |
| 23 |
Karl-Schwarzschild-Strasse 2 |
| 24 |
D 85748 Garching bei Muenchen |
| 25 |
GERMANY |
| 26 |
===========================================================================*/ |
| 27 |
|
| 28 |
/*+++++++++++++++++++++++++++ SC interface module SCE +++++++++++++++++++++++ |
| 29 |
.LANGUAGE C |
| 30 |
.IDENTIFICATION Module SCE |
| 31 |
.AUTHOR K. Banse ESO - Garching |
| 32 |
.KEYWORDS standard interfaces, errors |
| 33 |
.ENVIRONMENT VMS and UNIX |
| 34 |
.COMMENTS |
| 35 |
holds SCECNT, SCETER |
| 36 |
|
| 37 |
.VERSION |
| 38 |
070703 last modif |
| 39 |
|
| 40 |
----------------------------------------------------------------------------*/ |
| 41 |
|
| 42 |
|
| 43 |
#include <fileexts.h> |
| 44 |
|
| 45 |
#include <stdlib.h> |
| 46 |
#include <string.h> |
| 47 |
|
| 48 |
/* |
| 49 |
|
| 50 |
*/ |
| 51 |
|
| 52 |
int SCECNT(action,cont,log,disp) |
| 53 |
|
| 54 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 55 |
.PURPOSE |
| 56 |
implement the C-version of the module ERRCNTRL_ST |
| 57 |
.ALGORITHM |
| 58 |
straight forward |
| 59 |
.RETURNS |
| 60 |
status I*4 always = 0 |
| 61 |
--------------------------------------------------------*/ |
| 62 |
|
| 63 |
char *action /* IN : GET or PUT */; |
| 64 |
int *cont /* IN : pointer to continuation flag */; |
| 65 |
int *log /* IN : pointer to log flag */; |
| 66 |
int *disp /* IN : pointer to display flag */; |
| 67 |
|
| 68 |
{ |
| 69 |
|
| 70 |
|
| 71 |
if ((*action == 'G') || (*action == 'g')) /* get ERRO flags */ |
| 72 |
{ |
| 73 |
*cont = ERRO_CONT; |
| 74 |
*log = ERRO_LOG; |
| 75 |
*disp = ERRO_DISP; |
| 76 |
} |
| 77 |
|
| 78 |
else /* put ERRO flags */ |
| 79 |
{ |
| 80 |
ERRO_CONT = *cont; |
| 81 |
ERRO_LOG = *log; |
| 82 |
ERRO_DISP = *disp; |
| 83 |
} |
| 84 |
|
| 85 |
return ERR_NORMAL; |
| 86 |
|
| 87 |
} |
| 88 |
/* |
| 89 |
|
| 90 |
*/ |
| 91 |
|
| 92 |
void SCETER(myerrno,text) |
| 93 |
|
| 94 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 95 |
.PURPOSE |
| 96 |
put error no. 'myerrno' into key PROGSTAT + stop execution |
| 97 |
.ALGORITHM |
| 98 |
straight forward |
| 99 |
.RETURNS |
| 100 |
nothing |
| 101 |
--------------------------------------------------------*/ |
| 102 |
|
| 103 |
int myerrno /* IN: error no. */; |
| 104 |
char *text /* IN: message to display */; |
| 105 |
|
| 106 |
{ |
| 107 |
int unit=0; |
| 108 |
|
| 109 |
char mytext[82]; |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
if (KIWORDS[OFF_ERROR+3] != 0) |
| 114 |
{ |
| 115 |
MID_ERROR("APP",text,myerrno,1); |
| 116 |
SCTMES(M_RED_COLOR,text); /* display + log error message */ |
| 117 |
} |
| 118 |
else |
| 119 |
MID_ERROR("APP",text,myerrno,0); |
| 120 |
|
| 121 |
|
| 122 |
memset((void *)mytext,32,(size_t)80); /* int 32 = ' ' */ |
| 123 |
(void) memcpy(mytext,text,(size_t)strlen(text)); |
| 124 |
mytext[80] = '\0'; |
| 125 |
(void) SCKWRC("MID$ERRMESS",1,mytext,1,80,&unit); |
| 126 |
|
| 127 |
MID_ABORT(myerrno,100); /* and disappear like anybody else... */ |
| 128 |
} |
| 129 |
|