EPICS-synApps / configure

APS BCDA synApps module: configure
http://www.aps.anl.gov/bcda/synApps
Other
0 stars 2 forks source link

Adding a version 3 edm font file for use when invoking adl2edl. #6

Closed bhill-slac closed 6 years ago

bhill-slac commented 6 years ago

Not sure where this sample EDM font file should go in synapps, but you'll need this file or another valid EDM version 3 font file to get good font translations from adl2edl. Set env variable EDMFONTFILE to the full path to this file.

MarkRivers commented 6 years ago

Hi Bruce, Thanks for doing this. I have merged the 2 pull requests, built 1.5 of adl2edl (with one patch I will send you) and set the EDMFONTFILE environment variable to the font file you added.

When I run adl2edl I get an error about the font file:

corvette:ADCore/ADApp/op>echo $EDMFONTFILE
/home/epics/devel/configure/fonts.adl2edl
corvette:ADCore/ADApp/op>more $EDMFONTFILE
3 0 0
helvetica-medium-r-12.0
helvetica-medium-r-14.0

#
# Font spec strategy
# Generally we prefer scalable fonts, specified w/ zero point size, field 8, and zero avg width, field 12
# For example
# -adobe-helvetica-(medium,bold)-(r,o)-normal--0-(80,100,120,140,180,240)-75-75-p-0-*-*
# before the non-scalable font spec which uses a wild card
# -adobe-helvetica-(medium,bold)-(r,o)-normal--*-(80,100,120,140,180,240)-75-75-p-*-*-*
#

#
# For the newer RedHat RHEL6 machines, the available 75dpi fonts
# generally don't provide larger than 24.0 point sizes.
# Instead of just providing a generic match at the end of these font groups,
# which maps all the font sizes for that group to the generic font, I split
# these font groups, thus allowing a different font spec to be selected for the
# larger font sizes.   We rarely use these larger sizes, so defaulting to a
# generic font for them allows the screen to render while still keeping a
# good match for the smaller font sizes
#

# Helvetica sizes 8,10,12,14,18,and 24
helvetica={
-adobe-helvetica-(medium,bold)-(r,o)-normal--0-(80,100,120,140,180,240)-75-75-p-0-*-*
-adobe-helvetica-(medium,bold)-(r,o)-normal--*-(80,100,120,140,180,240)-75-75-p-*-*-*
-*-helvetica-(medium,bold)-(r,o)-normal--0-(80,100,120,140,180,240)-75-75-p-0-*-*
-*-helvetica-(medium,bold)-(r,o)-normal--*-(80,100,120,140,180,240)-75-75-p-*-*-*
-urw-urw gothic l-(medium,bold)-(r,o)-normal--0-(80,100,120,140,180,240)-75-75-p-0-*-*
-*-helvetica-(medium,bold)-(r,o)-normal--*-(80,100,120,140,180,240)-*-*-p-*-*-*
}
...

