⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 include.inc

📁 一个演示了用汇编语言编写的数据排序算法,源代码非常详细
💻 INC
📖 第 1 页 / 共 2 页
字号:
    ;-------------------------------------------------------------------------------------
    ;-- Bit mask for visible columns.
    LVCol_VISIBLE EQU 0F000h


    ;-------------------------------------------------------------------------------------
    ;-- This array contains informations about the columns (offset to the title,
    ;-- standard width, standard visibility status, index).
    LVResultInfo DWORD LVCol_VISIBLE + 120, lpSTR_COL_ALGORITHM
                 LVcolIndex_Algorithm       DWORD 0
                 DWORD LVCol_VISIBLE + 70,  lpSTR_COL_ELEMENTS
                 LVcolIndex_Count           DWORD 1
                 DWORD LVCol_VISIBLE + 70,  lpSTR_COL_COMPARISONS
                 LVcolIndex_CMPCounter      DWORD 2
                 DWORD LVCol_VISIBLE + 70,  lpSTR_COL_EXCHANGES
                 LVcolIndex_MOVCounter      DWORD 3
                 DWORD LVCol_VISIBLE + 70,  lpSTR_COL_TIME
                 LVcolIndex_Time            DWORD 4
                 DWORD LVCol_VISIBLE + 115, lpSTR_COL_MEMORY
                 LVcolIndex_Memory          DWORD 5
                 DWORD 70,                  lpSTR_COL_DATA
                 LVcolIndex_Data            DWORD 6
                 DWORD 70,                  lpSTR_COL_INITVALUE
                 LVcolIndex_InitValue       DWORD 7
                 DWORD NULL

    ;-------------------------------------------------------------------------------------
    ;-- Number of columns.
    LVResult_ColCount EQU 8


    ;-------------------------------------------------------------------------------------
    ;-- The separating char when copying/saving entries.
    SeparatingChar BYTE 9


    ;-------------------------------------------------------------------------------------
    ;-- Header flag, signs whether the column titles shall be copyied too when copying
    ;-- or saving entries.
    fHeaders BYTE TRUE


  ;---------------------------------------------------------------------------------------
  ;-- Dialog: Graphic

    ;-------------------------------------------------------------------------------------
    ;-- Display type (TRUE = lines, FALSE = points).
    fDisplayLines BYTE TRUE


    ;-------------------------------------------------------------------------------------
    ;-- These variables are used from the DelayAfterComparison macro.
    Element1 DWORD -1
    Element2 DWORD -1


  ;---------------------------------------------------------------------------------------
  ;-- Dialog: Info



;-----------------------------------------------------------------------------------------
; The constant data segment.
;-----------------------------------------------------------------------------------------

.const

  ;---------------------------------------------------------------------------------------
  ;-- Dialog: Frame

    ;-------------------------------------------------------------------------------------
    ;-- The tab item indexes.
      TABINDEX_GRAPHIC EQU 1
      TABINDEX_TABLE EQU 0


  ;---------------------------------------------------------------------------------------
  ;-- Dialog: Table

    ;-------------------------------------------------------------------------------------
    ;-- Possible number of elements.
    TABLE_AllowedElements DWORD 100, 200, 500, 1000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 5000000, 0


    ;-------------------------------------------------------------------------------------
    ;-- The parts in the status bar.
    sbPartsTable DWORD 170, 340, -1


    ;-------------------------------------------------------------------------------------
    ;-- The extended styles of the algorithm list view.
    STYLES_LV_ALGORITHMS EQU LVS_EX_FULLROWSELECT or LVS_EX_CHECKBOXES or LVS_EX_LABELTIP
    STYLES_LV_RESULT EQU LVS_EX_FULLROWSELECT or LVS_EX_LABELTIP or LVS_EX_HEADERDRAGDROP


    ;-------------------------------------------------------------------------------------
    ;-- Format-control string for a long unsigned integer.
    FCS_Integer BYTE "%lu%", 0


    ;-------------------------------------------------------------------------------------
    ;-- Filter of the Save-dialog (for saving entries of the result list view). 
    FILTER_SaveAs BYTE "*.txt", 0, "*.txt", 0
                  BYTE "*.csv", 0, "*.csv", 0
                  BYTE "*.*",   0, "*.*",   0
                  BYTE NULL
    EXTENSION_TXT EQU OFFSET FILTER_SaveAs + 7
    EXTENSION_CSV EQU OFFSET FILTER_SaveAs + 19


  ;---------------------------------------------------------------------------------------
  ;-- Dialog: Graphic

    ;-------------------------------------------------------------------------------------
    ;-- Possible number of elements.
    GRAPHIC_AllowedElements BYTE 8, 16, 32, 48, 64, 96, 128, 0


    ;-------------------------------------------------------------------------------------
    ;-- Possible delays in milliseconds.
    AllowedDelays DWORD 0, 5, 10, 15, 20, 30, 40, 50, 100, 200, 250, 500, 1000, 2000, 3000, 5000, 20000, -1


    ;-------------------------------------------------------------------------------------
    ;-- The parts in the status bar.
    sbPartsGraphic DWORD 170, 340, -1


    ;-------------------------------------------------------------------------------------
    ;-- Delay positions.
    DELAY_AFTER_PASS       EQU 0
    DELAY_AFTER_COMPARISON EQU 1
    DELAY_AFTER_EXCHANGE   EQU 2


    ;-------------------------------------------------------------------------------------
    ;-- Filter of the Save-dialog (for saving bitmaps). 
    FILTER_SaveAsBMP BYTE "Bitmap", 0, "*.bmp", 0
                     BYTE NULL
    EXTENSION_BMP EQU OFFSET FILTER_SaveAsBMP + 8


    ;-------------------------------------------------------------------------------------
    ;-- The name of the display device driver. 
    DriverName_Display BYTE "DISPLAY", 0


  ;---------------------------------------------------------------------------------------
  ;-- Dialog: Info

    ;-------------------------------------------------------------------------------------
    ;-- Operation verb for opening a file using ShellExecute.
    OperationOpen BYTE "open", 0


    ;-------------------------------------------------------------------------------------
    ;-- The email adress.
    MAILTO_Author BYTE "mailto:"
    EMAIL_Author  BYTE "marty@codingcrew.de", 0
    EMAIL_Subject BYTE "?subject=", 0


    ;-------------------------------------------------------------------------------------
    ;-- The URls.
    URL_CodingCrew_de BYTE "http://"
    WWW_CodingCrew_de BYTE "www.codingcrew.de", 0
    URL_MASM32_com    BYTE "http://"
    WWW_MASM32_com    BYTE "www.masm32.com", 0


  ;---------------------------------------------------------------------------------------
  ;-- General:

    ;-------------------------------------------------------------------------------------
    ;-- The algorithms array (offset to the title, offset to the algorithm procedure).
    AlgorithmsInfo DWORD OFFSET STRING_Bubblesort,              OFFSET BubbleSort
                   DWORD OFFSET STRING_ExtBubblesort,           OFFSET ExtendedBubbleSort
                   DWORD OFFSET STRING_Shakersort,              OFFSET ShakerSort
                   DWORD OFFSET STRING_Ripplesort,              OFFSET RippleSort
                   DWORD OFFSET STRING_Selectionsort,           OFFSET SelectionSort
                   DWORD OFFSET STRING_Insertionsort,           OFFSET InsertionSort
                   DWORD OFFSET STRING_Shellsort,               OFFSET ShellSort
                   DWORD OFFSET STRING_TwoWayMergesort,         OFFSET TwoWayMergeSort
                   DWORD OFFSET STRING_StraightTwoWayMergeSort, OFFSET StraightTwoWayMergeSort
                   DWORD OFFSET STRING_NaturalTwoWayMergeSort,  OFFSET NaturalTwoWayMergeSort
                   DWORD OFFSET STRING_RadixExchangeSort,       OFFSET RadixExchangeSort
                   DWORD OFFSET STRING_QuickSort,               OFFSET QuickSort
                   DWORD OFFSET STRING_StraightQuickSort,       OFFSET StraightQuickSort
                   DWORD OFFSET STRING_CombSort,                OFFSET CombSort
                   DWORD OFFSET STRING_BucketSort,              OFFSET BucketSort
                   DWORD NULL


    ;-------------------------------------------------------------------------------------
    ;-- The addresses of the pure algorithms (without the display- and delay-macros).
    AlgorithmsInfo_PURE DWORD OFFSET BubbleSort_PURE
                        DWORD OFFSET ExtendedBubbleSort_PURE
                        DWORD OFFSET ShakerSort_PURE
                        DWORD OFFSET RippleSort_PURE
                        DWORD OFFSET SelectionSort_PURE
                        DWORD OFFSET InsertionSort_PURE
                        DWORD OFFSET ShellSort_PURE
                        DWORD OFFSET TwoWayMergeSort_PURE
                        DWORD OFFSET StraightTwoWayMergeSort_PURE
                        DWORD OFFSET NaturalTwoWayMergeSort_PURE
                        DWORD OFFSET RadixExchangeSort_PURE
                        DWORD OFFSET QuickSort_PURE
                        DWORD OFFSET StraightQuickSort_PURE
                        DWORD OFFSET CombSort_PURE
                        DWORD OFFSET BucketSort_PURE


    ;-------------------------------------------------------------------------------------
    ;-- The titles of the algorithms.
    STRING_Bubblesort              BYTE "Bubblesort", 0
    STRING_ExtBubblesort           BYTE "Extended Bubblesort", 0
    STRING_Shakersort              BYTE "Shakersort", 0
    STRING_Ripplesort              BYTE "Ripplesort", 0
    STRING_Selectionsort           BYTE "Selectionsort", 0
    STRING_Insertionsort           BYTE "Insertionsort", 0
    STRING_Shellsort               BYTE "Shellsort", 0
    STRING_TwoWayMergesort         BYTE "2-Way Mergesort", 0
    STRING_StraightTwoWayMergeSort BYTE "Straight 2-Way Mergesort", 0
    STRING_NaturalTwoWayMergeSort  BYTE "Natural 2-Way Mergesort", 0
    STRING_RadixExchangeSort       BYTE "Radix Exchange-Sort", 0
    STRING_QuickSort               BYTE "Quicksort", 0
    STRING_StraightQuickSort       BYTE "Straight Quicksort (masm32.lib)", 0
    STRING_CombSort                BYTE "Combsort (masm32.lib)", 0
    STRING_BucketSort              BYTE "Bucketsort", 0


    ;-------------------------------------------------------------------------------------
    ;-- The structure for the function InitCommonControlsEx.
    ICCE INITCOMMONCONTROLSEX <SIZEOF INITCOMMONCONTROLSEX, ICC_STANDARD_CLASSES or ICC_WIN95_CLASSES>


    ;-------------------------------------------------------------------------------------
    ;-- The parts in the status bar.
    SB_PART_ALGORITHM  EQU 0
    SB_PART_CMPCOUNTER EQU 1
    SB_PART_MOVCOUNTER EQU 2


    ;-------------------------------------------------------------------------------------
    ;-- This string signs that an error occured while executing a specific sorting
    ;-- algorithm.
    LVI_Error BYTE "! ", 0


    ;-------------------------------------------------------------------------------------
    ;-- This constant signs a stack overflow.
    IFNDEF
      EXCEPTION_STACK_OVERFLOW       EQU 0C00000FDH
    ENDIF



