Exemplo n.º 1
0
int websFormDefine(char_t *name, void (*fn)(webs_t wp, char_t *path, 
	char_t *query))
{
	a_assert(name && *name);
	a_assert(fn);

	if (fn == NULL) {
		return -1;
	}

	symEnter(formSymtab, name, valueInteger((int) fn), (int) NULL);
	return 0;
}
Exemplo n.º 2
0
int websRomOpen()
{
	websRomPageIndexType	*wip;
	int						nchars;
	char_t					name[SYM_MAX];

	romTab = symOpen(WEBS_SYM_INIT);

	for (wip = websRomPageIndex; wip->path; wip++) {
		gstrncpy(name, wip->path, SYM_MAX);
		nchars = gstrlen(name) - 1;
		if (nchars > 0 &&
			(name[nchars] == '/' || name[nchars] == '\\')) {
			name[nchars] = '\0';
		}
		symEnter(romTab, name, valueInteger((int) wip), 0);
	}
	return 0;
}
Exemplo n.º 3
0
static void computeAbilities(WebsHash abilities, char *role, int depth)
{
    WebsRole    *rp;
    WebsKey     *key;

    assure(abilities >= 0);
    assure(role && *role);
    assure(depth >= 0);

    if (depth > 20) {
        error("Recursive ability definition for %s", role);
        return;
    }
    if (roles >= 0) {
        if ((key = hashLookup(roles, role)) != 0) {
            rp = (WebsRole*) key->content.value.symbol;
            for (key = hashFirst(rp->abilities); key; key = hashNext(rp->abilities, key)) {
                computeAbilities(abilities, key->name.value.string, ++depth);
            }
        } else {
            hashEnter(abilities, role, valueInteger(0), 0);
        }
    }
}