亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
美女一区二区视频| 国产精品网站一区| 蜜芽一区二区三区| 日韩欧美在线网站| 国内精品自线一区二区三区视频| 日韩欧美成人激情| 国产大陆精品国产| 亚洲视频香蕉人妖| 欧美日韩国产一二三| 欧美a一区二区| 国产婷婷色一区二区三区在线| jlzzjlzz国产精品久久| 亚洲天堂免费看| 欧美三区免费完整视频在线观看| 日本亚洲电影天堂| 久久久一区二区三区捆绑**| av在线不卡免费看| 视频一区二区不卡| 精品国产网站在线观看| 成人av电影免费观看| 亚洲国产中文字幕| 久久久久国产一区二区三区四区| 91丝袜美女网| 久久国产精品72免费观看| 国产精品久久久久aaaa樱花 | 国内精品视频一区二区三区八戒| 精品国产在天天线2019| 91在线观看地址| 久久99精品视频| 一区二区在线看| 欧美不卡一区二区| 日本精品视频一区二区| 九九视频精品免费| 亚洲一区二区三区四区在线观看 | 国产精品视频你懂的| 精品成人一区二区| 成人av网址在线观看| 奇米精品一区二区三区在线观看 | 精品一区二区三区在线播放| 综合亚洲深深色噜噜狠狠网站| 69久久夜色精品国产69蝌蚪网| 成人性色生活片| 美国欧美日韩国产在线播放| 亚洲另类在线一区| 国产欧美精品国产国产专区| 337p亚洲精品色噜噜噜| 99精品久久只有精品| 国产一区高清在线| 日韩1区2区3区| 尤物av一区二区| 久久精子c满五个校花| 欧美精选在线播放| 色丁香久综合在线久综合在线观看| 国产精品亚洲专一区二区三区 | 免费在线观看一区| 亚洲精品久久久久久国产精华液| 久久久精品免费网站| 日韩三级在线观看| 91精品国产aⅴ一区二区| 91福利视频在线| va亚洲va日韩不卡在线观看| 成人小视频在线观看| 国产成人在线免费观看| 久久97超碰国产精品超碰| 日韩精品一二三| 亚洲444eee在线观看| 亚洲一卡二卡三卡四卡| 伊人婷婷欧美激情| 亚洲欧美日韩在线| 亚洲精选视频在线| 1000精品久久久久久久久| 国产精品成人免费| 日韩美女视频一区二区| 国产精品人妖ts系列视频| 国产日韩av一区| 国产精品日韩精品欧美在线| 国产精品久久一卡二卡| 国产精品理伦片| 亚洲欧美日韩国产成人精品影院| 中文字幕日本乱码精品影院| 国产精品免费aⅴ片在线观看| 日本一区二区不卡视频| 国产精品久久久久精k8| 亚洲精品乱码久久久久久黑人 | 奇米777欧美一区二区| 日韩国产欧美三级| 老司机精品视频一区二区三区| 蜜臀久久99精品久久久久久9| 看片的网站亚洲| 国产麻豆91精品| 成人性视频网站| 欧洲一区二区三区在线| 91精品国产综合久久香蕉麻豆| 欧美一区二区播放| 国产日韩欧美激情| 一区二区三区四区不卡视频 | 美女久久久精品| 国产一区二区三区免费看| 成人午夜短视频| 色综合久久99| 日韩一区二区在线免费观看| 久久久精品tv| 亚洲精品成人在线| 亚洲va欧美va天堂v国产综合| 青青草视频一区| 成人午夜精品一区二区三区| 欧美色涩在线第一页| 久久综合视频网| 一区二区三区精品在线观看| 人人狠狠综合久久亚洲| 成人一区在线观看| 在线播放国产精品二区一二区四区| 精品国产91乱码一区二区三区| 国产精品美女久久久久久2018| 亚洲国产日韩综合久久精品| 久久国产成人午夜av影院| 99精品在线免费| 日韩亚洲欧美综合| 亚洲日本在线观看| 六月丁香综合在线视频| 91蝌蚪国产九色| www国产成人| 亚洲国产sm捆绑调教视频 | 99久久国产综合精品色伊| 欧美精品xxxxbbbb| 中文字幕一区二区三中文字幕| 爽爽淫人综合网网站| www.99精品| 精品国产成人在线影院 | 成人免费在线视频| 美日韩黄色大片| 在线视频欧美区| 欧美激情在线观看视频免费| 免费看日韩精品| 色哟哟一区二区在线观看| 久久一夜天堂av一区二区三区| 亚洲午夜免费福利视频| 不卡电影免费在线播放一区| 亚洲精品一区二区在线观看| 亚洲一本大道在线| 99精品一区二区三区| 久久精品亚洲精品国产欧美 | 亚洲三级在线看| 国产精品自拍一区| 日韩女优电影在线观看| 亚洲高清免费观看高清完整版在线观看| 国产91露脸合集magnet| 欧美变态tickle挠乳网站| 水蜜桃久久夜色精品一区的特点| 色噜噜夜夜夜综合网| 国产精品视频线看| 成人av资源下载| 欧美激情一区二区三区不卡 | 在线亚洲人成电影网站色www| 国产欧美日韩综合精品一区二区| 国内不卡的二区三区中文字幕| 欧美一区二区私人影院日本| 午夜精品视频在线观看| 欧美视频日韩视频| 亚洲一区二区三区激情| 在线免费观看日韩欧美| 亚洲伦在线观看| 色哟哟日韩精品| 亚洲精品综合在线| 色88888久久久久久影院按摩| 成人欧美一区二区三区视频网页 | 成人高清视频在线| 中文字幕国产一区| 成人福利视频网站| 亚洲视频一区二区在线| 91久久香蕉国产日韩欧美9色| 亚洲欧美偷拍三级| 欧美日韩一卡二卡| 日本三级韩国三级欧美三级| 欧美一级搡bbbb搡bbbb| 久久精品国产99国产| 欧美不卡一区二区三区四区| 国产精品中文字幕日韩精品| 亚洲综合激情网| 欧美在线观看视频一区二区| 亚洲bdsm女犯bdsm网站| 欧美r级电影在线观看| 国产精品羞羞答答xxdd| 欧美国产激情一区二区三区蜜月| av日韩在线网站| 午夜精品福利一区二区蜜股av| 4438x亚洲最大成人网| 黄色日韩网站视频| 亚洲视频狠狠干| 欧美日韩的一区二区| 麻豆国产精品一区二区三区| 欧美激情中文不卡| 欧美日韩亚洲不卡| 国产一区三区三区| 亚洲色图第一区| 欧美成人精品1314www| 菠萝蜜视频在线观看一区| 亚洲国产视频一区二区| 精品捆绑美女sm三区| 97精品国产97久久久久久久久久久久|