Uniface User Forum

 View Only
Expand all | Collapse all

Formating proc code: how?

  • 1.  Formating proc code: how?

    Posted 06-04-2024 09:46

    Hi Freaks

    Now that the biggest obstacles have been cleared away, I can take a closer look at the newer UnifAce versions.
    And I found this "10.4.02.045  :Feature: Format ProcScript, indentation corrections on entire code document"
    But how to activate?
    I'm selection a few line of code and use right mouse click:
    Not a single hint about formatting.
    I have also added the [userkeys] to our INI and USYS.INI: Nothing happens. 
    What else needs to be activated for the formatting to work?

    BTW:
    I did upgrade UnifAce 10.4.2.0-018 to UnifAce 10.4.2.0-49 but just simple copying the UnifAce-Patch

    TIA Ingo



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------


  • 2.  RE: Formating proc code: how?

    ROCKETEER
    Posted 06-04-2024 10:05

    Hi Ingo,

    You can upgrade using the installer instead of copying the patch files, which updates the environment,

    Because formatting rules might differ in various projects, you also need some assignment file settings in your ide,asn. This changed in a patch following initial release. Here are mine:

    [FORMATTING]
    ; Code formatting rules: Use tabs or spaces and specify how to align and indent your params, variables and scope blocks.
        ; You can also include a file with formatting rules placed in a secured location to enforce rules across
        ; your development organization, like:
        ; #file Z:\rules\rules.asn, or #file Z:\.policy
    ; IndentTabs: use tabs or spaces for indentation
        ;    on  = use tabs (default)
        ;    off = use spaces
    IndentTabs = on
    ; IndentSize: number of spaces for indentation
        ;    <number> = number of spaces (default is 4)
    IndentSize = 4
    ; AlignVariables: align variables by type and name
        ;    true  = align (default)
        ;    false = do not align
    AlignVariables = true
    ; AlignParams: align parameters by type, name and direction
        ;    true  = align (default)
        ;    false = do not align
    AlignParams = true
    ; IndentVariables: indent your variables blocks
        ;    true  = indent
        ;    false = do not indent (default)
    IndentVariables = false
    ; IndentParams: indent your params blocks
        ;    true  = indent
        ;    false = do not indent (default)
    IndentParams = false
    ; IndentScope: indent your scope blocks
        ;    true  = indent
        ;    false = do not indent (default)
    IndentScope = false

    Kind Regards, 



    ------------------------------
    David Akerman
    Principal Solution & Enablement Architect
    Rocket Internal - All Brands
    ------------------------------



  • 3.  RE: Formating proc code: how?

    Posted 06-04-2024 10:12

    Hi David

    Can the install routine of UnifAce handle our environment.
    I don't believe so as we do have a hole bunch of INI and ASN-Files :-)



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------



  • 4.  RE: Formating proc code: how?

    ROCKETEER
    Posted 06-04-2024 10:41

    If your environment is complex, you may need to replicate changes to your own files.

    The installer should backup the default ini file before making changes (although I always make my own copy in case). I think it also does the same with ide.asn as my environment was upgraded using the installer, but best make your own tests.

    The readme or release notes should give more information, along with the documentation:

    Rocket Software Documentation

    Rocketsoftware remove preview
    Rocket Software Documentation
    © Rocket Software, Inc. Rocket® is a registered trademark of Rocket Software, Inc. All other trademarks cited herein are the property of their respective owners.
    View this on Rocketsoftware >

    We have also produced some short videos demonstrating some of the new functionality:
    Uniface Shorts on Vimeo

    Vimeo remove preview
    Uniface Shorts on Vimeo
    Join the web's most supportive community of creators and get high-quality tools for hosting, sharing, and streaming videos in gorgeous HD with no ads.
    View this on Vimeo >



    ------------------------------
    David Akerman
    Principal Solution & Enablement Architect
    Rocket Internal - All Brands
    ------------------------------



  • 5.  RE: Formating proc code: how?

    Posted 06-05-2024 03:31

    Hi David

    I just installed UnifAce 10.4.2.0-049 in a new folder.
    As always you have to take such much care about such an installation as not only the folder, ASN or INI files could be overwritten but also the UROUTER and Tomcat. We do have also this for our different environment and I don't want to loose any of them ...

    After installing and switching the database to our development one, the new Uniface shine through :-)
    But now it's my task to find every  "necessary" change in the jumble of ASN/INI files on our site and on the 10.4.2.0-19 site.
    Will be a whole lot of work

    Ingo



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------



  • 6.  RE: Formating proc code: how?

    ROCKETEER
    Posted 06-06-2024 08:41

    Installing from the distribution into an existing install location will cause an upgrade. In the upgrade mode, the new settings will be added to the existing ini/asn files while maintaining existing customisations. It might be worth a try.

    Kind regards,

    Mike



    ------------------------------
    Michael Taylor
    Rocket Internal - All Brands
    ------------------------------



  • 7.  RE: Formating proc code: how?

    ROCKETEER
    Posted 06-05-2024 06:24

    From the looks of this you are not using the correct 4GL in your setup.

    [userkeys] is where the shortcut key combinations are defined and can be changed if you want.
    [formatting] can be used to tweak your formatting rules.

    Both are not needed per se to bring up the menu options...



    ------------------------------
    Jonke Korzelius
    Developer
    Rocket Internal - All Brands
    NL
    ------------------------------



  • 8.  RE: Formating proc code: how?

    Posted 06-05-2024 07:03

    Hi Jonke

    Found that settings  and got also the menu running :-)

    BTW:First test and the formating is already going a little crazy. Have to check whether this is a setting problem or a real issue :-)

    Ingo



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------



  • 9.  RE: Formating proc code: how?

    PARTNER
    Posted 06-05-2024 07:18
    Edited by Iain Sharp 06-05-2024 07:20

    Hi Ingo, 

    I already have a bug logged that whilst it correctly indents if and while statements where they are "if (" or "while (", it doesn't indent them properly if they are "if(" and "while(". 

    This may lead to it appearing to be madness at the moment on the formatting. 

    The 'workaround' is to find/replace "if(" with "if (" and while( with "while (" and then format. Which does help recover from the madness if you have lots of text in the editor. 

    BTW I discovered it also does indent #for (I don't think it should)

    Regards, 

    Iain



    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield GB
    ------------------------------



  • 10.  RE: Formating proc code: how?

    Posted 06-05-2024 07:33

    Hi Iain

    Exactly:  "IF(" does not work  :-)

    I wrote a prettifier long time ago which can handle all UnifAce-statements and more .
    The preprocessor directives will also handled.
    And if you say: #-statements will not be ident.

    Only problem with my solution:
    It is slow 'cause it is completly written in UnifAce itself.  Handling of strings is so slow :-)

    Ingo



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------



  • 11.  RE: Formating proc code: how?

    Posted 06-05-2024 09:13

    The definition looks like this (like [formatting])
    This are only the tokes, functional are a little bit more will be handled :-)

      ; V  = Verb
      ; V1 = GrobGruppe (-=Leer,#=Precompiler,C=Code)
      ; V3 = Klammerungsflag (B=Begin,E=End,M=Middle)
      ; V5 = VerbGruppe
      ;
      ; IG: Einrückgruppe
      ;   +1 -> B=   0,A=  +1 ; Eins einrücken nach dem Statement
      ;   -1 -> B=  -1,A=   0 ; Eins ausrücken vor dem Statement
      ;   ±1 -> B=  -1,A=  +1 ; Vorher eins ausrücken, Nachher wieder eins einrücken
      ;   01 -> B=1000,A=  +1 ; Statment bei 0, danach eins einrücken
      ;   10 -> B=1000,A=1000 ; Statment bei 0, danach bei 0 weiter (von eins kommend)
      ;   0R -> B=1000,A=2000 ; Statment bei 0, danach wie vorher weiter
      ;   ±N -> Um IA einrücken,dann wieder um IB raus

      ; ULC=Uppercase (U=Uppercase,L=Lowercase,""=unverändert)
      ; SEP=Separator (T=JA,F=Nein,""=unverändert)
      ; LIT=Literal
      ; DSC=Description

      $VD_LST$=""
      putitem/id $VD_LST$,"-"              ,"V=-·;V1=-·;IG=0R·;DSC=Leerzeile"
      putitem/id $VD_LST$,";1"             ,"V=;1·;V1=;·;IG=0R"
      putitem/id $VD_LST$,";N"             ,"V=;N·;V1=;"
      putitem/id $VD_LST$,"@1"             ,"V=@1·;V1=@·;IG=0R"
      putitem/id $VD_LST$,"@N"             ,"V=@N·;V1=@"
      putitem/id $VD_LST$,"@+"             ,"V=@+·;V1=@"
    #if (1=1)
      putitem/id $VD_LST$,"#IF"            ,"V=#IF·;V1=#·;V3=B·;IG=+1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#IFDEFINED"     ,"V=#IFDEFINED·;V1=#·;V3=B·;IG=+1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#IFUNDEFINED"   ,"V=#IFUNDEFINED·;V1=#·;V3=B·;IG=+1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ELSEIF"        ,"V=#ELSEIF·;V1=#·;V3=M·;IG=±1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ELSE"          ,"V=#ELSE·;V1=#·;V3=M·;IG=±1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ENDIF"         ,"V=#ENDIF·;V1=#·;V3=E·;IG=-1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#FOR"           ,"V=#FOR·;V1=#·;V3=B·;IG=+1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ENDFOR"        ,"V=#ENDFOR·;V1=#·;V3=E·;IG=-1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#DEFINE"        ,"V=#DEFINE·;V1=#·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#UNDEFINE"      ,"V=#UNDEFINE·;V1=#·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#INCLUDE"       ,"V=#INCLUDE·;V1=#·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#INFO"          ,"V=#INFO·;V1=#·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#WARNING"       ,"V=#WARNING·;V1=#·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ERROR"         ,"V=#ERROR·;V1=#·;ULC=L·;SEP=T"

    #else
      putitem/id $VD_LST$,"#IF"            ,"V=#IF·;V1=#·;V3=B·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#IFDEFINED"     ,"V=#IFDEFINED·;V1=#·;V3=B·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#IFUNDEFINED"   ,"V=#IFUNDEFINED·;V1=#·;V3=B·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ELSEIF"        ,"V=#ELSEIF·;V1=#·;V3=M·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ELSE"          ,"V=#ELSE·;V1=#·;V3=M·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ENDIF"         ,"V=#ENDIF·;V1=#·;V3=E·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#FOR"           ,"V=#FOR·;V1=#·;V3=B·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ENDFOR"        ,"V=#ENDFOR·;V1=#·;V3=E·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#DEFINE"        ,"V=#DEFINE·;V1=#·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#UNDEFINE"      ,"V=#UNDEFINE·;V1=#·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#INCLUDE"       ,"V=#INCLUDE·;V1=#·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#INFO"          ,"V=#INFO·;V1=#·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#WARNING"       ,"V=#WARNING·;V1=#·;IG=0R·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"#ERROR"         ,"V=#ERROR·;V1=#·;IG=0R·;ULC=L·;SEP=T"
    #endif
      putitem/id $VD_LST$,"GOTO"           ,"V=GOTO·;V1=C·;V5=G*"
      putitem/id $VD_LST$,"*GOTO_TAG"      ,"V=*GOTO_TAG·;V1=C·;V5=G*"
      putitem/id $VD_LST$,"*DY_ENTRY"      ,"V=*DY_ENTRY·;V1=C·;V3=B·;V5=E*·;IG=01"
      putitem/id $VD_LST$,"ENTRY"          ,"V=ENTRY·;V1=C·;V3=B·;V5=E*·;IG=01·;ULC=U·;SEP=T"
      putitem/id $VD_LST$,"OPERATION"      ,"V=OPERATION·;V1=C·;V3=B·;V5=E*·;IG=01·;ULC=U·;SEP=T"
      putitem/id $VD_LST$,"OPER_PUBLIC"    ,"V=public OPERATION·;V1=C·;V3=B·;V5=E*·;IG=01·;ULC=U·;SEP=T"
      putitem/id $VD_LST$,"OPER_PARTNER"   ,"V=partner OPERATION·;V1=C·;V3=B·;V5=E*·;IG=01·;ULC=U·;SEP=T"
      putitem/id $VD_LST$,"TRIGGER"        ,"V=TRIGGER·;V1=C·;V3=B·;V5=E*·;IG=01·;ULC=U·;SEP=T"
      putitem/id $VD_LST$,"END"            ,"V=END·;V1=C·;V3=E·;V5=E*·;IG=10·;ULC=U·;SEP=T"
      putitem/id $VD_LST$,"PARAMS"         ,"V=PARAMS·;V1=C·;V3=B·;V5=P*·;IG=+1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"ENDPARAMS"      ,"V=ENDPARAMS·;V1=C·;V3=E·;V5=P*·;IG=-1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"VARIABLES"      ,"V=VARIABLES·;V1=C·;V3=B·;V5=V*·;IG=+1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"ENDVARIABLES"   ,"V=ENDVARIABLES·;V1=C·;V3=E·;V5=V*·;IG=-1·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"WHILE_INL"      ,"V=WHILE_INL·;V1=C·;LIT=WHILE·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"WHILE"          ,"V=WHILE·;V1=C·;V3=B·;V5=W*·;IG=+1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"ENDWHILE"       ,"V=ENDWHILE·;V1=C·;V3=E·;V5=W*·;IG=-1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"REPEAT"         ,"V=REPEAT·;V1=C·;V3=B·;V5=R*·;IG=+1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"UNTIL"          ,"V=UNTIL·;V1=C·;V3=E·;V5=R*·;IG=-1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"FOR"            ,"V=FOR·;V1=C·;V3=B·;V5=F*·;IG=+1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"FORENTITY"      ,"V=FORENTITY·;V1=C·;V3=B·;V5=F*·;IG=+1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"FORLIST"        ,"V=FORLIST·;V1=C·;V3=B·;V5=F*·;IG=+1·;ULC=1"
      putitem/id $VD_LST$,"ENDFOR"         ,"V=ENDFOR·;V1=C·;V3=E·;V5=F*·;IG=-1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"IF_INL"         ,"V=IF_INL·;V1=C·;LIT=IF·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"IF"             ,"V=IF·;V1=C·;V3=B·;V5=I*·;IG=+1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"ELSE"           ,"V=ELSE·;V1=C·;V3=M·;V5=I*·;IG=±1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"ELSEIF"         ,"V=ELSEIF·;V1=C·;V3=M·;V5=I*·;IG=±1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"ENDIF"          ,"V=ENDIF·;V1=C·;V3=E·;V5=I*·;IG=-1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"SELECTCASE"     ,"V=SELECTCASE·;V1=C·;V3=B·;V5=S*·;IG=+1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"CASE"           ,"V=CASE·;V1=C·;V3=M·;V5=S*·;IG=±1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"ELSECASE"       ,"V=ELSECASE·;V1=C·;V3=M·;V5=S*·;IG=±1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"ENDSELECTCASE"  ,"V=ENDSELECTCASE·;V1=C·;V3=E·;V5=S*·;IG=-1·;ULC=1·;SEP=1"
      putitem/id $VD_LST$,"BREAK"          ,"V=BREAK·;V1=C·;ULC=U"
      putitem/id $VD_LST$,"CALL"           ,"V=CALL·;V1=C·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"RUN"            ,"V=RUN·;V1=C·;ULC=L·;SEP=S"
      putitem/id $VD_LST$,"ACTIVATE"       ,"V=ACTIVATE·;V1=C·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"RETURN"         ,"V=RETURN·;V1=C·;ULC=U·;SEP=F"
      putitem/id $VD_LST$,"DONE"           ,"V=DONE·;V1=C·;ULC=L"
      putitem/id $VD_LST$,"NEWINSTANCE"    ,"V=NEWINSTANCE·;V1=C·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"DELETEINSTANCE" ,"V=DELETEINSTANCE·;V1=C·;ULC=L·;SEP=T"
      putitem/id $VD_LST$,"PUTITEM"        ,"V=PUTITEM·;V1=C·;ULC=L"
      putitem/id $VD_LST$,"GETITEM"        ,"V=GETITEM·;V1=C·;ULC=L"
      putitem/id $VD_LST$,"DELITEM"        ,"V=DELITEM·;V1=C·;ULC=L"
      putitem/id $VD_LST$,"SETOCC"         ,"V=SETOCC·;V1=C"
      putitem/id $VD_LST$,"REMOCC"         ,"V=REMOCC·;V1=C"
      putitem/id $VD_LST$,"CREOCC"         ,"V=CREOCC·;V1=C"
      putitem/id $VD_LST$,"DISCARD"        ,"V=DISCARD·;V1=C"
      putitem/id $VD_LST$,"CLEAR"          ,"V=CLEAR·;V1=C"
      putitem/id $VD_LST$,"SORT"           ,"V=SORT·;V1=C"
      putitem/id $VD_LST$,"RETRIEVE"       ,"V=RETRIEVE·;V1=C"
      putitem/id $VD_LST$,"READ"           ,"V=READ·;V1=C"
      putitem/id $VD_LST$,"WRITE"          ,"V=WRITE·;V1=C"
      putitem/id $VD_LST$,"DELETE"         ,"V=DELETE·;V1=C"
      putitem/id $VD_LST$,"SCAN"           ,"V=SCAN·;V1=C"
      putitem/id $VD_LST$,"LENGTH"         ,"V=LENGTH·;V1=C"
      putitem/id $VD_LST$,"MESSAGE"        ,"V=MESSAGE·;V1=C"
      putitem/id $VD_LST$,"ASKMESS"        ,"V=ASKMESS·;V1=C"
      putitem/id $VD_LST$,"STRING"         ,"V=STRING·;V1=C"
      putitem/id $VD_LST$,"NUMERIC"        ,"V=NUMERIC·;V1=C"
      putitem/id $VD_LST$,"BOOLEAN"        ,"V=BOOLEAN·;V1=C"
      putitem/id $VD_LST$,"DATE"           ,"V=DATE·;V1=C"
      putitem/id $VD_LST$,"*VAR"           ,"V=*VAR·;V1=C"
      putitem/id $VD_LST$,"*BLOCK_TAG"     ,"V=*BLOCK_TAG·;V1=C"
      putitem/id $VD_LST$,"*LET"           ,"V=*LET·;V1=C"
      putitem/id $VD_LST$,"*STMT"          ,"V=*STMT·;V1=C"
      putitem/id $VD_LST$,"*CONT"          ,"V=*CONT·;V1=C·;IG=±1N"



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------



  • 12.  RE: Formating proc code: how?

    PARTNER
    Posted 06-06-2024 08:27

    We're also looking in to the formatting functionality at the moment, and it looks like we'll need to raise a support ticket too. From a quick look, we've found that the contents of forlist/id and forentity, and use of end (when used to end a trigger, operation, entry, etc) are not indenting as we would expect.



    ------------------------------
    David Reed
    Tribal Education Ltd
    ------------------------------



  • 13.  RE: Formating proc code: how?

    ROCKETEER
    Posted 06-12-2024 12:14

    Thanks, everyone, for the feedback. I am happy to inform you that we have been working on the points raised, and updates should be available in the next patch.

    Many thanks,

    Mike



    ------------------------------
    Michael Taylor
    Rocket Internal - All Brands
    ------------------------------