Example #1
0
static str_map_ptr _spell_stats_map(void)
{
    static str_map_ptr _map = NULL;
    if (!_map)
        _map = str_map_alloc(free);
    return _map;
}
Example #2
0
static str_map_ptr _innate_map(void)
{
    static str_map_ptr _map = NULL;
    if (!_map)
        _map = str_map_alloc(free);
    return _map;
}
Example #3
0
doc_ptr doc_alloc(int width)
{
    doc_ptr     res = malloc(sizeof(doc_t));
    doc_style_t style = {0};

    res->cursor.x = 0;
    res->cursor.y = 0;
    res->selection = doc_region_invalid();
    res->width = width;
    res->pages = vec_alloc(free);
    res->styles = str_map_alloc(free);
    res->bookmarks = vec_alloc(_doc_bookmark_free);
    res->links = int_map_alloc(_doc_link_free);
    res->style_stack = vec_alloc(free);
    res->name = string_alloc();
    res->html_header = string_alloc();

    /* Default Styles */
    _add_doc_style_f(res, "normal", _normal_style);
    _add_doc_style_f(res, "note", _note_style);
    _add_doc_style_f(res, "title", _title_style);
    _add_doc_style_f(res, "heading", _heading_style);
    _add_doc_style_f(res, "keyword", _keyword_style);
    _add_doc_style_f(res, "keypress", _keypress_style);
    _add_doc_style_f(res, "link", _link_style);
    _add_doc_style_f(res, "screenshot", _screenshot_style);
    _add_doc_style_f(res, "table", _table_style);
    _add_doc_style_f(res, "selection", _selection_style);
    _add_doc_style_f(res, "indent", _indent_style);
    _add_doc_style_f(res, "wide", _wide_style);

    /* bottom of the style stack is *always* "normal" and can never be popped */
    _normal_style(&style);
    doc_push_style(res, &style);

    return res;
}