scpi-parser, adopted from github

Dependents:   scpi_parser_test

Committer:
iesensor
Date:
Fri Nov 14 01:07:59 2014 +0000
Revision:
0:d8aca47812e0
tested on K64F

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iesensor 0:d8aca47812e0 1 /*-
iesensor 0:d8aca47812e0 2 * Copyright (c) 2012-2013 Jan Breuer,
iesensor 0:d8aca47812e0 3 *
iesensor 0:d8aca47812e0 4 * All Rights Reserved
iesensor 0:d8aca47812e0 5 *
iesensor 0:d8aca47812e0 6 * Redistribution and use in source and binary forms, with or without
iesensor 0:d8aca47812e0 7 * modification, are permitted provided that the following conditions are
iesensor 0:d8aca47812e0 8 * met:
iesensor 0:d8aca47812e0 9 * 1. Redistributions of source code must retain the above copyright notice,
iesensor 0:d8aca47812e0 10 * this list of conditions and the following disclaimer.
iesensor 0:d8aca47812e0 11 * 2. Redistributions in binary form must reproduce the above copyright
iesensor 0:d8aca47812e0 12 * notice, this list of conditions and the following disclaimer in the
iesensor 0:d8aca47812e0 13 * documentation and/or other materials provided with the distribution.
iesensor 0:d8aca47812e0 14 *
iesensor 0:d8aca47812e0 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
iesensor 0:d8aca47812e0 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
iesensor 0:d8aca47812e0 17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
iesensor 0:d8aca47812e0 18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
iesensor 0:d8aca47812e0 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
iesensor 0:d8aca47812e0 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
iesensor 0:d8aca47812e0 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
iesensor 0:d8aca47812e0 22 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
iesensor 0:d8aca47812e0 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
iesensor 0:d8aca47812e0 24 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
iesensor 0:d8aca47812e0 25 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
iesensor 0:d8aca47812e0 26 */
iesensor 0:d8aca47812e0 27
iesensor 0:d8aca47812e0 28 /**
iesensor 0:d8aca47812e0 29 * @file config.h
iesensor 0:d8aca47812e0 30 * @date Wed Mar 20 12:21:26 UTC 2013
iesensor 0:d8aca47812e0 31 *
iesensor 0:d8aca47812e0 32 * @brief SCPI Configuration
iesensor 0:d8aca47812e0 33 *
iesensor 0:d8aca47812e0 34 *
iesensor 0:d8aca47812e0 35 */
iesensor 0:d8aca47812e0 36
iesensor 0:d8aca47812e0 37 #ifndef __SCPI_CONFIG_H_
iesensor 0:d8aca47812e0 38 #define __SCPI_CONFIG_H_
iesensor 0:d8aca47812e0 39
iesensor 0:d8aca47812e0 40 #ifdef __cplusplus
iesensor 0:d8aca47812e0 41 extern "C" {
iesensor 0:d8aca47812e0 42 #endif
iesensor 0:d8aca47812e0 43
iesensor 0:d8aca47812e0 44 /* Compiler specific */
iesensor 0:d8aca47812e0 45 /* 8bit PIC - PIC16, etc */
iesensor 0:d8aca47812e0 46 #if defined(_MPC_)
iesensor 0:d8aca47812e0 47 #define HAVE_STRNLEN 0
iesensor 0:d8aca47812e0 48 #define HAVE_STRNCASECMP 0
iesensor 0:d8aca47812e0 49 #define HAVE_STRNICMP 1
iesensor 0:d8aca47812e0 50 #endif
iesensor 0:d8aca47812e0 51
iesensor 0:d8aca47812e0 52 /* PIC24 */
iesensor 0:d8aca47812e0 53 #if defined(__C30__)
iesensor 0:d8aca47812e0 54 #define HAVE_STRNLEN 0
iesensor 0:d8aca47812e0 55 #define HAVE_STRNCASECMP 0
iesensor 0:d8aca47812e0 56 #define HAVE_STRNICMP 0
iesensor 0:d8aca47812e0 57 #endif
iesensor 0:d8aca47812e0 58
iesensor 0:d8aca47812e0 59 /* PIC32mx */
iesensor 0:d8aca47812e0 60 #if defined(__C32__)
iesensor 0:d8aca47812e0 61 #define HAVE_STRNLEN 0
iesensor 0:d8aca47812e0 62 #define HAVE_STRNCASECMP 1
iesensor 0:d8aca47812e0 63 #define HAVE_STRNICMP 0
iesensor 0:d8aca47812e0 64 #endif
iesensor 0:d8aca47812e0 65
iesensor 0:d8aca47812e0 66 /* ======== test strnlen ======== */
iesensor 0:d8aca47812e0 67 #ifndef HAVE_STRNLEN
iesensor 0:d8aca47812e0 68 #define HAVE_STRNLEN 0
iesensor 0:d8aca47812e0 69 #endif
iesensor 0:d8aca47812e0 70 /* ======== test strncasecmp ======== */
iesensor 0:d8aca47812e0 71 #ifndef HAVE_STRNCASECMP
iesensor 0:d8aca47812e0 72 #define HAVE_STRNCASECMP 1
iesensor 0:d8aca47812e0 73 #endif
iesensor 0:d8aca47812e0 74 /* ======== test strnicmp ======== */
iesensor 0:d8aca47812e0 75 #ifndef HAVE_STRNICMP
iesensor 0:d8aca47812e0 76 #define HAVE_STRNICMP 0
iesensor 0:d8aca47812e0 77 #endif
iesensor 0:d8aca47812e0 78
iesensor 0:d8aca47812e0 79 /* define local macros depending on existance of strnlen */
iesensor 0:d8aca47812e0 80 #if HAVE_STRNLEN
iesensor 0:d8aca47812e0 81 #define SCPI_strnlen(s, l) strnlen((s), (l))
iesensor 0:d8aca47812e0 82 #else
iesensor 0:d8aca47812e0 83 #define SCPI_strnlen(s, l) BSD_strnlen((s), (l))
iesensor 0:d8aca47812e0 84 #endif
iesensor 0:d8aca47812e0 85
iesensor 0:d8aca47812e0 86 /* define local macros depending on existance of strncasecmp and strnicmp */
iesensor 0:d8aca47812e0 87 #if HAVE_STRNCASECMP
iesensor 0:d8aca47812e0 88 #define SCPI_strncasecmp(s1, s2, l) strncasecmp((s1), (s2), (l))
iesensor 0:d8aca47812e0 89 #elif HAVE_STRNICMP
iesensor 0:d8aca47812e0 90 #define SCPI_strncasecmp(s1, s2, l) strnicmp((s1), (s2), (l))
iesensor 0:d8aca47812e0 91 #else
iesensor 0:d8aca47812e0 92 #define SCPI_strncasecmp(s1, s2, l) OUR_strncasecmp((s1), (s2), (l))
iesensor 0:d8aca47812e0 93 #endif
iesensor 0:d8aca47812e0 94
iesensor 0:d8aca47812e0 95 #ifdef __cplusplus
iesensor 0:d8aca47812e0 96 }
iesensor 0:d8aca47812e0 97 #endif
iesensor 0:d8aca47812e0 98
iesensor 0:d8aca47812e0 99 #endif