;-----------------------------------------------------------------------------------------
; Include other procedures.
;-----------------------------------------------------------------------------------------

  include languages.asm
  include copyItems.asm
  include createElements.asm
  include sorting.asm

  include dlgFrame.asm
  include dlgTable.asm
  include dlgGraphic.asm
  include dlgInfo.asm


;-----------------------------------------------------------------------------------------
; Include the sorting algorithms.
;-----------------------------------------------------------------------------------------

  include algorithms/BubbleSort.asm
  include algorithms/ExtendedBubbleSort.asm
  include algorithms/ShakerSort.asm
  include algorithms/RippleSort.asm
  include algorithms/SelectionSort.asm
  include algorithms/InsertionSort.asm
  include algorithms/ShellSort.asm
  include algorithms/TwoWayMergeSort.asm
  include algorithms/RadixExchangeSort.asm
  include algorithms/QuickSort.asm
  include algorithms/CombSort.asm
  include algorithms/BucketSort.asm


  ;---------------------------------------------------------------------------------------
  ;-- Now include them without the display- and delay-macros. These procedures are used in
  ;-- the tabular representation (procedure name: xxx_PURE; e.g. BubbleSort_PURE).

  PURE_ALGORITHM = TRUE

  include algorithms/BubbleSort.asm
  include algorithms/ExtendedBubbleSort.asm
  include algorithms/ShakerSort.asm
  include algorithms/RippleSort.asm
  include algorithms/SelectionSort.asm
  include algorithms/InsertionSort.asm
  include algorithms/ShellSort.asm
  include algorithms/TwoWayMergeSort.asm
  include algorithms/RadixExchangeSort.asm
  include algorithms/QuickSort.asm
  include algorithms/CombSort.asm
  include algorithms/BucketSort.asm

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -