Jan Breuer
2012-12-24 be752f9c9139f8d70d0296c6a9f49003071c8c3c
Reorganize library
1个文件已修改
8个文件已添加
22 文件已重命名
10个文件已删除
1957 ■■■■ 已修改文件
.gitignore 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/common/scpi-def.c 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/common/scpi-def.h 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-interactive/Makefile 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-interactive/main.c 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-parser/Makefile 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-parser/main.c 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-tcp/Makefile 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-tcp/main.c 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/Makefile 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/constants.h 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/debug.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/error.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/fifo.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/ieee488.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/minimal.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/parser.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/scpi.h 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/types.h 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/units.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/debug.c 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/error.c 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/fifo.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/ieee488.c 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/minimal.c 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/parser.c 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/units.c 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/utils.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/utils.h 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/test/test_fifo.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/test/test_scpi_utils.c 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/.dep.inc 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/Makefile 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/nbproject/Makefile-Debug.mk 288 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/nbproject/Makefile-Release.mk 288 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/nbproject/Makefile-impl.mk 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/nbproject/Makefile-variables.mk 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/nbproject/Package-Debug.bash 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/nbproject/Package-Release.bash 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/nbproject/configurations.xml 207 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
netbeans/nbproject/project.xml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -15,10 +15,10 @@
*.exe
*.out
*.app
*.test
# Backup files
*~
/netbeans/nbproject/private/
/netbeans/build/Debug/
/netbeans/dist/Debug/
/netbeans/core
/libscpi/obj/
/libscpi/dist/
examples/common/scpi-def.c
File was renamed from test-parser.c
@@ -26,7 +26,7 @@
 */
/**
 * @file   main.c
 * @file   scpi-def.c
 * @date   Thu Nov 15 10:58:45 UTC 2012
 * 
 * @brief  SCPI parser test
@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <string.h>
#include "scpi/scpi.h"
#include "scpi-def.h"
scpi_result_t DMM_MeasureVoltageDcQ(scpi_t * context) {
    scpi_number_t param1, param2;
@@ -111,30 +112,11 @@
    SCPI_CMD_LIST_END
};
static size_t SCPI_Write(scpi_t * context, const char * data, size_t len) {
    (void) context;
    return fwrite(data, 1, len, stdout);
}
static int SCPI_Error(scpi_t * context, int_fast16_t err) {
    (void) context;
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
    return 0;
}
static scpi_result_t SCPI_Srq(scpi_t * context) {
    scpi_reg_val_t stb = SCPI_RegGet(context, SCPI_REG_STB);
    fprintf(stderr, "**SRQ: 0x%X (%d)\r\n", stb, stb);
    return SCPI_RES_OK;
}
static scpi_interface_t scpi_interface = {
    .write = SCPI_Write,
    .error = SCPI_Error,
    .reset = NULL,
    .test = NULL,
    .reset = SCPI_Reset,
    .test = SCPI_Test,
    .srq = SCPI_Srq,
};
@@ -155,56 +137,3 @@
    .units = scpi_units_def,
    .special_numbers = scpi_special_numbers_def,
};
/*
 *
 */
