#include "config.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <unistd.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <dirent.h>
#include "afterbase.h"
#include "asimage.h"
#include <sys/time.h>
#include <time.h>
#include <sys/times.h>
Go to the source code of this file.
#define DEALLOC_CACHE_SIZE 1024 |
Referenced by asim_parse_argb_color().
#define NAMLEN | ( | dirent | ) | strlen((dirent)->d_name) |
Definition at line 46 of file afterbase.c.
#define PATH_CHAR '/' |
Referenced by asim_find_file().
#define PATH_SEPARATOR_CHAR ':' |
Referenced by asim_find_file().
static ASHashResult add_item_to_bucket | ( | ASHashBucket * | bucket, | |
ASHashItem * | item, | |||
long(*)(ASHashableValue, ASHashableValue) | compare_func | |||
) | [static] |
Definition at line 834 of file afterbase.c.
References ASH_ItemExistsDiffer, ASH_ItemExistsSame, ASH_Success, ASHashItem::data, ASHashItem::next, NULL, and ASHashItem::value.
Referenced by asim_add_hash_item().
static void add_xml_buffer_close_tag | ( | ASXmlBuffer * | xb, | |
xml_elem_t * | tag | |||
) | [static] |
Definition at line 1809 of file afterbase.c.
References ASXmlBuffer::buffer, realloc_xml_buffer(), xml_elem_t::tag, and ASXmlBuffer::used.
Referenced by asim_xml_tags2xml_buffer().
static void add_xml_buffer_open_tag | ( | ASXmlBuffer * | xb, | |
xml_elem_t * | tag | |||
) | [static] |
Definition at line 1763 of file afterbase.c.
References ASXmlBuffer::buffer, xml_elem_t::child, for(), free(), len, xml_elem_t::next, NULL, p, xml_elem_t::parm, realloc_xml_buffer(), t, xml_elem_t::tag, ASXmlBuffer::used, and xml_parse_parm.
Referenced by asim_xml_tags2xml_buffer().
static void add_xml_buffer_spaces | ( | ASXmlBuffer * | xb, | |
int | len | |||
) | [static] |
Definition at line 1752 of file afterbase.c.
References ASXmlBuffer::buffer, realloc_xml_buffer(), and ASXmlBuffer::used.
Referenced by asim_xml_tags2xml_buffer().
ASHashResult asim_add_hash_item | ( | ASHashTable * | hash, | |
ASHashableValue | value, | |||
void * | data | |||
) |
Definition at line 859 of file afterbase.c.
References add_item_to_bucket(), ASH_BadParameter, ASH_Success, ASHashItem::data, deallocated_mem, free(), hash, ASHashItem::next, NULL, safecalloc, and ASHashItem::value.
void asim_add_xml_buffer_chars | ( | ASXmlBuffer * | xb, | |
char * | tmp, | |||
int | len | |||
) |
Definition at line 1744 of file afterbase.c.
References ASXmlBuffer::buffer, realloc_xml_buffer(), and ASXmlBuffer::used.
void asim_asxml_var_cleanup | ( | void | ) |
int asim_asxml_var_get | ( | const char * | name | ) |
Definition at line 1344 of file afterbase.c.
References AS_HASHABLE, ASH_Success, asxml_var, asxml_var_init, get_hash_item, ASHashData::i, show_debug, and ASHashData::vptr.
void asim_asxml_var_init | ( | void | ) |
Definition at line 1308 of file afterbase.c.
References asxml_var, asxml_var_insert, create_ashash, Display(), ASVisual::dpy, get_default_asvisual(), NULL, string_compare, string_destroy_without_data, and string_hash_value.
void asim_asxml_var_insert | ( | const char * | name, | |
int | value | |||
) |
Definition at line 1327 of file afterbase.c.
References add_hash_item, AS_HASHABLE, asxml_var, asxml_var_init, ASHashData::i, mystrdup, NULL, remove_hash_item, show_progress, True, and ASHashData::vptr.
static int asim_asxml_var_nget | ( | char * | name, | |
int | n | |||
) | [static] |
Definition at line 1359 of file afterbase.c.
References asxml_var_get.
Referenced by asim_parse_math().
long asim_casestring_compare | ( | ASHashableValue | value1, | |
ASHashableValue | value2 | |||
) |
ASHashKey asim_casestring_hash_value | ( | ASHashableValue | value, | |
ASHashKey | hash_size | |||
) |
int asim_check_file_mode | ( | const char * | file, | |
int | mode | |||
) |
char* asim_copy_replace_envvar | ( | char * | path | ) |
ASHashTable* asim_create_ashash | ( | ASHashKey | size, | |
ASHashKey(*)(ASHashableValue, ASHashKey) | hash_func, | |||
long(*)(ASHashableValue, ASHashableValue) | compare_func, | |||
void(*)(ASHashableValue, void *) | item_destroy_func | |||
) |
Definition at line 768 of file afterbase.c.
References asim_default_compare_func(), asim_default_hash_func(), False, hash, init_ashash, and safecalloc.
long asim_default_compare_func | ( | ASHashableValue | value1, | |
ASHashableValue | value2 | |||
) |
ASHashKey asim_default_hash_func | ( | ASHashableValue | value, | |
ASHashKey | hash_size | |||
) |
long asim_desc_long_compare_func | ( | ASHashableValue | value1, | |
ASHashableValue | value2 | |||
) |
Definition at line 749 of file afterbase.c.
void asim_destroy_ashash | ( | ASHashTable ** | hash | ) |
Definition at line 816 of file afterbase.c.
References asim_init_ashash(), destroy_ashash_bucket(), free(), hash, i, LOCAL_DEBUG_CALLER_OUT, NULL, and True.
char* asim_find_file | ( | const char * | file, | |
const char * | pathlist, | |||
int | type | |||
) |
Definition at line 304 of file afterbase.c.
References access, False, free(), i, len, local, mystrdup, NULL, PATH_CHAR, PATH_SEPARATOR_CHAR, ptr, put_file_home, safecalloc, strcpy(), and True.
void asim_flush_ashash_memory_pool | ( | ) |
xml_elem_t* asim_format_xml_buffer_state | ( | ASXmlBuffer * | xb | ) |
Definition at line 2086 of file afterbase.c.
References ASXML_BadAttrName, ASXML_BadStart, ASXML_BadTagName, ASXML_MissingAttrEq, ASXML_Start, ASXML_UnexpectedSlash, ASXML_UnmatchedClose, xml_elem_t::child, create_CDATA_tag(), ASXmlBuffer::level, NULL, xml_elem_t::parm, safemalloc, sprintf(), ASXmlBuffer::state, xml_elem_t::tag, ASXmlBuffer::tags_count, and xml_elem_new().
void asim_free_xml_buffer_resources | ( | ASXmlBuffer * | xb | ) |
Definition at line 1723 of file afterbase.c.
References ASXmlBuffer::allocated, ASXmlBuffer::buffer, ASXmlBuffer::current, free(), NULL, and ASXmlBuffer::used.
const char* asim_get_application_name | ( | ) |
int asim_get_drawable_size | ( | Drawable | d, | |
unsigned int * | ret_w, | |||
unsigned int * | ret_h | |||
) |
Definition at line 1106 of file afterbase.c.
References Display(), ASVisual::dpy, get_default_asvisual(), and root.
ASHashResult asim_get_hash_item | ( | ASHashTable * | hash, | |
ASHashableValue | value, | |||
void ** | trg | |||
) |
Definition at line 913 of file afterbase.c.
References ASH_ItemNotExists, ASH_Success, find_item_in_bucket(), hash, and NULL.
unsigned int asim_get_output_threshold | ( | ) |
void asim_init_ashash | ( | ASHashTable * | hash, | |
Bool | freeresources | |||
) |
Definition at line 755 of file afterbase.c.
References free(), hash, and LOCAL_DEBUG_CALLER_OUT.
Referenced by asim_destroy_ashash().
char* asim_interpret_ctrl_codes | ( | char * | text | ) |
char* asim_load_binary_file | ( | const char * | realfilename, | |
long * | file_size_return | |||
) |
char* asim_load_file | ( | const char * | realfilename | ) |
int asim_my_scandir_ext | ( | const char * | dirname, | |
int(*)(const char *) | filter_func, | |||
Bool(*)(const char *fname, const char *fullname, struct stat *stat_info, void *aux_data) | handle_direntry_func, | |||
void * | aux_data | |||
) |
int asim_mystrcasecmp | ( | const char * | s1, | |
const char * | s2 | |||
) |
char* asim_mystrdup | ( | const char * | str | ) |
int asim_mystrncasecmp | ( | const char * | s1, | |
const char * | s2, | |||
size_t | n | |||
) |
char* asim_mystrndup | ( | const char * | str, | |
size_t | n | |||
) |
void asim_nonGNUC_debugout | ( | const char * | format, | |
... | ||||
) |
void asim_nonGNUC_debugout_stub | ( | const char * | format, | |
... | ||||
) |
Definition at line 195 of file afterbase.c.
const char* asim_parse_argb_color | ( | const char * | color, | |
CARD32 * | pargb | |||
) |
Definition at line 582 of file afterbase.c.
References argb, Display(), ASVisual::dpy, FindColor(), get_default_asvisual(), hextoi, len, NULL, ptr, and x3.
Definition at line 669 of file afterbase.c.
References asim_asxml_var_nget(), asim_parse_math(), NULL, num, ptr, and total.
Referenced by asim_parse_math().
ASHashKey asim_pointer_hash_value | ( | ASHashableValue | value, | |
ASHashKey | hash_size | |||
) |
char* asim_put_file_home | ( | const char * | path_with_home | ) |
Definition at line 211 of file afterbase.c.
References getenv(), i, mystrdup, NULL, ptr, safemalloc, and str.
ASHashResult asim_remove_hash_item | ( | ASHashTable * | hash, | |
ASHashableValue | value, | |||
void ** | trg, | |||
Bool | destroy | |||
) |
Definition at line 935 of file afterbase.c.
References ASH_ItemNotExists, ASH_Success, DEALLOC_CACHE_SIZE, deallocated_mem, find_item_in_bucket(), free(), hash, ASHashItem::next, and NULL.
void asim_reset_xml_buffer | ( | ASXmlBuffer * | xb | ) |
Definition at line 1708 of file afterbase.c.
References ASXML_Start, ASXmlBuffer::current, False, ASXmlBuffer::level, ASXmlBuffer::quoted, ASXmlBuffer::state, ASXmlBuffer::tag_type, ASXmlBuffer::tags_count, ASXmlBuffer::used, and ASXmlBuffer::verbatim.
void asim_set_application_name | ( | char * | argv0 | ) |
unsigned int asim_set_output_threshold | ( | unsigned int | threshold | ) |
Bool asim_show_debug | ( | const char * | file, | |
const char * | func, | |||
int | line, | |||
const char * | msg_format, | |||
... | ||||
) |
Definition at line 169 of file afterbase.c.
References False, fprintf(), get_application_name, get_output_threshold, OUTPUT_LEVEL_DEBUG, and True.
Bool asim_show_error | ( | const char * | error_format, | |
... | ||||
) |
Definition at line 123 of file afterbase.c.
References False, fprintf(), get_application_name, get_output_threshold, OUTPUT_LEVEL_ERROR, and True.
Bool asim_show_progress | ( | const char * | msg_format, | |
... | ||||
) |
Definition at line 153 of file afterbase.c.
References False, fprintf(), get_application_name, get_output_threshold, OUTPUT_LEVEL_PROGRESS, and True.
Bool asim_show_warning | ( | const char * | warning_format, | |
... | ||||
) |
Definition at line 138 of file afterbase.c.
References False, fprintf(), get_application_name, get_output_threshold, OUTPUT_LEVEL_WARNING, and True.
int asim_spool_xml_tag | ( | ASXmlBuffer * | xb, | |
char * | tmp, | |||
int | len | |||
) |
Definition at line 1821 of file afterbase.c.
References add_xml_buffer_chars, ASXML_AttrEq, ASXML_AttrName, ASXML_AttrSlash, ASXML_AttrValue, ASXML_AttrValueStart, ASXML_BadAttrName, ASXML_BadStart, ASXML_BadTagName, ASXML_MissingAttrEq, ASXML_Start, ASXML_TagAttrOrClose, ASXML_TagName, ASXML_TagOpen, ASXML_UnexpectedSlash, ASXML_UnmatchedClose, False, i, ASXmlBuffer::level, ASXmlBuffer::quoted, start, ASXmlBuffer::state, ASXmlBuffer::tag_type, ASXmlBuffer::tags_count, True, and ASXmlBuffer::verbatim.
void asim_start_ticker | ( | unsigned int | size | ) |
long asim_string_compare | ( | ASHashableValue | value1, | |
ASHashableValue | value2 | |||
) |
void asim_string_destroy_without_data | ( | ASHashableValue | value, | |
void * | data | |||
) |
ASHashKey asim_string_hash_value | ( | ASHashableValue | value, | |
ASHashKey | hash_size | |||
) |
void asim_wait_tick | ( | ) |
void asim_xml_elem_delete | ( | xml_elem_t ** | list, | |
xml_elem_t * | elem | |||
) |
Definition at line 1495 of file afterbase.c.
References cdata_str, container_str, free(), list, xml_elem_t::next, NULL, ptr, xml_elem_delete, and xml_elem_remove().
int asim_xml_parse | ( | const char * | str, | |
xml_elem_t * | current, | |||
ASHashTable * | vocabulary | |||
) |
Definition at line 1535 of file afterbase.c.
References create_CDATA_tag(), empty, lcstring(), mystrncasecmp, mystrndup, NULL, xml_elem_t::parm, ptr, xml_elem_t::tag, xml_elem_t::tag_id, xml_elem_new(), xml_insert(), xml_name2id(), xml_parse, and xml_tagchar.
xml_elem_t* asim_xml_parse_doc | ( | const char * | str, | |
ASHashTable * | vocabulary | |||
) |
xml_elem_t* asim_xml_parse_parm | ( | const char * | parm, | |
ASHashTable * | vocabulary | |||
) |
Definition at line 1431 of file afterbase.c.
References free(), lcstring(), list, mystrndup, NULL, p, xml_elem_new(), xml_name2id(), and xml_tagchar.
void asim_xml_print | ( | xml_elem_t * | root | ) |
Definition at line 2074 of file afterbase.c.
References add_xml_buffer_chars, free_xml_buffer_resources, root, and xml_tags2xml_buffer.
Bool asim_xml_tags2xml_buffer | ( | xml_elem_t * | tags, | |
ASXmlBuffer * | xb, | |||
int | tags_count, | |||
int | depth | |||
) |
Definition at line 2035 of file afterbase.c.
References add_xml_buffer_chars, add_xml_buffer_close_tag(), add_xml_buffer_open_tag(), add_xml_buffer_spaces(), cdata_str, xml_elem_t::child, False, xml_elem_t::next, NULL, xml_elem_t::parm, xml_elem_t::tag, xml_elem_t::tag_id, True, XML_CDATA_ID, and xml_tags2xml_buffer.
static xml_elem_t* create_CDATA_tag | ( | ) | [static] |
Definition at line 1510 of file afterbase.c.
References xml_elem_t::tag, xml_elem_t::tag_id, XML_CDATA_ID, XML_CDATA_STR, and xml_elem_new().
Referenced by asim_format_xml_buffer_state(), and asim_xml_parse().
static xml_elem_t* create_CONTAINER_tag | ( | ) | [static] |
Definition at line 1519 of file afterbase.c.
References xml_elem_t::tag, xml_elem_t::tag_id, XML_CONTAINER_ID, XML_CONTAINER_STR, and xml_elem_new().
Referenced by asim_xml_parse_doc().
static void destroy_ashash_bucket | ( | ASHashBucket * | bucket, | |
void(*)(ASHashableValue, void *) | item_destroy_func | |||
) | [static] |
Definition at line 801 of file afterbase.c.
References ASHashItem::data, free(), if(), ASHashItem::next, NULL, and ASHashItem::value.
Referenced by asim_destroy_ashash().
static char* do_replace_envvar | ( | char * | path | ) | [static] |
Definition at line 408 of file afterbase.c.
References data, find_envvar(), free(), getenv(), len, NULL, safecalloc, and strcpy().
Referenced by asim_copy_replace_envvar().
static char* find_envvar | ( | char * | var_start, | |
int * | end_pos | |||
) | [static] |
Definition at line 383 of file afterbase.c.
References getenv(), i, and NULL.
Referenced by do_replace_envvar().
static ASHashItem** find_item_in_bucket | ( | ASHashBucket * | bucket, | |
ASHashableValue | value, | |||
long(*)(ASHashableValue, ASHashableValue) | compare_func | |||
) | [static] |
Definition at line 894 of file afterbase.c.
References NULL.
Referenced by asim_get_hash_item(), and asim_remove_hash_item().
static char* lcstring | ( | char * | str | ) | [static] |
Definition at line 1376 of file afterbase.c.
References ptr.
Referenced by asim_xml_parse(), and asim_xml_parse_parm().
static void realloc_xml_buffer | ( | ASXmlBuffer * | xb, | |
int | len | |||
) | [inline, static] |
Definition at line 1734 of file afterbase.c.
References ASXmlBuffer::allocated, ASXmlBuffer::buffer, realloc(), and ASXmlBuffer::used.
Referenced by add_xml_buffer_close_tag(), add_xml_buffer_open_tag(), add_xml_buffer_spaces(), and asim_add_xml_buffer_chars().
void sleep_a_little | ( | int | n | ) |
Definition at line 1165 of file afterbase.c.
References PORTABLE_SELECT, and Sleep().
Referenced by asim_start_ticker(), and asim_wait_tick().
void unix_path2dos_path | ( | char * | path | ) |
Definition at line 294 of file afterbase.c.
References i.
Referenced by ASImage2file(), locate_image_file(), and locate_image_file_in_path().
static xml_elem_t* xml_elem_new | ( | void | ) | [static] |
Definition at line 1384 of file afterbase.c.
References xml_elem_t::child, NEW, xml_elem_t::next, NULL, xml_elem_t::parm, xml_elem_t::tag, xml_elem_t::tag_id, and XML_UNKNOWN_ID.
Referenced by asim_format_xml_buffer_state(), asim_xml_parse(), asim_xml_parse_parm(), create_CDATA_tag(), and create_CONTAINER_tag().
static xml_elem_t* xml_elem_remove | ( | xml_elem_t ** | list, | |
xml_elem_t * | elem | |||
) | [static] |
Definition at line 1402 of file afterbase.c.
References list, xml_elem_t::next, and ptr.
Referenced by asim_xml_elem_delete().
static void xml_insert | ( | xml_elem_t * | parent, | |
xml_elem_t * | child | |||
) | [static] |
Definition at line 1421 of file afterbase.c.
References xml_elem_t::child, xml_elem_t::next, and NULL.
Referenced by asim_xml_parse().
static int xml_name2id | ( | const char * | name, | |
ASHashTable * | vocabulary | |||
) | [static] |
Definition at line 1394 of file afterbase.c.
References AS_HASHABLE, get_hash_item, ASHashData::i, and ASHashData::vptr.
Referenced by asim_xml_parse(), and asim_xml_parse_parm().
clock_t _as_ticker_last_tick = 0 [static] |
Definition at line 1157 of file afterbase.c.
clock_t _as_ticker_tick_size = 1 [static] |
Definition at line 1158 of file afterbase.c.
clock_t _as_ticker_tick_time = 0 [static] |
Definition at line 1159 of file afterbase.c.
char* asim_ApplicationName = NULL |
Definition at line 82 of file afterbase.c.
Referenced by asim_get_application_name(), and asim_set_application_name().
unsigned int asim_as_output_threshold = OUTPUT_DEFAULT_THRESHOLD [static] |
Definition at line 105 of file afterbase.c.
Referenced by asim_get_output_threshold(), and asim_set_output_threshold().
ASHashTable* asxml_var = NULL [static] |
Definition at line 1305 of file afterbase.c.
Referenced by asim_asxml_var_cleanup(), asim_asxml_var_get(), asim_asxml_var_init(), and asim_asxml_var_insert().
char* cdata_str = XML_CDATA_STR [static] |
Definition at line 1303 of file afterbase.c.
Referenced by asim_xml_elem_delete(), asim_xml_tags2xml_buffer(), and handle_asxml_tag_text().
char* container_str = XML_CONTAINER_STR [static] |
ASHashItem* deallocated_mem[DEALLOC_CACHE_SIZE+10] [static] |
Definition at line 855 of file afterbase.c.
Referenced by asim_add_hash_item(), asim_flush_ashash_memory_pool(), and asim_remove_hash_item().
unsigned int deallocated_used = 0 [static] |
Definition at line 856 of file afterbase.c.