labcomm2006_error.h 2.09 KB
Newer Older
1
/*
Sven Gestegård Robertz's avatar
Sven Gestegård Robertz committed
2
  labcomm2006_error.h -- labcomm error declarations
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

  Copyright 2013 Anders Blomdell <anders.blomdell@control.lth.se>

  This file is part of LabComm.

  LabComm is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  LabComm is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

22 23
#ifndef __LABCOMM2006_ERROR_H__
#define __LABCOMM2006_ERROR_H__
24

Sven Gestegård Robertz's avatar
Sven Gestegård Robertz committed
25
enum labcomm2006_error {
26
#define LABCOMM_ERROR(name, description) name ,
Sven Gestegård Robertz's avatar
Sven Gestegård Robertz committed
27
#include "labcomm2006_error.h"
28 29 30
#undef LABCOMM_ERROR
};

Sven Gestegård Robertz's avatar
Sven Gestegård Robertz committed
31
struct labcomm2006_error_handler;
32

Sven Gestegård Robertz's avatar
Sven Gestegård Robertz committed
33 34
void labcomm2006_error_warning(struct labcomm2006_error_handler *e,
			   enum labcomm2006_error,
35 36 37
			   char *format,
			   ...);
			 
Sven Gestegård Robertz's avatar
Sven Gestegård Robertz committed
38
void labcomm2006_error_fatal_global(enum labcomm2006_error error,
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
				char *format,
				...);
			 
#endif

#ifdef LABCOMM_ERROR

LABCOMM_ERROR(LABCOMM_ERROR_SIGNATURE_ALREADY_SET, 
	      "Signature has already been set")
LABCOMM_ERROR(LABCOMM_ERROR_SIGNATURE_NOT_SET, 
	      "Signature has not been set")

LABCOMM_ERROR(LABCOMM_ERROR_ENC_NO_REG_SIGNATURE, 
	      "Encoder has no registration for this signature")
LABCOMM_ERROR(LABCOMM_ERROR_ENC_BUF_FULL,
	      "The labcomm buffer is full")
LABCOMM_ERROR(LABCOMM_ERROR_DEC_UNKNOWN_DATATYPE,
	      "Decoder: Unknown datatype")
LABCOMM_ERROR(LABCOMM_ERROR_DEC_INDEX_MISMATCH, 
	      "Decoder: index mismatch")
LABCOMM_ERROR(LABCOMM_ERROR_DEC_TYPE_NOT_FOUND,
	      "Decoder: type not found")
LABCOMM_ERROR(LABCOMM_ERROR_UNIMPLEMENTED_FUNC,
	      "This function is not yet implemented")
LABCOMM_ERROR(LABCOMM_ERROR_MEMORY,
	      "Could not allocate memory")
LABCOMM_ERROR(LABCOMM_ERROR_USER_DEF,     
	      "User defined error")

#endif