亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? c-

?? C實例解析精粹
??
?? 第 1 頁 / 共 2 頁
字號:

#include "tdestr.h"
#include "common.h"
#include "tdefunc.h"
#include "define.h"


/*
 * Name:    sort_box_block
 * Purpose: sort lines according to text in marked BOX block
 * Date:    June 5, 1992
 * Passed:  window:  pointer to current window
 * Notes:   quick sort and insertion sort the lines in the BOX buff according
 *           to stuff in a box block.
 */
int  sort_box_block( WINDOW *window )
{
int  prompt_line;
int  block_type;
line_list_ptr ll;
register file_infos *file;
WINDOW *sw;
int  rc;
char line_buff[(MAX_COLS+1)*2]; /* buffer for char and attribute  */

   /*
    * make sure block is marked OK
    */
   rc = OK;
   prompt_line = window->bottom_line;
   entab_linebuff( );
   if (un_copy_line( window->ll, window, TRUE ) == ERROR)
      return( ERROR );
   check_block( );
   if (g_status.marked == TRUE) {
      file  = g_status.marked_file;
      block_type = file->block_type;
      if (block_type == BOX) {
         /*
          * sort ascending or descending?
          */
         rc = get_sort_order( window );
         if (rc != ERROR) {
            file->modified = TRUE;
            if (mode.do_backups == TRUE) {
               sw = g_status.window_list;
               for (; ptoul( sw->file_info ) != ptoul( file );)
                  sw = sw->next;
               backup_file( sw );
            }

            /*
             * figure the width of the block.
             */
            sort.block_len = file->block_ec + 1 - file->block_bc;

            /*
             * save the prompt line and print the quicksort message.
             */
            save_screen_line( 0, prompt_line, line_buff );
            eol_clear( 0, prompt_line, g_display.text_color );
            set_prompt( block22a, prompt_line );

            /*
             * set up the sort structure.
             */
            sort.bc  = g_status.marked_file->block_bc;
            sort.ec  = g_status.marked_file->block_ec;
            sort.order_array = (mode.search_case == IGNORE) ?
                                    sort_order.ignore : sort_order.match;

            /*
             * save the previous node for use with insertion sort.
             */
            ll = file->block_start->prev;
            quick_sort_block( file->block_br, file->block_er,
                              file->block_start, file->block_end );

            /*
             * get back previous node and clean up list with insertion
             *   sort.
             */
            if (ll == NULL)
               ll = file->line_list;
            else
               ll = ll->next;
            set_prompt( block22b, prompt_line );
            insertion_sort_block( file->block_br, file->block_er, ll );

            /*
             * housekeeping.  mark the file as dirty and restore the
             *   cursors, which are scrambled during the sort.
             */
            file->dirty = GLOBAL;
            restore_cursors( file );
            restore_screen_line( 0, prompt_line, line_buff );
         }
      } else {
         /*
          * can only sort box blocks
          */
         error( WARNING, prompt_line, block23 );
         rc = ERROR;
      }
   } else {
      /*
       * box not marked
       */
      error( WARNING, prompt_line, block24 );
      rc = ERROR;
   }
   return( rc );
}


/*
 * Name:    quick_sort_block
 * Purpose: sort lines according to text in marked BOX block
 * Date:    Jaunary 10, 1993
 * Passed:  low:        starting line in box block
 *          high:       ending line in a box block
 *          low_node:   starting node in box block
 *          high_node:  ending node in box block
 * Notes:   Quicksort lines in the BOX block according to keys in
 *           a box block.
 *          because the median of three method is used to find the partion
 *           node,  high - low  should be greater than or equal to 2.
 *          with end recursion removal and sorting the smallest sublist
 *           first, our stack only needs room for log2 (N+1)/(M+2) nodes.
 *           a stack size of 24 can reliably handle almost 500 million lines.
 */
