Skip to content

Commit 4248945

Browse files
committed
COMMON: Unitfy HASH and UDS
1 parent 9ac0382 commit 4248945

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

src/common/scan.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ bid_t comp_var_getID(const char *var_name) {
642642
comp_prepare_name(tmp, baseof(var_name, '/'), SB_KEYWORD_SIZE);
643643

644644
char *dot = strchr(tmp, '.');
645-
if (dot != 0 && *(dot + 1) == 0) {
645+
if (dot != NULL && *(dot + 1) == 0) {
646646
// name ends with dot
647647
sc_raise(MSG_MEMBER_DOES_NOT_EXISTS, tmp);
648648
return 0;
@@ -654,7 +654,7 @@ bid_t comp_var_getID(const char *var_name) {
654654
//
655655
// If the name is not found in comp_libtable then it
656656
// is treated as a structure reference
657-
if (dot != 0 && comp_check_lib(tmp)) {
657+
if (dot != NULL && comp_check_lib(tmp)) {
658658
for (i = 0; i < comp_varcount; i++) {
659659
if (strcmp(comp_vartable[i].name, tmp) == 0) {
660660
return i;
@@ -709,7 +709,7 @@ bid_t comp_var_getID(const char *var_name) {
709709
void comp_add_variable(bc_t *bc, const char *var_name) {
710710
char *dot = strchr(var_name, '.');
711711

712-
if (dot != 0 && !comp_check_lib(var_name)) {
712+
if (dot != NULL && !comp_check_lib(var_name)) {
713713
// uds-element (or sub-element eg foo.x.y.z)
714714
// record the uds-parent
715715

@@ -4038,7 +4038,13 @@ int comp_pass1(const char *section, const char *text) {
40384038
for (i = 0; i < comp_udpcount; i++) {
40394039
if (comp_udptable[i].ip == INVALID_ADDR) {
40404040
comp_line = comp_udptable[i].pline;
4041-
sc_raise(MSG_UNDEFINED_UDP, comp_udptable[i].name);
4041+
char *dot = strchr(comp_udptable[i].name, '.');
4042+
if (dot) {
4043+
sc_raise(MSG_UNDEFINED_HASH, comp_udptable[i].name);
4044+
} else {
4045+
sc_raise(MSG_UNDEFINED_UDP, comp_udptable[i].name);
4046+
}
4047+
break;
40424048
}
40434049
}
40444050
}

src/common/var.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@
7272
extern "C" {
7373
#endif
7474

75-
// the following prototype is declared later below
76-
typedef struct uds_field_s uds_field_s;
77-
7875
/**
7976
* @ingroup var
8077
* @typedef var_s
@@ -96,9 +93,6 @@ struct var_s {
9693
addr_t v; /** return-var ID */
9794
} ap;
9895

99-
// user defined structure
100-
uds_field_s *uds; /** pointer to the "structure" */
101-
10296
// hash map
10397
void* hash; /** pointer the hash structure */
10498

@@ -123,16 +117,6 @@ struct var_s {
123117
typedef struct var_s var_t;
124118
typedef var_t *var_p_t;
125119

126-
/*
127-
* user defined structures
128-
*/
129-
struct uds_field_s {
130-
uds_field_s *next; // next structure element
131-
addr_t field_id; // the element id
132-
var_p_t var; // the variable
133-
byte var_owner_flag; // whether var is owned by this node
134-
};
135-
136120
/*
137121
* label
138122
*/

src/languages/messages.en.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
#define MSG_PASS1 "Pass1...\n"
104104
#define MSG_PASS1_COUNT "\rPASS1: Line %d"
105105
#define MSG_UNDEFINED_UDP "Undefined SUB/FUNC code: %s"
106+
#define MSG_UNDEFINED_HASH "Undefined HASH: %s, (Use DIM)"
106107
#define MSG_PASS1_FIN "\rPASS1: Line %d; finished\n"
107108
#define MSG_EXP_SYM_NOT_FOUND "Export symbol '%s' not found"
108109
#define MSG_PASS2 "PASS2..."

0 commit comments

Comments
 (0)