int main(int argc, char** argv) {
    (void) argc;
    (void) argv;
    int result;
    SCPI_Init(&scpi_context);
#define TEST_SCPI_INPUT(cmd)    result = SCPI_Input(&scpi_context, cmd, strlen(cmd))
    TEST_SCPI_INPUT("*CLS\r\n");
    TEST_SCPI_INPUT("*RST\r\n");
    TEST_SCPI_INPUT("MEAS:volt:DC? 12,50;*OPC\r\n");
    TEST_SCPI_INPUT("*IDN?\r\n");
    TEST_SCPI_INPUT("SYST:VERS?");
    TEST_SCPI_INPUT("\r\n*ID");
    TEST_SCPI_INPUT("N?");
    TEST_SCPI_INPUT(""); // emulate command timeout
    TEST_SCPI_INPUT("*ESE\r\n"); // cause error -109, missing parameter
    TEST_SCPI_INPUT("*ESE 0x20\r\n");
    TEST_SCPI_INPUT("*SRE 0xFF\r\n");
    TEST_SCPI_INPUT("IDN?\r\n"); // cause error -113, undefined header
    TEST_SCPI_INPUT("SYST:ERR?\r\n");
    TEST_SCPI_INPUT("SYST:ERR?\r\n");
    TEST_SCPI_INPUT("*STB?\r\n");
    TEST_SCPI_INPUT("*ESR?\r\n");
    TEST_SCPI_INPUT("*STB?\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? 0.01 V, Default\r\n");
    TEST_SCPI_INPUT("meas:volt:dc?\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? def, 0.00001\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? 0.00001\r\n");
    //printf("%.*s %s\r\n",  3, "asdadasdasdasdas", "b");
    // interactive demo
    //char smbuffer[10];
    //while (1) {
    //     fgets(smbuffer, 10, stdin);
    //     SCPI_Input(&scpi_context, smbuffer, strlen(smbuffer));
    //}
    return (EXIT_SUCCESS);
}
examples/common/scpi-def.h
New file
@@ -0,0 +1,18 @@
#ifndef __SCPI_DEF_H_
#define __SCPI_DEF_H_
#include "scpi/scpi.h"
extern scpi_t scpi_context;
size_t SCPI_Write(scpi_t * context, const char * data, size_t len);
int SCPI_Error(scpi_t * context, int_fast16_t err);
scpi_result_t SCPI_Srq(scpi_t * context);
scpi_result_t SCPI_Reset(scpi_t * context);
scpi_result_t SCPI_Test(scpi_t * context);
#endif // __SCPI_DEF_H_
examples/test-interactive/Makefile
New file
@@ -0,0 +1,20 @@
PROG = test
SRCS = main.c ../common/scpi-def.c
CFLAGS += -Wextra -I ../../libscpi/inc/
LDFLAGS += ../../libscpi/dist/libscpi.a
all: $(PROG)
OBJS = $(SRCS:.c=.o)
.c.o:
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(PROG): $(OBJS)
    $(CC) -o $@ $(OBJS) $(LDFLAGS)
clean:
    $(RM) $(PROG) $(OBJS)
examples/test-interactive/main.c
New file
@@ -0,0 +1,92 @@
/*-
 * Copyright (c) 2012-2013 Jan Breuer,
 *
 * 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 AUTHORS ``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 AUTHORS 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.
 */
/**
 * @file   main.c
 * @date   Thu Nov 15 10:58:45 UTC 2012
 *
 * @brief  SCPI parser test
 *
 *
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "scpi/scpi.h"
#include "../common/scpi-def.h"
size_t SCPI_Write(scpi_t * context, const char * data, size_t len) {
    (void) context;
    return fwrite(data, 1, len, stdout);
}
int SCPI_Error(scpi_t * context, int_fast16_t err) {
    (void) context;
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
    return 0;
}
scpi_result_t SCPI_Srq(scpi_t * context) {
    scpi_reg_val_t stb = SCPI_RegGet(context, SCPI_REG_STB);
    fprintf(stderr, "**SRQ: 0x%X (%d)\r\n", stb, stb);
    return SCPI_RES_OK;
}
scpi_result_t SCPI_Test(scpi_t * context) {
    fprintf(stderr, "**Test\r\n");
    return SCPI_RES_OK;
}
scpi_result_t SCPI_Reset(scpi_t * context) {
    fprintf(stderr, "**Reset\r\n");
    return SCPI_RES_OK;
}
/*
 *
 */
int main(int argc, char** argv) {
    (void) argc;
    (void) argv;
    int result;
    SCPI_Init(&scpi_context);
    //printf("%.*s %s\r\n",  3, "asdadasdasdasdas", "b");
    printf("SCPI Interactive demo\r\n");
    char smbuffer[10];
    while (1) {
         fgets(smbuffer, 10, stdin);
         SCPI_Input(&scpi_context, smbuffer, strlen(smbuffer));
    }
    return (EXIT_SUCCESS);
}
examples/test-parser/Makefile
New file
@@ -0,0 +1,20 @@
PROG = test
SRCS = main.c ../common/scpi-def.c
CFLAGS += -Wextra -I ../../libscpi/inc/
LDFLAGS += ../../libscpi/dist/libscpi.a
all: $(PROG)
OBJS = $(SRCS:.c=.o)
.c.o:
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(PROG): $(OBJS)
    $(CC) -o $@ $(OBJS) $(LDFLAGS)