void quick_sort_block( long low, long high, line_list_ptr low_node,
                       line_list_ptr high_node )
{
long low_rline_stack[24];
long high_rline_stack[24];
line_list_ptr low_node_stack[24];
line_list_ptr high_node_stack[24];
long low_count;
long high_count;
long count;
line_list_ptr low_start;
line_list_ptr low_head;
line_list_ptr low_tail;
line_list_ptr high_end;
line_list_ptr high_head;
line_list_ptr high_tail;
line_list_ptr equal_head;
line_list_ptr equal_tail;
line_list_ptr walk_node;
line_list_ptr median_node;
int  i;
int  stack_pointer;

   assert( low_node->len != EOF);
   assert( high_node->len != EOF);

   stack_pointer = 0;
   for (;;) {

      /*
       * being that a median-of-three is used as the partition algorithm,
       *  we probably need to have at least 2 nodes in each sublist.  I
       *  chose a minimum of 25 nodes as a SWAG (scientific wild ass guess).
       *  a simple insertion sort mops the list after quicksort finishes.
       */
      while (high - low > 25) {

         assert( high >= 1 );
         assert( low  >= 1 );
         assert( low  <= high );

         /*
          * start the walk node at the head of the list and walk to the
          *  middle of the sublist.
          */
         walk_node  = low_node;
         count = (high - low) / 2;
         for (; count > 0; count--)
            walk_node = walk_node->next;

         /*
          * now, find the median of the low, middle, and high node.
          *
          * being that I am subject to error, let's assert that we really
          *  did find the median-of-three.
          */
         load_pivot( low_node );
         if (compare_pivot( walk_node ) < 0) {
            low_head   = walk_node;
            median_node = low_node;
         } else {
            low_head   = low_node;
            median_node = walk_node;
         }
         high_head = high_node;
         load_pivot( median_node );
         if (compare_pivot( high_node ) < 0) {
            high_head   = median_node;
            median_node = high_node;
         }
         load_pivot( median_node );
         if (compare_pivot( low_head ) > 0) {
            low_tail    = median_node;
            median_node = low_head;
            low_head    = low_tail;
         }

         load_pivot( median_node );

         assert( compare_pivot( low_head ) <= 0 );
         assert( compare_pivot( high_head ) >= 0 );

         /*
          * now, walk again from the head of the list comparing nodes and
          *  use the first occurrence of the median node as the partition.
          */
         walk_node = low_node;
         for (i = 0; ; walk_node = walk_node->next) {
            if (compare_pivot( walk_node ) == 0)
               break;
            i = 1;
         }

         /*
          * initialize pointers and counters for this partition.
          */
         low_start  = low_node->prev;
         high_end   = high_node->next;
         low_head   = low_tail  = NULL;
         high_head  = high_tail = NULL;
         low_count  = high_count = 0;

         /*
          * setup the first occurrence of the median node as a "fat pivot"
          *  sublist.  there are two cases to consider 1) the first
          *  occurrence of the median node is the first element in the
          *  sublist, i == 0, or 2) the first occurrence of the median node
          *  is somewhere in the sublist.
          */
         if (i == 0)
            walk_node = equal_head = equal_tail = low_node;
         else {
            equal_head = equal_tail = walk_node;
            equal_head->next->prev = equal_head->prev;
            equal_head->prev->next = equal_head->next;
            equal_head->next = low_node;
            walk_node = equal_head;
         }
         load_pivot( equal_head );

         /*
          * PARTITION:
          *  put all nodes less than the pivot on the end of the low list.
          *  put all nodes equal to the pivot on the end of the equal list.
          *  put all nodes greater than the pivot on the end of the high list.
          */
         for (count=low+1; count <= high; count++) {
            walk_node = walk_node->next;
            i = compare_pivot( walk_node );
            if (i > 0) {
               if (high_head == NULL)
                  high_head = high_tail = walk_node;
               else {
                  high_tail->next = walk_node;
                  walk_node->prev = high_tail;
                  high_tail = walk_node;
               }

               /*
                * keep a count of the number of nodes in the high list.
                */
               ++high_count;
            } else if (i < 0) {
               if (low_head == NULL)
                  low_head = low_tail = walk_node;
               else {
                  low_tail->next = walk_node;
                  walk_node->prev = low_tail;
                  low_tail = walk_node;
               }

               /*
                * keep a count of the number of nodes in the low list
                */
               ++low_count;
            } else {
               equal_tail->next = walk_node;
               walk_node->prev = equal_tail;
               equal_tail = walk_node;
            }
         }

         assert( low_count >= 0 );
         assert( low_count < high - low );
         assert( high_count >= 0 );
         assert( high_count < high - low );

         /*
          * we just partitioned the sublist into low, equal, and high
          *  sublists.  now, let's put the lists back together.
          */
         if (low_count > 0) {
            low_head->prev = low_start;
            if (low_start != NULL)
               low_start->next = low_head;
            else
               g_status.marked_file->line_list = low_head;
            low_tail->next = equal_head;
            equal_head->prev = low_tail;
         } else {
            equal_head->prev = low_start;
            if (low_start != NULL)
               low_start->next = equal_head;
            else
               g_status.marked_file->line_list = equal_head;
         }
         if (high_count > 0) {
            high_head->prev = equal_tail;
            equal_tail->next = high_head;
            high_tail->next = high_end;
            high_end->prev  = high_tail;
         } else {
            equal_tail->next = high_end;
            high_end->prev   = equal_tail;
         }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
黑人巨大精品欧美一区| 色诱视频网站一区| 日本韩国欧美一区二区三区| 欧美一级二级三级乱码| 中国色在线观看另类| 午夜激情一区二区| 91亚洲精品乱码久久久久久蜜桃| 欧美v日韩v国产v| 亚洲一级电影视频| 成人av资源在线观看| 久久综合久久综合久久综合| 亚洲香肠在线观看| 不卡高清视频专区| 久久免费的精品国产v∧| 日日欢夜夜爽一区| 在线精品视频一区二区| 国产精品国产三级国产aⅴ原创 | 一本久久a久久精品亚洲| 精品国产露脸精彩对白| 日本美女一区二区| 欧美日韩在线三级| 一区二区免费视频| 91麻豆精品在线观看| 国产精品成人一区二区艾草 | 亚洲影院久久精品| 99vv1com这只有精品| 中文在线免费一区三区高中清不卡| 男人的j进女人的j一区| 欧美精品久久一区| 亚洲一区二区高清| 欧美视频中文一区二区三区在线观看 | 99九九99九九九视频精品| 精品国产91亚洲一区二区三区婷婷| 天堂久久一区二区三区| 欧美三级视频在线观看| 亚洲国产裸拍裸体视频在线观看乱了 | 同产精品九九九| 欧美亚洲免费在线一区| 亚洲国产日韩一级| 欧美一区二区私人影院日本| 亚洲成人动漫av| 欧美日韩精品系列| 日本怡春院一区二区| 日韩一级片在线播放| 精品在线一区二区三区| 精品国内片67194| 国产精品99久| 国产精品不卡视频| 欧美午夜电影在线播放| 日韩精品免费专区| 精品成人一区二区| 国v精品久久久网| 一区二区三区国产精品| 欧美电影一区二区| 国产麻豆精品久久一二三| 国产精品污污网站在线观看| 99re亚洲国产精品| 亚洲成人动漫在线免费观看| 日韩精品一区二区三区swag | 91香蕉国产在线观看软件| 亚洲精品乱码久久久久久| 欧美日韩三级视频| 国产最新精品精品你懂的| 亚洲欧洲av另类| 欧美亚洲综合在线| 久久99精品久久久久| 中文字幕中文字幕在线一区| 欧美日韩一区中文字幕| 国内外成人在线| 亚洲免费观看在线视频| 欧美一区二区人人喊爽| 懂色av一区二区三区免费观看| 中文字幕亚洲欧美在线不卡| 欧美剧情片在线观看| 国产成人精品午夜视频免费| 亚洲综合自拍偷拍| 久久久久久亚洲综合| 欧美亚洲一区二区在线| 国产九色sp调教91| 视频一区国产视频| 亚洲欧洲一区二区三区| 欧美一卡二卡三卡四卡| bt欧美亚洲午夜电影天堂| 强制捆绑调教一区二区| 亚洲人成影院在线观看| 欧美一二三在线| 欧美亚洲禁片免费| 9i在线看片成人免费| 久久99久久久久久久久久久| 怡红院av一区二区三区| 国产亚洲欧美日韩日本| 日韩亚洲欧美在线观看| 欧美在线你懂得| 成人精品亚洲人成在线| 国产一区二区三区美女| 日本亚洲一区二区| 亚洲午夜精品在线| 亚洲婷婷综合色高清在线| 久久精品在线免费观看| 日韩精品在线一区| 91精品久久久久久久99蜜桃| 欧美在线免费播放| 91小宝寻花一区二区三区| 成人性生交大片免费看在线播放| 久久精品999| 免费看欧美女人艹b| 亚洲bt欧美bt精品| 亚洲国产欧美日韩另类综合| 一区二区三区91| 亚洲精品日韩综合观看成人91| 欧美激情在线免费观看| 久久久久久久久伊人| 26uuu另类欧美亚洲曰本| 日韩欧美一二区| 日韩视频一区二区| 日韩欧美三级在线| 日韩一区二区三区四区五区六区| 欧美精品vⅰdeose4hd| 欧美视频精品在线| 欧美群妇大交群的观看方式| 在线看国产一区| 欧美熟乱第一页| 88在线观看91蜜桃国自产| 欧美高清你懂得| 91精品国产综合久久久久久漫画 | 2023国产精品视频| 久久精品一区蜜桃臀影院| 久久久国产一区二区三区四区小说 | 在线亚洲人成电影网站色www| 色综合激情五月| 欧美日韩亚洲综合一区| 制服丝袜亚洲网站| 精品99一区二区三区| 2023国产一二三区日本精品2022| 久久久久久久久久看片| 国产亚洲人成网站| 国产精品网友自拍| 亚洲美女区一区| 天天免费综合色| 免费的成人av| 成人高清视频在线| 欧美制服丝袜第一页| 日韩欧美三级在线| 国产精品久久综合| 亚洲成人动漫精品| 国产精品一区二区在线观看网站| 国产91精品精华液一区二区三区| 色天使久久综合网天天| 制服视频三区第一页精品| 26uuuu精品一区二区| 1区2区3区欧美| 秋霞电影一区二区| 不卡电影一区二区三区| 欧美区一区二区三区| 久久综合久久综合九色| 亚洲欧美偷拍另类a∨色屁股| 性做久久久久久久久| 国产成人免费在线视频| 欧美午夜精品理论片a级按摩| 日韩美女视频在线| 亚洲精品亚洲人成人网| 麻豆国产91在线播放| 不卡的av网站| 日韩午夜激情av| 一区在线观看视频| 奇米色777欧美一区二区| av电影天堂一区二区在线观看| 欧美日韩亚洲高清一区二区| 国产三级精品视频| 奇米777欧美一区二区| 色综合天天综合网天天狠天天 | 日韩美女在线视频| 亚洲精品va在线观看| 国产成人在线视频播放| 欧美日韩国产美女| 亚洲欧洲成人精品av97| 精品影视av免费| 欧美日韩一区二区三区不卡| 国产精品久久精品日日| 久久精品国产亚洲a| 欧美日韩在线播放一区| 18涩涩午夜精品.www| 国产麻豆精品95视频| 欧美一区二区三区免费在线看 | 精品粉嫩超白一线天av| 亚洲一区在线观看网站| 东方aⅴ免费观看久久av| 日韩精品自拍偷拍| 亚洲地区一二三色| 色成人在线视频| 国产精品视频一二三区| 国产一区二区在线视频| 在线播放国产精品二区一二区四区 | 日韩伦理av电影| 国产91色综合久久免费分享| 日韩精品资源二区在线| 麻豆一区二区三区| 91精品国产一区二区三区香蕉| 亚洲福利视频一区| 在线观看国产91|