Rocket U2 | UniVerse & UniData

 View Only
  • 1.  [UniVerse 11.3.4+] Object Code Search Path

    PARTNER
    Posted 01-17-2023 19:33
    I'm adding some validation to a routine that launches BASIC programs to ensure that the program's object code can be found (and is not a subroutine or function).

    For main programs I think the search path is as simple as
    1. Local VOC
    2. GLOBAL.CATDIR (if the program starts with "*" - testing has shown that only globally cataloged programs that start with "*" can be  run )
    For subroutines and functions it gets more complicated
    1. Local object code of program that will call the sub/function
    2. Local VOC
    3. GLOBAL.CATDIR (for all the available prefixes: "*", "!", "-", "$"
    Leaving aside the technical hurdle of pulling apart local object code looking for additional subroutine/functions, and the logic needed to detect if object code is a subroutine/function - that will have to wait for now.

    Is there anything that I might have missed in these search paths?
    Is there any case sensitivity settings/toggles that can influence the search in each of these paths? 

    Many thanks

    ------------------------------
    Gregor Scott
    Software Architect
    Pentana Solutions Pty Ltd
    Mount Waverley VIC AU
    ------------------------------


  • 2.  RE: [UniVerse 11.3.4+] Object Code Search Path

    ROCKETEER
    Posted 01-19-2023 09:36
    Gregor,

    While I have not used it, the MAKE.MAP.FILE command may help.  ( Note that I believe it may only work on globally cataloged programs. )

    The following is from the UniVerse User Reference Manual:

    "MAKE.MAP.FILE
    The information in the &MAP& file is the same as that displayed by the MAP command. By creating the
    &MAP& file, you can take full advantage of the selection, sorting, and report formatting capabilities of
    the RetrieVe commands to produce reports on the catalog space."

    Also, note that while the MAP command does not show it in the listing, there is a dictionary item "M/S" that shows if the object code is a Main or Subroutine.

    ------------------------------
    Mike Rajkowski
    MultiValue Product Evangelist
    Rocket Internal - All Brands
    DENVER CO US
    ------------------------------



  • 3.  RE: [UniVerse 11.3.4+] Object Code Search Path

    PARTNER
    Posted 01-19-2023 18:59
    Thanks @Mike Rajkowski

    I did not know about the "M/S" field in the &MAP& file.
    Interesting that it does show differently for Main programs and Subroutines with no parameters - so there must be something in the object code to identify the difference.
    What it does not cover is identifying a function, or does it identify any local subroutines/functions within the global catalog object code.​​

    ------------------------------
    Gregor Scott
    Software Architect
    Pentana Solutions Pty Ltd
    Mount Waverley VIC AU
    ------------------------------



  • 4.  RE: [UniVerse 11.3.4+] Object Code Search Path

    PARTNER
    Posted 01-29-2023 20:44
    Interesting to see that the &MAP& record differentiate between a mainline program ("M") and a Subroutine ("S") with zero arguments.

    SORT &MAP& NAME WHO M/S ARGS 12:37:19  30-01-23  PAGE    1
    Catalog Name.................. Catalog Name.................. Who..... M/S Args
    
    !BPIOCP                        !BPIOCP                        uv-info  S      0
    !CLEAR.PROMPTS                 !CLEAR.PROMPTS                 uv-info  S      0
    *ADDAE                         *ADDAE                         uv       M
    *AE                            *AE                            uv       M
    *AE_ICOM1                      *AE_ICOM1                      uv       S      0
    *AE_UPS                        *AE_UPS                        uv       S      0
    *AE_VERSION                    *AE_VERSION                    uv       S      0
    *CONVERT.UNITS                 *CONVERT.UNITS                 uv       M
    *DC                            *DC                            uv       M
    *DC4                           *DC4                           uv       M
    *DEFINE.DF                     *DEFINE.DF                     uv       M
    *GET.RESIZE.PARAMS             *GET.RESIZE.PARAMS             uv       M
    *HS.CASE                       *HS.CASE                       uv       M
    *HS.RUNINACC                   *HS.RUNINACC                   uv       M
    *HS.SCRUB                      *HS.SCRUB                      uv       M
    *HS.SCRUBINTER                 *HS.SCRUBINTER                 uv       M
    *HS.SHOWCFG                    *HS.SHOWCFG                    uv       S      0
    *HS.UPDFINFO                   *HS.UPDFINFO                   uv       M
    *HS.WRTFINFO                   *HS.WRTFINFO                   uv       M
    *LCINIT                        *LCINIT                        uv       M
    Press any key to continue...

    I am not aware of any indicator in compiled object code that make that an easy determination, so the MAP command must be doing some fancy object code interrogation to derive this difference.

    ------------------------------
    Gregor Scott
    Software Architect
    Pentana Solutions Pty Ltd
    Mount Waverley VIC AU
    ------------------------------



  • 5.  RE: [UniVerse 11.3.4+] Object Code Search Path

    ROCKETEER
    Posted 02-06-2023 08:12
    Hi Gregor,
    The magic word of the BASIC object code file indicates whether the program is a subroutine or a main program. Based on my testing, if the first executable line in the program is the SUBROUTINE statement, then the magic word is set to ace1. Otherwise the magic word is ace0. The MAKE.MAP.FILE command uses this information to mark the entries in the catalog space with an "M" or "S".
    An example below with a main program and subroutine.

    # cd BP.O
    # od -xc TEST.MAIN | head -2
    0000000 ace0 b300 0005 0000 0000 0000 0000 0000
    254 340 263 \0 \0 005 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
    # od -xc TEST.SUB | head -2
    0000000 ace1 b300 0005 0000 0000 0002 0000 0000
    254 341 263 \0 \0 005 \0 \0 \0 \0 \0 002 \0 \0 \0 \0
    #

    Hope that clarifies.

    Thanks,

    Neil

    ------------------------------
    Neil Morris
    Universe Advanced Technical Support
    Rocket Software
    ------------------------------



  • 6.  RE: [UniVerse 11.3.4+] Object Code Search Path

    PARTNER
    Posted 02-06-2023 19:33

    Thanks @Neil Morris - it does make sense to have that indicator in the object.

    It is interesting that BASIC has had ​support for functions for a while now, yet the tools like the MAP command and the MAKE.MAP.FILE do not identify globally cataloged functions.
    Your "magic word" test for a FUNCTION looks exactly like a SUBROUTINE.



    ------------------------------
    Gregor Scott
    Software Architect
    Pentana Solutions Pty Ltd
    Mount Waverley VIC AU
    ------------------------------



  • 7.  RE: [UniVerse 11.3.4+] Object Code Search Path

    ROCKETEER
    Posted 02-07-2023 07:57
    Hi Gregor,
    You are correct. The magic word for a function does match a subroutine.
    We would need to look into what can be provided beyond the magic word to distinguish between the two.
    Thanks,
    Neil

    ------------------------------
    Neil Morris
    Universe Advanced Technical Support
    Rocket Software
    ------------------------------



  • 8.  RE: [UniVerse 11.3.4+] Object Code Search Path

    PARTNER
    Posted 01-29-2023 20:36
    I think I missed one step for the search path of subroutines & functions.
    It should read as this:
    1. Local object code of program that will call the sub/function
    2. Local VOC
    3. Same object library as callee
    4. GLOBAL.CATDIR


    ------------------------------
    Gregor Scott
    Software Architect
    Pentana Solutions Pty Ltd
    Mount Waverley VIC AU
    ------------------------------