=============================================================

 Manual for rskala - Construction of Round Dials

 dg4ydx, 30.12.2003

=============================================================

1 Name

  rskala

2 Syntax

  rskala inputfile outputfile

  If less than two arguments are given the program asks 
  for the missing filenames.

3 Description

  rskala can be used for the construction of round dials
  for ham radio and other electronic equipment.

  Output languages are LaTeX, emTeX, emTeXCAD and HPGL.
  For Linux systems LaTeX output is recommended.

4 Input File Format

4.0 Intro

	The input file is ASCII text. It consist of words
        (commands or numbers) separated by Space, Tab, 
        CR or LF. Line Feed has no special meaning here.

        Areas enclosed in braces are looked at as comments.
        Multiline comments are allowed, nested comments are
        not allowed.

	There is no difference made between upper and lower
        characters in the input files.

	The decimal point must be written as a dot, not as
        a comma:
	5/2 = 2.5 
	5/2 = 2,5 wrong!

	Here is an example of an input file:

-----------------------------------------------------------------
	PICWIDTH 210		{ page width = 210 mm, A4    }
	PICHEIGHT 297		{ page height = 297 mm A4 }
	LANGUAGE   HPGL		{ output for HP-Plotter or hp2xx }
	PI	  180		{ 360 deg = 1 circle }
	INIT			{ open output file }

	STRING			{ print a string }
		   XSTRING   0
		   YSTRING   140
		   WSTRING   10
		   HSTRING   10
		   QSTRING   1
		   ANGLESTRING 0
	STARTSTRING
		   FM RECEIVER
	ENDSTRING

	LINDIAL                { print a round dial }
		   RADIUS       40	
		   ANGLEFROM    -180  
		   ANGLETO    0     
		   NUMBERFROM      88	
		   NUMBERTO      108   
		   NUMBERDIST     2	
		   NODIGITS      3     
		   NODIGFRAC    0	
		   TURN	        1	
		   OUTSIDE	1	
		   DIGITHEIGHT  5  
		   DIGITWIDTH  5  
		   DIGITANGLE 0  
		   LENGTHDIGITTICK       3  
		   DISTTICKDIGIT	1  
		   LONGNUMBERDIST     1 
		   LENGTHLONGTICK       2  
		   SHORTNUMBERDIST     0.1 
		   LENGTHSHORTTICK	1.5 
	ENDDIAL
	LINE	  -100 0 100 0  { print a line }
-------------------------------------------------------
	First some variables are initialized
        (PICWIDTH, PICHEIGHT, LANGUAGE, PI),
	then the output is opened (INIT), 
	now strings, lines and round dials 
	are printed (STRING, LINE,
	LINDIAL, ALIGNDIAL).

I Variables

4.1 PICWIDTH x		- set page width to x mm

	Syntax: PICWIDTH number
	Example: PICWIDTH 280
	Meaning: page width is 280 mm, the x coordinates
	may be between -140 and 140.

4.2 PICHEIGHT x		- set page height to x mm

	Syntax: PICHEIGHT number
	Example: PICHEIGHT 200
	Meaning: page height is 200 mm, the y coordinates
	may be between -100 and 100.

4.4 MIRROR 		- output mirrored
       
        Syntax : MIRROR ON|OFF
        Example: MIRROR ON
        Meaning: left and right side of the dial have swapped;
                 useful when printing on the flip side of an
                 ohp transparency film. 
        Example: MIRROR OFF
        Meaning: default, normal printing on paper.

4.3 LANGUAGE		- set output language

	Syntax: LANGUAGE LATEX|EMTEX|TEXCAD|HPGL
	Example: LANGUAGE LATEX
	Meaning: Output in TeX format, can be processed
                 with TeTeX and printed.

4.5 PI x		- set angle of half a circle (maybe 180 degrees)

	Syntax: PI number
	Example: PI 3.14159
	Meaning: all following angles are interpreted in RAD.
	Example: PI 180
	Meaning: all following angles are interpreted in
                 degrees (default).

II Output commands

4.6 INIT		- initialize output (output can begin here)
	Syntax: INIT

