w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

preamble.c File Reference
#include "p2c.h"
#include "preamble.h"
#include "control.h"
#include "mtxline.h"
#include "strings.h"
#include "multfile.h"
#include "files.h"
#include "status.h"
#include "utility.h"
Include dependency graph for preamble.c:

Go to the source code of this file.

Macros

#define PREAMBLE_G
 
#define blank_   ' '
 
#define colon_   ':'
 
#define semicolon   ';'
 
#define comma_   ','
 
#define max_styles   24
 
#define c1   title
 
#define cn   start
 

Typedefs

typedef char style_index
 
typedef char style_index0
 

Enumerations

enum  command_type {
  none , title , composer , pmx ,
  tex , options , msize , bars ,
  shortnote , style , sharps , flats ,
  meter , space , pages , systems ,
  width , height , enable , disable ,
  range , name , indent , poet ,
  part , only , octave_ , start
}
 
enum  line_type {
  unknown , colon_line , command_line , comment_line ,
  plain_line
}
 

Functions

static voice_index0 voiceCount (char *s_)
 
static style_index0 findStyle (char *s_)
 
static void addStyle (char *S)
 
static void readStyles (void)
 
static void applyStyle (char *s_, char *stylename, stave_index first_inst, stave_index first_stave)
 
static void applyStyles (void)
 
static void wipeCommands (void)
 
boolean omitLine (paragraph_index line)
 
static void setName (void)
 
static void setIndent (void)
 
static void setInitOctave (void)
 
static void checkLabel (char *w)
 
static void setVoices (char *line)
 
static void setClefs (char *line_)
 
static void setDimension (char *line_, command_type lno)
 
static void setSize (char *line_)
 
static command_type findCommand (char *command)
 
boolean isCommand (char *command_)
 
static boolean mustAppend (command_type command)
 
static void doEnable (char *line, boolean choice)
 
static void setRange (char *line_)
 
static boolean isAssertion (char *line)
 
static line_type doCommand (char *line_)
 
void setOnly (char *line_)
 
void interpretCommands (void)
 
void preambleDefaults (void)
 
static void preambleGuess (voice_index maybe_voices)
 
void nonMusic (void)
 
boolean thisCase (void)
 
void augmentPreamble (boolean control_para)
 
void doPreamble (void)
 
void respace (void)
 
void restyle (void)
 
static short clefno (char cl)
 
static void doTenorClefs (void)
 
static void insertTeX (void)
 
static char * pmxMeter (char *Result)
 
static char * sizecode (char *Result, short k)
 
void doPMXpreamble (void)
 
char * startString (char *Result, voice_index0 voice)
 

Variables

static short known_styles = 12
 
static boolean warn_redefine = 0
 
static char commands [28][17]
 
static char cline [28][256]
 
static boolean redefined [28]
 
static char known_style [24][256]
 
static style_index old_known_styles
 
static boolean style_used [24]
 
static boolean omit_line [100]
 
static style_index0 orig_style_line [24]
 
static short orig_range_line
 
static short nclefs
 
static short n_pages
 
static short n_systems
 
static short n_sharps
 
static short ngroups
 
static char part_line [256]
 
static char title_line [256]
 
static char composer_line [256]
 
static char pmx_line [256]
 
static char options_line [256]
 
static char start_line [256]
 
static char voices [256]
 
static char clefs [256]
 
static short group_start [3]
 
static short group_stop [3]
 
static char instr_name [15][41]
 
static boolean style_supplied
 

Macro Definition Documentation

◆ blank_

#define blank_   ' '

Definition at line 41 of file preamble.c.

◆ c1

#define c1   title

Definition at line 64 of file preamble.c.

◆ cn

#define cn   start

Definition at line 65 of file preamble.c.

◆ colon_

#define colon_   ':'

Definition at line 42 of file preamble.c.

◆ comma_

#define comma_   ','

Definition at line 44 of file preamble.c.

◆ max_styles

#define max_styles   24

Definition at line 46 of file preamble.c.

◆ PREAMBLE_G

#define PREAMBLE_G

Definition at line 8 of file preamble.c.

◆ semicolon

#define semicolon (   void)    ';'

Definition at line 43 of file preamble.c.

Typedef Documentation

◆ style_index

typedef char style_index

Definition at line 59 of file preamble.c.

◆ style_index0

typedef char style_index0

Definition at line 61 of file preamble.c.

Enumeration Type Documentation

◆ command_type

Enumerator
none 
title 
composer 
pmx 
tex 
options 
msize 
bars 
shortnote 
style 
sharps 
flats 
meter 
space 
pages 
systems 
width 
height 
enable 
disable 
range 
name 
indent 
poet 
part 
only 
octave_ 
start 

