static update_end(gk_string *Have, gk_string *Avoid, char *stem, char *endstr, char *newkeys) { char savestem[MAXWORDSIZE]; strcpy(savestem,stem); /* * at this point check to see if you want this ending * if( merge_keys(endkeys,newendline) ) * mk_end() * else * go back */ if( merge_keys(Have,Avoid,savestem,endstr,newkeys) ) { set_gkstring(Have,savestem); /* * this should be put somewhere else ... */ CompStemEnd(Have,gkstring_of(Have),endstr); strcat(gkstring_of(Have),endstr); mk_end(gkstring_of(Have),Have,Avoid); } }
/** * returns -1 if o is greater * returns 0 may be identical, or may not be * returns 1 if o is less */ int compare(const vclock& o) const { bool l = false; bool g = false; auto keys = merge_keys(get_keys(_c), get_keys(o._c)); for(const auto& k : keys) { auto lvi = _c.find(k); auto rvi = o._c.find(k); size_t lv = lvi != std::end(_c) ? lvi->second : 0; size_t rv = rvi != std::end(o._c) ? rvi->second : 0; auto diff = static_cast<ptrdiff_t>(lv) - static_cast<ptrdiff_t>(rv); if(diff > 0) g = true; if(diff < 0) l = true; } if(l && g) return 0; if(l) return -1; if(g) return 1; return 0; }