Lines Matching refs:fr

1559 static inline mcp_funcgen_t *_mcp_funcgen_route_fallback(struct mcp_funcgen_router *fr, int cmd) {  in _mcp_funcgen_route_fallback()  argument
1560 if (fr->cmap[cmd]) { in _mcp_funcgen_route_fallback()
1561 return fr->cmap[cmd]; in _mcp_funcgen_route_fallback()
1563 return fr->def_fgen; in _mcp_funcgen_route_fallback()
1567 struct mcp_funcgen_router *fr = (struct mcp_funcgen_router *)fgen; in mcp_funcgen_route() local
1574 switch(fr->type) { in mcp_funcgen_route()
1579 return _mcp_funcgen_route_fallback(fr, pr->command); in mcp_funcgen_route()
1582 lookup = _mcp_router_shortsep(key, pr->klen, fr->conf.sep, &lookuplen); in mcp_funcgen_route()
1585 lookup = _mcp_router_longsep(key, pr->klen, fr->conf.lsep, &lookuplen); in mcp_funcgen_route()
1588 lookup = _mcp_router_anchorsm(key, pr->klen, fr->conf.anchorsm, &lookuplen); in mcp_funcgen_route()
1591 lookup = _mcp_router_anchorbig(key, pr->klen, &fr->conf.big, &lookuplen); in mcp_funcgen_route()
1596 return _mcp_funcgen_route_fallback(fr, pr->command); in mcp_funcgen_route()
1602 lua_rawgeti(L, LUA_REGISTRYINDEX, fr->map_ref); in mcp_funcgen_route()
1607 return _mcp_funcgen_route_fallback(fr, pr->command); in mcp_funcgen_route()
1623 return _mcp_funcgen_route_fallback(fr, pr->command); in mcp_funcgen_route()
1634 return _mcp_funcgen_route_fallback(fr, pr->command); in mcp_funcgen_route()
1641 struct mcp_funcgen_router *fr = (struct mcp_funcgen_router *)fgen; in mcp_funcgen_router_cleanup() local
1642 if (fr->map_ref) { in mcp_funcgen_router_cleanup()
1643 lua_rawgeti(L, LUA_REGISTRYINDEX, fr->map_ref); in mcp_funcgen_router_cleanup()
1667 luaL_unref(L, LUA_REGISTRYINDEX, fr->map_ref); in mcp_funcgen_router_cleanup()
1668 fr->map_ref = 0; in mcp_funcgen_router_cleanup()
1673 if (fr->cmap[x]) { in mcp_funcgen_router_cleanup()
1674 mcp_funcgen_dereference(L, fr->cmap[x]); in mcp_funcgen_router_cleanup()
1675 fr->cmap[x] = NULL; in mcp_funcgen_router_cleanup()
1679 if (fr->def_fgen) { in mcp_funcgen_router_cleanup()
1680 mcp_funcgen_dereference(L, fr->def_fgen); in mcp_funcgen_router_cleanup()
1681 fr->def_fgen = NULL; in mcp_funcgen_router_cleanup()
1748 static void _mcplib_router_new_mode(lua_State *L, struct mcp_funcgen_router *fr) { in _mcplib_router_new_mode() argument
1758 fr->type = FGEN_ROUTER_SHORTSEP; in _mcplib_router_new_mode()
1759 fr->conf.sep = '/'; in _mcplib_router_new_mode()
1762 fr->type = FGEN_ROUTER_SHORTSEP; in _mcplib_router_new_mode()
1763 fr->conf.sep = sep[0]; in _mcplib_router_new_mode()
1766 fr->type = FGEN_ROUTER_LONGSEP; in _mcplib_router_new_mode()
1767 memcpy(fr->conf.lsep, sep, len); in _mcplib_router_new_mode()
1768 fr->conf.lsep[len] = '\0'; // cap it. in _mcplib_router_new_mode()
1776 fr->type = FGEN_ROUTER_ANCHORSM; in _mcplib_router_new_mode()
1777 fr->conf.anchorsm[0] = '/'; in _mcplib_router_new_mode()
1778 fr->conf.anchorsm[1] = '/'; in _mcplib_router_new_mode()
1783 fr->type = FGEN_ROUTER_ANCHORSM; in _mcplib_router_new_mode()
1784 fr->conf.anchorsm[0] = sep[0]; in _mcplib_router_new_mode()
1785 fr->conf.anchorsm[1] = usep[0]; in _mcplib_router_new_mode()
1787 fr->type = FGEN_ROUTER_ANCHORBIG; in _mcplib_router_new_mode()
1788 memcpy(fr->conf.big.start, sep, len); in _mcplib_router_new_mode()
1789 memcpy(fr->conf.big.stop, usep, elen); in _mcplib_router_new_mode()
1790 fr->conf.big.start[len] = '\0'; in _mcplib_router_new_mode()
1791 fr->conf.big.stop[elen] = '\0'; in _mcplib_router_new_mode()
1800 struct mcp_funcgen_router fr = {0}; in mcplib_router_new() local
1826 fr.fgen_self.is_router = true; in mcplib_router_new()
1833 fr.type = FGEN_ROUTER_SHORTSEP; in mcplib_router_new()
1834 fr.conf.sep = '/'; in mcplib_router_new()
1837 _mcplib_router_new_mode(L, &fr); in mcplib_router_new()
1842 fr.type = FGEN_ROUTER_CMDMAP; in mcplib_router_new()
1854 fr.def_fgen = luaL_checkudata(L, -1, "mcp.funcgen"); in mcplib_router_new()
1860 memcpy(router, &fr, sizeof(struct mcp_funcgen_router)); in mcplib_router_new()