Definition at line 49 of file preamble.c.

◆ line_type

enum line_type
Enumerator
unknown 
colon_line 
command_line 
comment_line 
plain_line 

Definition at line 55 of file preamble.c.

Function Documentation

◆ addStyle()

static void addStyle ( char *  S)
static

Definition at line 158 of file preamble.c.

References colon_, error, findStyle(), known_style, known_styles, max_styles, NextWord(), print, S, and strcpy().

Referenced by doCommand(), and readStyles().

◆ applyStyle()

static void applyStyle ( char *  s_,
char *  stylename,
stave_index  first_inst,
stave_index  first_stave 
)
static

◆ applyStyles()

◆ augmentPreamble()

void augmentPreamble ( boolean  control_para)

◆ checkLabel()

static void checkLabel ( char *  w)
static

Definition at line 365 of file preamble.c.

References error, j, nvoices, pos1(), print, sprintf, STR2, strcmp(), strlen(), voice_label, w, and warning().

Referenced by setVoices().

◆ clefno()

static short clefno ( char  cl)
static

Definition at line 963 of file preamble.c.

References print, sprintf, STR2, and warning().

Referenced by doPMXpreamble().

◆ doCommand()

◆ doEnable()

static void doEnable ( char *  line,
boolean  choice 
)
static

Definition at line 547 of file preamble.c.

References blank_, choice, error, GetNextWord(), print, setFeature(), and sprintf.

Referenced by doCommand().

◆ doPMXpreamble()

◆ doPreamble()

void doPreamble ( void  )

Definition at line 913 of file preamble.c.

References error, i, maybeMusicLine(), P, para_len, preambleGuess(), print, style_supplied, and warning().

Referenced by main().

◆ doTenorClefs()

static void doTenorClefs ( void  )
static

Definition at line 1022 of file preamble.c.

References c, clef, i, nclefs, PMXinstr(), putLine(), sprintf, and toString().

Referenced by doPMXpreamble().

◆ findCommand()

static command_type findCommand ( char *  command)
static

Definition at line 517 of file preamble.c.

References c1, cn, curtail(), equalsIgnoreCase(), j, none, and style_supplied.

Referenced by doCommand(), and isCommand().

◆ findStyle()

static style_index0 findStyle ( char *  s_)
static

Definition at line 141 of file preamble.c.

References colon_, i, known_style, known_styles, s, sprintf, startsWithIgnoreCase(), strcpy(), and strlen().

Referenced by addStyle(), and applyStyles().

◆ insertTeX()

static void insertTeX ( void  )
static

Definition at line 1041 of file preamble.c.

References cline, redefined, tex, and TeXtype2().

Referenced by doPMXpreamble().

◆ interpretCommands()

◆ isAssertion()

static boolean isAssertion ( char *  line)
static

Definition at line 596 of file preamble.c.

Referenced by doCommand().

◆ isCommand()

boolean isCommand ( char *  command_)

Definition at line 532 of file preamble.c.

References findCommand(), none, and strcpy().

Referenced by isControlParagraph().

◆ mustAppend()

static boolean mustAppend ( command_type  command)
static

Definition at line 541 of file preamble.c.

References tex.

Referenced by doCommand().

◆ nonMusic()

void nonMusic ( void  )

Definition at line 860 of file preamble.c.

References cline, doCommand(), i, only, P, para_len, setOnly(), and wipeCommands().

Referenced by musicParagraph().

◆ omitLine()

boolean omitLine ( paragraph_index  line)

Definition at line 329 of file preamble.c.

References omit_line.

Referenced by obliterate().

◆ pmxMeter()

static char* pmxMeter ( char *  Result)
static

denom := 0;

denom := pmdenom;

Definition at line 1048 of file preamble.c.

References beatsPerLine(), meterChange(), meterdenom, meternum, num, old_meter_word, pmdenom, pmnum, PMXmeterdenom(), sprintf, and toString().

Referenced by doPMXpreamble().

◆ preambleDefaults()

◆ preambleGuess()

static void preambleGuess ( voice_index  maybe_voices)
static

Definition at line 815 of file preamble.c.

References cline, error, print, printf(), strcpy(), and style.

Referenced by doPreamble().

◆ readStyles()

static void readStyles ( void  )
static

Definition at line 176 of file preamble.c.

References addStyle(), fgets, known_styles, cutout::l, NULL, orig_style_line, P_eof(), S, strchr, stylefile, and styleFileFound().

