[This local archive copy (snapshot only, invalid links probably) mirrored from the canonical site: http://itrc.uwaterloo.ca/~kmarszal/mif/, 1980505; links may not have complete integrity, so use the canonical document at this URL if possible.]

Jade MIF Backend

Current version is 1.0e
(based on Jade 1.1)

Released: May 4th, 1998


What's New Usage Source Code Binaries Compiling Building as DLL Problems & Limitations Tips Supported Flow Objects Architecture Use Declaration Processing Instruction Support sgml-parse Function Extension New OLE Automation function: archParse


What's New

Fixed problems with ArcOpt and ArcOptSA architecture support attributes. Fixed problems with tables from DocBook stylesheet test.

Usage

The command line options are described in detail on the James Clark's jade page. To generate mif files use the -t mif option; there's been no new command line options added besides that.

Source Code

Tested with the version 1.1 of James Clark's Jade.

Source Code Changes
FileSubdirectoryStatus
ArcEngine.cxxlibchanged
ArcEngineMessages.msglibchanged (auto)
ArcEngineMessages.rclibchanged (auto)
ArcProcessor.hlibchanged
arc_ins.cxxlibchanged (auto)
arc_ins.m4libchanged
CGroveBuilder.cxxgroveoachanged
CGroveBuilder.hgroveoachanged
DssslApp.cxxstylechanged
DssslApp.hstylechanged
FlowObj.cxxstylechanged
FOTBuilder.hstylechanged
GroveManager.hstylechanged
groveoa.idlgroveoachanged
Interpreter.cxxstylechanged
Interpreter.hstylechanged
jade.cxxjadechanged
jade.hjadenew
jade.mak.changed
jade.rcjadechanged
Makefile.subjadechanged
MifDoc.cxxjadenew
MifDoc.hjadenew
MifFOTBuilder.cxxjadenew
MifFOTBuilder.hjadenew
MifFOTBuilderPrivate.hjadenew
MifFOTBuilder_ins.cxxjadenew (auto)
MifFOTBuilder_ins.m4jadenew
MifMessages.hjadenew (auto)
MifMessages.msgjadenew
MifMessages.rcjadenew (auto)
primitive.cxxstylechanged
primitive.hstylechanged
SgmlParser.cxxlibchanged
SgmlParser.hincludechanged
SP.mak.changed
TmpOutputByteStream.hjadenew

Zipped James Clark's distribution of Jade 1.1: [download (1077 KB)]
Zipped source code of MIF backend (contains subdirectories: use pkunzip -d under DOS): [download (163 KB)]

Compiling under UNIX

"make -f Makefile.jade depend" and then "make -f Makefile.jade" to compile. When unzipping use the unzip's option -a.

Compiling under Windows95/NT (using Visual C++ 4.2)

Open and build SP.mak, and then jade.mak

Binaries

Zipped Win95/NT binaries: jade.exe, nsgmls.exe, sgmlnorm.exe, spam.exe, spent.exe, sx.ede, jade.dll, sp130.dll, grove.dll, groveoa.dll, spgrove.dll, style.dll [download (1,269 KB)]

Building Applications that Use jade.dll

Make sure that the following project options are set:

Preprocessor definitions: SP_NAMESPACE=James_Clark_SP, DSSSL_NAMESPACE=James_Clark_DSSSL, GROVE_NAMESPACE=James_Clark_GROVE, SP_MULTI_BYTE, JADE_USE_DLL

Include directories: jade, style, spgrove, grove, include (in the jade source directory)

Library modules: jade_dll\Release\jade.lib lib\UnicodeRelease\sp130.lib style\Release\style.lib grove\Release\grove.lib spgrove\Release\spgrove.lib (in the jade source directory)

Run-time library: Multithreaded DLL

Resources: Include jade/jade.rc in your project (jade DLLs will look for message strings inside your application)

Here's a small example:


#include "jade.h"

int main() {

    James_Clark_DSSSL::JadeApp jadeApp;
    // use functions provided by the ...App classes (JadeApp/DssslApp/GroveApp/ParserApp).
    // command-line options can be set using jadeApp.processOption( ... )
    // and/or jadeApp.run( ... ) 
}

Problems & Limitations

If you have any suggestion/solutions you can contact me through email kmarszal@watarts.uwaterloo.ca

Table border resolution
It's not clear how to predictably enforce cell borders that have mixed line styles. I've posted a question about this to comp.text.frame, but there were no responses so far. [read the post]
External graphic width and height
In order to place external graphics inside a text flow one must use an anchored frame containing the <ImportObject...> statement. The ImportObject within the frame can shrink-wrap the referenced graphics, however the anchored frame itself cannot - in general the size of an anchored frame has to be specified explicitly. I've asked about this in comp.text.frame, but the only solutions involved using external programs to read the graphic size from graphic files. [read the post]
Space before non-paragraph displayed objects
Flow objects like external-graphic need to be anchored to empty paragraphs so that that frame can determine their position on the page automatically. Since the smallest paragraph height is 2pt (smallest font size that can be used), the total space before such objects should be larger than that. This does not apply to the paragraph flow objects themselves, and to the rule flow object. The rule flow object has the placement direction display size of 0 and it's possible to use negative PgfLeading to let the next paragraph move up if necessary.
The vertical positioning of the displayed rule flow object
Since the rule is position using inlined anchored frame, the placement is relative to the font baseline. It's assumend that the baseline is 1/3 the font size from the bottom.
The box flow object
Not sure how to implement it since anchored frames must have fixed height. Maybe using tables would work here(?)

Tips

Creating hypertext documents

You must decide on the filename extension you'll use at the stage when you run jade. If you don't want the .mif extension for your final document, feel free to use other extension when specifying the file name using the -o option.

  1. Open the book file.
  2. While holding SHIFT, select File->Open All Files in Book from the menu.
  3. Save each file using View Only format - nake sure you use original filenames.
Updating page numbering
  1. Open the book file.
  2. While holding SHIFT, select File->Open All Files in Book from the menu.
  3. Select File->Generate/Update... and then press Update.
Specifying colors

Currently jade supports only RGB color space. Here's an example of a red rule:


(make rule
    color: (color (color-space "ISO/IEC 10179:1996//Color-Space Family::Device RGB")
                   1 0 0)
    ...
)

Supported Flow Objects

Flow Objects character
display-group
rule
score
line-field
leader
link
index-entry
sequence
external-graphic
paragraph
paragraph-break
simple-page-sequence
table
table-part
table-column
table-row
table-cell
table-border

character
Inherited characteristics Non-inherited characteristics
font-weight
font-posture
font-name
font-size
input-whitespace-treatment
position-point-shift
language
country
color 1
1Currently jade supports (color-space "ISO/IEC 10179:1996//Color-Space Family::Device RGB")

display-group
Inherited characteristics Non-inherited characteristics
space-before
space-after
keep-with-previous?
keep-with-next?
break-before (#f, page)
break-after (#f, page)
keep (#f, page)
may-violate-keep-before?
may-violate-keep-after?

rule
Inherited characteristics Non-inherited characteristics
line-cap
line-thickness
line-repeat
line-sep
position-point-shift
display-alignment (start, end, center)
start-indent
end-indent
span (spans all columns if > 1)
color 1
orientation (horizontal, escapement)
length
space-before
space-after
keep-with-previous?
keep-with-next?
break-before (#f, page)
break-after (#f, page)
keep (#f, page)
may-violate-keep-before?
may-violate-keep-after?
1 Currently jade supports (color-space "ISO/IEC 10179:1996//Color-Space Family::Device RGB")

score
Inherited characteristics Non-inherited characteristics
line-repeat (1 for type of before and through, 1 or 2 for after) type (before, through, after)

line-field*
Inherited characteristics Non-inherited characteristics
field-width
field-align
* At the beginning of paragraph only.

leader*
Inherited characteristics Non-inherited characteristics
* On the last line of paragraph only. The principial port (the leader string itself) can contain characters only.

link
Inherited characteristics Non-inherited characteristics
destination [#f, objects returned by (idref-address ...) and (current-node-address ...)]

index-entry
Inherited characteristics Non-inherited characteristics
components
page-number?
sort-string
starts-page-range?
ends-page-range?
components
is a list of strings that represent index entry levels. This characterisitc is not inherited and shall be specified.
page-number?
is a boolean specifying whether this index entry should contain page number information. This characterisitc is not inherited. The default is #t.
sort-string
is either #f, specifying that this index entry's components should be used for sorting th index, or a string that should be used for sorting. This characterisitc is not inherited. The default is #f.
starts-page-range?
is a boolean specifying whether the index entry starts a page range. This characterisitc is not inherited. The default is #f.
ends-page-range?
is a boolean specifying whether the index entry starts a page range. This characterisitc is not inherited. The default is #f.

Here's how to enable the above extension:

(declare-flow-object-class index-entry
    "UNREGISTERED::ISOGEN//Flow Object Class::index-entry")
    

external-graphic
Inherited characteristics Non-inherited characteristics
space-before
space-after
display?
scale (max)
max-width
max-height
entity-system-id
display-alignment
start-indent
end-indent
span (spans all columns if > 1)
space-before
space-after
keep-with-previous?
keep-with-next?
break-before (#f, page)
break-after (#f, page)
keep (#f, page)
may-violate-keep-before?
may-violate-keep-after?

paragraph
Inherited characteristics Non-inherited characteristics
lines (wrap, asis-wrap)
hyphenation-ladder-count
hyphenation-remain-char-count
hyphenation-push-char-count
font-weight
font-posture
font-name
font-size
quadding
widow-count
orphan-count
language
country
span (spans all columns if > 1)
space-before
space-after
keep-with-previous?
keep-with-next?
break-before (#f, page)
break-after (#f, page)
keep (#f, page)
may-violate-keep-before?
may-violate-keep-after?
line-spacing
min-leading (#f or 0 for proportional line spacing)
first-line-start-indent

paragraph-break
Inherited characteristics Non-inherited characteristics
Same as for paragraph Same as for paragraph

simple-page-sequence
Inherited characteristics Non-inherited characteristics
page-width
page-height
left-margin
right-margin
top-margin
bottom-margin
header-margin
footer-margin
left-header
center-header
right-header
left-footer
center-footer
right-footer
(page-number-sosofo)
(current-node-page-number-sosofo)
"UNREGISTERED::James Clark//Procedure::if-first-page"
This can be used only in the specification of the value of one of the header/footer characteristics of simple-page-sequence. It returns a sosofo that will display as sosofo1 if the page is the first page of the simple-page-sequence and as sosofo2 otherwise.
"UNREGISTERED::James Clark//Procedure::if-front-page"
This can be used only in the specification of the value of one of the header/footer characteristics of simple-page-sequence. It returns a sosofo that will display as sosofo1 if the page is a front (ie recto, odd-numbered) page and as sosofo2 if it is a back (ie verso, even-numbered) page.
"UNREGISTERED::James Clark//Characteristic::page-n-columns"
Value is a strictly positive integer, specifying the number of columns. The initial value is 1.
"UNREGISTERED::James Clark//Characteristic::page-column-sep"
Value is a length, specifying the separation between columns. The initial value is .5in.
"UNREGISTERED::James Clark//Characteristic::page-balance-columns?"
Value is a boolean. If true, the columns on the final page of the page-sequence should be balanced. The initial value is #f.

Here's how to enable the above extensions:

(define if-first-page (external-procedure
    "UNREGISTERED::James Clark//Procedure::if-first-page"))
(define if-front-page (external-procedure   
    "UNREGISTERED::James Clark//Procedure::if-front-page"))

(declare-characteristic page-n-columns
    "UNREGISTERED::James Clark//Characteristic::page-n-columns" 1)
(declare-characteristic page-n-columns
    "UNREGISTERED::James Clark//Characteristic::page-column-gap" (* 36 1pt))
(declare-characteristic page-balance-columns?
    "UNREGISTERED::James Clark//Characteristic::page-balance-columns?" #f)
    

table
Inherited characteristics Non-inherited characteristics
table-border
display-alignment
start-indent
end-indent
table-width
before-row-border
after-row-border
before-column-border
after-column-border
span (spans all columns if > 1)
space-before
space-after
keep-with-previous?
keep-with-next?
break-before (#f, page)
break-after (#f, page)
keep (#f, page)
may-violate-keep-before?
may-violate-keep-after?

table-part
Inherited characteristics Non-inherited characteristics
space-before
space-after
keep-with-previous?
keep-with-next?
break-before (#f, page)
break-after (#f, page)
keep (#f, page)
may-violate-keep-before?
may-violate-keep-after?
header
footer

table-column
Inherited characteristics Non-inherited characteristics
start-indent
end-indent
column-number
n-columns-spanned
width
(table-unit k)

table-cell
Inherited characteristics Non-inherited characteristics
cell-before-row-margin
cell-after-row-margin
cell-before-column-margin
cell-after-column-margin
cell-row-alignment
cell-before-row-border
cell-after-row-border
cell-before-column-border
cell-after-column-border
cell-background?
background-color 1
column-number
n-columns-spanned
n-rows-spanned
starts-row?
ends-row?
1 Currently jade supports (color-space "ISO/IEC 10179:1996//Color-Space Family::Device RGB")

table-border
Inherited characteristics Non-inherited characteristics
border-present?
line-thickness
line-repeat (0, 1, or 2)
line-sep
color 1
1 Currently jade supports (color-space "ISO/IEC 10179:1996//Color-Space Family::Device RGB")

Architecture Use Declaration Processing Instruction Support

From the ISO/IEC 10744 Amendment 1 ( http://www.ornl.gov/sgml/wg8/document/1957.htm):

The architecture use declaration (arch) processing instruction provides an alternative form of architecture use declaration for use in environments where notations or data attributes are not supported. Architecture use PIs should occur within the prolog. It is not necessary to specify architecture base declarations for architectures declared using architecture use PIs. If multiple declarations are specified for an architecture, the first such declaration is used.

The processing instruction shall have the following form:

pio, "IS10744", (":" | s+), "arch", attribute specification list, pic

where the attribute specification list specifies attributes corresponding to the architecture notation declaration, architectural meta-DTD entity declaration, and architecture support attributes. The attributes corresponding to the architecture notation declaration are:

Attribute Description Equivalent Architectural Form Definition Attribute
name Architecture name
public-id Public identifier of architecture specification document
dtd-public-id Public identifier of architectural meta-DTD
dtd-system-id System identifier of architectural meta-DTD
form-att Architectural form attribute name ArcFormA
renamer-att Architectural attribute renamer attribute name ArcNamrA
suppressor-att Architecture suppressor attribute name ArcSuprA
ignore-data-att Architecture ignore data attribute name ArcIgnDA
doc-elem-form Architecture document element form name ArcDocF
bridge-form Architecture bridge form name ArcBridF
data-form Architecture data form name ArcDataF
auto Architecture automatic form mapping ArcAuto
options Architecture options ArcOpt
quantity Architecture quantity set; the value must consist of pairs of quantity names and numbers ArcQuant

NOTE: In this implementation the processing instruction attributes can override/supplement the Architectural Form Definition attributes if both methods are used.

An example of the instruction use:

simplearch.dtd

<!ELEMENT simpledoc  - o (title, paragraph+)>
<!ELEMENT title - o  (#PCDATA)>
<!ELEMENT paragraph - o  (#PCDATA)>

trip.dtd

<!ELEMENT trip.report  - o (destination, p+)>
<!ELEMENT destination  - o (#PCDATA)>
<!ELEMENT p  - o (#PCDATA)>

<!ATTLIST trip.report simplearch NAME #FIXED "simpledoc" >
<!ATTLIST destination simplearch NAME #FIXED "title" >
<!ATTLIST p           simplearch NAME #FIXED "paragraph" >

test.sgml

<!doctype trip.report SYSTEM "trip.dtd" [
<?IS10744:arch name="simplearch" doc-elem-form="simpledoc" dtd-system-id="simplearch.dtd">
]>

<trip.report>
<destination>XML Developer's Day
<p>I attended the XML Developer's day...</p>
</trip.report>

Result of running nsgmls test.sgml

?IS10744:arch doc-elem-form="simpledoc" dtd-system-id="simplearch.dtd"
ASIMPLEARCH TOKEN SIMPLEDOC
(TRIP.REPORT
ASIMPLEARCH TOKEN TITLE
(DESTINATION
-XML Developer's Day
)DESTINATION
ASIMPLEARCH TOKEN PARAGRAPH
(P
-I attended the XML Developer's day...
)P
)TRIP.REPORT
C

Result of running nsgmls -Asimplearch test.sgml

(SIMPLEDOC
(TITLE
-XML Developer's Day
)TITLE
(PARAGRAPH
-I attended the XML Developer's day...
)PARAGRAPH
)SIMPLEDOC
C

sgml-parse Function Extension

The DSSSL sgml-parse function has been extended from this definition:

(sgml-parse string #!key active: parent:)

to this one:

(sgml-parse string #!key active: parent: architecture:)

where architecture is a string specifying the architecture name with respect to which the SGML document entity should be parsed.

New OLE Automation function: archParse

It's now possible to parse with respect to an architecture or multiple architectures using the OLE Automation interface. Here's the IDL definition of the function:

HRESULT archParse([in] BSTR systemId,
                  [in] BSTR archNames,
                  [out, retval] SgmlDocumentNode **);

The archNames parameter should contain one or more architecture names separated by spaces (this corresponds to multiple -A options of nsgmls.)