bool ContextMerge::parseCmdArgs(int argc, char **argv, int skipFirstArgs) { _argc = argc; _argv = argv; _skipFirstArgs = skipFirstArgs; setProgram(_programNames[argv[0]]); _argsProcessed.resize(_argc - _skipFirstArgs, false); for (_i=_skipFirstArgs; _i < argc; _i++) { if (isUsed(_i - _skipFirstArgs)) { continue; } else if (strcmp(_argv[_i], "-n") == 0) { if (!handle_n()) return false; } else if (strcmp(_argv[_i], "-nms") == 0) { if (!handle_nms()) return false; } else if (strcmp(_argv[_i], "-scores") == 0) { if (!handle_scores()) return false; } else if (strcmp(_argv[_i], "-delim") == 0) { if (!handle_delim()) return false; } else if (strcmp(_argv[_i], "-d") == 0) { if (!handle_d()) return false; } else if (strcmp(_argv[_i], "-s") == 0) { if (!handle_s()) return false; } else if (strcmp(_argv[_i], "-S") == 0) { if (!handle_S()) return false; } } return ContextBase::parseCmdArgs(argc, argv, _skipFirstArgs); }
// Parse an inline, advancing subject, and add it as a child of parent. // Return 0 if no inline can be parsed, 1 otherwise. static int parse_inline(subject* subj, cmark_node * parent, int options) { cmark_node* new_inl = NULL; cmark_chunk contents; unsigned char c; int endpos; c = peek_char(subj); if (c == 0) { return 0; } switch(c) { case '\n': new_inl = handle_newline(subj); break; case '`': new_inl = handle_backticks(subj); break; case '\\': new_inl = handle_backslash(subj); break; case '&': new_inl = handle_entity(subj); break; case '<': new_inl = handle_pointy_brace(subj); break; case '*': case '_': case '\'': case '"': new_inl = handle_delim(subj, c, options & CMARK_OPT_SMART); break; case '-': new_inl = handle_hyphen(subj, options & CMARK_OPT_SMART); break; case '.': new_inl = handle_period(subj, options & CMARK_OPT_SMART); break; case '[': advance(subj); new_inl = make_str(cmark_chunk_literal("[")); push_delimiter(subj, '[', true, false, new_inl); break; case ']': new_inl = handle_close_bracket(subj, parent); break; case '!': advance(subj); if (peek_char(subj) == '[') { advance(subj); new_inl = make_str(cmark_chunk_literal("![")); push_delimiter(subj, '!', false, true, new_inl); } else { new_inl = make_str(cmark_chunk_literal("!")); } break; default: endpos = subject_find_special_char(subj, options); contents = cmark_chunk_dup(&subj->input, subj->pos, endpos - subj->pos); subj->pos = endpos; // if we're at a newline, strip trailing spaces. if (peek_char(subj) == '\n') { cmark_chunk_rtrim(&contents); } new_inl = make_str(contents); } if (new_inl != NULL) { cmark_node_append_child(parent, new_inl); } return 1; }
bool ContextBase::parseCmdArgs(int argc, char **argv, int skipFirstArgs) { for (_i=_skipFirstArgs; _i < argc; _i++) { if (isUsed(_i - _skipFirstArgs)) { continue; } if (strcmp(_argv[_i], "-i") == 0) { if (!handle_i()) return false; } else if (strcmp(_argv[_i], "-g") == 0) { if (!handle_g()) return false; } else if ((strcmp(_argv[_i], "-h") == 0) || (strcmp(_argv[_i], "--help") == 0)) { if (!handle_h()) return false; } else if (strcmp(_argv[_i], "-split") == 0) { if (!handle_split()) return false; } else if (strcmp(_argv[_i], "-bed") == 0) { if (!handle_bed()) return false; } else if (strcmp(_argv[_i], "-ubam") == 0) { if (!handle_ubam()) return false; } else if (strcmp(_argv[_i], "-fbam") == 0) { if (!handle_fbam()) return false; } else if(strcmp(_argv[_i], "-sorted") == 0) { if (!handle_sorted()) return false; } else if (strcmp(_argv[_i], "-nobuf") == 0) { if (!handle_nobuf()) return false; } else if (strcmp(_argv[_i], "-iobuf") == 0) { if (!handle_iobuf()) return false; } else if (strcmp(_argv[_i], "-prec") == 0) { if (!handle_prec()) return false; } else if (strcmp(_argv[_i], "-header") == 0) { if (!handle_header()) return false; } else if (strcmp(_argv[_i], "-n") == 0) { if (!handle_n()) return false; } else if (strcmp(_argv[_i], "-seed") == 0) { if (!handle_seed()) return false; } else if ((strcmp(_argv[_i], "-o") == 0) || (strcmp(_argv[_i], "-ops") == 0)) { if (!handle_o()) return false; } else if ((strcmp(_argv[_i], "-c") == 0) || (strcmp(_argv[_i], "-opCols") == 0)) { if (!handle_c()) return false; } else if (strcmp(_argv[_i], "-null") == 0) { if (!handle_null()) return false; } else if (strcmp(_argv[_i], "-delim") == 0) { if (!handle_delim()) return false; } else if (strcmp(_argv[_i], "-sortout") == 0) { if (!handle_sortout()) return false; } else if (strcmp(_argv[_i], "-nonamecheck") == 0) { if (!handle_nonamecheck()) return false; } } return true; }
bool ContextBase::parseCmdArgs(int argc, char **argv, int skipFirstArgs) { _argc = argc; _argv = argv; _skipFirstArgs = skipFirstArgs; if (_argc < 2) { setShowHelp(true); return false; } setProgram(_programNames[argv[0]]); _argsProcessed.resize(_argc - _skipFirstArgs, false); for (_i=_skipFirstArgs; _i < argc; _i++) { if (isUsed(_i - _skipFirstArgs)) { continue; } if (strcmp(_argv[_i], "-i") == 0) { if (!handle_i()) return false; } else if (strcmp(_argv[_i], "-g") == 0) { if (!handle_g()) return false; } else if ((strcmp(_argv[_i], "-h") == 0) || (strcmp(_argv[_i], "--help") == 0)) { if (!handle_h()) return false; } else if (strcmp(_argv[_i], "-split") == 0) { if (!handle_split()) return false; } else if (strcmp(_argv[_i], "-bed") == 0) { if (!handle_bed()) return false; } else if (strcmp(_argv[_i], "-ubam") == 0) { if (!handle_ubam()) return false; } else if (strcmp(_argv[_i], "-fbam") == 0) { if (!handle_fbam()) return false; } else if(strcmp(_argv[_i], "-sorted") == 0) { if (!handle_sorted()) return false; } else if (strcmp(_argv[_i], "-nobuf") == 0) { if (!handle_nobuf()) return false; } else if (strcmp(_argv[_i], "-iobuf") == 0) { if (!handle_iobuf()) return false; } else if (strcmp(_argv[_i], "-header") == 0) { if (!handle_header()) return false; } else if (strcmp(_argv[_i], "-n") == 0) { if (!handle_n()) return false; } else if (strcmp(_argv[_i], "-seed") == 0) { if (!handle_seed()) return false; } else if (strcmp(_argv[_i], "-o") == 0) { if (!handle_o()) return false; } else if (strcmp(_argv[_i], "-c") == 0) { if (!handle_c()) return false; } else if (strcmp(_argv[_i], "-null") == 0) { if (!handle_null()) return false; } else if (strcmp(_argv[_i], "-delim") == 0) { if (!handle_delim()) return false; } } return true; }