1个文件已修改
8个文件已添加
22 文件已重命名
10个文件已删除
| | |
| | | *.exe |
| | | *.out |
| | | *.app |
| | | *.test |
| | | |
| | | # Backup files |
| | | *~ |
| | | /netbeans/nbproject/private/ |
| | | /netbeans/build/Debug/ |
| | | /netbeans/dist/Debug/ |
| | | /netbeans/core |
| | | /libscpi/obj/ |
| | | /libscpi/dist/ |
| | | |
File was renamed from test-parser.c |
| | |
| | | */ |
| | | |
| | | /** |
| | | * @file main.c |
| | | * @file scpi-def.c |
| | | * @date Thu Nov 15 10:58:45 UTC 2012 |
| | | * |
| | | * @brief SCPI parser test |
| | |
| | | #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; |
| | |
| | | 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, |
| | | }; |
| | | |
| | |
| | | .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); |
| | | } |
| | | |
New file |
| | |
| | | #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_ |
| | | |
New file |
| | |
| | | |
| | | 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) |
New file |
| | |
| | | /*- |
| | | * 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); |
| | | } |
| | | |
New file |
| | |
| | | |
| | | 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) |
New file |
| | |
| | | /*- |
| | | * 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); |
| | | } |
| | | |
New file |
| | |
| | | |
| | | 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) |
New file |
| | |
| | | /*- |
| | | * 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); |
| | | } |
| | | |
New file |
| | |
| | | |
| | | 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) |
| | | |
| | | |
| | | |
File was renamed from scpi/scpi_debug.h |
| | |
| | | #ifndef SCPI_DEBUG_H |
| | | #define SCPI_DEBUG_H |
| | | |
| | | #include "scpi_types.h" |
| | | #include "scpi/types.h" |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
File was renamed from scpi/scpi_error.h |
| | |
| | | #ifndef SCPI_ERROR_H |
| | | #define SCPI_ERROR_H |
| | | |
| | | #include "scpi_types.h" |
| | | #include "scpi/types.h" |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
File was renamed from scpi/scpi_fifo.h |
| | |
| | | #ifndef SCPI_FIFO_H |
| | | #define SCPI_FIFO_H |
| | | |
| | | #include "scpi_types.h" |
| | | #include "scpi/types.h" |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
File was renamed from scpi/scpi_ieee488.h |
| | |
| | | #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); |
File was renamed from scpi/scpi_minimal.h |
| | |
| | | #ifndef SCPI_MINIMAL_H |
| | | #define SCPI_MINIMAL_H |
| | | |
| | | #include "scpi_types.h" |
| | | #include "scpi/types.h" |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
File was renamed from scpi/scpi_parser.h |
| | |
| | | #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" { |
File was renamed from scpi/scpi.h |
| | |
| | | #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" |
| | | |
| | | |
| | | |
File was renamed from scpi/scpi_units.h |
| | |
| | | #ifndef SCPI_UNITS_H |
| | | #define SCPI_UNITS_H |
| | | |
| | | #include "scpi_types.h" |
| | | #include "scpi/types.h" |
| | | |
| | | #ifdef __cplusplus |
| | | extern "C" { |
File was renamed from scpi/scpi_debug.c |
| | |
| | | */ |
| | | |
| | | #include <stdio.h> |
| | | #include "scpi_debug.h" |
| | | #include "scpi/debug.h" |
| | | |
| | | /** |
| | | * Debug function: show current command and its parameters |
| | |
| | | * @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; |
File was renamed from scpi/scpi_error.c |
| | |
| | | |
| | | #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; |
File was renamed from scpi/scpi_fifo.c |
| | |
| | | |
| | | #include "scpi_fifo.h" |
| | | #include "scpi/fifo.h" |
| | | |
| | | void fifo_init(fifo_t * fifo) { |
| | | fifo->wr = 0; |
File was renamed from scpi/scpi_ieee488.c |
| | |
| | | * |
| | | */ |
| | | |
| | | #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 |
File was renamed from scpi/scpi_minimal.c |
| | |
| | | */ |
| | | |
| | | |
| | | #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 |
File was renamed from scpi/scpi_parser.c |
| | |
| | | #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); |
File was renamed from scpi/scpi_units.c |
| | |
| | | */ |
| | | |
| | | #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" |
| | | |
| | | |
| | | /* |
File was renamed from scpi/scpi_utils.c |
| | |
| | | #include <string.h> |
| | | #include <ctype.h> |
| | | |
| | | #include "scpi_utils.h" |
| | | #include "utils.h" |
| | | |
| | | static size_t patternSeparatorShortPos(const char * pattern, size_t len); |
| | | |
File was renamed from scpi/scpi_utils.h |
| | |
| | | #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) \ |
File was renamed from netbeans/tests/test_fifo.c |
| | |
| | | #include <stdlib.h> |
| | | #include "CUnit/Basic.h" |
| | | |
| | | #include "../scpi/scpi_fifo.h" |
| | | #include "scpi/fifo.h" |
| | | |
| | | /* |
| | | * CUnit Test Suite |
File was renamed from netbeans/tests/test_scpi_utils.c |
| | |
| | | #include <stdlib.h> |
| | | #include "CUnit/Basic.h" |
| | | |
| | | #include "../scpi/scpi.h" |
| | | #include "scpi/scpi.h" |
| | | #include "../src/utils.h" |
| | | |
| | | /* |
| | | * CUnit Test Suite |