CSS Unitec Home Page
      

Form Definition Utility

 fdu(U)

Synopsis   Platforms   Description   Options   FDU Commands   Integration   Notes   Files   See also

Synopsis

fdu [-I path] [-o file] [file]...

Platforms

Unix, Windows NT

Description  

The program fdu translates the commands in all named files to HP LaserJet II control sequences. The standard input is read if - is used as a file name or if no input files are named. The result of fdu is written to file specified in o-option or to standard output, if no such option has been given.

By the use of the fdu-commands Macro and End_macro LaserJet programs can be defined. These programs may be activated by a subsequent Load-command and then be executed for each page printed. Only one macro may be active at any given time. Each Load-command implies the sequence unload; load #;. It is however possible to load different macros in sequence in the same printout (e.g. a page layout for statistics and an other one for a summary). By using the Include-command macro modules can be assembled.

LaserJet programming is similar to creating a screen layout. the various fonts and typefaces represent the attributes. The imaginary cursor may be positioned to any location with the Move-command. As a unit of measurement the so called point is used:

Points Conversion
1 0.084666 mm
300 1 Inch / 25.4 mm
12 ~ 1 mm
36 1 character at 8.3 CPI (horizontal)
30 1 character at 10 CPI
25 1 character at 12 CPI
18 1 character at 16.66 CPI
50 1 line at 6 LPI (vertical)
37.5 1 line at 8 LPI

Options

-o file

The argument given is the name of an output file to be used instead of the standard output.

-I path Adds path to the list of directories to be searched when an include file must be found. More than one I-option may be defined. See also the Notes about FDUPATH below.

FDU Commands

Fdu recognizes the following commands:

b_include file The contents of file is inserted at the current location without further processing by fdu. This command is useful to add a company logo that may have been created by a scanner producing LaserJet compatible files. If the filename contains special characters it has to be defined as string (i.e. enclosed in quotes like "logo.mac").
box y, x Draws a rectangle of y vertical and x horizontal points. The line width used defaults to one point and may be changed by the line_points command. The cursor position remains unchanged.
charset id Changes the character set to be used for text output to id. The available character sets are defined in /usr/lib/css/fdu/charset:

ansi_ascii ISO 6 ANSI ASCII
french_25 ISO 25 French
german HP German
german_21 ISO 21 German
ibm_pc IBM-PC USA
ibm_norw IBM Norwegian
roman_8 Roman-8


The corresponding alternate character sets have the prefix s_ (for secondary, e.g. s_ibm_pc).

copys #
copies #
Sets the number of copies that have to be printed of each page.
cpi id Sets the character pitch (character per inch) to id. The available values of id are defined in /usr/lib/css/fdu/charpitch:

8 8.3 CPI
10 10 CPI
12 12 CPI
16 16.66 CPI
c_move [[{+|-}]y][,[{+|-}]x] Moves the imaginary cursor to the character position with the coordinates y vertical and x horizontal (character position move). Relative moves may be performed by signed values. A negative sign moves y lines up or x characters left and a positive sign moves y lines down or x characters to the right. Missing values are substituted by the current coordinate and thus do not move in the corresponding direction. All other fdu positioning commands take typographic points (300x300) as arguments.
data d [[,] d]... This command is intended to define output data. The available parameter types for d are:
 
