Esempio n. 1
0
/* print out the start of an `img' or `a' tag, applying callbacks as needed.
 */
static void
printlinkyref(MMIOT *f, linkytype *tag, char *link, int size)
{
    char *edit;
    
    if ( is_flag_set(f->flags, IS_LABEL) )
	return;
    
    Qstring(tag->link_pfx, f);
	
    if ( tag->kind & IS_URL ) {
	if ( f->cb && f->cb->e_url && (edit = (*f->cb->e_url)(link, size, f->cb->e_data)) ) {
	    puturl(edit, strlen(edit), f, 0);
	    if ( f->cb->e_free ) (*f->cb->e_free)(edit, f->cb->e_data);
	}
	else
	    puturl(link + tag->szpat, size - tag->szpat, f, 0);
    }
    else
	___mkd_reparse(link + tag->szpat, size - tag->szpat, MKD_TAGTEXT, f, 0);

    Qstring(tag->link_sfx, f);

    if ( f->cb && f->cb->e_flags && (edit = (*f->cb->e_flags)(link, size, f->cb->e_data)) ) {
	Qchar(' ', f);
	Qstring(edit, f);
	if ( f->cb->e_free ) (*f->cb->e_free)(edit, f->cb->e_data);
    }
} /* printlinkyref */
Esempio n. 2
0
static void disablewan_set_cb(struct ofono_error *error, void *data)
{
	struct cb_data *cbd = data;
	struct ofono_wan_data *od = cbd->user;
	wan_result_cb cb = cbd->cb;
	struct wan_error werror;

	if (error) {
		werror.code = WAN_ERROR_FAILED;
		cb(&werror, cbd->data);
		goto cleanup;
	}

	if (is_flag_set(od->pending_configuration->flags, WAN_CONFIGURATION_TYPE_ROAMGUARD)) {
		if (od->pending_configuration->roamguard == ofono_connection_manager_get_roaming_allowed(od->cm)) {
			ofono_connection_manager_set_roaming_allowed(od->cm, !od->pending_configuration->roamguard,
														 roamguard_set_cb, cbd);
			return;
		}
	}

	cb(NULL, cbd->data);

cleanup:
	g_free(cbd);
}
Esempio n. 3
0
void ofono_wan_set_configuration(struct wan_service *service, struct wan_configuration *configuration,
									   wan_result_cb cb, void *data)
{
	struct ofono_wan_data *od = wan_service_get_data(service);
	struct cb_data *cbd = NULL;
	struct wan_error error;

	if (!od->current_service_path) {
		error.code = WAN_ERROR_NOT_AVAILABLE;
		cb(&error, data);
		return;
	}

	od->pending_configuration = configuration;

	if (is_flag_set(configuration->flags, WAN_CONFIGURATION_TYPE_DISABLEWAN)) {
		if (configuration->disablewan != od->wan_disabled) {
			cbd = cb_data_new(cb, data);
			cbd->user = od;

			switch_current_service_state(od, !configuration->disablewan,
										 disablewan_set_cb, cbd);
		}
	}
	else if (is_flag_set(configuration->flags, WAN_CONFIGURATION_TYPE_ROAMGUARD)) {
		if (configuration->roamguard == ofono_connection_manager_get_roaming_allowed(od->cm)) {
			cbd = cb_data_new(cb, data);
			cbd->user = od;

			ofono_connection_manager_set_roaming_allowed(od->cm, !configuration->roamguard,
														 roamguard_set_cb, cbd);
		}
	}
	else {
		cb (NULL, data);
	}
}
Esempio n. 4
0
/* extract a (-prefixed url from the input stream.
 * the label is either of the format `<link>`, where I
 * extract until I find a >, or it is of the format
 * `text`, where I extract until I reach a ')', a quote,
 * or (if image) a '='
 */
static int
linkyurl(MMIOT *f, int image, Footnote *p)
{
    int c;
    int mayneedtotrim=0;

    if ( (c = eatspace(f)) == EOF )
	return 0;

    if ( c == '<' ) {
	pull(f);
	if ( !is_flag_set(f->flags, MKD_1_COMPAT) )
	    return linkybroket(f,image,p);
	mayneedtotrim=1;
    }

    T(p->link) = cursor(f);
    for ( S(p->link)=0; (c = peek(f,1)) != ')'; ++S(p->link) ) {
	if ( c == EOF )
	    return 0;
	else if ( (c == '"' || c == '\'') && linkytitle(f, c, p) )
	    break;
	else if ( image && (c == '=') && linkysize(f, p) )
	    break;
	else if ( (c == '\\') && ispunct(peek(f,2)) ) {
	    ++S(p->link);
	    pull(f);
	}
	pull(f);
    }
    if ( peek(f, 1) == ')' )
	pull(f);
	
    ___mkd_tidy(&p->link);
    
    if ( mayneedtotrim && (T(p->link)[S(p->link)-1] == '>') )
	--S(p->link);
    
    return 1;
}
Esempio n. 5
0
PROTECTED int
map_local_is_writable (unw_word_t addr, size_t write_bytes)
{
  return is_flag_set (addr, PROT_WRITE, write_bytes);
}
Esempio n. 6
0
PROTECTED int
map_local_is_readable (unw_word_t addr, size_t read_bytes)
{
  return is_flag_set (addr, PROT_READ, read_bytes);
}
Esempio n. 7
0
bool Item::is_found() const
{
    return is_flag_set(IS_FOUND);
}
Esempio n. 8
0
bool Item::is_revealed() const
{
    return is_flag_set(IS_REVEAL);
}
Esempio n. 9
0
bool Item::does_group() const
{
    return is_flag_set(IS_MANY);
}
Esempio n. 10
0
bool Item::is_cursed() const
{
    return is_flag_set(IS_CURSED);
}
Esempio n. 11
0
bool Item::is_known() const
{
    return is_flag_set(IS_KNOW);
}