Skip to content

Commit

Permalink
Remove dependency of parser.c to units.h
Browse files Browse the repository at this point in the history
Move definition of scpi_bool_def to parser.c/.h
  • Loading branch information
j123b567 committed Aug 6, 2017
1 parent a10c464 commit 3cf1b42
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions libscpi/inc/scpi/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ extern "C" {
scpi_bool_t SCPI_ParamArbitraryBlock(scpi_t * context, const char ** value, size_t * len, scpi_bool_t mandatory);
scpi_bool_t SCPI_ParamCopyText(scpi_t * context, char * buffer, size_t buffer_len, size_t * copy_len, scpi_bool_t mandatory);

extern const scpi_choice_def_t scpi_bool_def[];
scpi_bool_t SCPI_ParamBool(scpi_t * context, scpi_bool_t * value, scpi_bool_t mandatory);
scpi_bool_t SCPI_ParamChoice(scpi_t * context, const scpi_choice_def_t * options, int32_t * value, scpi_bool_t mandatory);

Expand Down
1 change: 0 additions & 1 deletion libscpi/inc/scpi/units.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ extern "C" {

extern const scpi_unit_def_t scpi_units_def[];
extern const scpi_choice_def_t scpi_special_numbers_def[];
extern const scpi_choice_def_t scpi_bool_def[];

scpi_bool_t SCPI_ParamNumber(scpi_t * context, const scpi_choice_def_t * special, scpi_number_t * value, scpi_bool_t mandatory);

Expand Down
10 changes: 9 additions & 1 deletion libscpi/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "scpi/error.h"
#include "scpi/constants.h"
#include "scpi/utils.h"
#include "scpi/units.h"

/**
* Write data to SCPI output
Expand Down Expand Up @@ -1271,6 +1270,15 @@ scpi_bool_t SCPI_ChoiceToName(const scpi_choice_def_t * options, int32_t tag, co
return FALSE;
}

/*
* Definition of BOOL choice list
*/
const scpi_choice_def_t scpi_bool_def[] = {
{"OFF", 0},
{"ON", 1},
SCPI_CHOICE_LIST_END /* termination of option list */
};

/**
* Read BOOL parameter (0,1,ON,OFF)
* @param context
Expand Down
9 changes: 0 additions & 9 deletions libscpi/src/units.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,6 @@ const scpi_choice_def_t scpi_special_numbers_def[] = {
SCPI_CHOICE_LIST_END,
};

/*
* Special number values definition
*/
const scpi_choice_def_t scpi_bool_def[] = {
{"OFF", 0},
{"ON", 1},
SCPI_CHOICE_LIST_END /* termination of option list */
};

/**
* Convert string describing unit to its representation
* @param units units patterns
Expand Down

0 comments on commit 3cf1b42

Please sign in to comment.