clean:
    $(RM) $(PROG) $(OBJS)
examples/test-parser/main.c
New file
@@ -0,0 +1,122 @@
/*-
 * Copyright (c) 2012-2013 Jan Breuer,
 *
 * 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 AUTHORS ``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 AUTHORS 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.
 */
/**
 * @file   main.c
 * @date   Thu Nov 15 10:58:45 UTC 2012
 *
 * @brief  SCPI parser test
 *
 *
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "scpi/scpi.h"
#include "../common/scpi-def.h"
size_t SCPI_Write(scpi_t * context, const char * data, size_t len) {
    (void) context;
    return fwrite(data, 1, len, stdout);
}
int SCPI_Error(scpi_t * context, int_fast16_t err) {
    (void) context;
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
    return 0;
}
scpi_result_t SCPI_Srq(scpi_t * context) {
    scpi_reg_val_t stb = SCPI_RegGet(context, SCPI_REG_STB);
    fprintf(stderr, "**SRQ: 0x%X (%d)\r\n", stb, stb);
    return SCPI_RES_OK;
}
scpi_result_t SCPI_Test(scpi_t * context) {
    fprintf(stderr, "**Test\r\n");
    return SCPI_RES_OK;
}
scpi_result_t SCPI_Reset(scpi_t * context) {
    fprintf(stderr, "**Reset\r\n");
    return SCPI_RES_OK;
}
/*
 *
 */
int main(int argc, char** argv) {
    (void) argc;
    (void) argv;
    int result;
    SCPI_Init(&scpi_context);
#define TEST_SCPI_INPUT(cmd)    result = SCPI_Input(&scpi_context, cmd, strlen(cmd))
    TEST_SCPI_INPUT("*CLS\r\n");
    TEST_SCPI_INPUT("*RST\r\n");
    TEST_SCPI_INPUT("MEAS:volt:DC? 12,50;*OPC\r\n");
    TEST_SCPI_INPUT("*IDN?\r\n");
    TEST_SCPI_INPUT("SYST:VERS?");
    TEST_SCPI_INPUT("\r\n*ID");
    TEST_SCPI_INPUT("N?");
    TEST_SCPI_INPUT(""); // emulate command timeout
    TEST_SCPI_INPUT("*ESE\r\n"); // cause error -109, missing parameter
    TEST_SCPI_INPUT("*ESE 0x20\r\n");
    TEST_SCPI_INPUT("*SRE 0xFF\r\n");
    TEST_SCPI_INPUT("IDN?\r\n"); // cause error -113, undefined header
    TEST_SCPI_INPUT("SYST:ERR?\r\n");
    TEST_SCPI_INPUT("SYST:ERR?\r\n");
    TEST_SCPI_INPUT("*STB?\r\n");
    TEST_SCPI_INPUT("*ESR?\r\n");
    TEST_SCPI_INPUT("*STB?\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? 0.01 V, Default\r\n");
    TEST_SCPI_INPUT("meas:volt:dc?\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? def, 0.00001\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? 0.00001\r\n");
    //printf("%.*s %s\r\n",  3, "asdadasdasdasdas", "b");
    // interactive demo
    //char smbuffer[10];
    //while (1) {
    //     fgets(smbuffer, 10, stdin);
    //     SCPI_Input(&scpi_context, smbuffer, strlen(smbuffer));
    //}
    return (EXIT_SUCCESS);
}
examples/test-tcp/Makefile
New file
@@ -0,0 +1,20 @@
PROG = test
SRCS = main.c ../common/scpi-def.c
CFLAGS += -Wextra -I ../../libscpi/inc/
LDFLAGS += ../../libscpi/dist/libscpi.a
all: $(PROG)
OBJS = $(SRCS:.c=.o)
.c.o:
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(PROG): $(OBJS)
    $(CC) -o $@ $(OBJS) $(LDFLAGS)
