How to know what modules (.4gls) are in a particular .42m?

Started by Sally W., July 12, 2012, 05:24:38 PM

Previous topic - Next topic

Sally W.

Had the following on a customer's machine:

Date: 12/07/2012    Time: 14:27:23                                             
Program error at 'scratchpad.4gl', line number 0.                               
FORMS statement error number -6208.                                             
Module 'scratchpad': already loaded.

Eventually I recompiled all of the library functions and put the latest set on their box.

However it will be a big job to produce a set with exactly the same versions as they currently have, unless there is a quick way I don't know of identifying which ones have the module 'scratchpad' included?  Then I can just recompile those.

Is there a smart way to do this?

Julian B.

The .42m generally corresponds 1:1 with the .4gl source file.  You need to look in the .42r file.  It's a simple structure and you can write some C code to interpret it properly, but for most purposes (assuming you are on a *nix OS) you can just use strings(1) to get the names out of them.  E.g.

strings program.42r | grep scratchpad

If you want to be cleverer or the word scratchpad appears in too many function names, a quick and dirty script like this will work (slowly).  e.g.

genref -m *.42r | grep scratchpad.42m

Regards,

Code (shell) Select
#! /bin/sh

modules=false

if [ "$1" = "-m" ]
then
    modules=true
    shift
fi

for f in $*
do
    strings $f |
    {
        read jjtok || break
        if [ "$jjtok" != "JJJJ" ]
        then
            echo "Error: $f is not a Genero file"
            break
        fi

        while true
        do
            read function || break
            read module || break
            if $modules
            then
                if [ "$lastmod" != "$module" ]
                then
                    echo "$f:   $module.42m"
                fi
                lastmod=$module
            else
                echo "$f:       $module.42m     $function()"
            fi
        done
    }
done



Julian