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

C++ GetFileNumber函数代码示例

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

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



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

示例1: find_last_page

// This function starts a new log file in the DataFlash
void DataFlash_Block::start_new_log(void)
{
    uint16_t last_page = find_last_page();

    StartRead(last_page);
    //Serial.print("last page: ");	Serial.println(last_page);
    //Serial.print("file #: ");	Serial.println(GetFileNumber());
    //Serial.print("file page: ");	Serial.println(GetFilePage());

    if(find_last_log() == 0 || GetFileNumber() == 0xFFFF) {
        SetFileNumber(1);
        StartWrite(1);
        //Serial.println("start log from 0");
        return;
    }

    // Check for log of length 1 page and suppress
    if(GetFilePage() <= 1) {
        SetFileNumber(GetFileNumber());                 // Last log too short, reuse its number
        StartWrite(last_page);                                          // and overwrite it
        //Serial.println("start log from short");
    } else {
        if(last_page == 0xFFFF) last_page=0;
        SetFileNumber(GetFileNumber()+1);
        StartWrite(last_page + 1);
        //Serial.println("start log normal");
    }
}
开发者ID:RyanKING92,项目名称:ardupilot,代码行数:29,代码来源:LogFile.cpp


示例2: StartRead

// This function determines the number of whole or partial log files in the DataFlash
// Wholly overwritten files are (of course) lost.
uint16_t DataFlash_Block::get_num_logs(void)
{
    uint16_t lastpage;
    uint16_t last;
    uint16_t first;

    if (find_last_page() == 1) {
        return 0;
    }

    StartRead(1);

    if (GetFileNumber() == 0xFFFF) {
        return 0;
    }

    lastpage = find_last_page();
    StartRead(lastpage);
    last = GetFileNumber();
    StartRead(lastpage + 2);
    first = GetFileNumber();
    if(first > last) {
        StartRead(1);
        first = GetFileNumber();
    }

    if (last == first) {
        return 1;
    }

    return (last - first + 1);
}
开发者ID:54dashayu,项目名称:ardupilot,代码行数:34,代码来源:LogFile.cpp


示例3: get_num_logs

// This function finds the first and last pages of a log file
// The first page may be greater than the last page if the DataFlash has been filled and partially overwritten.
void DataFlash_Block::get_log_boundaries(uint16_t log_num, uint16_t & start_page, uint16_t & end_page)
{
    uint16_t num = get_num_logs();
    uint16_t look;

    if (df_BufferIdx != 0) {
        FinishWrite();
        hal.scheduler->delay(100);
    }

    if(num == 1)
    {
        StartRead(df_NumPages);
        if (GetFileNumber() == 0xFFFF)
        {
            start_page = 1;
            end_page = find_last_page_of_log((uint16_t)log_num);
        } else {
            end_page = find_last_page_of_log((uint16_t)log_num);
            start_page = end_page + 1;
        }

    } else {
        if(log_num==1) {
            StartRead(df_NumPages);
            if(GetFileNumber() == 0xFFFF) {
                start_page = 1;
            } else {
                start_page = find_last_page() + 1;
            }
        } else {
            if(log_num == find_last_log() - num + 1) {
                start_page = find_last_page() + 1;
            } else {
                look = log_num-1;
                do {
                    start_page = find_last_page_of_log(look) + 1;
                    look--;
                } while (start_page <= 0 && look >=1);
            }
        }
    }
    if (start_page == df_NumPages+1 || start_page == 0) {
        start_page = 1;
    }
    end_page = find_last_page_of_log(log_num);
    if (end_page == 0) {
        end_page = start_page;
    }
}
开发者ID:54dashayu,项目名称:ardupilot,代码行数:52,代码来源:LogFile.cpp


示例4: InitDebugLine

