ARB
Classes | Macros | Typedefs | Enumerations | Functions | Variables
arb_help2xml.cxx File Reference
#include <xml.hxx>
#include <arb_defs.h>
#include <arb_diff.h>
#include <static_assert.h>
#include <list>
#include <set>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstdarg>
#include <cstring>
#include <climits>
#include <unistd.h>
#include <sys/stat.h>
Include dependency graph for arb_help2xml.cxx:

Go to the source code of this file.

Classes

class  LineAttachedMessage
 
struct  MessageAttachable
 
class  Reader
 
class  Ostring
 
class  FINAL_TYPE< SEQTYPE >
 xml element More...
 
class  Link
 
class  Helpfile
 
class  FINAL_TYPE< SEQTYPE >
 xml element More...
 

Macros

#define h2x_assert(bed)   arb_assert(bed)
 
#define MAX_LINE_LENGTH   200
 
#define TABSIZE   8
 
#define MAX_ALLOWED_ENUM   99
 
#define PATHS   2
 

Typedefs

typedef list< OstringOstrings
 
typedef list< Section > SectionList
 
typedef list< LinkLinks
 

Enumerations

enum  SectionType {
  SEC_OCCURRENCE, SEC_DESCRIPTION, SEC_NOTES, SEC_EXAMPLES,
  SEC_WARNINGS, SEC_BUGS, SEC_SECTION, KNOWN_SECTION_TYPES,
  SEC_NONE, SEC_FAKE
}
 
enum  ParagraphType { PLAIN_TEXT, ENUMERATED, ITEM }
 
enum  EnumerationType { NONE, DIGITS, ALPHA_UPPER, ALPHA_LOWER }
 
enum  LinkType {
  LT_UNKNOWN = 0, LT_HTTP = 1, LT_HTTPS = 2, LT_FTP = 4,
  LT_FILE = 8, LT_EMAIL = 16, LT_HLP = 32, LT_PS = 64,
  LT_PDF = 128
}
 

