- Moved roledef_shift to role.c
This commit is contained in:
parent
fe960cfb6a
commit
1791699c01
@ -80,18 +80,6 @@ mgu_iterate (const Termlist tl)
|
||||
return iterate ();
|
||||
}
|
||||
|
||||
//! Yield roledef pointer for a given index
|
||||
Roledef
|
||||
roledef_shift (Roledef rd, int i)
|
||||
{
|
||||
while (i > 0 && rd != NULL)
|
||||
{
|
||||
rd = rd->next;
|
||||
i--;
|
||||
}
|
||||
return rd;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Sub
|
||||
//------------------------------------------------------------------------
|
||||
|
30
src/role.c
30
src/role.c
@ -255,3 +255,33 @@ roledef_iterate_events (Roledef rd, int (*func) ())
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//! Roledef length
|
||||
/**
|
||||
* Would be faster hard-coded,
|
||||
* but this just shows the use of the iteration.
|
||||
*/
|
||||
int
|
||||
roledef_length (const Roledef rd)
|
||||
{
|
||||
int count = 0;
|
||||
int countplus (Roledef rd)
|
||||
{
|
||||
count++;
|
||||
return 1;
|
||||
}
|
||||
roledef_iterate_events (rd, countplus);
|
||||
return count;
|
||||
}
|
||||
|
||||
//! Yield roledef pointer for a given index
|
||||
Roledef
|
||||
roledef_shift (Roledef rd, int i)
|
||||
{
|
||||
while (i > 0 && rd != NULL)
|
||||
{
|
||||
rd = rd->next;
|
||||
i--;
|
||||
}
|
||||
return rd;
|
||||
}
|
||||
|
@ -127,5 +127,7 @@ Role roleCreate (Term nameterm);
|
||||
void rolePrint (Role r);
|
||||
void rolesPrint (Role r);
|
||||
int roledef_iterate_events (Roledef rd, int (*func) ());
|
||||
int roledef_length (const Roledef rd);
|
||||
Roledef roledef_shift (Roledef rd, int i);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user