void InitDebugLine(
    dw_client                   cli,
    const char                  *source_filename,
    char                        *inc_list,
    unsigned                    inc_list_len )
{
    stmt_prologue prol = {
        0,
        DWARF_IMPL_VERSION,
        sizeof( stmt_prologue )
                - offsetof( stmt_prologue, minimum_instruction_length ),
        DW_MIN_INSTR_LENGTH,
        0,
        DWLINE_BASE,
        DWLINE_RANGE,
        DWLINE_OPCODE_BASE,
        {   /* LEB128 args  - Instruction op-code       */
            0,              /* DW_LNS_copy              */
            1,              /* DW_LNS_advance           */
            1,              /* DW_LNS_advance_line      */
            1,              /* DW_LNS_set_file          */
            1,              /* DW_LNS_set_column        */
            0,              /* DW_LNS_negate_stmt       */
            0,              /* DW_LNS_set_basic_block   */
            0,              /* DW_LNS_const_add_pc      */
            0               /* DW_LNS_fixed_advance_pc  */
            /*
            //  GNU sets the last entry to 1. This is (maybe?) incorrect as the DW_LNS_fixed_advance_pc
            //  opcode has a fixed uhalf (uint_16)argument, not a (U)LEB128 argument.
            */
        }
    };

    static uint_8 const terminators[] = {0,0};

    prol.prologue_length += inc_list_len + 2;   // +2 for 2 list terminators
    cli->debug_line.files = NULL;
    cli->debug_line.addr = 0;
    cli->debug_line.line = 1;
    cli->debug_line.column = 0;
    cli->debug_line.is_stmt = 0;
    cli->debug_line.end_sequence = 0;

    /* write the prologue */
    CLIWrite( DW_DEBUG_LINE, (char*)&prol, sizeof( prol ) );

    if( inc_list != 0 ) {       // write the include list
        CLIWrite( DW_DEBUG_LINE, inc_list, inc_list_len );
    }

    CLIWrite( DW_DEBUG_LINE, terminators, sizeof(terminators) );

    /* and put out the source filename */
    GetFileNumber( cli, source_filename );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:55,代码来源:dwline.c


示例5: ChecksumAddLump

static void ChecksumAddLump(md5_context_t *md5_context, lumpinfo_t *lump)
{
    char buf[9];

    strncpy(buf, lump->name, 8);
    buf[8] = '\0';
    MD5_UpdateString(md5_context, buf);
    MD5_UpdateInt32(md5_context, GetFileNumber(lump->wad_file));
    MD5_UpdateInt32(md5_context, lump->position);
    MD5_UpdateInt32(md5_context, lump->size);
}
开发者ID:Nekrofage,项目名称:DoomRPi,代码行数:11,代码来源:w_checksum.c


示例6: DWSetFile

void DWENTRY DWSetFile(
    dw_client                   cli,
    const char                  *filename )
{
    uint_8                      buf[ 1 + MAX_LEB128 ];
    uint_8                      *end;

    _Validate( filename != NULL );

    buf[0] = DW_LNS_set_file;
    end = LEB128( buf + 1, GetFileNumber( cli, filename ) );
    CLIWrite( DW_DEBUG_LINE, buf, end - buf );
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:13,代码来源:dwline.c


示例7: find_last_page

// This function starts a new log file in the DataFlash
uint16_t DataFlash_Block::start_new_log(void)
{
    uint16_t last_page = find_last_page();

    StartRead(last_page);
    //Serial.print("last page: ");	Serial.println(last_page);
    //Serial.print("file #: ");	Serial.println(GetFileNumber());
    //Serial.print("file page: ");	Serial.println(GetFilePage());

    if(find_last_log() == 0 || GetFileNumber() == 0xFFFF) {
        SetFileNumber(1);
        StartWrite(1);
        //Serial.println("start log from 0");
        log_write_started = true;
        return 1;
    }

    uint16_t new_log_num;

    // Check for log of length 1 page and suppress
    if(GetFilePage() <= 1) {
        new_log_num = GetFileNumber();
        // Last log too short, reuse its number
        // and overwrite it
        SetFileNumber(new_log_num);
        StartWrite(last_page);
    } else {
        new_log_num = GetFileNumber()+1;
        if (last_page == 0xFFFF) {
            last_page=0;
        }
        SetFileNumber(new_log_num);
        StartWrite(last_page + 1);
    }
    log_write_started = true;
    return new_log_num;
}
开发者ID:54dashayu,项目名称:ardupilot,代码行数:38,代码来源:LogFile.cpp



注:本文中的GetFileNumber函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetFilePath函数代码示例发布时间:2022-05-30
下一篇:
C++ GetFileList函数代码示例发布时间: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