corvette:ADCore/ADApp/op>make -sj
corvette:ADCore/ADApp/op>/bin/rm edl/autoconvert/*
corvette:ADCore/ADApp/op>make -sj
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl
fontInfoClass error: Invalid font conversion file fonts.adl2edl

Any ideas?

MarkRivers commented 6 years ago

I have determined that the problem is some conflict with the adl2ui. If I don't define ADL2UI then make for adl2edl works fine:

corvette:ADSimDetector/simDetectorApp/op>make clean
rm -f  edl/autoconvert/simDetector.edl edl/autoconvert/simDetectorSetup.edl opi/autoconvert/simDetector.opi opi/autoconvert/simDetectorSetup.opi
corvette:ADSimDetector/simDetectorApp/op>make
adl2edl -rgb -f /home/epics/devel/configure/fonts.adl2edl adl/simDetector.adl edl/autoconvert/simDetector.edl
adl2edl -rgb -f /home/epics/devel/configure/fonts.adl2edl adl/simDetectorSetup.adl edl/autoconvert/simDetectorSetup.edl
css -nosplash -application org.csstudio.opibuilder.adl2boy.application adl/simDetector.adl
...

However, if I change CONFIG_SITE.local.linux-x64_64 to define ADL2UI I get these errors:

corvette:ADSimDetector/simDetectorApp/op>make clean
rm -f ui/autoconvert/simDetector.ui ui/autoconvert/simDetectorSetup.ui edl/autoconvert/simDetector.edl edl/autoconvert/simDetectorSetup.edl opi/autoconvert/simDetector.opi opi/autoconvert/simDetectorSetup.opi
corvette:ADSimDetector/simDetectorApp/op>make
adl2ui adl/simDetector.adl
adl2ui -- file = <adl/simDetector.adl>
adl2ui -- file <stylesheet.qss> found and will be integrated in the resulting ui file
adl2ui -- if you do not want any styles, redefine CAQTDM_DISPLAY_PATH
...
mv -f simDetector.ui ui/autoconvert/
ADL2EDL_FONTS=-f /home/epics/devel/configure/fonts.adl2edl
/bin/sh: /home/epics/devel/configure/fonts.adl2edl: Permission denied
make: *** [ui/autoconvert/simDetector.ui] Error 126

So it is trying to execute ADL2EDL_FONTS as a /bin/sh command?

MarkRivers commented 6 years ago

@bhill-slac I have found and fixed the problem. The problem was that the ADL2EDL_FONTS definition lines started with tab characters. They were thus being interpreted as continuations of the ADL2UI rules. I replaced the tabs with spaces and the problem is fixed.

bhill-slac commented 6 years ago

Thanks for finding the fix! Let me know what the build fix for adl2edl was and I'll do a new release.

Cheers,

On 06/27/2018 11:20 AM, Mark Rivers wrote:

@bhill-slac https://github.com/bhill-slac I have found and fixed the problem. The problem was that the ADL2EDL_FONTS definition lines started with tab characters. They were thus being interpreted as continuations of the ADL2UI rules. I replaced the tabs with spaces and the problem is fixed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/EPICS-synApps/configure/pull/6#issuecomment-400781639, or mute the thread https://github.com/notifications/unsubscribe-auth/AF43JhaHbGq8i63o0omcu0aUC_eXviSaks5uA80AgaJpZM4U3gX2.

-- Bruce Hill Member Technical Staff SLAC National Accelerator Lab 2575 Sand Hill Road M/S 10 Menlo Park, CA 94025

MarkRivers commented 6 years ago

This is the patch for translator.cc. It fixes the problem that adl2edl uses a fixed name temporary file, so it won't work with parallel make.

diff --git a/translator.cc b/translator.cc
index 7c1f1f7..ee0c2b4 100644
--- a/translator.cc
+++ b/translator.cc
@@ -315,11 +315,16 @@ int translator::processFile (char *in, char *out)
    ostream *outd = (!normal_mode) ? (ostream *) &toutf: (ostream *) &cout;

    // open temp file for bubbling control widgets
-   char tfilename[12];
-   strcpy(tfilename,"adltemp");
+   char tfilename[256];
+   strcpy(tfilename,"adltemp_XXXXXX");
+   int temp_fd = mkstemp(tfilename);
+   if (temp_fd == -1) {
+       printf("Error calling mkstemp for temporary file %s\n", tfilename);
+       exit(1);
+   }
    ofstream outt(tfilename);
    if(!outt) {
-       //cout << "unable to open adltemp" << endl;
+       printf("Error creating temporary output file %s\n", tfilename);
        exit(1);
    }

@@ -535,10 +540,9 @@ int translator::processFile (char *in, char *out)

    // open temp file for bubble control widgets
-   strcpy(tfilename,"adltemp");
    ifstream in_t(tfilename);
    if(!in_t) {
-       *outd << "unable to open adltemp" << endl;
+       printf("Error creating temporary input file %s\n", tfilename);
        exit(1);
    }

@@ -549,6 +553,9 @@ int translator::processFile (char *in, char *out)
        ctr++;
    }
    in_t.close();
+   outt.close();
+   close(temp_fd);
+   remove(tfilename);

    return 1;
 }