void print_x_stanza (unspos numMasked) { int outputFormat = currParams->outputFormat; switch (outputFormat) { case fmtGfa: case fmtGfaNoScore: print_gfa_generic (currParams->outputFile, 'x', "num_masked=" unsposFmt, numMasked); break; case fmtLav: case fmtLavComment: case fmtLavScore: case fmtLavText: case fmtLavInfScores: print_lav_x_stanza (currParams->outputFile, numMasked); break; case fmtAxt: case fmtAxtComment: case fmtAxtGeneral: case fmtMaf: case fmtMafComment: case fmtMafNoComment: case fmtSoftSam: case fmtSoftSamNoHeader: case fmtHardSam: case fmtHardSamNoHeader: case fmtCigar: case fmtGenpaf: case fmtGenpafNoHeader: case fmtGenpafNameHeader: case fmtGenpafBlast: case fmtGenpafBlastNoHeader: case fmtText: case fmtZeroText: case fmtHspComp: case fmtDiffs: case fmtDiffsNoBlocks: case fmtInfStats: case fmtIdDist: case fmtDeseed: print_generic (currParams->outputFile, "num_masked=" unsposFmt, numMasked); break; case fmtInfScores: case fmtNone: ; // (do nothing) break; default: suicidef ("internal error, in print_x_stanza, outputFormat=%d", outputFormat); } // if (currParams->dotplotFile != NULL) // ; // (do nothing) }
void print_dn(FILE *f, CK_ULONG type, CK_VOID_PTR value, CK_ULONG size, CK_VOID_PTR arg) { print_generic(f, type, value, size, arg); #ifdef HAVE_OPENSSL if(size && value) { X509_NAME *name; name = d2i_X509_NAME(NULL, (const unsigned char **)&value, size); if(name) { BIO *bio = BIO_new(BIO_s_file()); BIO_set_fp(bio, f, BIO_NOCLOSE); fprintf(f, " DN: "); X509_NAME_print(bio, name, XN_FLAG_RFC2253); fprintf(f, "\n"); BIO_free(bio); } } #endif }
void slang_print_tree(const slang_operation *op, int indent) { GLuint i; switch (op->type) { case SLANG_OPER_NONE: spaces(indent); printf("SLANG_OPER_NONE\n"); break; case SLANG_OPER_BLOCK_NO_NEW_SCOPE: spaces(indent); printf("{ locals=%p outer=%p\n", (void*)op->locals, (void*)op->locals->outer_scope); print_generic(op, NULL, indent+3); spaces(indent); printf("}\n"); break; case SLANG_OPER_BLOCK_NEW_SCOPE: spaces(indent); printf("{{ // new scope locals=%p outer=%p: ", (void *) op->locals, (void *) op->locals->outer_scope); for (i = 0; i < op->locals->num_variables; i++) { printf("%s ", (char *) op->locals->variables[i]->a_name); } printf("\n"); print_generic(op, NULL, indent+3); spaces(indent); printf("}}\n"); break; case SLANG_OPER_VARIABLE_DECL: assert(op->num_children == 0 || op->num_children == 1); { slang_variable *v; v = _slang_variable_locate(op->locals, op->a_id, GL_TRUE); if (v) { const slang_variable_scope *scope; spaces(indent); printf("DECL (locals=%p outer=%p) ", (void*)op->locals, (void*) op->locals->outer_scope); print_type(&v->type); printf(" %s (%p)", (char *) op->a_id, (void *) find_var(op->locals, op->a_id)); scope = find_scope(op->locals, op->a_id); printf(" (in scope %p) ", (void *) scope); assert(scope); if (op->num_children == 1) { printf(" :=\n"); slang_print_tree(&op->children[0], indent + 3); } else if (v->initializer) { printf(" := INITIALIZER\n"); slang_print_tree(v->initializer, indent + 3); } else { printf(";\n"); } /* spaces(indent); printf("TYPE: "); print_type(&v->type); spaces(indent); printf("ADDR: %d size: %d\n", v->address, v->size); */ } else { spaces(indent); printf("DECL %s (anonymous variable!!!!)\n", (char *) op->a_id); } } break; case SLANG_OPER_ASM: spaces(indent); printf("ASM: %s at %p locals=%p outer=%p\n", (char *) op->a_id, (void *) op, (void *) op->locals, (void *) op->locals->outer_scope); print_generic(op, "ASM", indent+3); break; case SLANG_OPER_BREAK: spaces(indent); printf("BREAK\n"); break; case SLANG_OPER_CONTINUE: spaces(indent); printf("CONTINUE\n"); break; case SLANG_OPER_DISCARD: spaces(indent); printf("DISCARD\n"); break; case SLANG_OPER_RETURN: spaces(indent); printf("RETURN\n"); if (op->num_children > 0) slang_print_tree(&op->children[0], indent + 3); break; case SLANG_OPER_LABEL: spaces(indent); printf("LABEL %s\n", (char *) op->a_id); break; case SLANG_OPER_EXPRESSION: spaces(indent); printf("EXPR: locals=%p outer=%p\n", (void *) op->locals, (void *) op->locals->outer_scope); /*print_generic(op, "SLANG_OPER_EXPRESSION", indent);*/ slang_print_tree(&op->children[0], indent + 3); break; case SLANG_OPER_IF: spaces(indent); printf("IF\n"); slang_print_tree(&op->children[0], indent + 3); spaces(indent); printf("THEN\n"); slang_print_tree(&op->children[1], indent + 3); spaces(indent); printf("ELSE\n"); slang_print_tree(&op->children[2], indent + 3); spaces(indent); printf("ENDIF\n"); break; case SLANG_OPER_WHILE: assert(op->num_children == 2); spaces(indent); printf("WHILE LOOP: locals = %p\n", (void *) op->locals); indent += 3; spaces(indent); printf("WHILE cond:\n"); slang_print_tree(&op->children[0], indent + 3); spaces(indent); printf("WHILE body:\n"); slang_print_tree(&op->children[1], indent + 3); indent -= 3; spaces(indent); printf("END WHILE LOOP\n"); break; case SLANG_OPER_DO: spaces(indent); printf("DO LOOP: locals = %p\n", (void *) op->locals); indent += 3; spaces(indent); printf("DO body:\n"); slang_print_tree(&op->children[0], indent + 3); spaces(indent); printf("DO cond:\n"); slang_print_tree(&op->children[1], indent + 3); indent -= 3; spaces(indent); printf("END DO LOOP\n"); break; case SLANG_OPER_FOR: spaces(indent); printf("FOR LOOP: locals = %p\n", (void *) op->locals); indent += 3; spaces(indent); printf("FOR init:\n"); slang_print_tree(&op->children[0], indent + 3); spaces(indent); printf("FOR condition:\n"); slang_print_tree(&op->children[1], indent + 3); spaces(indent); printf("FOR step:\n"); slang_print_tree(&op->children[2], indent + 3); spaces(indent); printf("FOR body:\n"); slang_print_tree(&op->children[3], indent + 3); indent -= 3; spaces(indent); printf("ENDFOR\n"); /* print_generic(op, "FOR", indent + 3); */ break; case SLANG_OPER_VOID: spaces(indent); printf("(oper-void)\n"); break; case SLANG_OPER_LITERAL_BOOL: spaces(indent); printf("LITERAL ("); for (i = 0; i < op->literal_size; i++) printf("%s ", op->literal[0] ? "TRUE" : "FALSE"); printf(")\n"); break; case SLANG_OPER_LITERAL_INT: spaces(indent); printf("LITERAL ("); for (i = 0; i < op->literal_size; i++) printf("%d ", (int) op->literal[i]); printf(")\n"); break; case SLANG_OPER_LITERAL_FLOAT: spaces(indent); printf("LITERAL ("); for (i = 0; i < op->literal_size; i++) printf("%f ", op->literal[i]); printf(")\n"); break; case SLANG_OPER_IDENTIFIER: { const slang_variable_scope *scope; spaces(indent); if (op->var && op->var->a_name) { scope = find_scope(op->locals, op->var->a_name); printf("VAR %s (in scope %p)\n", (char *) op->var->a_name, (void *) scope); assert(scope); } else { scope = find_scope(op->locals, op->a_id); printf("VAR' %s (in scope %p) locals=%p outer=%p\n", (char *) op->a_id, (void *) scope, (void *) op->locals, (void *) op->locals->outer_scope); assert(scope); } } break; case SLANG_OPER_SEQUENCE: print_generic(op, "COMMA-SEQ", indent+3); break; case SLANG_OPER_ASSIGN: spaces(indent); printf("ASSIGNMENT locals=%p outer=%p\n", (void *) op->locals, (void *) op->locals->outer_scope); print_binary(op, ":=", indent); break; case SLANG_OPER_ADDASSIGN: spaces(indent); printf("ASSIGN\n"); print_binary(op, "+=", indent); break; case SLANG_OPER_SUBASSIGN: spaces(indent); printf("ASSIGN\n"); print_binary(op, "-=", indent); break; case SLANG_OPER_MULASSIGN: spaces(indent); printf("ASSIGN\n"); print_binary(op, "*=", indent); break; case SLANG_OPER_DIVASSIGN: spaces(indent); printf("ASSIGN\n"); print_binary(op, "/=", indent); break; /*SLANG_OPER_MODASSIGN,*/ /*SLANG_OPER_LSHASSIGN,*/ /*SLANG_OPER_RSHASSIGN,*/ /*SLANG_OPER_ORASSIGN,*/ /*SLANG_OPER_XORASSIGN,*/ /*SLANG_OPER_ANDASSIGN,*/ case SLANG_OPER_SELECT: spaces(indent); printf("SLANG_OPER_SELECT n=%d\n", op->num_children); assert(op->num_children == 3); slang_print_tree(&op->children[0], indent+3); spaces(indent); printf("?\n"); slang_print_tree(&op->children[1], indent+3); spaces(indent); printf(":\n"); slang_print_tree(&op->children[2], indent+3); break; case SLANG_OPER_LOGICALOR: print_binary(op, "||", indent); break; case SLANG_OPER_LOGICALXOR: print_binary(op, "^^", indent); break; case SLANG_OPER_LOGICALAND: print_binary(op, "&&", indent); break; /*SLANG_OPER_BITOR*/ /*SLANG_OPER_BITXOR*/ /*SLANG_OPER_BITAND*/ case SLANG_OPER_EQUAL: print_binary(op, "==", indent); break; case SLANG_OPER_NOTEQUAL: print_binary(op, "!=", indent); break; case SLANG_OPER_LESS: print_binary(op, "<", indent); break; case SLANG_OPER_GREATER: print_binary(op, ">", indent); break; case SLANG_OPER_LESSEQUAL: print_binary(op, "<=", indent); break; case SLANG_OPER_GREATEREQUAL: print_binary(op, ">=", indent); break; /*SLANG_OPER_LSHIFT*/ /*SLANG_OPER_RSHIFT*/ case SLANG_OPER_ADD: print_binary(op, "+", indent); break; case SLANG_OPER_SUBTRACT: print_binary(op, "-", indent); break; case SLANG_OPER_MULTIPLY: print_binary(op, "*", indent); break; case SLANG_OPER_DIVIDE: print_binary(op, "/", indent); break; /*SLANG_OPER_MODULUS*/ case SLANG_OPER_PREINCREMENT: spaces(indent); printf("PRE++\n"); slang_print_tree(&op->children[0], indent+3); break; case SLANG_OPER_PREDECREMENT: spaces(indent); printf("PRE--\n"); slang_print_tree(&op->children[0], indent+3); break; case SLANG_OPER_PLUS: spaces(indent); printf("SLANG_OPER_PLUS\n"); break; case SLANG_OPER_MINUS: spaces(indent); printf("SLANG_OPER_MINUS\n"); break; /*SLANG_OPER_COMPLEMENT*/ case SLANG_OPER_NOT: spaces(indent); printf("NOT\n"); slang_print_tree(&op->children[0], indent+3); break; case SLANG_OPER_SUBSCRIPT: spaces(indent); printf("SLANG_OPER_SUBSCRIPT locals=%p outer=%p\n", (void *) op->locals, (void *) op->locals->outer_scope); print_generic(op, NULL, indent+3); break; case SLANG_OPER_CALL: #if 0 slang_function *fun = _slang_function_locate(A->space.funcs, oper->a_id, oper->children, oper->num_children, &A->space, A->atoms); #endif spaces(indent); printf("CALL %s(\n", (char *) op->a_id); for (i = 0; i < op->num_children; i++) { slang_print_tree(&op->children[i], indent+3); if (i + 1 < op->num_children) { spaces(indent + 3); printf(",\n"); } } spaces(indent); printf(")\n"); break; case SLANG_OPER_METHOD: spaces(indent); printf("METHOD CALL %s.%s\n", (char *) op->a_obj, (char *) op->a_id); break; case SLANG_OPER_FIELD: spaces(indent); printf("FIELD %s of\n", (char*) op->a_id); slang_print_tree(&op->children[0], indent+3); break; case SLANG_OPER_POSTINCREMENT: spaces(indent); printf("POST++\n"); slang_print_tree(&op->children[0], indent+3); break; case SLANG_OPER_POSTDECREMENT: spaces(indent); printf("POST--\n"); slang_print_tree(&op->children[0], indent+3); break; default: printf("unknown op->type %d\n", (int) op->type); } }
void print_match (unspos pos1, unspos pos2, unspos length, score s) // pos1 and pos2 are the positions of first character in the match, // .. (origin-0). { static u32 printsUntilFlush = matchFlushFrequency; int outputFormat = currParams->outputFormat; if ((currParams->searchLimit > 0) && (printedForQuery >= currParams->searchLimit)) return; printedForQuery++; if (!strandHeaderPrinted) { print_header (); strandHeaderPrinted = true; } if (infer_scores_dbgShowIdentity) { unspos numer, denom; u32 bin; segment_identity (currParams->seq1, pos1, currParams->seq2, pos2, length, &numer, &denom); bin = identity_bin (numer, denom); // nota bene: positions written as 1-based print_generic (currParams->outputFile, unsposSlashFmt " pct_identity=" unsposSlashFmt " (bin as " identityBinFormat ")", pos1+1, pos2+1, numer, denom, bin_to_identity (bin)); } switch (outputFormat) { case fmtGfa: case fmtGfaNoScore: print_gfa_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, (outputFormat == fmtGfa)? s : 0); break; case fmtLav: case fmtLavComment: case fmtLavText: case fmtLavInfScores: print_lav_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s); if (outputFormat == fmtLavText) goto text_format; if (outputFormat == fmtLavInfScores) goto inf_scores_format; break; case fmtLavScore: print_lavscore_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s); break; case fmtAxt: case fmtAxtComment: print_axt_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, /* comments */ outputFormat==fmtAxtComment, /* extras */ NULL); break; case fmtAxtGeneral: print_axt_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, /* comments */ false, /* extras */ currParams->outputInfo); break; case fmtMaf: case fmtMafNoComment: print_maf_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, /* comments */ false); break; case fmtMafComment: print_maf_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, /* comments */ true); break; case fmtSoftSam: case fmtSoftSamNoHeader: print_sam_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, /* softMasking */ true, currParams->samRGTags); break; case fmtHardSam: case fmtHardSamNoHeader: print_sam_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, /* softMasking */ false, currParams->samRGTags); break; case fmtCigar: print_cigar_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, /* withInfo */ true, /* markMismatches */ false, /* letterAfter */ false, /* hideSingles */ false, /* lowerCase */ false, /* withNewLine */ true); break; case fmtGenpaf: case fmtGenpafNoHeader: case fmtGenpafNameHeader: case fmtGenpafBlast: case fmtGenpafBlastNoHeader: print_genpaf_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, currParams->outputInfo); break; case fmtText: case fmtZeroText: text_format: print_text_align_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, (outputFormat!=fmtZeroText), currParams->textContext); break; case fmtDiffs: case fmtDiffsNoBlocks: print_align_diffs_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, (outputFormat == fmtDiffs), currParams->nIsAmbiguous); break; case fmtHspComp: print_match_composition (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, currParams->hitSeed, currParams->step); break; case fmtInfStats: infer_stats_from_match (currParams->seq1, pos1, currParams->seq2, pos2, length); break; case fmtInfScores: inf_scores_format: gather_stats_from_match (currParams->seq1, pos1, currParams->seq2, pos2, length); break; case fmtIdDist: identity_dist_from_match (currParams->seq1, pos1, currParams->seq2, pos2, length); break; case fmtDeseed: dump_match (currParams->outputFile, currParams->seq1, pos1, currParams->seq2, pos2, length); printf ("\n"); break; case fmtNone: ; // (do nothing) break; default: suicidef ("internal error, in print_match, outputFormat=%d", outputFormat); } if (currParams->dotplotFile != NULL) print_genpaf_match (currParams->dotplotFile, currParams->seq1, pos1, currParams->seq2, pos2, length, s, currParams->dotplotKeys); if (--printsUntilFlush == 0) { fflush (currParams->outputFile); printsUntilFlush = matchFlushFrequency; } }
void print_align_list (alignel* alignList) { int outputFormat = currParams->outputFormat; alignel* a; if ((currParams->searchLimit > 0) && (printedForQuery >= currParams->searchLimit)) return; printedForQuery++; if (!strandHeaderPrinted) { print_header (); strandHeaderPrinted = true; } if (infer_scores_dbgShowIdentity) { unspos numer, denom; u32 bin; for (a=alignList ; a!=NULL ; a=a->next) { alignment_identity (currParams->seq1, currParams->seq2, a, &numer, &denom); bin = identity_bin (numer, denom); // nota bene: positions written as 1-based print_generic (currParams->outputFile, unsposSlashFmt " pct_identity=" unsposSlashFmt " (bin as " identityBinFormat ")", a->beg1, a->beg2, numer, denom, bin_to_identity (bin)); } } switch (outputFormat) { case fmtGfa: case fmtGfaNoScore: print_gfa_align_list (currParams->outputFile, (outputFormat == fmtGfa)? currParams->scoring : NULL, alignList, currParams->seq1, currParams->seq2); break; case fmtLav: case fmtLavComment: case fmtLavScore: case fmtLavInfScores: print_lav_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2); if (outputFormat == fmtLavInfScores) goto inf_scores_format; break; case fmtLavText: for (a=alignList ; a!=NULL ; a=a->next) { print_lav_align (currParams->outputFile, a->seq1, a->beg1-1, a->end1, a->seq2, a->beg2-1, a->end2, a->script, a->s); print_text_align_align (currParams->outputFile, currParams->seq1, a->beg1-1, a->end1, currParams->seq2, a->beg2-1, a->end2, a->script, a->s, false, currParams->textContext); } break; case fmtAxt: case fmtAxtComment: print_axt_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, /* comments */ outputFormat==fmtAxtComment, /* extras */ NULL); break; case fmtAxtGeneral: print_axt_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, /* comments */ false, /* extras */ currParams->outputInfo); break; case fmtMaf: case fmtMafNoComment: print_maf_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, /* comments */ false); break; case fmtMafComment: print_maf_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, /* comments */ true); break; case fmtSoftSam: case fmtSoftSamNoHeader: print_sam_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, /* softMasking */ true, currParams->samRGTags); break; case fmtHardSam: case fmtHardSamNoHeader: print_sam_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, /* softMasking */ false, currParams->samRGTags); break; case fmtCigar: print_cigar_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, /* withInfo */ true, /* markMismatches */ false, /* letterAfter */ false, /* hideSingles */ false, /* lowerCase */ false, /* withNewLine */ true); break; case fmtGenpaf: case fmtGenpafNoHeader: case fmtGenpafNameHeader: case fmtGenpafBlast: case fmtGenpafBlastNoHeader: print_genpaf_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, currParams->outputInfo); break; case fmtText: case fmtZeroText: print_text_align_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, (outputFormat!=fmtZeroText), currParams->textContext); break; case fmtDiffs: case fmtDiffsNoBlocks: print_align_diffs_align_list (currParams->outputFile, alignList, currParams->seq1, currParams->seq2, (outputFormat == fmtDiffs), currParams->nIsAmbiguous); break; case fmtInfStats: infer_stats_from_align_list (alignList, currParams->seq1, currParams->seq2); break; case fmtInfScores: inf_scores_format: gather_stats_from_align_list (alignList, currParams->seq1, currParams->seq2); break; case fmtIdDist: identity_dist_from_align_list (alignList, currParams->seq1, currParams->seq2); break; case fmtHspComp: case fmtDeseed: case fmtNone: ; // (do nothing) break; default: suicidef ("internal error, in print_align_list, outputFormat=%d", outputFormat); } if (currParams->dotplotFile != NULL) print_genpaf_align_list_segments (currParams->dotplotFile, alignList, currParams->seq1, currParams->seq2, currParams->dotplotKeys, currParams->scoring); }