Functions

 STATIC_ASSERT (ARRAY_ELEMS(knownSections)==KNOWN_SECTION_TYPES)
 
 __ATTR__VFORMAT (1) static string vstrf(const char *format
 
 while (1)
 
return string (buffer, length)
 
 __ATTR__FORMAT (1) static string strf(const char *format
 
 va_start (argPtr, format)
 
 va_end (argPtr)
 
LineAttachedMessage unattached_message (const string &message)
 
void add_warning (const LineAttachedMessage &laMsg)
 
void add_warning (const string &warning, size_t lineno)
 
void check_TODO (const char *, const Reader &)
 
bool isWhite (char c)
 
bool isEmptyOrComment (const char *s)
 
const charextractKeyword (const char *line, string &keyword)
 
const chareatWhite (const char *line)
 
void pushParagraph (Section &sec, string &paragraph, size_t lineNo, ParagraphType &type, EnumerationType &etype, unsigned num)
 
const charfirstChar (const char *s)
 
bool is_startof_itemlist_element (const char *contentStart)
 
static EnumerationType startsWithLetter (string &s, unsigned &number)
 
static bool startsWithNumber (string &s, unsigned &number)
 
static EnumerationType detectLineEnumType (string &line, unsigned &number)
 
static void parseSection (Section &sec, const char *line, int indentation, Reader &reader)
 
void check_specific_duplicates (const string &link, const Links &existing, bool add_warnings)
 
void check_duplicates (const string &link, const Links &uplinks, const Links &references, bool add_warnings)
 
static void warnAboutDuplicate (SectionList &sections)
 
static bool shouldReflow (const string &s, int &foundIndentation)
 
static string correctSpaces (const string &text, int change)
 
static string correctIndentation (const string &text, int change)
 
size_t countSpaces (const string &text)
 
static size_t scanMinIndentation (const string &text)
 
static string LinkType2id (LinkType type)
 
const chargetExtension (const string &name)
 
static LinkType detectLinkType (const string &link_target)
 
static string locate_helpfile (const string &helpname)
 
static string locate_document (const string &docname)
 
static void add_link_attributes (XML_Tag &link, LinkType type, const string &dest, size_t source_line)
 
static void print_XML_Text_expanding_links (const string &text, size_t lineNo)
 
static void create_top_links (const Links &links, const char *tag)
 
static void show_err (const string &err, size_t lineno, const string &helpfile)
 
void show_err (const LineAttachedMessage &line_err, const string &helpfile)
 
void show_warning (const LineAttachedMessage &line_err, const string &helpfile)
 
void show_warnings (const string &helpfile)
 
static void show_error_and_warnings (const LineAttachedMessage &error, const string &helpfile)
 
int ARB_main (int argc, char *argv[])
 

Variables

static const charknownSections []
 
va_list static argPtr size_t buf_size = 256
 
static charbuffer = new char[buf_size]
 
size_t length
 
string result = vstrf(format, argPtr)
 
const size_t NO_LINENUMBER_INFO = -1U
 
static list< LineAttachedMessagewarnings
 
static const charlink_id []
 

Macro Definition Documentation

#define h2x_assert (   bed)    arb_assert(bed)
#define MAX_LINE_LENGTH   200

Definition at line 56 of file arb_help2xml.cxx.

#define TABSIZE   8

Definition at line 57 of file arb_help2xml.cxx.

#define MAX_ALLOWED_ENUM   99

Definition at line 465 of file arb_help2xml.cxx.

Referenced by startsWithLetter(), and startsWithNumber().

#define PATHS   2

Referenced by locate_helpfile().

Typedef Documentation

typedef list<Ostring> Ostrings

Definition at line 306 of file arb_help2xml.cxx.

typedef list<Section> SectionList

Definition at line 345 of file arb_help2xml.cxx.

typedef list<Link> Links

Definition at line 364 of file arb_help2xml.cxx.

Enumeration Type Documentation

Enumerator
SEC_OCCURRENCE 
SEC_DESCRIPTION 
SEC_NOTES 
SEC_EXAMPLES 
SEC_WARNINGS 
SEC_BUGS 
SEC_SECTION 
KNOWN_SECTION_TYPES 
SEC_NONE 
SEC_FAKE 

Definition at line 69 of file arb_help2xml.cxx.

Enumerator
PLAIN_TEXT 
ENUMERATED 
ITEM 

Definition at line 240 of file arb_help2xml.cxx.

Enumerator
NONE 
DIGITS 
ALPHA_UPPER 
ALPHA_LOWER 

Definition at line 245 of file arb_help2xml.cxx.

enum LinkType
Enumerator
LT_UNKNOWN 
LT_HTTP 
LT_HTTPS 
LT_FTP 
LT_FILE 
LT_EMAIL 
LT_HLP 
LT_PS 
LT_PDF 

Definition at line 1232 of file arb_help2xml.cxx.

Function Documentation

__ATTR__VFORMAT ( ) const
while ( )

Definition at line 90 of file arb_help2xml.cxx.

References buf_size, buffer, h2x_assert, and string().

Referenced by GBS_hash_next_element_that().

return string ( buffer  ,
length   
)

Referenced by add_link_attributes(), FailedAt::add_prefix(), XML_Text::add_son(), XML_Comment::add_son(), ARB_main(), ComplementLocation::as_string(), awt_radio_button::awar2db(), awt_create_input_mask(), LineReader::backLine(), ConfigMapping::config_string(), constCastTo(), conversion_function_name(), correctSpaces(), current_changed_cb(), detect_sina_version(), ed_submit_info_event_rm(), ArbMatchResultsManager::enumerate_results(), extractKeyword(), StringParser::extractWord(), find_data_file(), ArbMatchResultsManager::findResultSet(), GroupBuilder::generate_group_name(), ConfigDefinition::get_awar_name(), get_downgroups(), ConfigMapping::get_entries(), RegExpr::get_error(), PartialSequence::get_multilist(), GetImageFile(), BufferedFileReader::getLine_intern(), getLocalFlag(), ShaderPlugin::init_awars(), init_file_printing(), inputMaskFullname(), keptHitReason(), load_probe_collection(), QueryExpr::matches(), mp_file2list(), NT_importValidNames(), ArbMatchResultsManager::openResultsFile(), Parameter::Parameter(), gc_desc::parse_decl(), parseLocation(), parsePosition(), parseSection(), probe_match_event(), probe_match_with_specificity_event(), MultiFastaWriter::readData(), MultiFastaWriter::readString(), GEN_graphic::reinit_gen_root(), ArbProbeCollection::remove(), XML_Text::remove_son(), XML_Comment::remove_son(), StringParser::rest(), ArbMatchResult::result(), save_probe_list_to_DB(), SetVariables::set(), awt_mask_item::set_name(), GroupChanges::show_message(), store_cb(), throw_IO_error(), throwError(), ArbMatchResultsManager::updateResults(), ArbMatchResult::weightAndResult(), and while().

__ATTR__FORMAT ( ) const
va_start ( argPtr  ,
format   
)
va_end ( argPtr  )
LineAttachedMessage unattached_message ( const string message)

Definition at line 136 of file arb_help2xml.cxx.

Referenced by ARB_main(), and Helpfile::readHelp().

void add_warning ( const LineAttachedMessage laMsg)
inline
void add_warning ( const string warning,
size_t  lineno 
)
inline

Definition at line 143 of file arb_help2xml.cxx.

References add_warning().

void check_TODO ( const char ,
const Reader  
)
inline

Definition at line 315 of file arb_help2xml.cxx.

Referenced by parseSection(), and Helpfile::readHelp().

bool isWhite ( char  c)
inline

Definition at line 398 of file arb_help2xml.cxx.

Referenced by eatWhite(), firstChar(), isEmptyOrComment(), and shouldReflow().

bool isEmptyOrComment ( const char s)
inline

Definition at line 400 of file arb_help2xml.cxx.

References isWhite().

Referenced by parseSection(), and Helpfile::readHelp().

const char* extractKeyword ( const char line,
string keyword 
)
inline

Definition at line 410 of file arb_help2xml.cxx.

References line, NULp, arb_test::space(), and string().

Referenced by parseSection(), and Helpfile::readHelp().

const char* eatWhite ( const char line)
inline

Definition at line 428 of file arb_help2xml.cxx.

References isWhite(), and line.

Referenced by Helpfile::readHelp().

void pushParagraph ( Section &  sec,
string paragraph,
size_t  lineNo,
ParagraphType type,
EnumerationType etype,
unsigned  num 
)
inline

Definition at line 434 of file arb_help2xml.cxx.

References ENUMERATED, NONE, and PLAIN_TEXT.

Referenced by parseSection().

const char* firstChar ( const char s)
inline

Definition at line 449 of file arb_help2xml.cxx.

References isWhite(), and s.

Referenced by parseSection(), and translate_config_changed_cb().

bool is_startof_itemlist_element ( const char contentStart)
inline

Definition at line 454 of file arb_help2xml.cxx.

Referenced by parseSection().

static EnumerationType startsWithLetter ( string s,
unsigned &  number 
)
static

Definition at line 467 of file arb_help2xml.cxx.

References ALPHA_LOWER, ALPHA_UPPER, h2x_assert, MAX_ALLOWED_ENUM, and NONE.

Referenced by detectLineEnumType().

static bool startsWithNumber ( string s,
unsigned &  number 
)
static

Definition at line 495 of file arb_help2xml.cxx.

References MAX_ALLOWED_ENUM.

Referenced by detectLineEnumType().

static EnumerationType detectLineEnumType ( string line,
unsigned &  number 
)
static

Definition at line 522 of file arb_help2xml.cxx.

References DIGITS, startsWithLetter(), and startsWithNumber().

Referenced by parseSection().

static void parseSection ( Section &  sec,
const char line,
int  indentation,
Reader reader 
)
static
void check_specific_duplicates ( const string link,
const Links existing,
bool  add_warnings 
)
inline

Definition at line 630 of file arb_help2xml.cxx.

References add_warning(), link, and strf().

Referenced by check_duplicates(), and Helpfile::extractInternalLinks().

void check_duplicates ( const string link,
const Links uplinks,
const Links references,
bool  add_warnings 
)
inline

Definition at line 638 of file arb_help2xml.cxx.

References check_specific_duplicates().

Referenced by Helpfile::readHelp().

static void warnAboutDuplicate ( SectionList sections)
static

Definition at line 643 of file arb_help2xml.cxx.

References s.

Referenced by Helpfile::readHelp().

static bool shouldReflow ( const string s,
int foundIndentation 
)
static

Definition at line 765 of file arb_help2xml.cxx.

References CHAR, h2x_assert, and isWhite().

static string correctSpaces ( const string text,
int  change 
)
static

Definition at line 803 of file arb_help2xml.cxx.

References h2x_assert, and string().

Referenced by correctIndentation().

static string correctIndentation ( const string text,
int  change 
)
static

Definition at line 821 of file arb_help2xml.cxx.

References correctSpaces(), and result.

size_t countSpaces ( const string text)
inline

Definition at line 847 of file arb_help2xml.cxx.

Referenced by scanMinIndentation().

static size_t scanMinIndentation ( const string text)
static

Definition at line 853 of file arb_help2xml.cxx.

References countSpaces(), and min.

static string LinkType2id ( LinkType  type)
static

Definition at line 1256 of file arb_help2xml.cxx.

Referenced by add_link_attributes().

const char* getExtension ( const string name)
inline

Definition at line 1265 of file arb_help2xml.cxx.

References NULp.

Referenced by detectLinkType().

static LinkType detectLinkType ( const string link_target)
static
static string locate_helpfile ( const string helpname)
static

Definition at line 1293 of file arb_help2xml.cxx.

References PATHS.

Referenced by add_link_attributes(), and locate_document().

static string locate_document ( const string docname)
static

Definition at line 1310 of file arb_help2xml.cxx.

References locate_helpfile().

Referenced by add_link_attributes().

static void add_link_attributes ( XML_Tag &  link,
LinkType  type,
const string dest,
size_t  source_line 
)
static
static void print_XML_Text_expanding_links ( const string text,
size_t  lineNo 
)
static

Definition at line 1344 of file arb_help2xml.cxx.

References add_link_attributes(), detectLinkType(), and link.

static void create_top_links ( const Links links,
const char tag 
)
static

Definition at line 1473 of file arb_help2xml.cxx.

References add_link_attributes(), detectLinkType(), link, and s.

Referenced by Helpfile::writeXML().

static void show_err ( const string err,
size_t  lineno,
const string helpfile 
)
static

Definition at line 1609 of file arb_help2xml.cxx.

Referenced by show_err(), show_error_and_warnings(), and show_warning().

void show_err ( const LineAttachedMessage line_err,
const string helpfile 
)
inline
void show_warning ( const LineAttachedMessage line_err,
const string helpfile 
)
inline
void show_warnings ( const string helpfile)
inline

Definition at line 1627 of file arb_help2xml.cxx.

References show_warning().

Referenced by ARB_main(), and show_error_and_warnings().

static void show_error_and_warnings ( const LineAttachedMessage error,
const string helpfile 
)
static

Definition at line 1632 of file arb_help2xml.cxx.

References show_err(), and show_warnings().

Referenced by ARB_main().

int ARB_main ( int  argc,
char argv[] 
)

Variable Documentation

const char* knownSections[]
static
Initial value:
= {
"OCCURRENCE",
"DESCRIPTION",
"NOTES",
"EXAMPLES",
"WARNINGS",
"BUGS",
"SECTION",
}

Definition at line 59 of file arb_help2xml.cxx.

va_list static argPtr size_t buf_size = 256
static

Definition at line 86 of file arb_help2xml.cxx.

Referenced by while().

char* buffer = new char[buf_size]
static

Definition at line 87 of file arb_help2xml.cxx.

Referenced by while().

size_t length
return result = vstrf(format, argPtr)

Definition at line 111 of file arb_help2xml.cxx.

Referenced by addids_match_info(), aisc_server_load_token(), alignQuality(), an_get_short(), AP_dump_index_event(), AP_probe_iterate_event(), SaiBoolchainOperator::apply(), SaiAciApplicator::apply(), apply_auto_numeric_binop(), apply_double_binop(), apply_numeric_binop(), apply_to_origin(), applyToItemFoundByKey(), ARB_float_2_ascii(), ARB_getenv_ignore_empty(), arb_look_and_start_ptserver(), ARB_main(), arb_shell_expand(), ARB_strpartdup(), AW_extract_directory(), aw_help_search(), aw_question(), aw_ref_to_title(), AW_unfold_path(), aw_xkey_2_awkey(), awar_translate(), AWTC_makeUniqueShortName(), binop_compare(), binop_equals(), SEC_root::buildStructureString(), calc_diff(), probe_combi_statistic::calc_index_system3(), probe_combi_statistic::check_duplicates(), checkopt(), CON_calculate(), ConfigMapping::config_string(), PrefixIterator::copy(), correct_extension(), correctIndentation(), default_characters(), default_color(), ColorGroupDef::defaultColorgroupName(), ED4_folding_line::delete_member(), DI_MATRIX::detect_transformation(), dont_return_unchanged(), ED4_get_NDS_text(), encode_escaped_chars(), escapeString(), List< Type >::exchange_members(), List< Type >::exchange_positions(), execute_guarded(), execute_guarded_ClientCode(), EXP_find_experiment_by_id(), expandMore(), filter_columnstat_SAIs(), filter_posvar_SAI_for_ali(), RootSynchronizer::find_best_root_candidate(), findSegmentContaining(), FindType(), ArbDBWriter::finishSave(), firstCharOfAwarOrDefault(), chartable::SepBaseFreq::firstDifference(), TreeNode::fixDeletedSon(), flag_callback(), format(), fullMacroname(), g_b_read_number2(), GB_append_suffix(), GB_canonical_path(), GB_close(), GB_command_interpreter_in_env(), GB_concat_full_path(), GB_concat_path(), GB_find_all_files(), gb_find_internal(), GB_find_latest_file(), GB_get_callback_info(), GB_get_subfields(), GB_getenv(), gb_index_find(), GB_property_file(), GB_read_file(), GB_read_lossless_byte(), GB_read_lossless_float(), GB_read_lossless_int(), GBCMC_find(), gbcmc_key_alloc(), gbcmc_send_undo_info_commands(), gbcms_talking_undo(), GBK_assert_msg(), gbl_command(), gbl_do(), gbl_eval(), gbl_exec(), gbl_select(), gbl_taxonomy(), gbmGetMemImpl(), gbs_compress_command(), GBS_global_string(), GBS_global_string_copy(), GBS_incr_hash(), GBS_merge_tagged_strings(), GBS_modify_tagged_string_with_ACI(), GBS_ptserver_id_to_choice(), GBS_read_arb_tcp(), GBS_regreplace(), GBS_scan_arb_tcp_param(), GBS_unwrap_regexpr(), GBT_create_alignment(), GBT_gen_species_array(), GBT_get_alignment_type_string(), GBT_get_name_or_description(), GBT_get_names_of_species_in_tree(), GBT_is_partial(), GBT_read_as_string(), GBT_read_char_pntr(), GBT_read_float(), GBT_read_gene_sequence_and_length(), GBT_read_int(), GBT_read_string(), GBT_readOrCreate_char_pntr(), GBT_readOrCreate_float(), GBT_readOrCreate_int(), GBT_readOrCreate_string(), GBT_relativeMacroname(), GBT_tree_2_newick(), GBT_tree_info_string(), gde_filter_weights(), gen_find_gene_by_id(), genbank_date(), ED4_base::get_area_level(), RootSynchronizer::get_current_roots(), get_downgroups(), ArbTcpDat::get_entry(), get_file_content_for_viewer(), get_full_qualified_help_file_name(), TypedDatabaseCallback::get_info(), get_local_help_url(), get_match_hinfo_formatted(), get_match_info_formatted(), get_match_overlay(), List< Type >::get_next(), List< Type >::get_prev(), Pair::get_primers(), Pair::get_result(), get_taxonomy(), get_taxonomy_string(), get_upgroup(), get_upper_lower_cursor_pos(), ResourceStack::getEdge(), getenv_executable(), getenv_existing_directory(), getHitInfo(), ResourceStack::getNode(), getparamlist(), getParsedFontPart(), gets_noOverflow(), GS_calc_resulting_groupname(), ignore_arb_prop(), GenerationDuplicates::insert(), List< Type >::insert_after_current(), List< Type >::insert_at_pos(), List< Type >::insert_before_current(), AWT_translator::isStartOrStopCodon(), kill_verbose(), chartable::SepBaseFreq::lastDifference(), list_keywords(), SaiBoolchainOperator::make(), SaiAciApplicator::make(), makeFromConfigRule(), makeUniqueShortName(), matrix_config_changed_cb(), message_cb(), MG_create_current_field_content(), MG_create_field_content(), MG_export_fields(), MG_update_example(), modsai_cb(), ED4_cursor::move_cursor(), MP_get_comment(), MP_get_probes(), MP_is_probe(), ArbImporter::next_file(), NT_count_different_chars(), revcomp_op::operate(), unalign_op::operate(), shift_op::operate(), AttributeParser::parse(), AW_root::peek_key_event(), pngLoad(), AW_device::polygon(), AP_STACK< AP_tree_nlen >::pop(), PRD_strdup(), primer_design_event_go(), Pair::print(), probe_match_event(), propertyName(), ptpd_read_names(), readable_probe(), MultiFastaWriter::readData(), RefEntries::refresh_result_cb(), relative_inside(), List< Type >::remove_pos_from_list(), remove_redundant_translation(), ED4_terminal::resolve_pointer_to_char_pntr(), run_command(), safe_write(), scan_flag_parameter(), scan_keyword_parameter(), scan_long_parameter(), scan_optional_parameter(), scan_string_parameter(), ExportFieldScanner::scanFields(), ED4_manager::search_spec_child_rek(), searchParamsChanged(), set_field_of_queried_cb(), shortenLongString(), Generation::single_in_generation(), SQ_evaluate(), SQ_mark_species(), strndup(), probe_combi_statistic::sub_expected_children(), RegExpr::subexpr_match(), ARB_seqtree::take_seq(), test_address_valid(), SaiBoolRule::to_string(), PartQueue::to_string(), unEscapeString(), ED4_manager::update_bases_and_rebuild_consensi(), and XFER_getFullFTS().

const size_t NO_LINENUMBER_INFO = -1U

Definition at line 134 of file arb_help2xml.cxx.

list<LineAttachedMessage> warnings
static

Definition at line 139 of file arb_help2xml.cxx.

Referenced by ARB_main(), build_consensus_tree(), main(), and TREE_load_to_db().

const char* link_id[]
static
Initial value:
= {
"unknown",
"www",
"www",
"www",
"www",
"email",
"hlp",
"ps",
"pdf",
}

Definition at line 1244 of file arb_help2xml.cxx.