liblscp 0.5.6
|
00001 // parser.h 00002 // 00003 /**************************************************************************** 00004 liblscp - LinuxSampler Control Protocol API 00005 Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License along 00018 with this program; if not, write to the Free Software Foundation, Inc., 00019 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00020 00021 *****************************************************************************/ 00022 00023 #ifndef __LSCP_PARSER_H 00024 #define __LSCP_PARSER_H 00025 00026 #include <stdio.h> 00027 #include <stdlib.h> 00028 #include <string.h> 00029 00030 #if (defined(_WIN32) || defined(__WIN32__)) 00031 #if (!defined(WIN32)) 00032 #define WIN32 00033 #endif 00034 #endif 00035 00036 #if defined(__cplusplus) 00037 extern "C" { 00038 #endif 00039 00040 //------------------------------------------------------------------------- 00041 // Simple token parser. 00042 00043 typedef struct _lscp_parser_t 00044 { 00045 char *pchBuffer; 00046 int cchBuffer; 00047 const char *pszToken; 00048 char *pch; 00049 00050 } lscp_parser_t; 00051 00052 const char *lscp_parser_strtok (char *pchBuffer, const char *pszDelim, char **ppch); 00053 00054 void lscp_parser_init (lscp_parser_t *pParser, const char *pchBuffer, int cchBuffer); 00055 const char *lscp_parser_next (lscp_parser_t *pParser); 00056 int lscp_parser_nextint (lscp_parser_t *pParser); 00057 float lscp_parser_nextnum (lscp_parser_t *pParser); 00058 int lscp_parser_test (lscp_parser_t *pParser, const char *pszToken); 00059 int lscp_parser_test2 (lscp_parser_t *pParser, const char *pszToken, const char *pszToken2); 00060 void lscp_parser_free (lscp_parser_t *pParser); 00061 00062 #if defined(__cplusplus) 00063 } 00064 #endif 00065 00066 #endif // __LSCP_PARSER_H 00067 00068 // end of parser.h