'abc' Text string abc. Strings follow the syntax of the C language to define special characters:
\a, \b, \f, \n, \r, \t, \v, \\, \', \", \xXXX, \OOO
where
XXX = 1..3 Hex-Zahlen
OOO = 1..3 Oktal-Zahlen
"abc" Same as 'abc'.
123 Byte (decimal 0..255)
0123 Byte (octal 0..377)
0x12 Byte (hex 0..ff)
ctl ASCII control character synonym:
Synonym hex Ctl
nul 00 ^@
soh 01 ^A
stx 02 ^B
etx 03 ^C
eot 04 ^D
enq 05 ^E
ack 06 ^F
bel 07 ^G
bs 08 ^H
ht 09 ^I
lf 0a ^J
nl 0a ^J
vt 0b ^K
ff 0c ^L
cr 0d ^M
so 0e ^N
si 0f ^O
dle 10 ^P
dc1 11 ^Q
dc2 12 ^R
dc3 13 ^S
dc4 14 ^T
nak 15 ^U
syn 16 ^V
etb 17 ^W
can 18 ^X
em 19 ^Y
sub 1a ^Z
e 1b ^[
esc 1b ^[
fs 1c ^\
gs 1d ^]
rs 1e ^^
us 1f ^_
sp 20 ^`
del 7f  


The commas that separate data arguments are optional. The position of the imaginary cursor is moved to the end of the text generated by the data command.

eject Perform a formfeed.
end_macro Concludes the definition of a macro that has been initiated by a macro command.
font id Set the font for subsequent text to id. The available values of id are defined in /usr/lib/css/fdu/font:

i1 .. i18 internal fonts 1 to 18
l1 .. l5 left cartridge font 1 to 5
r1 .. r5 right cartridge font 1 to 5
p1 .. p5 download fonts 1 to 5


The corresponding secondary fonts have the prefix s_ (e.g. s_il).

gray id Selects the gray scale value to be used by the gray_box command. The available values of id are defined in /usr/lib/css/fdu/grayscale:

1 2%
2 10%
3 15%
4 30%
5 45%
6 70%
7 90%
8 100% (solid black)
light 10%
medium 30%
dark 70%
gray_box y,x Draws a filled rectangle of y vertical and x horizontal points. The default gray scale value is 2%, it may however be changed by the gray command. Unlike the box command, gray_box does not draw a surrounding border. The cursor position remains unchanged.
h_line x Draws a horizontal line with a length of x points. The line width used defaults to one point and may be changed by the line_points command. The cursor position remains unchanged.
h_move [{+|-}]x Moves the imaginary cursor to the horizontal position x (in points). Relative moves may be performed by signed values. A negative sign moves x points left and a positive sign moves x points to the right.
include file The contents of file is inserted at the current location and interpreted by fdu. This command is useful to isolate often used definitions in procedure files. If the filename contains special characters it has to be defined as string (i.e. enclosed in quotes like "invoice.mac").
init Initialize printer and reset internal variables to their default values.
italic {on|off} Set italic font on or off.
landscape Set printer to landscape format.
left_margin # Defines the left margin in number of characters. The size of the margin is dependent on the current character size at the time of the left_margin command.
line_pitch id Sets the line pitch (lines per inch) to id. The available values of id are defined in /usr/lib/css/fdu/linepitch:

1 1 LPI
2 2 LPI
3 3 LPI
4 4 LPI
6 6 LPI
8 8 LPI
12 12 LPI
24 24 LPI
48 48 LPI
lpi id Synonym for the line_pitch statement.
line_points # Sets the line width for the box-, h_line- and v_line commands (in points).
lines # Defines the page size in number of lines. The size of the page area is dependent on the current line pitch at the time of the lines command.
load # Activates the macro number # and starts macro overlay. Load 0 terminates macro overlay and is identical with unload.
macro # Start definition of macro number #. Each definition must be terminated by a end_macro command.
move [[{+|-}]y][,[{+|-}]x] Moves the imaginary cursor to the point position with the coordinates y vertical and x horizontal. Relative moves may be performed by signed values. A negative sign moves y points up or x points left and a positive sign moves y points down or x points to the right. Missing values are substituted by the current coordinate and thus do not move in the corresponding direction.
page_size # Synonym for the lines command.
pattern id Selects the pattern to be used by the pat_box command. The available values of id are defined in /usr/lib/css/fdu/pattern:

1 horizontal lines
2 vertical lines
3 diagonal lines 1
4 diagonal lines 2
5 square grid
6 diagonal grid
pat_box y, x Draws a pattern filled rectangle of y vertical and x horizontal points. The current pattern has to be set by the pattern command. Unlike the box command, pat_box does not draw a surrounding border.
pitch id Synonym for the cpi command.
points # Sets the character size in points.
portrait Set printer to portrait format.
pop Moves the imaginary cursor to the location most recently added to the stack by a push command.
primary Sets the primary character set for text output (default).
proportional {on|off} Set proportional font on or off.
push Save the current position of the imaginary cursor in a stack. Pushed addresses may be used in subsequent pop commands. The stack should not be overused. A maximum of about 10 save locations will ensure portability.
right_margin # Defines the right margin in number of characters. The size of the margin is dependent on the current character size at the time of the right_margin command.
secondary Sets the secondary character set for text output.
stroke id Selects the stroke weight to be used for text output. The available values of id are defined in /usr/lib/css/fdu/strokeweight:

light light
medium medium
bold bold
stop Stop the macro translation by fdu.
text d [[,] d]... Synonym for the Data command.
text_lines # Defines the size of the text area in number of lines. The size of the text area is dependent on the current line pitch at the time of the text_lines command.
top_margin # Defines the top margin in number of lines. The size of the top margin is dependent on the current line pitch at the time of the top_margin command.
typeface id Selects the typeface to be used for text output. The available values of id are defined in /usr/lib/css/fdu/typeface:

caslon, courier, dutch, elite, gothic, helvetic, lp (line printer), orator, pica, present (presentation), prestige, roman, times roman, script, swiss

The corresponding secondary typefaces have the prefix s_ (e.g. s_pica).

underline {on|off} Set underline mode on or off.
unload Deactivates the macro overlay of a previous load command.
v_line y Draws a vertical line with a length of y points. The line width used defaults to one point and may be changed by the line_points command. The cursor position remains unchanged.
v_move [{+|-}]y Moves the imaginary cursor to the vertical position y (in points). Relative moves may be performed by signed values. A negative sign moves y points up and a positive sign moves y points down.
x_line x Synonym for the h_line command.
x_move [{+|-}]x Synonym for the h_move command.
y_line y Synonym for the v_line command.
y_move [{+|-}]y Synonym for the v_move command.
# comment Comment up to the end of the line.

Fdu commands may be entered in free format and are case insensitive. Each command must be terminated by a semicolon ';'.

Integration

Fdu is designed to create and translate HP LaserJet programs. The results of the compilations should be stored in the Unix file system using special ordering criterions. CSS supports many such criterions which are suited to build an automatic macro management, where the spooler takes care of when to load the appropriate macros to the printer. The most important ordering variables for this purpose are listed in the following table (for a complete list, please see  css.devices(C)):
%F Form type (lpr f-option)
%S Form subtype (lpr f-suboption)
%D Device number (lpr d-option)
%L LANG(UAGE) environment variable or lpr L-option
%N Device name as defined in the dn-parameter of css.devices(C) or lpr d-Option
%P Program name (lpr p-option)
%O User ordering info lpr O-option
%T Device type as defined in the dt-parameter of css.devices(C)
%V Device file as defined in the dv-parameter of css.devices(C)


If e.g. a device definition in /etc/css.devices includes the begin-of-report parameter

bor=/usr/lib/css/macros/%L/%P.%F

and the printout was invoked by lpr -p prog01 -fb file, CSS will try to load the file /usr/css/macros/english/prog01.bB to the printer (assuming LANGUAGE=english). If no such file can be found, the bor parameter is simply ignored. As always, the lpr options may be embedded in the print file instead of defining them on the command line (see css(P)).

Each printout is processed in the following sequence:

  • Check current form mounted on the device / see also map- and xmap-parameters in css.devices(C).
  • Process all bor-parameters in the order of their definition in css.devices(C). Prior to any output, all ordering variables are substituted with their current values. If a bor-parameter starts with the character '/' and a file with the generated name exists, its contents is sent to the printer. Conditional bor definitions will of course be treated only if all conditions evaluate to true.
  • Generate the file name for if1 by substituting the current ordering values. If a file with the generated name exists, its contents is sent to the printer. (Note: The if- and of-parameters are supported for compatibility reasons. The identical functionality is provided by bor and eor respectively.)
  • Same for if2.
  • Print report.
  • Generate the file name for tf1 by substituting the current ordering values. If a file with the generated name exists, its contents is sent to the printer.
  • Same for tf2.
  • Process all eor-parameters. The same rules apply as for the bor-parameters.

Configuration example:

/etc/css.devices:

#
# Brother HL-8
#
1|HL-8 (HP):as:cr:pg:dv=/dev/lp:\
:map=a,b,c,d:\
:bor=\E\rH\EE:#set HP-emulation mode, reset device:\
:bor=/usr/lib/css_mac/%L/%P:\
:eor=\EE:#reset device:\
:e1=\E&k0S:#10 cpi:\
...
:e50=\E&f5x2y4X:#load macro 2:


Program prog_xy:

FILE *pFp, *popen();

/* open pipe to CSS */

if ((pFp = popen("lpr", "w")) == NULL)
{
    perror("prog_xy: popen lpr");
    exit(1);
}

/* write CSS instream options */

fprintf(pFp, "++CSS++ -f B -p prog_xy\n");

/* write report into file 'pFp' */
...
pclose(pFp);
exit(0);


Macro prog_xy:

#
# Fdu-Macro prog_xy
#
init; # initialize
landscape;
page_size 46;
macro 1;
    move 2300, 30; # 46 lines * 50,
                   # 1 char * 30
    h_line 540;    # 18 char * 30
    v_move +40;    # 4/5 line down
    text 'Printed by CSS/FDU';
end_macro;

#
# Final setup
#
top_margin 3;
text_lines 42;
left_margin 1;
right_margin 112;
load 1; # overlay on each page
#
# end macro prog_xyx


Compilation:

fdu -o /usr/lib/css_mac/german/prog_xy prog_xy

Notes

Many of the fdu commands are defined as macros in /usr/lib/css/fdu/commands. The rules to follow for extensions are documented at the beginning of that file. You may as well need to adjust the other parameter files in /usr/lib/css/fdu to reflect your local environment.
Fdu options may be also defined in the file $HOME/.fdurc as well as in the shell environment variable FDUOPT. The evaluation order is described in the section 'Syntax of Command Lines' page 1-7.
The shell environment variable FDUPATH allows you to define one or multiple path names of directories containing fdu include files. The names are separated by colons.

Example:

FDUPATH=/usr/fdu/include:/usr/css/include;
export FDUPATH

Files

/usr/lib/css/fdu

fdu control directory

See also

css.devices(P), lpr, HP LaserJet II User's Manual

 

Back to top