4.7 ECHO ... ENDECHO	- print a string on stdout (not into a file!);
                          words beginning with a "#" are interpreted
                          as a number - the ascii character belonging 
                          to that number is printed.

	Syntax: ECHO {word|#number} ENDECHO
        Example: ECHO Hello, #13 world! ENDECHO 
        Prints:  "Hello, 
                  world!"  

III Print commands:

4.8 LINE x1 y1 x2 y2 	- draw a line from (x1,y1) to (x2,y2). 

        Syntax: LINE number number number number
	Example: LINE -100 0 100 0 
        Draws: a 200 mm linie from the left to the right.

4.9 STRING		- prints a string into the output file.

        Syntax: STRING parameter-list STARTSTRING ENDSTRING
		parameter-list = {XSTRING|YSTRING|WSTRING|HSTRING zahl}
	Example:
		STRING
		   XSTRING 20
		   YSTRING 15
		   WSTRING 8
		   HSTRING 12
		   QSTRING 0
		   ANGLESTRING 0
		STARTSTRING
		   This is a string. 
		ENDSTRING

4.9.1 XSTRING - set the x-distance between string and center 
                 of the picture.

        Syntax: XSTRING number
        Example: XSTRING 20
        Meaning: The string is 20mm right of the center.
        Example: XSTRING -35
        Meaning: The string is 20mm left of the center.

4.9.2 YSTRING - set the y-distance between string and center 
                 of the picture.

	Syntax: YSTRING number
        Example: YSTRING 40
        Meaning: The string is 40mm above the center.

4.9.3 WSTRING - set the width of a character

        Syntax : WSTRING number
        Example: WSTRING 7
        Meaning: every character on the paper is 7mm wide. 

4.9.4 HSTRING - set the height of a character

	Syntax  : HSTRING number
	Example: HSTRING 9 
        Meaning: every character on the paper is 9mm high.

4.9.5 QSTRING - position/alignment of a string

        Syntax : QSTRING 0|1|2|3
        Example: QSTRING 0 
        Result: string is right above the position which is 
        defined with XSTRING und YSTRING.
        Example: QSTRING 1 
        Result: string is left above the defined position. 
        Example: QSTRING 2 
        Result: string is left beneath the defined position.
	Example: QSTRING 3 
        Result: string is right beneath the defined position.

4.9.6 ANGLESTRING - angle of the string
 
        Syntax : ANGLESTRING number
        Example: ANGLESTRING 90
        Result : the string has turned left for 90 degrees and is
                 standing on its first character.
        Example: ANGLESTRING -90
        Result : the string has turned right for 90 degrees and is
                 standing on its last character.

4.9.7 STARTSTRING ... ENDSTRING - output a string (on the paper)

        Syntax : STARTSTRING {word} ENDSTRING
        Example: STARTSTRING hello, world! ENDSTRING
        Result : Output "hello, world!"

4.10 LINDIAL - draw a linear dial (all ticks have the same distance from their neighbours)

	Syntax  : LINDIAL argument-list ENDDIAL
	argument-list = {RADIUS|ANGLEFROM|ANGLETO|NUMBERFROM|NUMBERTO
                        |NUMBERDIST|NODIGITS|NODIGFRAC|TURN|OUTSIDE|
			|DIGITHEIGHT|DIGITWIDTH|DIGITANGLE
			|LENGTHDIGITTICK|DISTTICKDIGIT|LONGNUMBERDIST|LENGTHLONGTICK
                        |SHORTNUMBERDIST|LENGTHSHORTTICK} zahl
	Example:
	LINDIAL
		RADIUS    40	{ radius of circle }
		ANGLEFROM 0     { from 3 o' clock  }
		ANGLETO 180     { to 9 o' clock    }
		TURN	  1	{ dial mounted on tuning knob }
		OUTSIDE	  1	{ numbers outside the circle }

		NUMBERFROM   88	{ from 88 MHz }
		NUMBERTO   108   { to  108 MHz }
		NUMBERDIST  2	{ numbers every 2 MHz}
		NODIGITS   3     { at least three digits }
		NODIGFRAC 0	{ but no decimal part }

		TURN	  1	{ the numbers shall turn around the center (dial connected to the knob!) }
		OUTSIDE	  1	{ numbers are outside the 40mm circle }
		DIGITHEIGHT  5  { height of digit 5 mm }
		DIGITWIDTH  5  { width of digit also 5 mm } 
		DIGITANGLE 0  { the digit ist standing above the center of the dial } 
		LENGTHDIGITTICK       3  { length of those ticks belonging to a number }
		DISTTICKDIGIT	     1  { Abstand Zahl - Strichmarke 1 mm }
		LONGNUMBERDIST     1  { long ticks every 1MHz }
		LENGTHLONGTICK       2  { length of long ticks is 2 mm }
		SHORTNUMBERDIST     0.1 { short ticks every 100kHz }
		LENGTHSHORTTICK	     1.5 { length of short ticks is 1,5 mm }
	ENDDIAL

4.10.1 RADIUS

	Syntax : RADIUS number
	Example: RADIUS 70
	Result : Dial with a diameter of 140mm.

4.10.2 ANGLEFROM

	Syntax : ANGLEFROM number
	Example: ANGLEFROM 0
	Result : dial begins on the right side of the paper
	Example: ANGLEFROM 90
	Result : dial begins on the upper side of the paper
	Example: ANGLEFROM 180
	Result : dial begins on the left side of the paper
	Example: ANGLEFROM -90
	Result : dial begins on the lower side of the paper
	Remark : compare the angle to the position on a clock:
	  0 degrees -  3 am	180 degrees -  9 am
	 30 degrees -  2 am	210 degrees -  8 am
	 60 degrees -  1 am	240 degrees -  7 am
	 90 degrees - 12 am	270 degrees -  6 am
	120 degrees - 11 am	300 degrees -  5 am
	150 degrees - 10 am 	330 degrees -  4 am

4.10.3 ANGLETO

	Syntax : ANGLETO zahl
	Example: ANGLETO 180
	Result : dial ends on left side

	Bemerkung: angle between ANGLEFROM and ANGLETO
        runs against the clock (in mathematical way).
	Example: ANGLEFROM 0 ANGLEFROM 180
	Result : upper half of a circle.
	Example: ANGLEFROM 180 ANGLETO 360
	Result : lower half of a circle.
	Remark: if ANGLEFROM is bigger than ANGLETO, 
                you need to add 360 degrees to ANGLETO
                to get the the wanted direction.

4.10.4 NUMBERFROM

	Syntax : NUMBERFROM number
	Example: NUMBERFROM 88
	Result : the number 88 (MHz) is displayed 
                 at the position ANGLEFROM.
4.10.5 NUMBERTO

	Syntax : NUMBERTO number
	Example: NUMBERTO 108
	Result : the number 108 (MHz) is displayed 
                 at the position ANGLETO.

4.10.6 NUMBERDIST

	Syntax : NUMBERDIST number
	Example: NUMBERDIST 2
	Result : the numbers 90, 92, ..., 106 are displayes
                 at the wanted position on the dial.

4.10.7 NODIGITS

	Syntax : NODIGITS number
	Example: NODIGITS 3
	Result : all numbers are displayed with at least
                 three digits.

4.10.8 NODIGFRAC

	Syntax : NODIGFRAC number
	Example: NODIGFRAC 1
	Result : all numbers are displayed with a one
                 decimal part.

4.10.9 TURN - is the dial mounted at the chassis or at the dial knob?

	Syntax : TURN {0|1}
	Example: TURN 0 
	Result : all numbers are displayes with the same angle
                 so you don't have to turn your head when you 
                 want to read them - but only if your dial is 
                 mounted at the chassis or cabinet.
	Example: TURN 1
	Result: all numbers are displayed so when you turn the dial,
                you always can read a number at the same position
                without turning your head. 
                This is useful if you like to mount your dials
                on the dial knob (so the dial turns if you tune).
                In most cases this looks much better (IMHO).
	
4.10.10 OUTSIDE - are the ticks and numbers outside or inside the circle?

	Syntax : OUTSIDE {0|1}
	Example: OUTSIDE 0
	Result : all ticks and numbers are inside the circle.
	Example: OUTSIDE 1
	Result : all ticks and numbers are outside the circle.

4.10.11 DIGITHEIGHT - digit height

	Syntax : DIGITHEIGHT number
	Example: DIGITHEIGHT 3
	Result : every digit has a height of 3mm.

4.10.12 DIGITWIDTH - digit width

	Syntax : DIGITWIDTH number
	Example: DIGITWIDTH 1.5
	Result : every digit has a width of 1.5mm.

4.10.13 DIGITANGLE - angle of numbers

	Syntax : DIGITANGLE
	Example: DIGITANGLE 0
	Result with TURN=0: all numbers are standing.
	Result with TURN=1: the number at 3 'o clock is standing,
	the other numbers are turning together with the ticks.
	Useful if the dial window is positioned right to the center
        of the dial. 

	Example: DIGITANGLE -90
	Result with Dreh=0: all numbers are lying on their left side.
	Result with Dreh=1: the number at 12'o clock is standing,
	all other numbers are turning together with the ticks.
	Useful if the dial window is positioned above the center
        of the dial (for example: Drake SSR-1). 

4.10.14 LENGTHDIGITTICK - length of ticks at numbers

	Syntax  : LENGTHDIGITTICK number
	Example: LENGTHDIGITTICK 2
	Result : every tick belonging to a number has a length of 2mm.

4.10.15 DISTTICKDIGIT - graphical distance between tick and number

	Syntax : DISTTICKDIGIT number
	Example: DISTTICKDIGIT 1
	Result : distance between tick and number is 1mm.

4.10.16 LONGNUMBERDIST - numerical distance between long ticks

	Syntax : LONGNUMBERDIST number
	Example: LONGNUMBERDIST 1
	Result : long ticks have a distance of 1 (for example 1 MHz).

4.10.17 LENGTHLONGTICK - graphical length of long ticks

	Syntax : LENGTHLONGTICK number
	Example: LENGTHLONGTICK 1.5 
	Result : length of long ticks is 1.5mm.

4.10.18 SHORTNUMBERDIST - numerical distance between short ticks

	Syntax : SHORTNUMBERDIST number
	Example: SHORTNUMBERDIST 0.5
	Result : short ticks have a distance of 0.5 
                 (for example 0.5 MHz).

4.10.18 LENGTHSHORTTICK - graphical length of short ticks

	Syntax : LENGTHSHORTTICK number
	Example: LENGTHSHORTTICK 1
	Result : length of short ticks is 1mm.

4.11 ALIGNDIAL - draw a dial with value-angle pairs

	Syntax : ALIGNDIAL argument-list ENDDIAL
	argument-list = {((RADIUS|ANGLEFROM|ANGLETO
			  |NODIGITS|NODIGFRAC|TURN|OUTSIDE
			  |DIGITHEIGHT|DIGITWIDTH|DIGITANGLE
			  |LENGTHDIGITTICK|DISTTICKDIGIT|LONGNUMBERDIST|LENGTHLONGTICK|SHORTNUMBERDIST|LENGTHSHORTTICK)
                          zahl) | pairs}
	pairs = LIST {number number} ENDLIST
	Example: 
	ALIGNDIAL
		RADIUS    40	{ radius of circle }
		ANGLEFROM -180  { from 9 'o clock  }
		ANGLETO 0     { up to 3 'o clock }
		LIST		{ list of pairs:   }
			88.5    -180	{ 88.5 MHz,  -180 degrees }
			90	-163	{ 90 MHz,    -180 degrees }
			92	-146	{ 92 MHz,    -180 degrees }
			94	-129	{ 94 MHz,    -180 degrees }
			96	-110	{ 96 MHz,    -180 degrees }
			98	-109	{ 98 MHz,    -180 degrees }
			100	-72	{ 100 MHz,   -180 degrees }
			102	-54	{ 102 MHz,   -180 degrees }
			104	-36	{ 104 MHz,   -180 degrees }
			106	-18	{ 106 MHz,   -180 degrees }
			107.5	0	{ 107.5 MHz, -180 degrees }
		ENDLIST
		NODIGITS   3     { 3 digits }
 		NODIGFRAC 0	{ no decimal part }
		TURN	  1	{ dial mounted at the knob }
		OUTSIDE	  1	{ numbers outside the circle }
		DIGITHEIGHT  5  { digit height 5 mm }
		DIGITWIDTH  5  { digit width 5 mm } 
		DIGITANGLE 0  { bottom of digits standing on the center } 
		LENGTHDIGITTICK       3  { number ticks, length in mm }
		DISTTICKDIGIT	     1  { distance tick-number in mm }
		LONGNUMBERDIST     1  { long ticks every 1 MHz }
		LENGTHLONGTICK       2  { length of them 2 mm }
		SHORTNUMBERDIST     0.1 { short ticks every 100 kHz }
		LENGTHSHORTTICK	     1.5 { length of then 1.5 mm }
	ENDDIAL

4.11.1 LIST ... ENDLIST - list of value-angle pairs (measured before)

	Syntax:   LIST {number number} ENDLIST
	Example: LIST 
			14.020 -90
			14.090 0
			14.185 90 
		  ENDLIST
	Result: at the position -90 degrees (12 'o clock)
                the number 14.020 is displayed (14,020 MHz).
                At the position 0 degrees (3 'o clock)
                the number 14.090 is displayed. 
                At the position 90 degrees (6 'o clock)
                the number 14.185 is displayed. 
                Between these three values a
                linear interpolation is provided - just like
                LINDIAL, but there are no number between
                these values.
                The more value-angle pairs you have got, the
                more accurate are the interpolated values.

4.11.2 RADIUS, ANGLEFROM, ANGLETO, NODIGITS, NODIGFRAC, TURN, OUTSIDE,
       DIGITHEIGHT, DIGITWIDTH, DIGITANGLE, LENGTHDIGITTICK, DISTTICKDIGIT, LONGNUMBERDIST
       LENGTHLONGTICK, SHORTNUMBERDIST, LENGTHSHORTTICK
    
	Syntax and examples: look at LINDIAL.

5 Author/versions

Author...: dg4ydx@gyrator.de
Version..: 1.20
Datum....: 2003/12/30
Language.: Pascal