clean:
    $(RM) $(PROG) $(OBJS)
examples/test-tcp/main.c
New file
@@ -0,0 +1,122 @@
/*-
 * Copyright (c) 2012-2013 Jan Breuer,
 *
 * 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 AUTHORS ``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 AUTHORS 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.
 */
/**
 * @file   main.c
 * @date   Thu Nov 15 10:58:45 UTC 2012
 *
 * @brief  SCPI parser test
 *
 *
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "scpi/scpi.h"
#include "../common/scpi-def.h"
size_t SCPI_Write(scpi_t * context, const char * data, size_t len) {
    (void) context;
    return fwrite(data, 1, len, stdout);
}
int SCPI_Error(scpi_t * context, int_fast16_t err) {
    (void) context;
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
    return 0;
}
scpi_result_t SCPI_Srq(scpi_t * context) {
    scpi_reg_val_t stb = SCPI_RegGet(context, SCPI_REG_STB);
    fprintf(stderr, "**SRQ: 0x%X (%d)\r\n", stb, stb);
    return SCPI_RES_OK;
}
scpi_result_t SCPI_Test(scpi_t * context) {
    fprintf(stderr, "**Test\r\n");
    return SCPI_RES_OK;
}
scpi_result_t SCPI_Reset(scpi_t * context) {
    fprintf(stderr, "**Reset\r\n");
    return SCPI_RES_OK;
}
/*
 *
 */
int main(int argc, char** argv) {
    (void) argc;
    (void) argv;
    int result;
    SCPI_Init(&scpi_context);
#define TEST_SCPI_INPUT(cmd)    result = SCPI_Input(&scpi_context, cmd, strlen(cmd))
    TEST_SCPI_INPUT("*CLS\r\n");
    TEST_SCPI_INPUT("*RST\r\n");
    TEST_SCPI_INPUT("MEAS:volt:DC? 12,50;*OPC\r\n");
    TEST_SCPI_INPUT("*IDN?\r\n");
    TEST_SCPI_INPUT("SYST:VERS?");
    TEST_SCPI_INPUT("\r\n*ID");
    TEST_SCPI_INPUT("N?");
    TEST_SCPI_INPUT(""); // emulate command timeout
    TEST_SCPI_INPUT("*ESE\r\n"); // cause error -109, missing parameter
    TEST_SCPI_INPUT("*ESE 0x20\r\n");
    TEST_SCPI_INPUT("*SRE 0xFF\r\n");
    TEST_SCPI_INPUT("IDN?\r\n"); // cause error -113, undefined header
    TEST_SCPI_INPUT("SYST:ERR?\r\n");
    TEST_SCPI_INPUT("SYST:ERR?\r\n");
    TEST_SCPI_INPUT("*STB?\r\n");
    TEST_SCPI_INPUT("*ESR?\r\n");
    TEST_SCPI_INPUT("*STB?\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? 0.01 V, Default\r\n");
    TEST_SCPI_INPUT("meas:volt:dc?\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? def, 0.00001\r\n");
    TEST_SCPI_INPUT("meas:volt:dc? 0.00001\r\n");
    //printf("%.*s %s\r\n",  3, "asdadasdasdasdas", "b");
    // interactive demo
    //char smbuffer[10];
    //while (1) {
    //     fgets(smbuffer, 10, stdin);
    //     SCPI_Input(&scpi_context, smbuffer, strlen(smbuffer));
    //}
    return (EXIT_SUCCESS);
}
libscpi/Makefile
New file
@@ -0,0 +1,89 @@
VERSION = 0.3.0
LIBNAME = scpi
CFLAGS += -Wextra -O1 -g -fPIC -Iinc
LDFLAGS += -Wl,--as-needed
TESTFLAGS += -lcunit
OBJDIR=obj
DISTDIR=dist
TESTDIR=test
STATICLIBFLAGS = rcs
SHAREDLIBFLAGS = $(LDFLAGS) -shared -Wl,-soname
STATICLIB = lib$(LIBNAME).a
SHAREDLIB = lib$(LIBNAME).so
SHAREDLIBVER = $(SHAREDLIB).$(VERSION)
SRCS = $(addprefix src/, \
    debug.c error.c fifo.c ieee488.c \
    minimal.c parser.c units.c utils.c \
    )
