ucx/ucx/ucx.h

Thu, 21 Dec 2017 19:48:27 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 21 Dec 2017 19:48:27 +0100
changeset 359
bacb54502b24
parent 335
c1bc13faadaa
child 505
481802342fdf
permissions
-rw-r--r--

davql: allow ANYWHERE keyword in SELECT statements

This may seem pointless, but users might want to be explicit about this and the grammar is more consistent.

This commit also adds some no-ops to the functions body of the SET parser, because some day the grammar might allow more clauses after the WHERE clause.

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2017 Mike Becker, Olaf Wintermann All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
/**
 * Main UCX Header providing most common definitions.
 * 
 * @file   ucx.h
 * @author Mike Becker
 * @author Olaf Wintermann
 */

#ifndef UCX_H
#define	UCX_H

/** Major UCX version as integer constant. */
#define UCX_VERSION_MAJOR   1

/** Minor UCX version as integer constant. */
#define UCX_VERSION_MINOR   0

/** Version constant which ensures to increase monotonically. */
#define UCX_VERSION (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)

#include <stdlib.h>
#include <stdint.h>

#ifdef _WIN32
#if !(defined __ssize_t_defined || defined _SSIZE_T_)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#define __ssize_t_defined
#define _SSIZE_T_
#endif /* __ssize_t_defined and _SSIZE_T */
#else /* !_WIN32 */
#include <sys/types.h>
#endif /* _WIN32 */

#ifdef	__cplusplus
extern "C" {
#endif
    

/**
 * A function pointer to a destructor function.
 * @see ucx_mempool_setdestr()
 * @see ucx_mempool_regdestr()
 */
typedef void(*ucx_destructor)(void*);

/**
 * Function pointer to a compare function.
 * 
 * The compare function shall take three arguments: the two values that shall be
 * compared and optional additional data.
 * The function shall then return -1 if the first argument is less than the
 * second argument, 1 if the first argument is greater than the second argument
 * and 0 if both arguments are equal. If the third argument is
 * <code>NULL</code>, it shall be ignored.
 */
typedef int(*cmp_func)(const void*,const void*,void*);

/**
 * Function pointer to a distance function.
 * 
 * The distance function shall take three arguments: the two values for which
 * the distance shall be computed and optional additional data.
 * The function shall then return the signed distance as integer value.
 */
typedef intmax_t(*distance_func)(const void*,const void*,void*);

/**
 * Function pointer to a copy function.
 * 
 * The copy function shall create a copy of the first argument and may use
 * additional data provided by the second argument. If the second argument is
 * <code>NULL</code>, it shall be ignored.

 * <b>Attention:</b> if pointers returned by functions of this type may be
 * passed to <code>free()</code> depends on the implementation of the
 * respective <code>copy_func</code>.
 */
typedef void*(*copy_func)(const void*,void*);

/**
 * Function pointer to a write function.
 * 
 * The signature of the write function shall be compatible to the signature
 * of standard <code>fwrite</code>, though it may use arbitrary data types for
 * source and destination.
 * 
 * The arguments shall contain (in ascending order): a pointer to the source,
 * the length of one element, the element count and a pointer to the
 * destination.
 */
typedef size_t(*write_func)(const void*, size_t, size_t, void*);

/**
 * Function pointer to a read function.
 * 
 * The signature of the read function shall be compatible to the signature
 * of standard <code>fread</code>, though it may use arbitrary data types for
 * source and destination.
 * 
 * The arguments shall contain (in ascending order): a pointer to the
 * destination, the length of one element, the element count and a pointer to
 * the source.
 */
typedef size_t(*read_func)(void*, size_t, size_t, void*);

#ifdef	__cplusplus
}
#endif

#endif	/* UCX_H */

mercurial