Mike Gerwitz

Activist for User Freedom

summaryrefslogtreecommitdiffstats
blob: 65a5ee5920641e24b022b0eb0863d09b9ab8379a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
% LoVullo rater specification class
%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{raterspec}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{lvspec}}
\ProcessOptions\relax

% we're an extension of the base lvspec
\LoadClass[insuranceterms]{lvspec}

%%
% Default package includes
%
% Note that these are not all the packages that are available; see the
% raterspec/ directory in the lvspec repo
%
\RequirePackage{raterspec/param}
\RequirePackage{raterspec/class}
\RequirePackage{raterspec/question}
\RequirePackage{raterspec/rates}
\RequirePackage{raterspec/form}
\RequirePackage{raterspec/c1import}
\RequirePackage{lvflow}
%\RequirePackage{premcalc}


%%
% Formatting
%

% we gots some big section numbers
\renewcommand\l@subsubsection{\@dottedtocline{3}{7em}{4.6em}}


%%
% Rater-specific specification additions
%
% This should be called before beginning the documet environment
%
\def\@RaterProgramName#1{
  \gdef\@lvspec@pretitle{%
    #1 Supplier\\Specifications:\\
    \vspace{0.5em}%
  }
  \gdef\@lvspec@premarktitle{#1:\space}

  \abstract{%
    This document is a formal specification for the integration of
    \@title@short{} with the Dwelling Program of the Quote Server, Program
    UI and~ConceptOne. This document should contain all information
    necessary to complete a conforming implementation with minimal
    clarification and will serve as a reference for future development,
    including bug fixes and feature requests.
  }
}

\terminology{%
  \subsection{Rater Terminology}
  \input{raterspec/sec/rater-dfn}
}


%%
% Beginning of document
%
% The host environment is the same for all new systems
%

\let\@@madespec0

\def\@raterspec@mkhook#1#2#3#4{
  \expandafter\gdef\csname @raterspec@#1\endcsname{
    \PackageWarning{raterspec}{Missing #2!
      \MessageBreak Define using \expandafter\protect\csname#1\endcsname}%
    \todo{No #2 have been defined.}%
  }
  % publically accessible input macro
  \expandafter\gdef\csname#1in\endcsname##1{%
    \expandafter\gdef\csname @raterspec@#1\endcsname{%
      #3\input{##1}#4%
    }%
  }
  % publically accessible output macro
  \expandafter\gdef\csname#1out\endcsname{%
    \csname @raterspec@#1\endcsname
  }
}

\def\makespec{
  \ifx\@@madespec1%
    \PackageError{raterspec}{Duplicate call to \protect\makespec}
  \fi

  \global\let\@@madespec1
  \input{raterspec/parts}
}

\AtEndDocument{
  \ifx\@@madespec0
    \PackageError{raterspec}{\protect\makespec\space was not called}
  \fi
}


%%
% Document hooks
%%

\@raterspec@mkhook{inputtypes}{input types}
  {%
    % can't really include a sigline here because approvial would be global
    \pnumoff
      Parameter types in this section are common to the \@title@short\ program.
    \pnumon
    \index{parameter type|(}%
  }
  {\index{parameter type|)}}

\@raterspec@mkhook{inputparams}{input parameters}
  {}
  {}

\@raterspec@mkhook{dataclass}{data classifications}
  {}
  {}

\@raterspec@mkhook{premcalc}{premium calculations}
  {}
  {}

\@raterspec@mkhook{forms}{forms}
  {}
  {}



%%
% Code generation
%
% Right now the code generation is tightly coupled with the packages that it
% is applicable to; they need to be refactored and hooks added
\newwrite\@@codegen
\immediate\openout\@@codegen=gen.xml

\def\@codegen{%
  \begingroup
    % prepare common cases for plain-text output
    \def\sref##1{the specification}%
    \def~{ }%
    \def\emph{}%
    \def\nobreakspace{ }%
    \def\${}%
    \@do@codegen
}
\def\@do@codegen#1{%
    \immediate\write\@@codegen{#1}%
  \endgroup
}


%%
% Misc
%

\def\@firstchar #1#2||{#1}
\def\@secondchar #1#2#3||{#2}
\def\@ifnumeric#1{{%
  \edef\@@chk{\@firstchar#1||}%
  % determine if this is a number
  \def\@@result{0}%
  % strip any negative sign
  \ifnum\expandafter`\@@chk=`-
    \edef\@@chk{\@secondchar#1--||}%
  \fi
  % perform number check
  \ifnum\expandafter`\@@chk<`0\else
    \ifnum\expandafter`\@@chk>`9\else
      % is a number
      \def\@@result{1}%
    \fi
  \fi
  % use the result to output a conditional that will match a closing \fi
  \aftergroup\ifnum
  \expandafter\aftergroup\@@result
  \aftergroup=%
  \aftergroup1%
  \aftergroup\relax
}}


\def\beginundersletter{%
  \begingroup% ended by \@dotypedef
  \catcode`\_=11\relax
}
\def\endundersletter{%
  \endgroup
}