inpcom.c, add function inp_check_scope_mod()
This commit is contained in:
parent
9c2ccfb649
commit
cd2417dd5c
|
|
@ -150,6 +150,7 @@ static char *inp_pathresolve_at(char *name, char *dir);
|
|||
static char *search_plain_identifier(char *str, const char *identifier);
|
||||
void tprint(struct line *deck, int numb);
|
||||
static void inp_add_levels(struct line *deck);
|
||||
bool inp_check_scope_mod(unsigned short elem_level[], unsigned short mod_level[]);
|
||||
|
||||
struct inp_read_t
|
||||
{ struct line *cc;
|
||||
|
|
@ -6775,3 +6776,21 @@ inp_add_levels(struct line *deck)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* return TRUE if element is within scope of model */
|
||||
bool
|
||||
inp_check_scope_mod(unsigned short elem_level[], unsigned short mod_level[])
|
||||
{
|
||||
int i;
|
||||
/* model at top level, accessible from all devices */
|
||||
if (mod_level[0] == 0)
|
||||
return TRUE;
|
||||
/* model at nesting level */
|
||||
for (i = 0; i < NESTINGDEPTH - 1; i++)
|
||||
if ((elem_level[i] > 0) && (elem_level[i] == mod_level[i]) && (mod_level[i + 1] == 0))
|
||||
return TRUE;
|
||||
if ((elem_level[NESTINGDEPTH - 1] > 0) && (elem_level[NESTINGDEPTH - 1] == mod_level[NESTINGDEPTH - 1]))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue