• Welcome to Theos PowerBasic Museum 2017.

Code-Formatter PB 10

Started by Theo Gottwald, January 18, 2011, 07:58:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Peter Weis

#150
Hello,
new update. Replace underscore with AS when underscore option is turned on

Input:

LOCAL a, b, _   'kdsjfjasdkfj
        c, _        'abcde
         e AS INTEGER   'test   


Output:


    LOCAL    a                          AS INTEGER          'kdsjfjasdkfj
    LOCAL    b                          AS INTEGER
    LOCAL    c                          AS INTEGER          'abcde
    LOCAL    e                          AS INTEGER          'test       


regards Peter

Theo Gottwald


Paul Elliott

Isn't that what you said you had back on the 12th? Or were all those output lines hand-written?

I haven't tested it yet.


Peter Weis

#153
Hi Paul,
that was dated 11/12/2011 were written by hand! Now things are really as far as I can see!

regards Peter

Paul Elliott

Hi, Peter,

When you don't  reply to each question I can only guess that you haven't worked on it yet.
And with no remarks in the source as to the date/time of any changes I can only guess that
there have been no changes yet.

Doesn't look like anybody else is testing.


Peter Weis

#155
Hi Paul,
that was a question of me on 11.12.2011. How do you want to have the formatting. After I received no answer from you. I Repace underline option programmed.

In addition, more and who file a new zip here, there is also an update.

Today I added multi-line macros

regards Peter

Paul Elliott

Peter,

The question was "Were you going to handle it or ignore it".  If you were going to handle it then
formatting would be exactly like the rest of split variables. If you were going to ignore it then
don't change the format in any way.

How are you handling continued lines? Is this going to be yet another option? If so then you better
make a much bigger form to handle all the different possibilities.

How are you aligning the continued lines under the first line? Indenting  a tab size, indenting to the
= sign or the ( or to the right of the last of the first line?

I'm not sure what you are doing with Macros ( especially multi-line ) as changing the spacing within
them might change the output results. You do not want to be replacing the macro name with the
macro text within the main body of the program.

Are you documenting any of this in the source code?


Theo Gottwald

Paul, Peter told me that he has currently a bit problems with understanding what you write.
And i am not always availabe to translate.

Anyway i would like to implement this scheme:
- Paul makes ready until he really says "I am done"
- Then we take a look and you can then get the code and make improvements.

Under the current babylonic situation, together with the fact that Peter is not yet ready,
a discussion will waist our time. Let's just wait until Peter says "I am ready".



Paul Elliott

#158
Theo,

That goes both ways. Most times I have to guess at what Peter is saying. I don't speak a word of
German.

I'll wait until Peter or you say he's got all the bugs worked out and all the points that I mentioned
are taken care of. Probably shouldn't take more than a week.
This posting of incomplete code is a waste of time.

Ok?




Paul Elliott

#159
Peter and Theo,

I was curious about noname1.bas and tried it thru the current program.
Indenting went way off the screen.

Ran it thru my flowcharting program and got the following.
Seems that most of the Macro Function parts are incomplete ( at least according to PB Help ).
Or else I have a problem but there aren't a lot of extra End Macros at the end.

Just thought it might help.

LATER:

guess there's a limit that's different between Preview & Post.
Preview was fine.

attached is a zip of the pikx.big file.



   

Peter Weis

Hi Paul,
send me the source as a zip file. Then I can watch me break this down

regards Peter

Peter Weis

#161
Hi Paul,
I wanted to test out your file. I was however not possible because I do not remove the numbers at the left side wanted!
I told you but a new update added for testing

The new version can Class

see output


#COMPILE DLL
#DIM ALL
#RESOURCE "collection.pbr"
#COM DOC "Dies ist ein Test"
#COM NAME "Collection", 1.1
#COM GUID GUID$( "{85AF93DB-EF37-4916-BE38-CE32985B9C63}")
#COM TLIB ON



#IF NOT %DEF(%CCOLLECTIONINC)
%CCOLLECTIONINC                   = 1


    INTERFACE ICollectionEvent GUID$( "{BC0DA08D-A429-42E7-BEC2-0FC5C56C131F}") AS EVENT
        INHERIT IAUTOMATION
        METHOD BevoreAdd(BYVAL nCount AS DWORD)


        METHOD AfterAdd(BYVAL nCount AS DWORD)


        METHOD ItemRemoved(oKey AS VARIANT)


        METHOD ERROR(BYVAL nNumber AS DWORD)

    END INTERFACE


    CLASS CCollection GUID$( "{BE08C50D-1D02-4A0A-8FA6-514E365B848F}") AS COM
        INSTANCE arObj() AS VARIANT
        INSTANCE arKey() AS STRING
        INSTANCE nCounter AS DWORD

        CLASS METHOD DESTROY()
            ERASE arObj()
            ERASE arKey()
        END METHOD

        CLASS METHOD GetArIndex(sKey AS STRING) AS DWORD
            LOCAL    i                  AS DWORD
            ARRAY SCAN arKey(), COLLATE UCASE, = sKey, TO i
            METHOD = i
        END METHOD

        CLASS METHOD RemoveFromObjAr(BYVAL nIndex AS DWORD)
            LOCAL    i                  AS DWORD

            FOR i = nIndex TO UBOUND(arObj())
                IF nIndex > 0 THEN
                    SWAP arobj(i - 1), arobj(i)
                    SWAP arKey(i - 1), arkey(i)
                ELSE
                    IF i < UBOUND(arObj()) THEN
                        SWAP arobj(i), arobj(i + 1)
                        SWAP arKey(i), arKey(i + 1)
                    END IF
                END IF
            NEXT

            IF nCounter - 1 = 0 THEN
                REDIM    arobj(nCounter - 1)
                REDIM    arKey(nCounter - 1)
            ELSE
                REDIM    PRESERVE arobj(nCounter - 1)
                REDIM    PRESERVE arKey(nCounter - 1)
            END IF
        END METHOD

        INTERFACE ICollection GUID$( "{F975C92B-988F-4FA8-9BBA-6762C27014A7}")
            INHERIT IDISPATCH

            PROPERTY GET COUNT() AS DWORD
                PROPERTY = nCounter
            END PROPERTY

            PROPERTY GET GetKey(BYVAL nIndex AS DWORD) AS STRING
                IF nIndex < LBOUND(arKey()) THEN
                    RAISEEVENT ICollectionEvent.Error(3)
                    EXIT PROPERTY
                END IF
                IF nIndex > UBOUND(arKey()) THEN
                    RAISEEVENT ICollectionEvent.Error(4)
                    EXIT PROPERTY
                END IF
                PROPERTY = arKey(nIndex)
            END PROPERTY

            PROPERTY GET GetItemDirect(BYVAL nIndex AS DWORD) AS VARIANT
                IF nIndex < LBOUND(arKey()) THEN
                    RAISEEVENT ICollectionEvent.Error(3)
                    EXIT PROPERTY
                END IF
                IF nIndex > UBOUND(arKey()) THEN
                    RAISEEVENT ICollectionEvent.Error(4)
                    EXIT PROPERTY
                END IF
                PROPERTY = arObj(nIndex)
            END PROPERTY


            METHOD ADD(BYVAL obj AS VARIANT, OPT BYVAL oKey AS VARIANT) AS DWORD
                LOCAL    s              AS STRING

                RAISEEVENT ICollectionEvent.BevoreAdd(nCounter)
                IF ISMISSING(oKey) THEN oKey = STR$(nCounter + 1)

                SELECT CASE VARIANTVT(oKey)
                    CASE %VT_BSTR: s = UCASE$(VARIANT$(oKey))
                    CASE ELSE: s = STR$(VARIANT#(oKey))
                END SELECT

                IF me.GetArIndex(s) > 0 THEN
                    RAISEEVENT ICollectionEvent.Error(1)
                    EXIT METHOD
                END IF

                nCounter += 1
                REDIM    PRESERVE arObj(nCounter)
                REDIM    PRESERVE arKey(nCounter)
                arObj(nCounter) = obj
                arKey(nCounter) = s

                RAISEEVENT ICollectionEvent.AfterAdd(nCounter)
                METHOD = nCounter
            END METHOD

            METHOD Remove(BYVAL nItemOrKey AS VARIANT) AS DWORD
                LOCAL    s              AS STRING
                LOCAL    n              AS DWORD

                SELECT CASE VARIANTVT(nItemOrKey)
                    CASE 8: s = UCASE$(VARIANT$(nItemOrKey))
                    CASE ELSE
                        n = VARIANT#(nItemOrKey)
                        Me.RemoveFromObjAr(n)
                        nCounter -= 1
                        METHOD = n
                        RAISEEVENT ICollectionEvent.ItemRemoved(nItemOrKey)
                        EXIT METHOD
                END SELECT
                n = me.GetArIndex(s)
                IF n < 1 THEN
                    RAISEEVENT ICollectionEvent.Error(1)
                    EXIT METHOD
                END IF
                Me.RemoveFromObjAr(n)
                nCounter -= 1

                RAISEEVENT ICollectionEvent.ItemRemoved(nItemOrKey)
                METHOD = n
            END METHOD

            METHOD ITEM(BYVAL nItemOrKey AS VARIANT) AS VARIANT
                LOCAL    s              AS STRING
                LOCAL    n              AS DWORD

                SELECT CASE VARIANTVT(nItemOrKey)
                    CASE 8:
                        s = UCASE$(VARIANT$(nItemOrKey))
                        n = Me.GetArIndex(s) - 1
                        IF n > 0 THEN METHOD = arObj(n)
                        EXIT METHOD
                    CASE ELSE
                        METHOD = arObj(VARIANT#(nItemOrKey))
                        EXIT METHOD
                END SELECT
                RAISEEVENT ICollectionEvent.Error(2)
            END METHOD


        END INTERFACE

        EVENT SOURCE ICollectionEvent
    END CLASS
#ENDIF


regards Peter

Paul Elliott

Theo,

I'm sorry I posted that file.

Please explain to Peter:
Noname1.bas is his file. It was in the RAR that he posted.
I was curious to see if his program could handle it but it did not.
The indenting ran way to the right and never reset to the left.

The file I posted just pointed out where single line macros were and where
multi-line macros started and ended.

Macro Functions are only multi-line according to PB Help file.
There are many of them in that file that are really single line macro and have
no End Macro line.

I will not download or test anything for at least a week. Hopefully by then Peter
will have the program complete & tested. If not then I'll wait longer.

Sorry.


Peter Weis

#163
Hi Paul,
Even multi-line macros will be formatted! See here!
File by Theo!

input File:

'##################################################################################################
'
'##################################################################################################
MACRO G_REG()
REGISTER R01 AS LONG,R02 AS LONG
END MACRO

MACRO G_S01()
LOCAL S01 AS STRING
END MACRO

MACRO G_S02()
LOCAL S01,S02 AS STRING
END MACRO

MACRO G_S03()
LOCAL S01,S02,S03 AS STRING
END MACRO

MACRO G_S04()
LOCAL S01,S02,S03,S04 AS STRING
END MACRO

MACRO G_S05()
LOCAL S01,S02,S03,S04,S05 AS STRING
END MACRO

MACRO G_S06()
LOCAL S01,S02,S03,S04,S05,S06 AS STRING
END MACRO

MACRO G_S07()
LOCAL S01,S02,S03,S04,S05,S06,S07 AS STRING
END MACRO

MACRO G_S08()
LOCAL S01,S02,S03,S04,S05,S06,S07,S08 AS STRING
END MACRO

MACRO G_S09()
LOCAL S01,S02,S03,S04,S05,S06,S07,S08,S09 AS STRING
END MACRO

MACRO G_S10()
LOCAL S01,S02,S03,S04,S05,S06,S07,S08,S09,S10 AS STRING
END MACRO

MACRO G_S11()
LOCAL S01,S02,S03,S04,S05,S06,S07,S08,S09,S10,S11 AS STRING
END MACRO

MACRO G_S12()
LOCAL S01,S02,S03,S04,S05,S06,S07,S08,S09,S10,S11,S12 AS STRING
END MACRO

MACRO G_T01()
LOCAL T01 AS LONG
END MACRO

MACRO G_T02()
LOCAL T01,T02 AS LONG
END MACRO

MACRO G_T03()
LOCAL T01,T02,T03 AS LONG
END MACRO

MACRO G_T04()
LOCAL T01,T02,T03,T04 AS LONG
END MACRO

MACRO G_T05()
LOCAL T01,T02,T03,T04,T05 AS LONG
END MACRO

MACRO G_T06()
LOCAL T01,T02,T03,T04,T05,T06 AS LONG
END MACRO

MACRO G_T07()
LOCAL T01,T02,T03,T04,T05,T06,T07 AS LONG
END MACRO

MACRO G_T08()
LOCAL T01,T02,T03,T04,T05,T06,T07,T08 AS LONG
END MACRO

MACRO G_T09()
LOCAL T01,T02,T03,T04,T05,T06,T07,T08,T09 AS LONG
END MACRO

MACRO G_T10()
LOCAL T01,T02,T03,T04,T05,T06,T07,T08,T09,T10 AS LONG
END MACRO

MACRO G_T11()
LOCAL T01,T02,T03,T04,T05,T06,T07,T08,T09,T10,T11 AS LONG
END MACRO

MACRO G_T12()
LOCAL T01,T02,T03,T04,T05,T06,T07,T08,T09,T10,T11,T12 AS LONG
END MACRO

MACRO EXIF() =EXIT FUNCTION
MACRO EXIC() =EXIT SELECT
MACRO EXIS() =EXIT SUB

MACRO ENDS() =END SUB

MACRO ENDF_R01()
   FUNCTION=R01
   END FUNCTION
END MACRO

MACRO ENDF_R02()
   FUNCTION=R02
   END FUNCTION
END MACRO

MACRO ENDF_S01()
   FUNCTION=S01
   END FUNCTION
END MACRO
'##################################################################################################
'
'##################################################################################################

FUNCTION How_got_here() AS STRING
  REGISTER R01 AS LONG
   LOCAL S01 AS STRING
  FOR R01 = CALLSTKCOUNT TO 1 STEP -1
S01+=$CRLF+CALLSTK$(R01)
  NEXT
S01+="---------------------------------------"+$CRLF
FUNCTION=S01
END FUNCTION
'##################################################################################################
'
'##################################################################################################
MACRO G_ERM(P1)
ero:
G_ERO$="ERL: "+STR$(ERL)+" * "+P1+":"+ERROR$(ERR)+" * ("+STR$(ERR)+"). ERAPI="+STR$(ERRAPI): G_AA G_ERO$:ERRCLEAR:RESUME NEXT
END MACRO

SUB G_AA(BYVAL a$)
MSGBOX "An Error happened:"+$CRLF+a$,,"http://www.it-berater.org - Software Library"
EXIT SUB
END SUB


#ENDIF
'##################################################################################################
'
'##################################################################################################


MACRO MAXVALUE_DL =  1.7976931348623157E+308#      'max value for a double
MACRO MINVALUE_DL = -1.7976931348623157E+308#      'min value for a double

MACRO MAXVALUE_SN =  3.402823e+38!                 'max value for a single
MACRO MINVALUE_SN = -3.402823e+38!                 'min value for a single

MACRO MAXVALUE_SQ =  9,223,372,036,854,775,807&&   'max value for a signed quad (64 bits)
MACRO MINVALUE_SQ = -9,223,372,036,854,775,808&&   'min value for a signed quad (64 bits)

MACRO MAXVALUE_UQ =  18446744073709551615    'max value for a unsigned quad (64 bits)
MACRO MINVALUE_UQ =  0                             'min value for a unsigned quad (64 bits)

MACRO MAXVALUE_LN =  2147483647&                'max value for a long
MACRO MINVALUE_LN = -2147483648&                'min value for a long

MACRO MAXVALUE_DW =  4294967295???              'min value for a dword
MACRO MINVALUE_DW =  0???                          'min value for a dword

MACRO MAXVALUE_SW =  32767%                        'max value for a signed word
MACRO MINVALUE_SW = -32768%                        'min value for a signed word

MACRO MAXVALUE_UW =  65535??                       'max value for an unsigned word
MACRO MINVALUE_UW =  0??                           'min value for an unsigned word

MACRO MAXVALUE_SB =  127?                          'min value for a signed byte
MACRO MINVALUE_SB = -128?                          'min value for a signed byte

MACRO MAXVALUE_UB =  255                           'max value for a unsigned byte
MACRO MINVALUE_UB =  0                             'min value for a unsigned byte
'##################################################################################################
'
'##################################################################################################
%MAX_DW=4294967295
%MAX_LW=2147483647
%MIN_LW=-2147483648

%MAX_BYTE = 255?
%MAXIMUM_INT = 32767%
%MAXIMUM_DWORD = &HFFFFFFFF???
%MAXIMUM_LONG = &H7FFFFFFF&
%MINIMUM_LONG = &H80000000&

%ONE_FILETIME_DAY     =   600000000&& * 60&& * 24&&
%ONE_FT_DAY           =   864000000000&&   ' 864,000,000,000
%ONE_FILETIME_HOUR    =   %ONE_FILETIME_DAY \ 24
%ONE_FILETIME_MINUTE  =   %ONE_FILETIME_HOUR \ 60
%ONE_FILETIME_SECOND  =   %ONE_FILETIME_MINUTE \ 60

MACRO T_SECOND = (10000000)
MACRO T_MINUTE = (60 * T_SECOND)
MACRO T_HOUR   = (60 * T_MINUTE)
MACRO T_DAY    = (24 * T_HOUR)
MACRO T_1970   = (T_DAY * 134774)
'##################################################################################################
'
'##################################################################################################

MACRO UINT8 = BYTE
MACRO SINT16 = INTEGER
MACRO UINT16 = WORD
MACRO SINT32 = LONG
MACRO UINT32 = DWORD
MACRO SINT64 = QUAD

'##################################################################################################
'
'##################################################################################################
#IF NOT %DEF(%G_AK_INC)
%G_AK_INC=1

' Includes für X_BG und X_BF (DateToNumber und NumberToDate)

%MAXYEAR = 11734883???  'yes, the functions will handle dates up to December 31 of this year
%MAXDAY = 4285493616??? 'the maximum number of days allowed by the
'"NumberToDate" function. Corresponds to 12-31-%MAXYEAR

#ENDIF


MACRO PI1=3.141592653589793238462643383279#
MACRO PI2 = 6.2831853071796#

$G_TXT="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß[]{}@<>.1234567890_\-;:*+#§%&/()=!"
$G_Largeletter_engl="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$G_Num="0123456789"
$G_HEXNum="0123456789ABCDEF"

#IF NOT %DEF(%D_NUM_INC)
%D_NUM_INC=1

$D_NUM="0123456789"
$D_LET="abcdefghijklmnopqrstuvwxyzöüäßABCDEFGHIJKLMNOPQRSTUVWXYZÄÜÖ"
$D_FLA="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'[]{}@|<>.1234567890_\-;:*+#§%&/()=! "
$D_FLB="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'´`[]{}@.1234567890_-;+#§%&()=! "
$D_FLC="\/:*?<>|"+$DQ
$D_FLD=":\abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'[]{}@.1234567890_-;+#§%&()=! "
$D_FLE="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890_\ "
#ENDIF

'%MAX_QUAD=2^63-1&&
'##################################################################################################
'
'##################################################################################################
#IF NOT %DEF(%A_AU_FData_INC)
%A_AU_FData_INC=1
TYPE A_AU_FData
files AS QUAD ' Found Files muss auf 0 gesetzt werden
dirs AS QUAD  ' found dirs, muss auf 0 gesetzt werden
MODE AS DWORD ' 1 - pause, 2 - cancel operation 0 - normal
bytes AS QUAD ' enthält die Bytes die zurückgegeben werden
total AS QUAD ' Gesamtanzahl gefundener Items
END TYPE
#ENDIF

#IF NOT %DEF(%Type_D_List)
%Type_D_List=1

TYPE D_List
U AS LONG ' In Use = %True, Empty=%False
N AS DWORD ' Nr of Elements (0 - Liste ist leer)
D AS DWORD ' actual maximum Dimension
END TYPE
#ENDIF
'##################################################################################################
'
'##################################################################################################
MACRO A_AU_Reset(p1)
p1.files=0:p1.dirs=0:p1.mode=0:p1.bytes=0:p1.total=0
END MACRO
'##################################################################################################
'
'##################################################################################################
#IF NOT %DEF(%Prop_MACROS)
%Prop_MACROS = 1
MACRO PropGet(PropName,PropType)=PROPERTY GET PropName() AS PropType:PROPERTY=PropName:END PROPERTY
MACRO PropSet(PropName,PropType)=PROPERTY SET PropName(BYVAL param AS PropType):PropName=param:END PROPERTY
MACRO PropSetBR(PropName,PropType)=PROPERTY SET PropName(BYREF param AS PropType):PropName=param:END PROPERTY

' P1 - Unteres Limit, P2 - oberes Limit
MACRO PropSetCheck(PropName,PropType,P1,P2)
PROPERTY SET PropName(BYVAL param AS PropType)
IF (param>P2) THEN param=P2
IF (param<P1) THEN param=P1
PropName=param
END PROPERTY
END MACRO
MACRO PropGS(PropN,PropT)=PropGet(PropN,PropT):PropSet(PropN,PropT)
MACRO PropGSR(PropN,PropT)=PropGet(PropN,PropT):PropSetBR(PropN,PropT)
MACRO PropGSC(PropN,PropT,P1,P2)
PropGet(PropN,PropT)
PropSetCheck(PropN,PropT,P1,P2)
END MACRO

MACRO INST = INSTANCE
' P1 - Interfacevariable, P2 - Variable mit Objektpointer aus BYVAL Threadfunktion, P3 = "ThreadP" (Name der Klasse inkl. "")
' Beispiel: OpenClass(E1,T01,"ThreadP")
MACRO OpenClass(P1,P2,P3) = P1 = CLASS P3:POKE DWORD, VARPTR(P1),P2: P1.AddRef

' P1 - Threadhandle
MACRO WaitForThread(P1) =  WaitForSingleObject(P1,%INFINITE)

' P1 erstes Element eines Feldes mit Threadhandles, zum Beispiel "hThread(0)"
' P2 - Anzahl Threads
MACRO WaitForThreads(P1,P2) = WaitForMultipleObjects(P2,BYVAL VARPTR(P1), %TRUE, %INFINITE)

' Create a Non-Signaled, manual Reset Event - Needs later a  CloseHandle(P1)
' P1 = Long-Variable
MACRO MakeEventN(P1)
  P1=CreateEvent($NUL,%True,%False,$NUL)
END MACRO

' Create a Signaled, manual Reset Event - Needs later a  CloseHandle(P1)
' P1 = Long-Variable
MACRO MakeEventS(P1)
  P1=CreateEvent($NUL,%True,%True,$NUL)
END MACRO

' Create a Non-Signaled, Auto-Reset (Pulsed) Event - Needs later a  CloseHandle(P1)
' P1 = Long-Variable
MACRO MakeEventNP(P1)
  P1=CreateEvent($NUL,%False,%False,$NUL)
END MACRO

' Create a Signaled, manual Reset Event - Needs later a  CloseHandle(P1)
' P1 = Long-Variable
MACRO MakeEventSP(P1)
  P1=CreateEvent($NUL,%False,%True,$NUL)
END MACRO

MACRO WaitForEvent(P1)
   WaitForSingleObject(P1,%INFINITE)
END MACRO

' Dazu gehört noch  API: "SetEvent(X) und ResetEvent(X)

#ENDIF
' Signal-Events
' SetEvent(hEvent)
' ResetEvent (hEvent)
' PulseEvent(
' WaitForSingleObject(WR_HV_EH(T01),%INFINITE)
' WR_HV_EH(R01)=CreateEvent($NUL,0,0,$NUL)   -> CloseHandle(WR_HV_EH(R01))
' WaitForMultipleObjects T04+1, BYVAL VARPTR(hThread(0)), %TRUE, %INFINITE
'##################################################################################################
'
'##################################################################################################
' PowerBasic builtin Clases Construction
MACRO Make_StringbuilderA(P1) = LOCAL P1 AS ISTRINGBUILDERA: P1 = CLASS "StringbuilderA"
MACRO Make_StringbuilderW(P1) = LOCAL P1 AS ISTRINGBUILDERW: P1 = CLASS "StringbuilderW"
MACRO Make_Powertime(P1) = LOCAL P1 AS IPOWERTIME: P1 = CLASS "Powertime"
MACRO Make_Collection(P1) = LOCAL P1 AS IPOWERCOLLECTION: P1 = CLASS "PowerCollection"
MACRO Make_LinkedList(P1) = LOCAL P1 AS ILINKLISTCOLLECTION: P1 = CLASS "LinkListCollection"
MACRO Make_Stack(P1) = LOCAL P1 AS ISTACKCOLLECTION:P1 = CLASS "StackCollection"
MACRO Make_Que(P1) = LOCAL P1 AS IQUEUECOLLECTION:P1 = CLASS "QueueCollection"
MACRO Make_PowerThread(P1,P2) = LOCAL P1 AS IPOWERTHREAD: P1 = CLASS P2
'##################################################################################################
'
'##################################################################################################
' X_AQ() DoEventsAPI
#IF NOT %DEF(%X_AQ_INC)
%X_AQ_INC=1
SUB X_AQ()
ON ERROR RESUME NEXT
STATIC Msg AS tagMsg
IF PeekMessage(Msg,%NULL, 0, 0, %PM_REMOVE) THEN
TranslateMessage Msg:DispatchMessage Msg
END IF
END SUB
#ENDIF
'##################################################################################################
'
'##################################################################################################
#IF NOT %DEF(%X_GV_INC)
%X_GV_INC=1
' DoQueryEvents for Hwnd
'
SUB X_GV(hDlg AS LONG)
LOCAL Msg AS tagMsg
WHILE PeekMessage(Msg, %NULL, %NULL, %NULL, %PM_REMOVE)
  IF (IsDialogMessage(hDlg, Msg)=0) THEN
TranslateMessage Msg
DispatchMessage Msg
  END IF
WEND
END SUB
#ENDIF

'##################################################################################################
'
'##################################################################################################





output file

'##################################################################################################
'
'##################################################################################################
MACRO G_REG()
    REGISTER R01                        AS LONG
    REGISTER R02                        AS LONG
END MACRO

MACRO G_S01()
    LOCAL    S01                        AS STRING
END MACRO

MACRO G_S02()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
END MACRO

MACRO G_S03()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
END MACRO

MACRO G_S04()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
END MACRO

MACRO G_S05()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
    LOCAL    S05                        AS STRING
END MACRO

MACRO G_S06()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
    LOCAL    S05                        AS STRING
    LOCAL    S06                        AS STRING
END MACRO

MACRO G_S07()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
    LOCAL    S05                        AS STRING
    LOCAL    S06                        AS STRING
    LOCAL    S07                        AS STRING
END MACRO

MACRO G_S08()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
    LOCAL    S05                        AS STRING
    LOCAL    S06                        AS STRING
    LOCAL    S07                        AS STRING
    LOCAL    S08                        AS STRING
END MACRO

MACRO G_S09()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
    LOCAL    S05                        AS STRING
    LOCAL    S06                        AS STRING
    LOCAL    S07                        AS STRING
    LOCAL    S08                        AS STRING
    LOCAL    S09                        AS STRING
END MACRO

MACRO G_S10()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
    LOCAL    S05                        AS STRING
    LOCAL    S06                        AS STRING
    LOCAL    S07                        AS STRING
    LOCAL    S08                        AS STRING
    LOCAL    S09                        AS STRING
    LOCAL    S10                        AS STRING
END MACRO

MACRO G_S11()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
    LOCAL    S05                        AS STRING
    LOCAL    S06                        AS STRING
    LOCAL    S07                        AS STRING
    LOCAL    S08                        AS STRING
    LOCAL    S09                        AS STRING
    LOCAL    S10                        AS STRING
    LOCAL    S11                        AS STRING
END MACRO

MACRO G_S12()
    LOCAL    S01                        AS STRING
    LOCAL    S02                        AS STRING
    LOCAL    S03                        AS STRING
    LOCAL    S04                        AS STRING
    LOCAL    S05                        AS STRING
    LOCAL    S06                        AS STRING
    LOCAL    S07                        AS STRING
    LOCAL    S08                        AS STRING
    LOCAL    S09                        AS STRING
    LOCAL    S10                        AS STRING
    LOCAL    S11                        AS STRING
    LOCAL    S12                        AS STRING
END MACRO

MACRO G_T01()
    LOCAL    T01                        AS LONG
END MACRO

MACRO G_T02()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
END MACRO

MACRO G_T03()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
END MACRO

MACRO G_T04()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
END MACRO

MACRO G_T05()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
    LOCAL    T05                        AS LONG
END MACRO

MACRO G_T06()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
    LOCAL    T05                        AS LONG
    LOCAL    T06                        AS LONG
END MACRO

MACRO G_T07()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
    LOCAL    T05                        AS LONG
    LOCAL    T06                        AS LONG
    LOCAL    T07                        AS LONG
END MACRO

MACRO G_T08()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
    LOCAL    T05                        AS LONG
    LOCAL    T06                        AS LONG
    LOCAL    T07                        AS LONG
    LOCAL    T08                        AS LONG
END MACRO

MACRO G_T09()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
    LOCAL    T05                        AS LONG
    LOCAL    T06                        AS LONG
    LOCAL    T07                        AS LONG
    LOCAL    T08                        AS LONG
    LOCAL    T09                        AS LONG
END MACRO

MACRO G_T10()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
    LOCAL    T05                        AS LONG
    LOCAL    T06                        AS LONG
    LOCAL    T07                        AS LONG
    LOCAL    T08                        AS LONG
    LOCAL    T09                        AS LONG
    LOCAL    T10                        AS LONG
END MACRO

MACRO G_T11()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
    LOCAL    T05                        AS LONG
    LOCAL    T06                        AS LONG
    LOCAL    T07                        AS LONG
    LOCAL    T08                        AS LONG
    LOCAL    T09                        AS LONG
    LOCAL    T10                        AS LONG
    LOCAL    T11                        AS LONG
END MACRO

MACRO G_T12()
    LOCAL    T01                        AS LONG
    LOCAL    T02                        AS LONG
    LOCAL    T03                        AS LONG
    LOCAL    T04                        AS LONG
    LOCAL    T05                        AS LONG
    LOCAL    T06                        AS LONG
    LOCAL    T07                        AS LONG
    LOCAL    T08                        AS LONG
    LOCAL    T09                        AS LONG
    LOCAL    T10                        AS LONG
    LOCAL    T11                        AS LONG
    LOCAL    T12                        AS LONG
END MACRO

MACRO EXIF() = EXIT FUNCTION
MACRO EXIC() = EXIT SELECT
MACRO EXIS() = EXIT SUB

MACRO ENDS() = END SUB

MACRO ENDF_R01()
    FUNCTION = R01
END FUNCTION
END MACRO

MACRO ENDF_R02()
    FUNCTION = R02
END FUNCTION
END MACRO

MACRO ENDF_S01()
    FUNCTION = S01
END FUNCTION
END MACRO
'##################################################################################################
'
'##################################################################################################

FUNCTION How_got_here() AS STRING
    REGISTER R01                        AS LONG
    LOCAL    S01                        AS STRING
    FOR R01 = CALLSTKCOUNT TO 1 STEP - 1
        S01 += $CRLF + CALLSTK$(R01)
    NEXT
    S01 += "---------------------------------------" + $CRLF
    FUNCTION = S01
END FUNCTION
'##################################################################################################
'
'##################################################################################################
MACRO G_ERM(P1)
ero:
    G_ERO$ = "ERL: " + STR$(ERL) + " * " + P1 + ":" + ERROR$(ERR) + " * (" + STR$(ERR) + "). ERAPI=" + STR$(ERRAPI): G_AA G_ERO$: ERRCLEAR: RESUME NEXT
END MACRO

SUB G_AA(BYVAL a$)
    MSGBOX "An Error happened:" + $CRLF + a$,, "http://www.it-berater.org - Software Library"
    EXIT SUB
END SUB



#ENDIF
'##################################################################################################
'
'##################################################################################################


MACRO MAXVALUE_DL = 1.7976931348623157E + 308#             'max value for a double
MACRO MINVALUE_DL = - 1.7976931348623157E + 308#           'min value for a double

MACRO MAXVALUE_SN = 3.402823e + 38!                        'max value for a single
MACRO MINVALUE_SN = - 3.402823e + 38!                      'min value for a single

MACRO MAXVALUE_SQ = 9, 223, 372, 036, 854, 775, 807&&      'max value for a signed quad (64 bits)
MACRO MINVALUE_SQ = - 9, 223, 372, 036, 854, 775, 808&&    'min value for a signed quad (64 bits)

MACRO MAXVALUE_UQ = 18446744073709551615                   'max value for a unsigned quad (64 bits)
MACRO MINVALUE_UQ = 0                                      'min value for a unsigned quad (64 bits)

MACRO MAXVALUE_LN = 2147483647&                            'max value for a long
MACRO MINVALUE_LN = - 2147483648&                          'min value for a long

MACRO MAXVALUE_DW = 4294967295???                          'min value for a dword
MACRO MINVALUE_DW = 0???                                   'min value for a dword

MACRO MAXVALUE_SW = 32767%                                 'max value for a signed word
MACRO MINVALUE_SW = - 32768%                               'min value for a signed word

MACRO MAXVALUE_UW = 65535??                                'max value for an unsigned word
MACRO MINVALUE_UW = 0??                                    'min value for an unsigned word

MACRO MAXVALUE_SB = 127?                                   'min value for a signed byte
MACRO MINVALUE_SB = - 128?                                 'min value for a signed byte

MACRO MAXVALUE_UB = 255                                    'max value for a unsigned byte
MACRO MINVALUE_UB = 0                                      'min value for a unsigned byte
'##################################################################################################
'
'##################################################################################################
%MAX_DW                           = 4294967295
%MAX_LW                           = 2147483647
%MIN_LW                           = -2147483648

%MAX_BYTE                         = 255?
%MAXIMUM_INT                      = 32767%
%MAXIMUM_DWORD                    = &HFFFFFFFF???
%MAXIMUM_LONG                     = &H7FFFFFFF&
%MINIMUM_LONG                     = &H80000000&

%ONE_FILETIME_DAY                 = 600000000&&*60&&*24&&
%ONE_FT_DAY                       = 864000000000&&         ' 864,000,000,000
%ONE_FILETIME_HOUR                = %ONE_FILETIME_DAY\24
%ONE_FILETIME_MINUTE              = %ONE_FILETIME_HOUR\60
%ONE_FILETIME_SECOND              = %ONE_FILETIME_MINUTE\60


MACRO T_SECOND = (10000000)
MACRO T_MINUTE = (60 * T_SECOND)
MACRO T_HOUR = (60 * T_MINUTE)
MACRO T_DAY = (24 * T_HOUR)
MACRO T_1970 = (T_DAY * 134774)
'##################################################################################################
'
'##################################################################################################

MACRO UINT8 = BYTE
MACRO SINT16 = INTEGER
MACRO UINT16 = WORD
MACRO SINT32 = LONG
MACRO UINT32 = DWORD
MACRO SINT64 = QUAD

'##################################################################################################
'
'##################################################################################################
#IF NOT %DEF(%G_AK_INC)
%G_AK_INC                         = 1

    ' Includes für X_BG und X_BF (DateToNumber und NumberToDate)

%MAXYEAR                          = 11734883???            'yes, the functions will handle dates up to December 31 of this year
%MAXDAY                           = 4285493616???          'the maximum number of days allowed by the
    '"NumberToDate" function. Corresponds to 12-31-%MAXYEAR

#ENDIF



MACRO PI1 = 3.141592653589793238462643383279#
MACRO PI2 = 6.2831853071796#

$G_TXT                            = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß[]{}@<>.1234567890_\-;:*+#§%&/()=!"
$G_LARGELETTER_ENGL               = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$G_NUM                            = "0123456789"
$G_HEXNUM                         = "0123456789ABCDEF"

#IF NOT %DEF(%D_NUM_INC)
%D_NUM_INC                        = 1

$D_NUM                            = "0123456789"
$D_LET                            = "abcdefghijklmnopqrstuvwxyzöüäßABCDEFGHIJKLMNOPQRSTUVWXYZÄÜÖ"
$D_FLA                            = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'[]{}@|<>.1234567890_\-;:*+#§%&/()=! "
$D_FLB                            = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'´`[]{}@.1234567890_-;+#§%&()=! "
$D_FLC                            = "\/:*?<>|"+$DQ
$D_FLD                            = ":\abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZüöäÜÖÄß'[]{}@.1234567890_-;+#§%&()=! "
$D_FLE                            = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890_\ "
#ENDIF

'%MAX_QUAD=2^63-1&&
'##################################################################################################
'
'##################################################################################################
#IF NOT %DEF(%A_AU_FDATA_INC)
%A_AU_FDATA_INC                   = 1
    TYPE A_AU_FData
        files AS QUAD                                      ' Found Files muss auf 0 gesetzt werden
        dirs AS QUAD                                       ' found dirs, muss auf 0 gesetzt werden
        MODE AS DWORD                                      ' 1 - pause, 2 - cancel operation 0 - normal
        bytes AS QUAD                                      ' enthält die Bytes die zurückgegeben werden
        total AS QUAD                                      ' Gesamtanzahl gefundener Items
    END TYPE
#ENDIF

#IF NOT %DEF(%TYPE_D_LIST)
%TYPE_D_LIST                      = 1

    TYPE D_List
        U AS LONG                                          ' In Use = %True, Empty=%False
        N AS DWORD                                         ' Nr of Elements (0 - Liste ist leer)
        D AS DWORD                                         ' actual maximum Dimension
    END TYPE

#ENDIF
'##################################################################################################
'
'##################################################################################################
MACRO A_AU_Reset(p1)
    p1.files = 0: p1.dirs = 0: p1.mode = 0: p1.bytes = 0: p1.total = 0
END MACRO
'##################################################################################################
'
'##################################################################################################
#IF NOT %DEF(%PROP_MACROS)
%PROP_MACROS                      = 1
MACRO PropGet(PropName, PropType) = PROPERTY GET PropName() AS PropType: PROPERTY = PropName: END PROPERTY
MACRO PropSet(PropName, PropType) = PROPERTY SET PropName(BYVAL param AS PropType): PropName = param: END PROPERTY
MACRO PropSetBR(PropName, PropType) = PROPERTY SET PropName(BYREF param AS PropType): PropName = param: END PROPERTY




' P1 - Unteres Limit, P2 - oberes Limit
MACRO PropSetCheck(PropName, PropType, P1, P2)
    PROPERTY SET PropName(BYVAL param AS PropType)

        IF (param > P2) THEN param = P2
        IF (param < P1) THEN param = P1
        PropName = param
    END PROPERTY
END MACRO
MACRO PropGS(PropN, PropT) = PropGet(PropN, PropT): PropSet(PropN, PropT)
MACRO PropGSR(PropN, PropT) = PropGet(PropN, PropT): PropSetBR(PropN, PropT)
MACRO PropGSC(PropN, PropT, P1, P2)
    PropGet(PropN, PropT)
    PropSetCheck(PropN, PropT, P1, P2)
END MACRO

MACRO INST = INSTANCE
' P1 - Interfacevariable, P2 - Variable mit Objektpointer aus BYVAL Threadfunktion, P3 = "ThreadP" (Name der Klasse inkl. "")
' Beispiel: OpenClass(E1,T01,"ThreadP")
MACRO OpenClass(P1, P2, P3) = P1 = CLASS P3: POKE DWORD, VARPTR(P1), P2: P1.AddRef

' P1 - Threadhandle
MACRO WaitForThread(P1) = WaitForSingleObject(P1, %INFINITE)

' P1 erstes Element eines Feldes mit Threadhandles, zum Beispiel "hThread(0)"
' P2 - Anzahl Threads
MACRO WaitForThreads(P1, P2) = WaitForMultipleObjects(P2, BYVAL VARPTR(P1), %TRUE, %INFINITE)

' Create a Non-Signaled, manual Reset Event - Needs later a  CloseHandle(P1)
' P1 = Long-Variable
MACRO MakeEventN(P1)
    P1 = CreateEvent($NUL, %TRUE, %FALSE, $NUL)
END MACRO

' Create a Signaled, manual Reset Event - Needs later a  CloseHandle(P1)
' P1 = Long-Variable
MACRO MakeEventS(P1)
    P1 = CreateEvent($NUL, %TRUE, %TRUE, $NUL)
END MACRO

' Create a Non-Signaled, Auto-Reset (Pulsed) Event - Needs later a  CloseHandle(P1)
' P1 = Long-Variable
MACRO MakeEventNP(P1)
    P1 = CreateEvent($NUL, %FALSE, %FALSE, $NUL)
END MACRO

' Create a Signaled, manual Reset Event - Needs later a  CloseHandle(P1)
' P1 = Long-Variable
MACRO MakeEventSP(P1)
    P1 = CreateEvent($NUL, %FALSE, %TRUE, $NUL)
END MACRO

MACRO WaitForEvent(P1)
    WaitForSingleObject(P1, %INFINITE)
END MACRO

' Dazu gehört noch  API: "SetEvent(X) und ResetEvent(X)

#ENDIF
' Signal-Events
' SetEvent(hEvent)
' ResetEvent (hEvent)
' PulseEvent(
' WaitForSingleObject(WR_HV_EH(T01),%INFINITE)
' WR_HV_EH(R01)=CreateEvent($NUL,0,0,$NUL)   -> CloseHandle(WR_HV_EH(R01))
' WaitForMultipleObjects T04+1, BYVAL VARPTR(hThread(0)), %TRUE, %INFINITE
'##################################################################################################
'
'##################################################################################################
' PowerBasic builtin Clases Construction
MACRO Make_StringbuilderA(P1) = LOCAL P1 AS ISTRINGBUILDERA: P1 = CLASS "StringbuilderA"
MACRO Make_StringbuilderW(P1) = LOCAL P1 AS ISTRINGBUILDERW: P1 = CLASS "StringbuilderW"
MACRO Make_Powertime(P1) = LOCAL P1 AS IPOWERTIME: P1 = CLASS "Powertime"
MACRO Make_Collection(P1) = LOCAL P1 AS IPOWERCOLLECTION: P1 = CLASS "PowerCollection"
MACRO Make_LinkedList(P1) = LOCAL P1 AS ILINKLISTCOLLECTION: P1 = CLASS "LinkListCollection"
MACRO Make_Stack(P1) = LOCAL P1 AS ISTACKCOLLECTION: P1 = CLASS "StackCollection"
MACRO Make_Que(P1) = LOCAL P1 AS IQUEUECOLLECTION: P1 = CLASS "QueueCollection"
MACRO Make_PowerThread(P1, P2) = LOCAL P1 AS IPOWERTHREAD: P1 = CLASS P2
'##################################################################################################
'
'##################################################################################################
' X_AQ() DoEventsAPI
#IF NOT %DEF(%X_AQ_INC)
%X_AQ_INC                         = 1
    SUB X_AQ()
        ON ERROR RESUME NEXT
        STATIC   Msg                    AS tagMsg
        IF PeekMessage(Msg, %NULL, 0, 0, %PM_REMOVE) THEN
            TranslateMessage Msg: DispatchMessage Msg
        END IF
    END SUB
#ENDIF
'##################################################################################################
'
'##################################################################################################
#IF NOT %DEF(%X_GV_INC)
%X_GV_INC                         = 1
    ' DoQueryEvents for Hwnd
    '
    SUB X_GV(hDlg AS LONG)
        LOCAL    Msg                    AS tagMsg
        WHILE PeekMessage(Msg, %NULL, %NULL, %NULL, %PM_REMOVE)
            IF (IsDialogMessage(hDlg, Msg) = 0) THEN
                TranslateMessage Msg
                DispatchMessage Msg
            END IF
        WEND
    END SUB
#ENDIF

'##################################################################################################
'
'##################################################################################################

regards Peter

Theo Gottwald

Ok, I'll try to translate that.

Quoteheo,

I'm sorry I posted that file.
> Ich entschuldige mich, die Datei gepostet zu haben.

Please explain to Peter:
> Bitte erkläre Peter

Noname1.bas is his file. It was in the RAR that he posted.
>Noname 1 ist seine Datei. Sie war in dem RAR File.

I was curious to see if his program could handle it but it did not.
>I Ich wolltesehen was sein Programm daraus macht, aber es hat damit nicht funktioniert.

The indenting ran way to the right and never reset to the left.
> Der Einzug lief nach rechts und kam nicht mehr nach links zurück.

The file I posted just pointed out where single line macros were and where multi-line macros started and ended.
> Die Datei die ich gepostet habe zeigt wo Single- und Multi-Line Macros anfangen und enden.

Macro Functions are only multi-line according to PB Help file.
> Macro Functionen sind immer Multi-Line Macros (PB Help File).

There are many of them in that file that are really single line macro and have no End Macro line.
> Es gibt in der Datei viele Single-Line Macros.

I will not download or test anything for at least a week. Hopefully by then Peter will have the program complete & tested.
> Ich werde in einer Woche nochmal vorbeischauen, vielleicht ist Peter dann ja schon weiter.