News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

protosort

Started by ecube, September 03, 2007, 03:39:18 PM

Previous topic - Next topic

ecube

Well i'm beginning to realize that some of the larger projects i'm working on in masm are kind of messy do to my lazy coding and cleaning up manually is daughtening, so heres my first step in automation  :bg. This program uses Donkeys great Files, and Strings.lib to alphabetically sort all the proto lines in a file and write them backout. You should just copy the proto lines into a file by themselves(like in the attached example) so no other code is harmed :) my next upload will alphabetically sort all procs-endp's aswell in the code.

[attachment deleted by admin]

u

In large projects, alphabetical sorting is very BAD, imho. You should group them by functionality:


;-------------[ Undo/Redo Manager ]-------------------------------------------------------------------------------------------------------\
URM_CreateURManager proto   *** notice: declare system-boot procs first
URM_DeleteURManager proto pURM:DWORD
URM_SetDefaultURM proto pURM:DWORD

URM_ClearRedoChains proto pURM:DWORD *** here a group of chain-managing procs is defined
URM_ClearUndoChains proto pURM:DWORD
URM_ClearAll proto pURM:DWORD
URM_DeleteOneUndoChain proto pURM:DWORD,pAction:DWORD
URM_NewAction proto pActionFunc:DWORD,lpszDescription:DWORD,pData:DWORD,param1:DWORD,param2:DWORD

URM_Undo proto pURM:DWORD *** here "end-user" procs for the GUI are defined
URM_Redo proto pURM:DWORD
URM_SetupMenuItems proto pURM:DWORD,hMenu:DWORD,UndoItemID:DWORD,RedoItemID:DWORD,lpszUndoAccel:DWORD,lpszRedoAccel:DWORD
URM_CanUndo proto pURM:DWORD
URM_CanRedo proto pURM:DWORD

XURM_Word proto pWord:DWORD *** small in-between procs to sequence data
XURM_Dword proto pDword:DWORD
XURM_ConstArray proto pArray:DWORD,ArraySize:DWORD
XURM_DynArray proto ppvArray:DWORD  ; pointer to pointer.  This array MUST be allocated with HEAP1
XURM_ObjVector_Insert proto pObjVector:DWORD,ObjPtr:DWORD
XURM_ObjVector_Delete proto pObjVector:DWORD,ObjPtr:DWORD ; this is a simple delete, doesn't take into account the old
;----------------------------------------------------------------------------------------------------------------------------------------/

;-----[ Math tools ]------------------------------[
Maths_SB_Clear proto pDest:DWORD,Num:DWORD ; dest = 0 *** simple operations first
Maths_SB_Copy proto pDest:DWORD,pSrc:DWORD,Num:DWORD ; dest = src
Maths_SB_Add proto pDest:DWORD,pSrc:DWORD,Num:DWORD ; dest = dest + src
Maths_SB_Mul proto pDest:DWORD,pSrc:DWORD,Num:DWORD,ValueL:DWORD,ValueR:DWORD ; dest = dest * Value
Maths_SB_MulAdd proto pDest:DWORD,pSrc:DWORD,Num:DWORD,ValueL:DWORD,ValueR:DWORD ; dest = dest + (src*Value)
*** notice increasing complexity of procs

Maths_SB_Mul@Slide proto pDest:DWORD,pSrc:DWORD,Num:DWORD,ValueL:DWORD,ValueR:DWORD,EndValueL:DWORD,EndValueR:DWORD
Maths_SB_MulAdd@Slide proto pDest:DWORD,pSrc:DWORD,Num:DWORD,ValueL:DWORD,ValueR:DWORD,EndValueL:DWORD,EndValueR:DWORD

Maths_SB_Average proto pSrc:DWORD,Num:DWORD ; returns in EAX(left) and EDX(right)
Maths_SB_Average_Rough proto pSrc:DWORD,Num:DWORD ; returns in EAX(left) and EDX(right)
*** generally, at the end put the protos that you need to be reminded less frequently of
;-------------------------------------------------/
Please use a smaller graphic in your signature.