labcomm_error.h 2.13 KB
Newer Older
Anders Blomdell's avatar
Anders Blomdell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
  labcomm_error.h -- labcomm error declarations

  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 __LABCOMM_ERROR_H___
#define __LABCOMM_ERROR_H___
Anders Blomdell's avatar
Anders Blomdell committed
24 25 26 27 28 29 30

enum labcomm_error {
#define LABCOMM_ERROR(name, description) name ,
#include "labcomm_error.h"
#undef LABCOMM_ERROR
};

Anders Blomdell's avatar
Anders Blomdell committed
31 32
struct labcomm_error_handler;

33 34 35 36 37 38 39 40 41
void labcomm_error_warning(struct labcomm_error_handler *e,
			   enum labcomm_error,
			   char *format,
			   ...);
			 
void labcomm_error_fatal_global(enum labcomm_error error,
				char *format,
				...);
			 
Anders Blomdell's avatar
Anders Blomdell committed
42 43 44 45
#endif

#ifdef LABCOMM_ERROR

46 47 48 49 50
LABCOMM_ERROR(LABCOMM_ERROR_SIGNATURE_ALREADY_SET, 
	      "Signature has already been set")
LABCOMM_ERROR(LABCOMM_ERROR_SIGNATURE_NOT_SET, 
	      "Signature has not been set")

Anders Blomdell's avatar
Anders Blomdell committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
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")
67 68
LABCOMM_ERROR(LABCOMM_ERROR_BAD_WRITER,
	      "Decoder: writer_ioctl() failed")
Anders Blomdell's avatar
Anders Blomdell committed
69 70

#endif