[xslt] OpenVMS port of XSLT
- From: John A Fotheringham <mailinglist jafsoft com>
- To: xslt gnome org
- Subject: [xslt] OpenVMS port of XSLT
- Date: Tue, 13 Nov 2001 14:21:12 +0000
Following my work on libxml, I have managed to get XSLT to build
and run under OpenVMS. In fact, very little needed doing, just
one more-than-31-character-name function in extension.c/.h
needed modifying.
Attached are
- a readme.vms describing VMS issues for this build
- a diffs.vms differences file for the changes
- a BUILD_XSLT.COM build command file
I've passed these on to Daniel so hopefully these will appear in a [.vms]
subdirectory in future releases.
Cheers, Jaf
PS. The .com file was reported back to me as a potential virus when
I posted a similar file to the libxml list. In fact .com under VMS
is a script file, and can be viewed with a normal text editor.
$! BUILD_XSLT.COM
$!
$! Build the XSLT library
$!
$! Arguments:
$!
$! p1 - "DEBUG" is you want to build with debug
$!
$! This package requires libxml to have already been installed. You need
$! to ensure that the logical name LIBXML is defined and points to the
$! directory containing libxml's .h files
$!
$! This procedure creates the object libraries
$!
$! XMLOLB:LIBXSLT.OLB
$! XMLOLB:LIBEXSLT.OLB
$!
$! and the program
$!
$! XSLTPROC
$!
$! After the library is built, you can link these routines into
$! your code with the command
$!
$! LINK your_modules,XMLOLB:LIBEXSLT/LIB,LIBXSLT/LIBRARY,LIBXML/LIB
$!
$! Change History
$! --------------
$! Command file author : John A Fotheringham (jaf@jafsoft.com)
$! Last update : 2 Nov 2001
$!
$!- configuration -------------------------------------------------------------
$!
$!- compile command.
$!
$ if p1.eqs."DEBUG"
$ then
$ debug = "y"
$ cc_command = "CC/DEBUG/NOOPT"
$ else
$ debug = "n"
$ cc_command = "CC"
$ endif
$!
$!- configure multiple build passes for each library. -------------------------
$!
$! For each pass:
$!
$! "libname" is the name of the library or module being created
$!
$! "progname" is the name of the program being created
$!
$! "src" is the list of sources to be built into the library or program
$! - This should be compared to the definition of
$! "<NAME>_la_SOURCES" in the MAKEFILE.IN file in
$! corresponding directory.
$!
$ num_passes = 3 ! two libraries and a program
$!
$!- pass 1 - library LIBXSLT
$!
$ libname_1 = "LIBXSLT"
$ h_file_1 = "xslt.h"
$ progname_1 = ""
$!
$ ! see "libxslt_la_SOURCES" in [.libxslt]makefile.in
$ src_1 = "xslt.c xsltutils.c pattern.c templates.c variables.c keys.c"
$ src_1 = src_1 + " numbers.c extensions.c extra.c functions.c"
$ src_1 = src_1 + " namespaces.c imports.c attributes.c documents.c"
$ src_1 = src_1 + " preproc.c transform.c"
$!
$!- pass 2 - library LIBEXSLT
$!
$ libname_2 = "LIBEXSLT"
$ h_file_2 = "exslt.h"
$ progname_2 = ""
$!
$ ! see "libexslt_la_SOURCES" in [.libexslt]makefile.in
$ src_2 = "exslt.c common.c math.c sets.c functions.c strings.c date.c saxon.c"
$!
$!- pass 3 - program XSLTPROC
$!
$ libname_3 = ""
$ h_file_3 = ""
$ progname_3 = "XSLTPROC"
$!
$ ! see "xsltproc_SOURCES" in [.xsltproc]makefile.in
$ src_3 = "xsltproc.c"
$!
$!- set up and check logicals -----------------------------------------------
$!
$! XMLOLB - object library directory
$! LIBXML - source directory containing .h files for libxml package
$!
$ if f$trnlnm("XMLOLB").eqs.""
$ then
$ write sys$output ""
$ write sys$output " You need to define a XMLOLB logical directory to"
$ write sys$output " point to the directory containing your CMS object"
$ write sys$output " libraries. This should already contain LIBXML.OLB"
$ write sys$output " from the libxml package, and will be the directory"
$ write sys$output " the new LIBXSLT.OLB library will be placed in"
$ write sys$output ""
$ exit
$ endif
$!
$ if f$trnlnm("libxml").eqs.""
$ then
$ ! look for globals.h in a directory installed paralle to this one
$ on error then continue
$ globfile = f$search("[--...]globals.h")
$ if globfile.eqs.""
$ then
$ write sys$output ""
$ write sys$output " You need to define a LIBXML logical directory to"
$ write sys$output " point to the directory containing the .h files"
$ write sys$output " for the libxml package"
$ write sys$output ""
$ exit
$ else
$ srcdir = f$element(0,"]",globfile)+ "]"
$ define/process LIBXML "''srcdir'"
$ write sys$output "Defining LIBXML as ""''srcdir'"""
$ endif
$ endif
$!
$!- set up some working logicals -------------------
$!
$ pass_no = 1
$ set_pass_logical:
$!
$ if pass_no.le.num_passes
$ then
$!
$ Libname = libname_'pass_no'
$ progname = progname_'pass_no'
$ if libname.nes.""
$ then
$ logname = "''libname'_SRCDIR"
$ else
$ logname = "''progname'_SRCDIR"
$ endif
$ findfile = f$element(0," ",src_'pass_no')
$!
$!--- set up a source directory logical
$!
$ if f$trnlnm("''logname'").eqs.""
$ then
$ ! look for the target file in a parallel subdirectory
$ globfile = f$search("[-...]''findfile'")
$ if globfile.eqs.""
$ then
$ write sys$output "Can't locate ''findfile'. You need to manually define a ''logname' logical"
$ exit
$ else
$ srcdir = f$element(0,"]",globfile)+ "]"
$ define/process 'logname' "''srcdir'"
$ write sys$output "Defining ''logname' as ""''srcdir'"""
$ endif
$ endif
$!
$!--- if it's a library, set up a logical pointing to the .h files
$!
$ if libname.nes.""
$ then
$ if f$trnlnm("''libname'").eqs.""
$ then
$ ! look for the target .h file in a parallel subdirectory
$ h_file = h_file_'pass_no'
$ globfile = f$search("[-...]''h_file'")
$ if globfile.eqs.""
$ then
$ write sys$output "Can't locate ''h_file'. You need to manually define a ''libname' logical"
$ exit
$ else
$ includedir = f$element(0,"]",globfile)+ "]"
$ define/process 'libname' "''includedir'"
$ write sys$output "Defining ''libname' as ""''includedir'"""
$ endif
$ endif
$ endif
$!
$ pass_no = pass_no +1
$ goto set_pass_logical
$!
$ endif ! for each pass
$!
$!- set up error handling (such as it is) -------------------------------------
$!
$ exit_status = 1
$ saved_default = f$environment("default")
$ on error then goto ERROR_OUT
$ on control_y then goto ERROR_OUT
$!
$ goto start_here
$ start_here: ! move this line to debug/rerun parts of this command file
$!
$!- compile modules into the library ------------------------------------------
$!
$!
$ pass_no = 1 ! make three passes, one for each library, one for XSLTPROC
$ pass_loop:
$!
$ if pass_no.le.num_passes
$ then
$ Libname = libname_'pass_no'
$ progname = progname_'pass_no'
$ if libname.nes.""
$ then
$ logname = "''libname'_SRCDIR"
$ pass_description = "the XMLOLB:''libname'.OLB object library"
$ else
$ logname = "''progname'_SRCDIR"
$ pass_description = "the programs in ''progname'"
$ endif
$ src = src_'pass_no'
$!
$!- create the library if need
$!
$ if libname.nes.""
$ then
$ if f$search("XMLOLB:''libname'.OLB").eqs.""
$ then
$ write sys$output "Creating new object library XMLOLB:''libname'.OLB..."
$ library/create XMLOLB:'libname'.OLB
$ endif
$ endif
$!
$!- move to the source directory
$!
$ set def 'logname'
$!
$!- define the library and link commands (link command not used as is)
$!
$ if libname.nes.""
$ then
$ lib_command = "LIBRARY/REPLACE XMLOLB:''libname'.OLB"
$ link_command = ""
$ else
$ lib_command = ""
$ link_command = "LINK"
$ endif
$!
$ write sys$output ""
$ write sys$output "Building ''pass_description'
$ write sys$output ""
$!
$ s_no = 0
$ src = f$edit(src,"COMPRESS")
$!
$ source_loop:
$!
$ next_source = f$element (S_no," ",src)
$ if next_source.nes."" .and. next_source.nes." "
$ then
$ if link_command.nes."" .or. next_source.eqs."xsltutils.c"
$ then
$ call build 'next_source' /IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE
$ else
$ call build 'next_source'
$ endif
$ s_no = s_no + 1
$ goto source_loop
$ endif
$!
$ pass_no = pass_no + 1
$ goto pass_loop
$!
$ endif ! for each pass
$!
$!- Th-th-th-th-th-that's all folks! ------------------------------------------
$!
$EXIT_OUT:
$!
$ set def 'saved_default
$ exit 'exit_status
$!
$
$ERROR_OUT:
$ exit_status = $status
$ write sys$output "''f$message(exit_status)'"
$ goto EXIT_OUT
$!
$!- the BUILD subroutine. Compile then insert into library or link as required
$!
$BUILD: subroutine
$ on warning then goto EXIT_BUILD
$ source_file = p1
$ name = f$element(0,".",source_file)
$ object_file = f$fao("XMLOLB:!AS.OBJ",name)
$!
$!- compile
$ write sys$output "Compiling ",p1,p2,"..."
$ cc_command /object='object_file 'source_file' 'p2'
$!
$!- insert into library if command defined
$!
$ if lib_command.nes.""
$ then
$ lib_command 'object_file'
$ delete/nolog 'object_file';*
$ endif
$!
$!- link module if command defined
$!
$ if link_command.nes.""
$ then
$ text = f$element(0,".",p1) ! lose the ".c"
$ write sys$output "Linking ",text,"..."
$ dbgopts = ""
$ if debug then dbgopts = "/DEBUG"
$ link_command'dbgopts' 'object_file',-
XMLOLB:libexslt/lib,-
XMLOLB:libxslt/lib,-
XMLOLB:libxml/library
$ endif
$!
$EXIT_BUILD:
$ exit $status
$!
$endsubroutine
---------------------------------------------------------------------------
EXTENSIONS.H
142,154c142
<
< #if defined(VMS) || defined(__VMS)
<
< xsltPreComputeFunction
< xsltExtModElemPreComputeLookup
< (const xmlChar *name,
< const xmlChar *URI);
<
< #define xsltExtModuleElementPreComputeLookup xsltExtModElemPreComputeLookup
<
< #else
<
< xsltPreComputeFunction
---
> xsltPreComputeFunction
158,159d145
< #endif
<
---------------------------------------------------------------------------
EXTENSIONS.C
1142,1146d1141
< #if defined(VMS) || defined(__VMS)
< xsltPreComputeFunction
< xsltExtModElemPreComputeLookup (const xmlChar *name,
< const xmlChar *URI) {
< #else
1150,1151d1144
< #endif
<
Building XSLT under OpenVMS
===========================
Here's a summary of the issues I encountered when building XSLT under
VMS. I'd previously done the same for the LIBXML package, on which
XSLT depends.
I present this list "as is" to hopefully act as a guide to anyone
having similar problems in the future.
That's it. Good luck!
John A Fotheringham (jaf@jafsoft.com)
November 2001
Installation kit
----------------
- File attributes. When downloading essentially a Unix distribution,
some of the file attributes may not be correct... especially those
in the [.VMS] subdirectory. In EDT you could see line feeds and
carriage returns as <LF><CR> etc. To correct this use the command
$ set file <filespec> /attr=rfm=stm
This sets the record format to be "stream". Other variants may be
used instead depending on how you got the files onto your system.
Files will look okay in an EDT editor once the attributes are set.
Without this the command file may not run correctly, since it may
be interpreted as a single line.
- VMS-specific files are in a [.VMS] directory. If you've found
this file then you already know this :-) This directory contains
BUILD_XSLT.COM - a build command file
README.VMS - these notes
- Don't execute BUILD_LIBXML.COM until you've done all the
following
- read these notes
- define the logicals XMLOLB and LIBXML
- copy CONFIG.H to [.libxslt] and [.libexslt]
- reviewed the configuration section of BUILD_XSLT.COM, and in
particular update the module lists in line with MAKEFILE
- re-read these notes :-p
instructions for all these steps are below.
- the XSLT package requires the LIBXML package to have been
previously been installed. The following logicals should be
defined
LIBXML - the directory containing LIBXML's .h files
XMLOLB - the directory to contain both the LIBXML and XSLT
object libraries
- you'll need to copy config.h into the [.libxslt] and [.libexslt]
directories. If in the future a VMS-specific version is created,
use [.vms]config.vms instead.
- The command file BUILD_XSLT.COM will do the following
- setup and test some logicals
- set def to the source directory
- compile modules and place them into a LIBXSLT.OLB library
- compile modules and place them into a LIBEZSLT.OLB library
- compile and link the XSLTPROC program
- set def back to the original directory (i.e. if it fails you
might not be where you started :-)
before running this command file review the configuration segment
at the top. In particular compare the lists of modules with those
in the most recent version of MAKEFILE.IN files sound in the source
directories. Instructions are contained in the command file itself.
The TRIO package
----------------
- The libxml package uses a sub-package TRIO to provide some
functions not naturally available under VMS. These include support
for infinite and undefined numbers, and specialised print functions
like "snprintf"
To build this software we need to add
/IEEE_MODE=UNDERFLOW_TO_ZERO/FLOAT=IEEE
to the compile command for xsltutils, and to any main program
that uses this functionality. BUILD_XSLT.COM should do this
for you.
Without this you are likely to get run-time errors like this
%SYSTEM-F-HPARITH, high performance arithmetic trap, Imask=00000000,
Fmask=00000 400, summary=02, PC=000000000006A330, PS=0000001B
-SYSTEM-F-FLTINV, floating invalid operation, PC=000000000006A330,
PS=0000001B
If this occurs you'll need to locate the modules that need the
above switches applied
Compiler and linker errors
--------------------------
- with respect to the TRIO package you'll get the error
"no main module for UNDERFLOW_TO_ZERO"
You can suppress this "expected" messages by using the compile command
$ CC /WARN=DISABLE=(NOMAINUFLO)
- the Linker will report the following error
%LINK-W-MULDEF, symbol DECC$STRERROR multiply defined
in module DECC$SHR file SYS$COMMON:[SYSLIB]DECC$SHR.EXE;5
This is complaining that DECC$STRERROR is multiply defined, which
in turn is because this system symbol is getting added to LIBXML.OLB
when strio.c was compiled in the libxml package.
I'm not sure what the solution for this is, but this is a fairly
benign error.
Changes made to the codebase
----------------------------
- In the module extensions.c the name
xsltExtModuleElementPreComputeLookup
is too long (more than 31 characters). The solution has been
to rename it to a shorter name on VMS builds, and to then
create a #define that maps the longer name to the shorter name,
so that all references to the longer name will work.
You may need to repeat this exercise with any future modules added.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]