• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RC函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RC函数的典型用法代码示例。如果您正苦于以下问题:C++ RC函数的具体用法?C++ RC怎么用?C++ RC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RC函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: matcher_execute

rc_t matcher_execute( matcher* self, const p_matcher_input in )
{
    VSchema * dflt_schema;
    const VTable * src_table;
    rc_t rc;

    if ( self == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcSelf, rcNull );
    if ( in->manager == NULL || in->add_schemas == NULL || 
         in->cfg == NULL || in->columns == NULL || 
         in->src_path == NULL || in->dst_path == NULL ||
         in->dst_tabname == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcParam, rcNull );

    rc = matcher_build_column_vector( self, in->columns );
    if ( rc != 0 ) return rc;

    rc = matcher_exclude_columns( self, in->excluded_columns );
    if ( rc != 0 ) return rc;

    rc = helper_parse_schema( in->manager, &dflt_schema, in->add_schemas );
    if ( rc != 0 ) return rc;

    rc = VDBManagerOpenTableRead( in->manager, &src_table, dflt_schema, "%s", in->src_path );
    if ( rc == 0 )
    {
        const VSchema * src_schema;
        rc = VTableOpenSchema ( src_table, &src_schema );
        if ( rc == 0 )
        {
            rc = matcher_read_src_types( self, src_table, src_schema );
            if ( rc == 0 )
            {
                if ( in->legacy_schema != NULL )
                    rc = VSchemaParseFile ( dflt_schema, "%s", in->legacy_schema );
                if ( rc == 0 )
                {
                    VTable * dst_table;
                    KCreateMode cmode = kcmParents;
                    const VSchema * dst_schema = src_schema;

                    if ( in->legacy_schema != NULL )
                        dst_schema = dflt_schema;

                    if ( in->force_unlock )
                        VDBManagerUnlock ( in->manager, "%s", in->dst_path );

                    if ( in->force_kcmInit )
                        cmode |= kcmInit;
                    else
                        cmode |= kcmCreate;

                    rc = VDBManagerCreateTable( in->manager, &dst_table, 
                                                dst_schema, in->dst_tabname, cmode, "%s", in->dst_path );

                    if ( rc == 0 )
                    {
                        rc = matcher_read_dst_types( self, dst_table, dst_schema );
                        if ( rc == 0 )
                        {
                            rc = matcher_make_type_matrix( self );
                            if ( rc == 0 )
                                rc = matcher_match_matrix( self, src_schema, in->cfg );
                        }
                        VTableRelease( dst_table );
                        if ( !(in->force_kcmInit) )
                            KDirectoryRemove ( in->dir, true, "%s", in->dst_path );
                    }
                }
            }
            VSchemaRelease( src_schema );
        }
        VTableRelease( src_table );
    }
    VSchemaRelease( dflt_schema );
    return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:77,代码来源:type_matcher.c


示例2: MakeIndexes

static
rc_t MakeIndexes(const SRATable* stbl, KTable* ktbl, KMetadata* meta)
{
    rc_t rc = 0;
    int i;
    char* buffer = NULL;
    size_t buffer_sz = g_file_block_sz * 100;

    SIndexObj idx[] = {
     /*  meta, file,        format,         index,          func,    file_size, buffer_sz, minSpotId, maxSpotId */
        {NULL, "fastq",    "fastq",      "fuse-fastq",    Fastq_Idx,     0, 0, 0, 0},
        {NULL, "sff",      "SFF",        "fuse-sff",      SFF_Idx,       0, 0, 0, 0},
        {NULL, "fastq.gz", "fastq-gzip", "fuse-fastq-gz", FastqGzip_Idx, 0, 0, 0, 0},
        {NULL, "sff.gz",   "SFF-gzip",   "fuse-sff-gz",   SFFGzip_Idx,   0, 0, 0, 0}
    };

    for(i = 0; rc == 0 && i < sizeof(idx) / sizeof(idx[0]); i++) {
        KMDataNode* parent = NULL;
        if( (rc = KMetadataOpenNodeUpdate(meta, &parent, "/FUSE")) == 0 ) {
            KMDataNodeDropChild(parent, "root"); /* drop old stuff */
            if( g_ungzip || strcmp(&idx[i].file[strlen(idx[i].file) - 3], ".gz") == 0 ) {
                STSMSG(0, ("Preparing index %s", idx[i].index));
                MD5StateInit(&idx[i].md5);
                SLListInit(&idx[i].li);
                KMDataNodeDropChild(parent, "%s.tmp", idx[i].file);
                if( (rc = KMDataNodeOpenNodeUpdate(parent, &idx[i].meta, "%s.tmp", idx[i].file)) == 0 ) {
                    if( idx[i].func != NULL ) {
                        if( buffer == NULL ) {
                            if( (buffer = malloc(buffer_sz)) == NULL ) {
                                rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
                                break;
                            }
                        }
                        rc = idx[i].func(stbl, &idx[i], buffer, buffer_sz);
                        if( rc == 0 ) {
                            MD5StateFinish(&idx[i].md5, idx[i].md5_digest);
                            rc = CommitIndex(ktbl, idx[i].index, &idx[i].li);
                        }
                    }
                    if( rc == 0 ) {
                        rc = WriteFileMeta(&idx[i]);
                    }
                    KMDataNodeRelease(idx[i].meta);
                }
                if( GetRCState(rc) == rcUnsupported ) {
                    KMDataNodeDropChild(parent, "%s", idx[i].file);
                    PLOGERR(klogWarn, (klogWarn, rc, "Index $(i) is not supported for this table", PLOG_S(i), idx[i].index));
                    rc = 0;
                } else if( rc == 0 ) {
                    char f[4096];
                    strcpy(f, idx[i].file);
                    strcat(f, ".tmp");
                    KMDataNodeDropChild(parent, "%s", idx[i].file);
                    rc = KMDataNodeRenameChild(parent, f, idx[i].file);
                }
            } else if( !g_ungzip ) {
                KTableDropIndex(ktbl, idx[i].index);
                KMDataNodeDropChild(parent, "%s", idx[i].file);
            }
            KMDataNodeDropChild(parent, "%s.tmp", idx[i].file);
            KMDataNodeRelease(parent);
        }
        SLListWhack(&idx[i].li, WhackIndexData, NULL);
    }
    free(buffer);
    return rc;
}
开发者ID:ncbi,项目名称:sra-tools,代码行数:67,代码来源:sra-makeidx.c


示例3: SFF_Idx

static
rc_t SFF_Idx(const SRATable* sratbl, SIndexObj* obj, char* buffer, const size_t buffer_sz)
{
    rc_t rc = 0;
    const SFFReader* reader = NULL;

    if( (rc = SFFReaderMake(&reader, sratbl, g_accession, obj->minSpotId, obj->maxSpotId)) != 0 ) {
        return rc;
    } else {
        size_t written = 0;
        uint32_t blk = 0;
        SIndexNode* inode = NULL;

        while( rc == 0 ) {
            rc = SFFReader_GetNextSpotData(reader, buffer, buffer_sz, &written);
            if( blk >= g_file_block_sz || (GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted) ) {
                inode->key_size = blk;
                SLListPushTail(&obj->li, &inode->n);
                DEBUG_MSG(5, ("SFF index closed spots %lu, offset %lu, block size %lu\n", inode->id_qty, inode->key, inode->key_size));
                inode = NULL;
                if( blk > obj->buffer_sz ) {
                    obj->buffer_sz = blk;
                }
                blk = 0;
            }
            if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted ) {
                rc = 0;
                break;
            }
            if( inode == NULL ) {
                spotid_t spotid = 0;
                if( (rc = SFFReaderCurrentSpot(reader, &spotid)) != 0 ) {
                    break;
                }
                inode = malloc(sizeof(SIndexNode));
                if( inode == NULL ) {
                    rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
                    break;
                }
                inode->key = obj->file_size;
                inode->key_size = 0;
                inode->id = spotid;
                inode->id_qty = 0;
                DEBUG_MSG(5, ("SFF index opened spot %ld, offset %lu\n", inode->id, inode->key));
                if( spotid == 1 ) {
                    char hd[10240];
                    size_t hd_sz = 0;
                    if( (rc = SFFReaderHeader(reader, 0, hd, sizeof(hd), &hd_sz)) == 0 ) {
                        obj->file_size += hd_sz;
                        blk += hd_sz;
                        MD5StateAppend(&obj->md5, hd, hd_sz);
                        if( g_dump ) {
                            fwrite(hd, hd_sz, 1, stderr);
                        }
                    }
                }
            }
            obj->file_size += written;
            blk += written;
            inode->id_qty++;
            MD5StateAppend(&obj->md5, buffer, written);
            if( g_dump ) {
                fwrite(buffer, written, 1, stderr);
            }
        }
        rc = rc ? rc : Quitting();
        if( rc != 0 ) {
            spotid_t spot = 0;
            SFFReaderCurrentSpot(reader, &spot);
            PLOGERR(klogErr, (klogErr, rc, "spot $(s)", PLOG_U32(s), spot));
        }
    }
    SFFReaderWhack(reader);
    return rc;
}
开发者ID:ncbi,项目名称:sra-tools,代码行数:75,代码来源:sra-makeidx.c


示例4: Fastq_Idx

static
rc_t Fastq_Idx(const SRATable* sratbl, SIndexObj* obj, char* buffer, const size_t buffer_sz)
{
    rc_t rc = 0;
    const FastqReader* reader = NULL;

    uint8_t colorSpace = false;
    char* colorSpaceKey = "\0";
    uint8_t origFormat = false;
    uint8_t printLabel = true;
    uint8_t printReadId = true;
    uint8_t clipQuality = true;
    uint32_t minReadLen = 0;
    uint16_t qualityOffset = 0;

    {{
        const SRAColumn* c = NULL;
        const uint8_t *platform = SRA_PLATFORM_UNDEFINED;
        bitsz_t o, z;

        if( (rc = SRATableOpenColumnRead(sratbl, &c, "PLATFORM", sra_platform_id_t)) != 0 ) {
            return rc;
        }
        if( (rc = SRAColumnRead(c, 1, (const void **)&platform, &o, &z)) != 0 ) {
            return rc;
        }
        if( *platform == SRA_PLATFORM_ABSOLID ) {
            colorSpace = true;
        }
        SRAColumnRelease(c);
    }}

    if( (rc = FastqReaderMake(&reader, sratbl, g_accession,
                        colorSpace, origFormat, false, printLabel, printReadId,
                        !clipQuality, minReadLen, qualityOffset, colorSpaceKey[0],
                        obj->minSpotId, obj->maxSpotId)) != 0 ) {
        return rc;
    } else {
        KMDataNode* opt = NULL, *nd = NULL;

        if( (rc = KMDataNodeOpenNodeUpdate(obj->meta, &opt, "Format/Options")) != 0 ) {
            return rc;
        }
        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "colorSpace")) == 0 ) {
            rc = KMDataNodeWriteB8(nd, &colorSpace);
            KMDataNodeRelease(nd);
        }
        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "colorSpaceKey")) == 0 ) {
            rc = KMDataNodeWrite(nd, colorSpaceKey, 1);
            KMDataNodeRelease(nd);
        }
        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "origFormat")) == 0 ) {
            rc = KMDataNodeWriteB8(nd, &origFormat);
            KMDataNodeRelease(nd);
        }
        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "printLabel")) == 0 ) {
            rc = KMDataNodeWriteB8(nd, &printLabel);
            KMDataNodeRelease(nd);
        }
        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "printReadId")) == 0 ) {
            rc = KMDataNodeWriteB8(nd, &printReadId);
            KMDataNodeRelease(nd);
        }
        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "clipQuality")) == 0 ) {
            rc = KMDataNodeWriteB8(nd, &clipQuality);
            KMDataNodeRelease(nd);
        }
        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "minReadLen")) == 0 ) {
            rc = KMDataNodeWriteB32(nd, &minReadLen);
            KMDataNodeRelease(nd);
        }
        if( rc == 0 && (rc = KMDataNodeOpenNodeUpdate(opt, &nd, "qualityOffset")) == 0 ) {
            rc = KMDataNodeWriteB16(nd, &qualityOffset);
            KMDataNodeRelease(nd);
        }
        KMDataNodeRelease(opt);
    }

    if( rc == 0 ) {
        size_t written = 0;
        uint32_t blk = 0;
        SIndexNode* inode = NULL;

        while( rc == 0 ) {
            rc = FastqReader_GetNextSpotSplitData(reader, buffer, buffer_sz, &written);
            if( blk >= g_file_block_sz || (GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted) ) {
                inode->key_size = blk;
                SLListPushTail(&obj->li, &inode->n);
                DEBUG_MSG(5, ("Fastq index closed spots %lu, offset %lu, block size %lu\n",
                                                            inode->id_qty, inode->key, inode->key_size));
                inode = NULL;
                if( blk > obj->buffer_sz ) {
                    obj->buffer_sz = blk;
                }
                blk = 0;
            }
            if( GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted ) {
                rc = 0;
                break;
            }
//.........这里部分代码省略.........
开发者ID:ncbi,项目名称:sra-tools,代码行数:101,代码来源:sra-makeidx.c


示例5: FastqReaderFileGetRecord

rc_t FastqReaderFileGetRecord ( const FastqReaderFile *f, const Record** result )
{
    rc_t rc;
    FastqReaderFile* self = (FastqReaderFile*) f;

    if (self->pb.fatalError)
        return 0;

    self->pb.record = (FastqRecord*)malloc(sizeof(FastqRecord));
    if (self->pb.record == NULL)
    {
        rc = RC ( RC_MODULE, rcData, rcAllocating, rcMemory, rcExhausted );
        return 0;
    }
    rc = FastqRecordInit(self->pb.record);
    if (rc != 0)
        return rc;

    FASTQ_ParseBlockInit( & self->pb );

    if ( FASTQ_parse( & self->pb ) == 0 && self->pb.record->rej == 0 )
    {   /* normal end of input */
        RecordRelease((const Record*)self->pb.record);
        *result = 0;
        return 0;
    }

    /*TODO: remove? compensate for an artificially inserted trailing \n */
    if ( self->eolInserted )
    {
        -- self->pb.length;
        self->eolInserted = false;
    }

    if (self->pb.record->rej != 0) /* had error(s) */
    {   /* save the complete raw source in the Rejected object */
        StringInit(& self->pb.record->rej->source, string_dup(self->recordStart, self->pb.length), self->pb.length, (uint32_t)self->pb.length);
        self->pb.record->rej->fatal = self->pb.fatalError;
    }

    if (rc == 0 && self->reader != 0)
    {
        /* advance the record start pointer beyond the last token */
        size_t length;
        rc = KLoaderFile_Read( self->reader, self->pb.length, 0, (const void**)& self->recordStart, & length);
        if (rc != 0)
            LogErr(klogErr, rc, "FastqReaderFileGetRecord failed");

        self->curPos -= self->pb.length;
    }

    StringInit( & self->pb.record->seq.spotname,    (const char*)self->pb.record->source.base + self->pb.spotNameOffset,    self->pb.spotNameLength, (uint32_t)self->pb.spotNameLength);
    StringInit( & self->pb.record->seq.spotgroup,   (const char*)self->pb.record->source.base + self->pb.spotGroupOffset,   self->pb.spotGroupLength, (uint32_t)self->pb.spotGroupLength);
    StringInit( & self->pb.record->seq.read,        (const char*)self->pb.record->source.base + self->pb.readOffset,        self->pb.readLength, (uint32_t)self->pb.readLength);
    StringInit( & self->pb.record->seq.quality,     (const char*)self->pb.record->source.base + self->pb.qualityOffset,     self->pb.qualityLength, (uint32_t)self->pb.qualityLength);
    self->pb.record->seq.qualityFormat = self->pb.qualityFormat;
    self->pb.record->seq.qualityAsciiOffset = self->pb.qualityAsciiOffset;

    if (self->pb.record->seq.readnumber == 0)
        self->pb.record->seq.readnumber = self->pb.defaultReadNumber;

    *result = (const Record*) self->pb.record;

    return rc;
}
开发者ID:ncbi,项目名称:sra-tools,代码行数:65,代码来源:fastq-reader.c


示例6: RC

 * neither.
 *
 * This list should probably be more configurable, and more than
 * likely on a per-realm basis, so locally-defined services can be
 * added, or not.
 */
static const struct krb_convert sconv_list[] = {
    /* Realm conversion, Change service name */
#define RC(V5NAME,V4NAME) { V5NAME, V4NAME, DO_REALM_CONVERSION, sizeof(V5NAME)-1 }
    /* Realm conversion */
#define R(NAME)         { NAME, NAME, DO_REALM_CONVERSION, sizeof(NAME)-1 }
    /* No Realm conversion */
#define NR(NAME)        { NAME, NAME, 0, sizeof(NAME)-1 }

    NR("kadmin"),
    RC("rcmd", "host"),
    R("discuss"),
    R("rvdsrv"),
    R("sample"),
    R("olc"),
    R("pop"),
    R("sis"),
    R("rfs"),
    R("imap"),
    R("ftp"),
    R("ecat"),
    R("daemon"),
    R("gnats"),
    R("moira"),
    R("prms"),
    R("mandarin"),
开发者ID:Baalmart,项目名称:krb5,代码行数:31,代码来源:conv_princ.c


示例7: align_info

static rc_t align_info(const Params* prm) {
    rc_t rc = 0;

    const VDatabase* db = NULL;
    const VDBManager* mgr = NULL;
    const KDBManager *kmgr = NULL;
    VSchema* schema = NULL;
    bool is_db = false;

    if (prm == NULL)
    {   return RC(rcExe, rcQuery, rcExecuting, rcParam, rcNull); }

    if (rc == 0) {
        rc = VDBManagerMakeRead(&mgr, NULL);
        DISP_RC(rc, "while calling VDBManagerMakeRead");
    }

    if (rc == 0) {
        rc = VDBManagerOpenKDBManagerRead(mgr, &kmgr);
        DISP_RC(rc, "while calling VDBManagerOpenKDBManagerRead");
    }

    if (rc == 0) {
        rc = VDBManagerMakeSRASchema(mgr, &schema);
        DISP_RC(rc, "while calling VDBManagerMakeSRASchema");
    }

    if (rc == 0) {
        rc = VDBManagerOpenDBRead(mgr, &db, schema, prm->dbPath);
        if (rc == 0) {
            is_db = true;
        }
        else if (rc == SILENT_RC(rcDB, rcMgr, rcOpening, rcDatabase, rcIncorrect)) {
            PLOGMSG(klogWarn, (klogWarn,
                "'$(path)' is not a database", "path=%s", prm->dbPath));
            rc = 0;
        }
        else {
            PLOGERR(klogErr,
                (klogErr, rc, "$(path)", "path=%s", prm->dbPath));
        }
    }

    if (is_db) {
        if (rc == 0) {
            if (prm->paramRef) {
                const VDBDependencies* dep = NULL;
                uint32_t count = 0;
                int i = 0;
                if (prm->paramHeaders) {
                    OUTMSG(("Alignments:\n"));
                }
                rc = VDatabaseListDependencies(db, &dep, false);
                DISP_RC2(rc, prm->dbPath,
                    "while calling VDatabaseListDependencies");
                if (rc == 0) {
                    rc = VDBDependenciesCount(dep, &count);
                    DISP_RC2(rc, prm->dbPath,
                        "while calling VDBDependenciesCount");
                }
                for (i = 0; i < count && rc == 0; ++i) {
                    bool circular = false;
                    const char* name = NULL;
                    const char* path = NULL;
                    const char* remote = NULL;
                    bool local = false;
                    const char* seqId = NULL;
                    rc = VDBDependenciesCircular(dep, &circular, i);
                    if (rc != 0) {
                        DISP_RC2(rc, prm->dbPath,
                            "while calling VDBDependenciesCircular");
                        break;
                    }
                    rc = VDBDependenciesName(dep, &name, i);
                    if (rc != 0) {
                        DISP_RC2(rc, prm->dbPath,
                            "while calling VDBDependenciesName");
                        break;
                    }
                    rc = VDBDependenciesPath(dep, &path, i);
                    if (rc != 0) {
                        DISP_RC2(rc, prm->dbPath,
                            "while calling VDBDependenciesPath");
                        break;
                    }
                    rc = VDBDependenciesLocal(dep, &local, i);
                    if (rc != 0) {
                        DISP_RC2(rc, prm->dbPath,
                            "while calling VDBDependenciesLocal");
                        break;
                    }
                    rc = VDBDependenciesSeqId(dep, &seqId, i);
                    if (rc != 0) {
                        DISP_RC2(rc, prm->dbPath,
                            "while calling VDBDependenciesSeqId");
                        break;
                    }
                    rc = VDBDependenciesPathRemote(dep, &remote, i);
                    if (rc != 0) {
                        DISP_RC2(rc, prm->dbPath,
//.........这里部分代码省略.........
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:101,代码来源:align-info.c


示例8: KMain

rc_t CC KMain(int argc, char* argv[]) {
    rc_t rc = 0;
    Args* args = NULL;

    Params prm;
    memset(&prm, 0, sizeof prm);

    do {
        uint32_t pcount = 0;

        rc = ArgsMakeAndHandle(&args, argc, argv, 1,
            Options, sizeof Options / sizeof (OptDef));
        if (rc) {
            LOGERR(klogErr, rc, "While calling ArgsMakeAndHandle");
            break;
        }
        rc = ArgsParamCount(args, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "While calling ArgsParamCount");
            break;
        }
        if (pcount < 1) {
            MiniUsage(args);
            DESTRUCT(Args, args);
            exit(1);
            break;
        }
        if (pcount > 1) {
            rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcAmbiguous);
            LOGERR(klogErr, rc, "Too many database parameters");
            break;
        }
        rc = ArgsParamValue(args, 0, &prm.dbPath);
        if (rc) {
            LOGERR(klogErr, rc, "Failure retrieving database name");
            break;
        }

        rc = ArgsOptionCount (args, OPTION_ALL, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_ALL "' argument");
            break;
        }
        if (pcount)
        {   prm.paramBamHeader = prm.paramQuality = prm.paramRef = true; }

        rc = ArgsOptionCount (args, OPTION_BAM, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_BAM "' argument");
            break;
        }
        if (pcount)
        {   prm.paramBamHeader = true; }

        rc = ArgsOptionCount (args, OPTION_QUA, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_QUA "' argument");
            break;
        }
        if (pcount)
        {   prm.paramQuality = true; }

        rc = ArgsOptionCount (args, OPTION_REF, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_REF "' argument");
            break;
        }
        if (pcount)
        {   prm.paramRef = true; }

        if (!prm.paramBamHeader && !prm.paramQuality && !prm.paramRef)
        {   prm.paramRef = true; }

        rc = ArgsOptionCount (args, OPTION_HEA, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_HEA "' argument");
            break;
        }
        if (pcount) {
            prm.paramHeaders = true;
        }
    } while (false);

    if (rc == 0)
    {   rc = align_info(&prm); }

    DESTRUCT(Args, args);
    return rc;
}
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:89,代码来源:align-info.c


示例9: SFFGzip_Idx

static
rc_t SFFGzip_Idx(const SRATable* sratbl, SIndexObj* obj, char* buffer, const size_t buffer_sz)
{
    rc_t rc = 0;
    uint16_t zlib_ver = ZLIB_VERNUM;
    const SFFReader* reader = NULL;

    if( (rc = SFFReaderMake(&reader, sratbl, g_accession, obj->minSpotId, obj->maxSpotId)) != 0 ) {
        return rc;
    } else {
        size_t written = 0;
        uint32_t blk = 0, spots_per_block = 0, proj_id_qty = 0;
        SIndexNode* inode = NULL;
        size_t z_blk = 0;
        size_t spots_buf_sz = g_file_block_sz * 100;
        size_t zbuf_sz = spots_buf_sz + 100;

        char* zbuf = malloc(zbuf_sz);
        char* spots_buf = malloc(spots_buf_sz);
        bool eof = false;

        if( zbuf == NULL || spots_buf == NULL ) {
            rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
        }
        while( rc == 0 ) {
            if( (rc = SFFReader_GetNextSpotData(reader, buffer, buffer_sz, &written)) == 0 ) {
                if( inode == NULL ) {
                    spotid_t spotid = 0;
                    if( (rc = SFFReaderCurrentSpot(reader, &spotid)) != 0 ) {
                        break;
                    }
                    inode = malloc(sizeof(SIndexNode));
                    if( inode == NULL ) {
                        rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
                        break;
                    }
                    inode->key = obj->file_size;
                    inode->key_size = 0;
                    inode->id = spotid;
                    inode->id_qty = 0;
                    DEBUG_MSG(5, ("%s open key: spot %ld, offset %lu\n", obj->index, inode->id, inode->key));
                    if( spotid == 1 ) {
                        char hd[10240];
                        size_t hd_sz = 0;
                        if( (rc = SFFReaderHeader(reader, 0, hd, sizeof(hd), &hd_sz)) == 0 ) {
                            if( hd_sz + written > spots_buf_sz ) {
                                rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcInsufficient);
                                break;
                            }
                            memmove(&spots_buf[blk], hd, hd_sz);
                            blk += hd_sz;
                            if( g_dump ) {
                                fwrite(hd, hd_sz, 1, stderr);
                            }
                        }
                    }

                }
                if( blk + written > spots_buf_sz ) {
                    rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcInsufficient);
                    break;
                }
                inode->id_qty++;
                memmove(&spots_buf[blk], buffer, written);
                blk += written;
                if( g_dump ) {
                    fwrite(buffer, written, 1, stderr);
                }
            }
            if( (eof = (GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted)) ) {
                rc = 0;
                if( inode == NULL ) {
                    break;
                }
            }
            if( rc == 0 && (eof || 
                            (proj_id_qty == 0 && inode->id_qty > (spots_per_block * 0.95)) || 
                            (proj_id_qty > 0 && inode->id_qty >= proj_id_qty) ) ) {
                rc = ZLib_DeflateBlock(spots_buf, blk, zbuf, zbuf_sz, &z_blk);
                if( z_blk < g_file_block_sz ) {
                    /* project needed id_qty */
                    proj_id_qty = g_file_block_sz * inode->id_qty / z_blk * 1.05;
                    DEBUG_MSG(5, ("%s: project id qty %lu\n", obj->index, proj_id_qty));
                } else {
                    DEBUG_MSG(10, ("%s: no projection %lu > %lu\n", obj->index, z_blk, g_file_block_sz));
                }
            }
            if( rc == 0 && (eof || z_blk >= g_file_block_sz) ) {
                obj->file_size += z_blk;
                MD5StateAppend(&obj->md5, zbuf, z_blk);
                inode->key_size = z_blk;
                SLListPushTail(&obj->li, &inode->n);
                DEBUG_MSG(5, ("%s close key: spots %lu, size %lu, ratio %hu%%, raw %lu\n",
                         obj->index, inode->id_qty, inode->key_size, (uint16_t)(((float)(blk - z_blk)/blk)*100), blk));
                spots_per_block = inode->id_qty;
                inode = NULL;
                if( blk > obj->buffer_sz ) {
                    obj->buffer_sz = blk;
                }
                blk = 0;
//.........这里部分代码省略.........
开发者ID:ncbi,项目名称:sra-tools,代码行数:101,代码来源:sra-makeidx.c


示例10: KNSManagerInitDNSEndpoint

/* InitDNSEndpoint
 *  initialize the endpoint with a DNS name and a port number
 *
 *  "ep" [ OUT ] - address of endpoint block to be intialized
 *
 *  "dns" [ IN ] - textual DNS address.
 *
 *  "port" [ IN, DEFAULT 0 ] - binary port number in native integer byte order.
 *   if the special port number 0 is given, it represents any available port.
 */
LIB_EXPORT
rc_t CC KNSManagerInitDNSEndpoint ( struct KNSManager const *self,
    KEndPoint *ep, struct String const *dns, uint16_t port )
{
    rc_t rc = 0;

    if ( ep == NULL )
        rc = RC (rcNS, rcNoTarg, rcInitializing, rcParam, rcNull );
    else
    {
        if ( self == NULL )
            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcNull );
        else if ( dns == NULL )
            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcParam, rcNull );
        else if ( dns -> size == 0 )
            rc = RC ( rcNS, rcNoTarg, rcInitializing, rcSelf, rcInsufficient );
        else
        {
            KDataBuffer b;
            char buffer [ 4096 ], * hostname = buffer;
            size_t buff_size = sizeof buffer;

            if ( dns -> size >= sizeof buffer )
            {
                rc = KDataBufferMakeBytes ( & b, dns -> size + 1 );
                if ( rc == 0 )
                {
                    hostname = b . base;
                    buff_size = ( size_t ) b . elem_count;
                }
            }

            if ( rc == 0 )
            {
                size_t size;
                rc = string_printf ( hostname, buff_size, & size, "%S", dns );

                assert ( rc == 0 );
                assert ( size < buff_size );
                assert ( hostname [ size ] == 0 );

                if ( rc ==  0 )
                {
                    int lerrno;
                    struct hostent *remote = gethostbyname ( hostname );
                    if ( remote != NULL )
                    { 
                        ep -> type = epIPV4;
                        memcpy ( & ep -> u . ipv4 . addr, remote -> h_addr_list [ 0 ], sizeof ep -> u . ipv4 . addr );
                        ep -> u . ipv4 . addr = htonl ( ep -> u . ipv4 . addr );
                        ep -> u . ipv4 . port = ( uint16_t ) port;
                    }
                    else switch ( lerrno = WSAGetLastError () )
                    {
                    case WSANOTINITIALISED: /* Must have WSAStartup call */
                        rc = RC ( rcNS, rcNoTarg, rcInitializing, rcEnvironment, rcUndefined );
                        break;
                    case WSAENETDOWN:/* network subsystem failed */
                        rc = RC ( rcNS, rcNoTarg, rcInitializing, rcNoObj, rcFailed );
                        break;
                    case WSAHOST_NOT_FOUND: /* Answer host not found */
                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcNotFound );
                        break;
                    case WSATRY_AGAIN: /* host not found or server failure */
                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcBusy );
                        break;
                    case WSANO_RECOVERY: /* non-recoverable error */
                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcError );
                        break;
                    case WSANO_DATA: /* name is valid but no data */
                        rc = RC ( rcNS, rcNoTarg, rcValidating, rcConnection, rcEmpty );
                        break;
                    case WSAEINPROGRESS: /* call is in progress */
                        rc = RC ( rcNS, rcNoTarg, rcReading, rcId, rcUndefined );
                        break;
                    case WSAEFAULT: /* name paremeter is not valid part of addr space */
                        rc = RC ( rcNS, rcNoTarg, rcReading, rcMemory, rcOutofrange );
                        break;
                    case WSAEINTR: /* socket call was calanceled */
                        rc = RC ( rcNS, rcNoTarg, rcReading, rcConnection, rcCanceled );
                        break;
                    default:
                        rc = RC ( rcNS, rcNoTarg, rcReading, rcNoObj, rcError );
                    }
                }
            }

            if ( hostname != buffer )
                KDataBufferWhack ( & b );
        }
//.........这里部分代码省略.........
开发者ID:gconcepcion,项目名称:sratoolkit,代码行数:101,代码来源:sysendpoint.c


示例11: FastqGzip_Idx

static
rc_t FastqGzip_Idx(const SRATable* sratbl, SIndexObj* obj, char* buffer, const size_t buffer_sz)
{
    rc_t rc = 0;
    const FastqReader* reader = NULL;

    uint16_t zlib_ver = ZLIB_VERNUM;
    uint8_t colorSpace = false;
    char* colorSpaceKey = "\0";
    uint8_t origFormat = false;
    uint8_t printLabel = true;
    uint8_t printReadId = true;
    uint8_t clipQuality = true;
    uint32_t minReadLen = 0;
    uint16_t qualityOffset = 0;

    {{
        const SRAColumn* c = NULL;
        const uint8_t *platform = SRA_PLATFORM_UNDEFINED;
        bitsz_t o, z;

        if( (rc = SRATableOpenColumnRead(sratbl, &c, "PLATFORM", sra_platform_id_t)) != 0 ) {
            return rc;
        }
        if( (rc = SRAColumnRead(c, 1, (const void **)&platform, &o, &z)) != 0 ) {
            return rc;
        }
        if( *platform == SRA_PLATFORM_ABSOLID ) {
            colorSpace = true;
        }
        SRAColumnRelease(c);
    }}

    if( (rc = FastqReaderMake(&reader, sratbl, g_accession,
                        colorSpace, origFormat, false, printLabel, printReadId,
                        !clipQuality, minReadLen, qualityOffset, colorSpaceKey[0],
                        obj->minSpotId, obj->maxSpotId)) != 0 ) {
        return rc;
    } else {
        size_t written = 0;
        uint32_t blk = 0, spots_per_block = 0, proj_id_qty = 0;
        SIndexNode* inode = NULL;
        size_t z_blk = 0;
        size_t spots_buf_sz = g_file_block_sz * 100;
        size_t zbuf_sz = spots_buf_sz + 100;
        char* zbuf = malloc(zbuf_sz);
        char* spots_buf = malloc(spots_buf_sz);
        bool eof = false;

        if( zbuf == NULL || spots_buf == NULL ) {
            rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
        }
        while( rc == 0 ) {
            if( (rc = FastqReader_GetNextSpotSplitData(reader, buffer, buffer_sz, &written)) == 0 ) {
                if( inode == NULL ) {
                    spotid_t spotid = 0;
                    if( (rc = FastqReaderCurrentSpot(reader, &spotid)) != 0 ) {
                        break;
                    }
                    inode = malloc(sizeof(SIndexNode));
                    if( inode == NULL ) {
                        rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcExhausted);
                        break;
                    }
                    inode->key = obj->file_size;
                    inode->key_size = 0;
                    inode->id = spotid;
                    inode->id_qty = 0;
                    DEBUG_MSG(5, ("%s open key: spot %ld, offset %lu\n", obj->index, inode->id, inode->key));
                }
                if( blk + written > spots_buf_sz ) {
                    rc = RC(rcExe, rcIndex, rcConstructing, rcMemory, rcInsufficient);
                    break;
                }
                inode->id_qty++;
                memmove(&spots_buf[blk], buffer, written);
                blk += written;
                if( g_dump ) {
                    fwrite(buffer, written, 1, stderr);
                }
            }
            if( (eof = (GetRCObject(rc) == rcRow && GetRCState(rc) == rcExhausted)) ) {
                rc = 0;
                if( inode == NULL ) {
                    break;
                }
            }
            if( rc == 0 && (eof || 
                            (proj_id_qty == 0 && inode->id_qty > (spots_per_block * 0.95)) || 
                            (proj_id_qty > 0 && inode->id_qty >= proj_id_qty) ) ) {
                rc = ZLib_DeflateBlock(spots_buf, blk, zbuf, zbuf_sz, &z_blk);
                if( z_blk < g_file_block_sz ) {
                    /* project needed id_qty */
                    proj_id_qty = g_file_block_sz * inode->id_qty / z_blk * 1.05;
                    DEBUG_MSG(5, ("%s: project id qty %u\n", obj->index, proj_id_qty));
                } else {
                    DEBUG_MSG(10, ("%s: no projection %u > %u\n", obj->index, z_blk, g_file_block_sz));
                }
            }
            if( rc == 0 && (eof || z_blk >= g_file_block_sz) ) {
//.........这里部分代码省略.........
开发者ID:ncbi,项目名称:sra-tools,代码行数:101,代码来源:sra-makeidx.c


示例12: KMain

rc_t KMain(int argc, char *argv[])
{
    rc_t rc = 0;
    Args* args = NULL;
    const char* errmsg = NULL, *table_dir = NULL;
    char accn[1024];
    
    if( (rc = ArgsMakeAndHandle(&args, argc, argv, 1, MainArgs, MainArgsQty)) == 0 ) {
        const char* blksz = NULL;
        uint32_t count, dump = 0, gzip = 0;

        if( (rc = ArgsParamCount(args, &count)) != 0 || count != 1 ) {
            rc = rc ? rc : RC(rcExe, rcArgv, rcParsing, rcParam, count > 1 ? rcExcessive : rcInsufficient);
            errmsg = "table";

        } else if( (rc = ArgsOptionCount(args, MainArgs[eopt_BlockSize].name, &count)) != 0 || count > 1 ) {
            rc = rc ? rc : RC(rcExe, rcArgv, rcParsing, rcParam, rcExcessive);
            errmsg = MainArgs[eopt_BlockSize].name;
        } else if( count > 0 && (rc = ArgsOptionValue(args, MainArgs[eopt_BlockSize].name, 0, (const void **)&blksz)) != 0 ) {
            errmsg = MainArgs[eopt_BlockSize].name;

        } else if( (rc = ArgsOptionCount(args, MainArgs[eopt_Accession].name, &count)) != 0 || count > 1 ) {
            rc = rc ? rc : RC(rcExe, rcArgv, rcParsing, rcParam, rcExcessive);
            errmsg = MainArgs[eopt_Accession].name;
        } else if( count > 0 && (rc = ArgsOptionValue(args, MainArgs[eopt_Accession].name, 0, (const void **)&g_accession)) != 0 ) {
            errmsg = MainArgs[eopt_Accession].name;

        } else if( (rc = ArgsOptionCount(args, MainArgs[eopt_DumpIndex].name, &dump)) != 0 ) {
            errmsg = MainArgs[eopt_DumpIndex].name;

        } else if( (rc = ArgsOptionCount(args, MainArgs[eopt_noGzip].name, &gzip)) != 0 ) {
            errmsg = MainArgs[eopt_noGzip].name;
        }
        while( rc == 0 ) {
            long val = 0;
            char* end = NULL;

            if( blksz != NULL ) {
                errno = 0;
                val = strtol(blksz, &end, 10);
                if( errno != 0 || blksz == end || *end != '\0' || val <= 0 ) {
                    rc = RC(rcExe, rcArgv, rcReading, rcParam, rcInvalid);
                    errmsg = MainArgs[eopt_BlockSize].name;
                    break;
                } else if( val <= 128 || val > (1024 * 1024 * 1024) ) {
                    rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcEmpty);
                    errmsg = "block size invalid";
                    break;
                }
                g_file_block_sz = val;
            }
            if( (rc = ArgsParamValue(args, 0, (const void **)&table_dir)) != 0 ) {
                errmsg = "table";
                break;
            }
            if( g_accession == NULL ) {
                const char* p = strchr(table_dir, '/');
                size_t l = 0;

                g_accession = accn;
                if( p == NULL ) {
                    p = strchr(table_dir, '\\');
                }
                strncpy(accn, p == NULL ? table_dir : p + 1, sizeof(accn) - 1);
                if( accn[0] == '\0' ) {
                    rc = RC(rcExe, rcArgv, rcValidating, rcParam, rcEmpty);
                    errmsg = "accession";
                }
                l = strlen(accn);
                if( accn[l - 1] == '/' || accn[l - 1] == '\\') {
                    accn[--l] = '\0';
                }
                if( strncmp(&accn[l - 9], ".lite.sra", 9) == 0 ) {
                    accn[l - 9] = '\0';
                } else if( strncmp(&accn[l - 4], ".sra", 4) == 0 ) {
                    accn[l - 4] = '\0';
                }
            }
            g_dump = dump > 0;
            g_ungzip = gzip > 0;
            break;
        }
    }
    if( rc == 0 ) {
        SRAMgr* smgr = NULL;
        KDBManager* kmgr = NULL;

        DEBUG_MSG(5, ("table %s, accession %s\n", table_dir, g_accession));
        if( (rc = SRAMgrMakeUpdate(&smgr, NULL)) == 0 ) {
            if( (rc = KDBManagerMakeUpdate(&kmgr, NULL)) == 0 ) {
                bool relock = true;
                if( (rc = KDBManagerUnlock(kmgr, table_dir)) != 0 ) {
                    relock = false;
                    rc = GetRCState(rc) == rcUnlocked ? 0 : rc;
                } else {
                    PLOGMSG(klogInfo, (klogInfo, "Table $(p) locked, unlocking", PLOG_S(p), table_dir));
                }
                if( rc == 0 ) {
                    KTable* ktbl = NULL;
                    if( (rc = KDBManagerOpenTableUpdate(kmgr, &ktbl, table_dir)) == 0 ) {
//.........这里部分代码省略.........
开发者ID:ncbi,项目名称:sra-tools,代码行数:101,代码来源:sra-makeidx.c


示例13: extract_statistic_from_row

rc_t extract_statistic_from_row(statistic *self, 
                                row_input const *data)
{
    rc_t rc = 0;
    spotgrp *sg;
    char const *spotgrp_base;
    uint32_t spotgrp_len;
    unsigned i;
    uint8_t lb = 4;
    unsigned hpr = 0;
    unsigned gcc = 0;
    
    if (data == NULL) {
        return RC(rcXF, rcFunction, rcExecuting, rcParam, rcNull);
    }
    if (self == NULL) {
        return RC(rcXF, rcFunction, rcExecuting, rcSelf, rcNull);
    }
    rc = validate_row_data(self, data);
    if (rc)
        return rc;
    
    spotgrp_base = data->spotgroup;
    spotgrp_len = data->spotgroup_len;
    
    if (spotgrp_base == NULL || spotgrp_len == 0) {
        spotgrp_base = "";
        spotgrp_len = 0;
    }

    sg = find_spotgroup( self, spotgrp_base, spotgrp_len );
    if ( sg == NULL )
    {
        sg = make_spotgrp( spotgrp_base, spotgrp_len );
        if ( sg == NULL )
        {
            return RC( rcXF, rcFunction, rcExecuting, rcMemory, rcExhausted );
        }
        else
        {
            rc = BSTreeInsert ( &self->spotgroups, (BSTNode *)sg, spotgroup_sort );
            if (rc)
                return rc;
        }
    }
    for (i = 0; i < data->read_len && rc == 0; ++i) {
        unsigned const base = data->read[i];
        unsigned dimer;

        if (base > 3) {
            dimer = 16;
            hpr = 0;
        }
        else {
            dimer = (lb > 3) ? 16 : ((lb << 2) | base);
            if (lb == base)
                ++hpr;
            else
                hpr = 0;
        }
        if (i > 0)
            rc = spotgroup_enter_values(sg, data->quality[i], dimer, gcc, hpr, data->base_pos_offset + i, CASE_MATCH);

        if (base == 1 || base == 2)
            ++gcc;
        if (i >= self->gc_window) {
            unsigned const out = data->read[i - self->gc_window];
            
            if (out == 1 || out == 2)
                --gcc;
        }
        lb = base;
	}
    return rc;
}
开发者ID:binlu1981,项目名称:ncbi-vdb,代码行数:75,代码来源:stat_mod.c


示例14: qual_stats

static rc_t qual_stats(const Params* prm, const VDatabase* db) {
    rc_t rc = 0;
    const char tblName[] = "SEQUENCE";
    const VTable* tbl = NULL;
    const KMetadata* meta = NULL;
    const KMDataNode* node = NULL;
    assert(prm && db);
    if (rc == 0) {
        rc = VDatabaseOpenTableR 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RCBA32函数代码示例发布时间:2022-05-30
下一篇:
C++ RB_TYPE_P函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap