Subversion Repositories Kolibri OS

Rev

Rev 1892 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* cairo - a vector graphics library with display and print output
  2.  *
  3.  * Copyright © 2002 University of Southern California
  4.  * Copyright © 2005 Red Hat, Inc.
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it either under the terms of the GNU Lesser General Public
  8.  * License version 2.1 as published by the Free Software Foundation
  9.  * (the "LGPL") or, at your option, under the terms of the Mozilla
  10.  * Public License Version 1.1 (the "MPL"). If you do not alter this
  11.  * notice, a recipient may use your version of this file under either
  12.  * the MPL or the LGPL.
  13.  *
  14.  * You should have received a copy of the LGPL along with this library
  15.  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
  16.  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
  17.  * You should have received a copy of the MPL along with this library
  18.  * in the file COPYING-MPL-1.1
  19.  *
  20.  * The contents of this file are subject to the Mozilla Public License
  21.  * Version 1.1 (the "License"); you may not use this file except in
  22.  * compliance with the License. You may obtain a copy of the License at
  23.  * http://www.mozilla.org/MPL/
  24.  *
  25.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
  26.  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
  27.  * the specific language governing rights and limitations.
  28.  *
  29.  * The Original Code is the cairo graphics library.
  30.  *
  31.  * The Initial Developer of the Original Code is University of Southern
  32.  * California.
  33.  *
  34.  * Contributor(s):
  35.  *      Carl D. Worth <cworth@cworth.org>
  36.  */
  37.  
  38. #ifndef _CAIRO_ERROR_PRIVATE_H_
  39. #define _CAIRO_ERROR_PRIVATE_H_
  40.  
  41. #include "cairo.h"
  42. #include "cairo-compiler-private.h"
  43. #include "cairo-types-private.h"
  44.  
  45. #include <assert.h>
  46.  
  47. CAIRO_BEGIN_DECLS
  48.  
  49. /* Sure wish C had a real enum type so that this would be distinct
  50.  * from #cairo_status_t. Oh well, without that, I'll use this bogus 100
  51.  * offset.  We want to keep it fit in int8_t as the compiler may choose
  52.  * that for #cairo_status_t */
  53. enum _cairo_int_status {
  54.     CAIRO_INT_STATUS_SUCCESS = 0,
  55.  
  56.     CAIRO_INT_STATUS_NO_MEMORY,
  57.     CAIRO_INT_STATUS_INVALID_RESTORE,
  58.     CAIRO_INT_STATUS_INVALID_POP_GROUP,
  59.     CAIRO_INT_STATUS_NO_CURRENT_POINT,
  60.     CAIRO_INT_STATUS_INVALID_MATRIX,
  61.     CAIRO_INT_STATUS_INVALID_STATUS,
  62.     CAIRO_INT_STATUS_NULL_POINTER,
  63.     CAIRO_INT_STATUS_INVALID_STRING,
  64.     CAIRO_INT_STATUS_INVALID_PATH_DATA,
  65.     CAIRO_INT_STATUS_READ_ERROR,
  66.     CAIRO_INT_STATUS_WRITE_ERROR,
  67.     CAIRO_INT_STATUS_SURFACE_FINISHED,
  68.     CAIRO_INT_STATUS_SURFACE_TYPE_MISMATCH,
  69.     CAIRO_INT_STATUS_PATTERN_TYPE_MISMATCH,
  70.     CAIRO_INT_STATUS_INVALID_CONTENT,
  71.     CAIRO_INT_STATUS_INVALID_FORMAT,
  72.     CAIRO_INT_STATUS_INVALID_VISUAL,
  73.     CAIRO_INT_STATUS_FILE_NOT_FOUND,
  74.     CAIRO_INT_STATUS_INVALID_DASH,
  75.     CAIRO_INT_STATUS_INVALID_DSC_COMMENT,
  76.     CAIRO_INT_STATUS_INVALID_INDEX,
  77.     CAIRO_INT_STATUS_CLIP_NOT_REPRESENTABLE,
  78.     CAIRO_INT_STATUS_TEMP_FILE_ERROR,
  79.     CAIRO_INT_STATUS_INVALID_STRIDE,
  80.     CAIRO_INT_STATUS_FONT_TYPE_MISMATCH,
  81.     CAIRO_INT_STATUS_USER_FONT_IMMUTABLE,
  82.     CAIRO_INT_STATUS_USER_FONT_ERROR,
  83.     CAIRO_INT_STATUS_NEGATIVE_COUNT,
  84.     CAIRO_INT_STATUS_INVALID_CLUSTERS,
  85.     CAIRO_INT_STATUS_INVALID_SLANT,
  86.     CAIRO_INT_STATUS_INVALID_WEIGHT,
  87.     CAIRO_INT_STATUS_INVALID_SIZE,
  88.     CAIRO_INT_STATUS_USER_FONT_NOT_IMPLEMENTED,
  89.     CAIRO_INT_STATUS_DEVICE_TYPE_MISMATCH,
  90.     CAIRO_INT_STATUS_DEVICE_ERROR,
  91.     CAIRO_INT_STATUS_INVALID_MESH_CONSTRUCTION,
  92.     CAIRO_INT_STATUS_DEVICE_FINISHED,
  93.  
  94.     CAIRO_INT_STATUS_LAST_STATUS,
  95.  
  96.     CAIRO_INT_STATUS_UNSUPPORTED = 100,
  97.     CAIRO_INT_STATUS_DEGENERATE,
  98.     CAIRO_INT_STATUS_NOTHING_TO_DO,
  99.     CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY,
  100.     CAIRO_INT_STATUS_IMAGE_FALLBACK,
  101.     CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN,
  102. };
  103.  
  104. typedef enum _cairo_int_status cairo_int_status_t;
  105.  
  106. #define _cairo_status_is_error(status) \
  107.     (status != CAIRO_STATUS_SUCCESS && status < CAIRO_STATUS_LAST_STATUS)
  108.  
  109. #define _cairo_int_status_is_error(status) \
  110.     (status != CAIRO_INT_STATUS_SUCCESS && status < CAIRO_INT_STATUS_LAST_STATUS)
  111.  
  112. cairo_private cairo_status_t
  113. _cairo_error (cairo_status_t status);
  114.  
  115. /* hide compiler warnings when discarding the return value */
  116. #define _cairo_error_throw(status) do { \
  117.     cairo_status_t status__ = _cairo_error (status); \
  118.     (void) status__; \
  119. } while (0)
  120.  
  121. CAIRO_END_DECLS
  122.  
  123. #endif /* _CAIRO_ERROR_PRIVATE_H_ */
  124.