Referenced by preambleDefaults().

◆ respace()

void respace ( void  )

Definition at line 935 of file preamble.c.

References i, j, must_respace, ninstr, nspace, sprintf, STR2, TeXtype2(), toString(), and unspec.

Referenced by doPMXpreamble(), and musicParagraph().

◆ restyle()

void restyle ( void  )

Definition at line 957 of file preamble.c.

References must_restyle.

Referenced by musicParagraph().

◆ setClefs()

static void setClefs ( char *  line_)
static

Definition at line 444 of file preamble.c.

References blank_, clef, GetNextWord(), nclefs, s, strcpy(), and strlen().

Referenced by interpretCommands().

◆ setDimension()

static void setDimension ( char *  line_,
command_type  lno 
)
static

Definition at line 464 of file preamble.c.

References cline, error, isdigit, cutout::l, n, p, print, sprintf, strcpy(), strlen(), and substr_().

Referenced by interpretCommands().

◆ setIndent()

static void setIndent ( void  )
static

Definition at line 351 of file preamble.c.

References cline, fracindent, indent, redefined, and strcpy().

Referenced by interpretCommands().

◆ setInitOctave()

static void setInitOctave ( void  )
static

Definition at line 358 of file preamble.c.

References cline, initOctaves(), octave_, and redefined.

Referenced by interpretCommands().

◆ setName()

static void setName ( void  )
static

◆ setOnly()

◆ setRange()

static void setRange ( char *  line_)
static

◆ setSize()

static void setSize ( char *  line_)
static

Definition at line 487 of file preamble.c.

References blank_, GetNextWord(), getNum(), i, musicsize, ninstr, stave_size, strcpy(), and unspec.

Referenced by RegexCompile::compileSet(), and interpretCommands().

◆ setVoices()

static void setVoices ( char *  line)
static

◆ sizecode()

static char* sizecode ( char *  Result,
short  k 
)
static

Definition at line 1066 of file preamble.c.

References error, k, musicsize, print, and strcpy().

Referenced by doPMXpreamble().

◆ startString()

char* startString ( char *  Result,
voice_index0  voice 
)

Definition at line 1193 of file preamble.c.

References curtail(), GetNextWord(), j, s, sprintf, start_line, strcpy(), voice, and w.

Referenced by includeStartString().

◆ thisCase()

boolean thisCase ( void  )

Definition at line 872 of file preamble.c.

References choice, P, pos1(), startsWithIgnoreCase(), and strcpy().

Referenced by augmentPreamble(), and doMusic().

◆ voiceCount()

static voice_index0 voiceCount ( char *  s_)
static

Definition at line 126 of file preamble.c.

References blank_, comma_, i, cutout::l, s, strcpy(), strlen(), and wordCount().

Referenced by applyStyle(), and applyStyles().

◆ wipeCommands()

static void wipeCommands ( void  )
static

Definition at line 320 of file preamble.c.

References c, c1, cline, and cn.

Referenced by doPMXpreamble(), and nonMusic().

Variable Documentation

◆ clefs

char clefs[256]
static

Definition at line 118 of file preamble.c.

Referenced by applyStyle(), applyStyles(), doPMXpreamble(), and interpretCommands().

◆ cline

char cline[28][256]
static
Initial value:
= {
"", "", "", "", "", "", "", "", "1/4", "", "0", "", "C", "", "1", "1",
"190mm", "260mm", "", "", "", "", "", "", "", "", "", ""
}

Definition at line 81 of file preamble.c.

Referenced by applyStyles(), doCommand(), doPMXpreamble(), insertTeX(), interpretCommands(), nonMusic(), preambleGuess(), setDimension(), setIndent(), setInitOctave(), setName(), TabularBeginRow(), TabularCline(), texFTitle(), and wipeCommands().

◆ commands

char commands[28][17]
static
Initial value:
= {
"NONE", "TITLE", "COMPOSER", "PMX", "TEX", "OPTIONS", "SIZE", "BARS/LINE",
"SHORT", "STYLE", "SHARPS", "FLATS", "METER", "SPACE", "PAGES", "SYSTEMS",
"WIDTH", "HEIGHT", "ENABLE", "DISABLE", "RANGE", "NAME", "INDENT", "POET",
"PART", "ONLY", "OCTAVE", "START"
}

Definition at line 71 of file preamble.c.

◆ composer_line

char composer_line[256]
static

Definition at line 116 of file preamble.c.

Referenced by doPMXpreamble(), and interpretCommands().

◆ group_start

short group_start[3]
static

Definition at line 119 of file preamble.c.