OBJS = $(addprefix $(OBJDIR)/, $(notdir $(SRCS:.c=.o)))
HDRS = $(addprefix inc/scpi/, \
    scpi.h constants.h debug.h error.h \
    fifo.h ieee488.h minimal.h parser.h \
    types.h units.h \
    ) src/utils.h
TESTS = $(addprefix test/, \
    test_fifo.c test_scpi_utils.c \
    )
TESTS_OBJS = $(TESTS:.c=.o)
TESTS_BINS = $(TESTS_OBJS:.o=.test)
.PHONY: all clean static shared test
all: static shared
$(OBJDIR):
    mkdir -p $@
$(DISTDIR):
    mkdir -p $@
$(OBJDIR)/%.o: src/%.c
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(DISTDIR)/$(STATICLIB): $(OBJS)
    $(AR) $(STATICLIBFLAGS) $(DISTDIR)/$(STATICLIB) $(OBJS)
$(DISTDIR)/$(SHAREDLIBVER): $(OBJS)
    $(CC) $(SHAREDLIBFLAGS),$(SHAREDLIB) -o $(DISTDIR)/$(SHAREDLIBVER) $(OBJS)
$(DISTDIR)/$(SHAREDLIB): $(DISTDIR)/$(SHAREDLIBVER)
    ln -s $(SHAREDLIBVER) $(DISTDIR)/$(SHAREDLIB)
static: $(DISTDIR)/$(STATICLIB)
shared: $(DISTDIR)/$(SHAREDLIB)
$(OBJS): $(HDRS) $(DISTDIR) $(OBJDIR)
clean:
    $(RM) -r $(OBJDIR) $(DISTDIR) $(TESTS_BINS) $(TESTS_OBJS)
test: static $(TESTS_BINS)
    for t in $(TESTS_BINS); do ./$$t; done
$(TESTDIR)/%.o: $(TESTDIR)/%.c
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(TESTDIR)/%.test: $(TESTDIR)/%.o
    $(CC) $(TESTFLAGS) $< $(DISTDIR)/$(STATICLIB) -o $@ $(LDFLAGS)
libscpi/inc/scpi/constants.h
libscpi/inc/scpi/debug.h
File was renamed from scpi/scpi_debug.h
@@ -37,7 +37,7 @@
#ifndef SCPI_DEBUG_H
#define    SCPI_DEBUG_H
#include "scpi_types.h"
#include "scpi/types.h"
#ifdef    __cplusplus
extern "C" {
libscpi/inc/scpi/error.h
File was renamed from scpi/scpi_error.h
@@ -37,7 +37,7 @@
#ifndef SCPI_ERROR_H
#define    SCPI_ERROR_H
#include "scpi_types.h"
#include "scpi/types.h"
#ifdef    __cplusplus
extern "C" {
libscpi/inc/scpi/fifo.h
File was renamed from scpi/scpi_fifo.h
@@ -37,7 +37,7 @@
#ifndef SCPI_FIFO_H
#define    SCPI_FIFO_H
#include "scpi_types.h"
#include "scpi/types.h"
#ifdef    __cplusplus
extern "C" {
libscpi/inc/scpi/ieee488.h
File was renamed from scpi/scpi_ieee488.h
@@ -37,7 +37,7 @@
#ifndef SCPI_IEEE488_H
#define    SCPI_IEEE488_H
#include "scpi_types.h"
#include "scpi/types.h"
scpi_result_t SCPI_CoreCls(scpi_t * context);
scpi_result_t SCPI_CoreEse(scpi_t * context);
libscpi/inc/scpi/minimal.h
File was renamed from scpi/scpi_minimal.h
@@ -37,7 +37,7 @@
#ifndef SCPI_MINIMAL_H
#define    SCPI_MINIMAL_H
#include "scpi_types.h"
#include "scpi/types.h"
#ifdef    __cplusplus
extern "C" {
libscpi/inc/scpi/parser.h
File was renamed from scpi/scpi_parser.h
@@ -37,8 +37,8 @@
#ifndef SCPI_PARSER_H
#define    SCPI_PARSER_H
#include "scpi_types.h"
#include "scpi_debug.h"
#include "scpi/types.h"
#include "scpi/debug.h"
#ifdef    __cplusplus
extern "C" {
libscpi/inc/scpi/scpi.h
File was renamed from scpi/scpi.h
@@ -37,13 +37,12 @@
#ifndef SCPI_H
#define    SCPI_H
#include "scpi_parser.h"
#include "scpi_ieee488.h"
#include "scpi_error.h"
#include "scpi_constants.h"
#include "scpi_minimal.h"
#include "scpi_utils.h"
#include "scpi_units.h"
#include "scpi/parser.h"
#include "scpi/ieee488.h"
#include "scpi/error.h"
#include "scpi/constants.h"
#include "scpi/minimal.h"
#include "scpi/units.h"
libscpi/inc/scpi/types.h
libscpi/inc/scpi/units.h
File was renamed from scpi/scpi_units.h
@@ -37,7 +37,7 @@
#ifndef SCPI_UNITS_H
#define    SCPI_UNITS_H
#include "scpi_types.h"
#include "scpi/types.h"
#ifdef    __cplusplus
extern "C" {
libscpi/src/debug.c
File was renamed from scpi/scpi_debug.c
@@ -35,7 +35,7 @@
 */
#include <stdio.h>
#include "scpi_debug.h"
#include "scpi/debug.h"
/**
 * Debug function: show current command and its parameters
@@ -43,8 +43,10 @@
 * @return 
 */
bool_t SCPI_DebugCommand(scpi_t * context) {
    size_t res;
    printf("**DEBUG: %s (\"", context->paramlist.cmd->pattern);
    fwrite(context->paramlist.parameters, 1, context->paramlist.length, stdout);
    res = fwrite(context->paramlist.parameters, 1, context->paramlist.length, stdout);
    (void)res;
    printf("\" - %ld)\r\n", context->paramlist.length);
    
    return TRUE;
libscpi/src/error.c
File was renamed from scpi/scpi_error.c
@@ -36,10 +36,10 @@
#include <stdint.h>
#include "scpi_parser.h"
#include "scpi_ieee488.h"
#include "scpi_error.h"
#include "scpi_fifo.h"
#include "scpi/parser.h"
#include "scpi/ieee488.h"
#include "scpi/error.h"
#include "scpi/fifo.h"
// basic FIFO
static fifo_t local_error_queue;
libscpi/src/fifo.c
File was renamed from scpi/scpi_fifo.c
@@ -1,5 +1,5 @@
#include "scpi_fifo.h"
#include "scpi/fifo.h"
void fifo_init(fifo_t * fifo) {
    fifo->wr = 0;
libscpi/src/ieee488.c
File was renamed from scpi/scpi_ieee488.c
@@ -34,10 +34,10 @@
 * 
 */
#include "scpi_parser.h"
#include "scpi_ieee488.h"
#include "scpi_error.h"
#include "scpi_constants.h"
#include "scpi/parser.h"
#include "scpi/ieee488.h"
#include "scpi/error.h"
#include "scpi/constants.h"
/**
 * Update register value
libscpi/src/minimal.c
File was renamed from scpi/scpi_minimal.c
@@ -35,11 +35,11 @@
 */
#include "scpi_parser.h"
#include "scpi_minimal.h"
#include "scpi_constants.h"
#include "scpi_error.h"
#include "scpi_ieee488.h"
#include "scpi/parser.h"
#include "scpi/minimal.h"
#include "scpi/constants.h"
#include "scpi/error.h"
#include "scpi/ieee488.h"
/**
 * Command stub function
libscpi/src/parser.c
File was renamed from scpi/scpi_parser.c
@@ -37,9 +37,9 @@
#include <ctype.h>
#include <string.h>
#include "scpi_parser.h"
#include "scpi_utils.h"
#include "scpi_error.h"
#include "scpi/parser.h"
#include "utils.h"
#include "scpi/error.h"
static size_t patternSeparatorPos(const char * pattern, size_t len);
libscpi/src/units.c
File was renamed from scpi/scpi_units.c
@@ -35,10 +35,10 @@
 */
#include <string.h>
#include "scpi_parser.h"
#include "scpi_units.h"
#include "scpi_utils.h"
#include "scpi_error.h"
#include "scpi/parser.h"
#include "scpi/units.h"
#include "utils.h"
#include "scpi/error.h"
/*
libscpi/src/utils.c
File was renamed from scpi/scpi_utils.c
@@ -39,7 +39,7 @@
#include <string.h>
#include <ctype.h>
#include "scpi_utils.h"
#include "utils.h"
static size_t patternSeparatorShortPos(const char * pattern, size_t len);
libscpi/src/utils.h
File was renamed from scpi/scpi_utils.h
@@ -38,22 +38,24 @@
#define    SCPI_UTILS_H
#include <stdint.h>
#include "scpi_types.h"
#include "scpi/types.h"
#ifdef    __cplusplus
extern "C" {
#endif
    char * strnpbrk(const char *str, size_t size, const char *set);
    bool_t compareStr(const char * str1, size_t len1, const char * str2, size_t len2);
    size_t longToStr(int32_t val, char * str, size_t len);
    size_t doubleToStr(double val, char * str, size_t len);
    size_t strToLong(const char * str, int32_t * val);
    size_t strToDouble(const char * str, double * val);
    bool_t locateText(const char * str1, size_t len1, char ** str2, size_t * len2);
    bool_t locateStr(const char * str1, size_t len1, char ** str2, size_t * len2);
    size_t skipWhitespace(const char * cmd, size_t len);
    bool_t matchPattern(const char * pattern, size_t pattern_len, const char * str, size_t str_len);
    #define LOCAL __attribute__((visibility ("hidden")))
    char * strnpbrk(const char *str, size_t size, const char *set) LOCAL;
    bool_t compareStr(const char * str1, size_t len1, const char * str2, size_t len2) LOCAL;
    size_t longToStr(int32_t val, char * str, size_t len) LOCAL;
    size_t doubleToStr(double val, char * str, size_t len) LOCAL;
    size_t strToLong(const char * str, int32_t * val) LOCAL;
    size_t strToDouble(const char * str, double * val) LOCAL;
    bool_t locateText(const char * str1, size_t len1, char ** str2, size_t * len2) LOCAL;
    bool_t locateStr(const char * str1, size_t len1, char ** str2, size_t * len2) LOCAL;
    size_t skipWhitespace(const char * cmd, size_t len) LOCAL;
    bool_t matchPattern(const char * pattern, size_t pattern_len, const char * str, size_t str_len) LOCAL;
#define max(a,b) \
libscpi/test/test_fifo.c
File was renamed from netbeans/tests/test_fifo.c
@@ -9,7 +9,7 @@
#include <stdlib.h>
#include "CUnit/Basic.h"
#include "../scpi/scpi_fifo.h"
#include "scpi/fifo.h"
/*
 * CUnit Test Suite
libscpi/test/test_scpi_utils.c
File was renamed from netbeans/tests/test_scpi_utils.c
@@ -9,7 +9,8 @@
#include <stdlib.h>
#include "CUnit/Basic.h"
#include "../scpi/scpi.h"
#include "scpi/scpi.h"
#include "../src/utils.h"
/*
 * CUnit Test Suite
netbeans/.dep.inc
File was deleted
netbeans/Makefile
File was deleted
netbeans/nbproject/Makefile-Debug.mk
File was deleted
netbeans/nbproject/Makefile-Release.mk
File was deleted
netbeans/nbproject/Makefile-impl.mk
File was deleted
netbeans/nbproject/Makefile-variables.mk
File was deleted
netbeans/nbproject/Package-Debug.bash
File was deleted
netbeans/nbproject/Package-Release.bash
File was deleted
netbeans/nbproject/configurations.xml
File was deleted
netbeans/nbproject/project.xml
File was deleted