Referenced by applyStyle(), and doPMXpreamble().

◆ group_stop

short group_stop[3]
static

Definition at line 119 of file preamble.c.

Referenced by applyStyle(), and doPMXpreamble().

◆ instr_name

char instr_name[15][41]
static

Definition at line 120 of file preamble.c.

Referenced by applyStyle(), doPMXpreamble(), setName(), and setVoices().

◆ known_style

char known_style[24][256]
static
Initial value:
= {
"SATB: Voices S,A T,B; Choral; Clefs G F",
"SATB4: Voices S A T B; Choral; Clefs G G G8 F",
"SINGER: Voices Voice; Vocal; Clefs G",
"PIANO: Voices RH LH; Continuo; Clefs G F",
"ORGAN: Voices RH LH Ped; Continuo; Clefs G F F",
"SOLO: Voices V; Clefs G", "DUET: Voices V1 Vc; Clefs G F",
"TRIO: Voices V1 Va Vc; Clefs G C F",
"QUARTET: Voices V1 V2 Va Vc; Clefs G G C F",
"QUINTET: Voices V1 V2 Va Vc1 Vc2; Clefs G G C F F",
"SEXTET: Voices V1 V2 Va1 Va2 Vc1 Vc2; Clefs G G C C F F",
"SEPTET: Voices V1 V2 Va1 Va2 Vc1 Vc2 Cb; Clefs G G C C F F F", "", "", "",
"", "", "", "", "", "", "", "", ""
}

Known styles

Definition at line 94 of file preamble.c.

Referenced by addStyle(), applyStyles(), findStyle(), and interpretCommands().

◆ known_styles

short known_styles = 12
static

◆ n_pages

short n_pages
static

Definition at line 115 of file preamble.c.

Referenced by doPMXpreamble(), interpretCommands(), and preambleDefaults().

◆ n_sharps

short n_sharps
static

Definition at line 115 of file preamble.c.

Referenced by doPMXpreamble(), and interpretCommands().

◆ n_systems

short n_systems
static

Definition at line 115 of file preamble.c.

Referenced by doPMXpreamble(), interpretCommands(), and preambleDefaults().

◆ nclefs

short nclefs
static

Definition at line 115 of file preamble.c.

Referenced by doPMXpreamble(), doTenorClefs(), and setClefs().

◆ ngroups

short ngroups
static

◆ old_known_styles

style_index old_known_styles
static

Definition at line 109 of file preamble.c.

Referenced by interpretCommands(), and preambleDefaults().

◆ omit_line

boolean omit_line[100]
static

Definition at line 111 of file preamble.c.

Referenced by omitLine(), preambleDefaults(), and setOnly().

◆ options_line

char options_line[256]
static

Definition at line 117 of file preamble.c.

Referenced by interpretCommands().

◆ orig_range_line

short orig_range_line
static

Definition at line 113 of file preamble.c.

Referenced by doCommand(), and setRange().

◆ orig_style_line

style_index0 orig_style_line[24]
static

Definition at line 112 of file preamble.c.

Referenced by applyStyles(), doCommand(), and readStyles().

◆ part_line

char part_line[256]
static

Definition at line 116 of file preamble.c.

Referenced by doPMXpreamble(), and interpretCommands().

◆ pmx_line

char pmx_line[256]
static

Definition at line 117 of file preamble.c.

Referenced by doPMXpreamble(), and interpretCommands().

◆ redefined

boolean redefined[28]
static
Initial value:
= {
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0
}

Definition at line 86 of file preamble.c.

Referenced by doCommand(), doPMXpreamble(), insertTeX(), interpretCommands(), setIndent(), setInitOctave(), and setName().

◆ start_line

char start_line[256]
static

Definition at line 117 of file preamble.c.

Referenced by doCommand(), preambleDefaults(), startString(), and t1_flush_cs().

◆ style_supplied

boolean style_supplied
static

Definition at line 121 of file preamble.c.

Referenced by doPreamble(), findCommand(), and preambleDefaults().

◆ style_used

boolean style_used[24]
static

Definition at line 110 of file preamble.c.

Referenced by applyStyles(), and interpretCommands().

◆ title_line

char title_line[256]
static

Definition at line 116 of file preamble.c.

Referenced by doPMXpreamble(), and interpretCommands().

◆ voices

char voices[256]
static

Definition at line 117 of file preamble.c.

Referenced by applyStyle(), applyStyles(), interpretCommands(), and isControlParagraph().

◆ warn_redefine

boolean warn_redefine = 0
static

Definition at line 69 of file preamble.c.

Referenced by doCommand().