\hypertarget{unity_8h}{
\section{unity.h File Reference}
\label{unity_8h}\index{unity.h@{unity.h}}
}


The Library to support parsing unit strings.  


{\ttfamily \#include $<$stdio.h$>$}\par
Include dependency graph for unity.h:
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structfunction__definition}{function\_\-definition}
\begin{DoxyCompactList}\small\item\em Represents the definition of a known function. \end{DoxyCompactList}\item 
struct \hyperlink{struct_function_application}{FunctionApplication}
\begin{DoxyCompactList}\small\item\em A unit corresponding to an application of a function to a unit sequence. \end{DoxyCompactList}\item 
struct \hyperlink{struct_simple_unit}{SimpleUnit}
\begin{DoxyCompactList}\small\item\em A simple unit, corresponding to, for example, ‘MHz’. \end{DoxyCompactList}\item 
struct \hyperlink{structunit__struct}{unit\_\-struct}
\begin{DoxyCompactList}\small\item\em A single parsed unit. \end{DoxyCompactList}\item 
struct \hyperlink{struct_unit_def}{UnitDef}
\begin{DoxyCompactList}\small\item\em Encapsulates per-\/syntax information about a unit. \end{DoxyCompactList}\item 
struct \hyperlink{struct_unit_expression}{UnitExpression}
\begin{DoxyCompactList}\small\item\em The parsed version of a unit string. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{unity_8h_a1320721039eab15bbe218466a179bd27}{UNITY\_\-CHECK\_\-ALL}~UNITY\_\-CHECK\_\-RECOGNISED $|$ UNITY\_\-CHECK\_\-RECOMMENDED $|$ UNITY\_\-CHECK\_\-CONSTRAINTS
\begin{DoxyCompactList}\small\item\em Flag: perform all checks. \end{DoxyCompactList}\item 
\#define \hyperlink{unity_8h_aaac121f3891035ae9b77b51fbab2fe7c}{UNITY\_\-CHECK\_\-CONSTRAINTS}~4
\begin{DoxyCompactList}\small\item\em Flag: check whether the unit is used in a way which satisfies constraints. \end{DoxyCompactList}\item 
\#define \hyperlink{unity_8h_abe3e8af418a23a13ece5068f3a2f85d3}{UNITY\_\-CHECK\_\-RECOGNISED}~1
\begin{DoxyCompactList}\small\item\em Flag: check whether the unit is recognised. \end{DoxyCompactList}\item 
\#define \hyperlink{unity_8h_a268b93e7e08712a4c312f488a5553748}{UNITY\_\-CHECK\_\-RECOMMENDED}~2
\begin{DoxyCompactList}\small\item\em Flag: check whether the unit is recommended. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{unity_8h_aa3dfac6a18a3277cd4e76e1e17b2d490}{
typedef struct \hyperlink{structunit__struct}{unit\_\-struct} \hyperlink{unity_8h_aa3dfac6a18a3277cd4e76e1e17b2d490}{Unit}}
\label{unity_8h_aa3dfac6a18a3277cd4e76e1e17b2d490}

\begin{DoxyCompactList}\small\item\em A clearer name for struct \hyperlink{structunit__struct}{unit\_\-struct}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{unity_8h_a698ff4e23791882278b041c9c0c8d7d3}{UnitTypes} \{ \hyperlink{unity_8h_a698ff4e23791882278b041c9c0c8d7d3a008905ef7596382c552525e4879e1697}{simple\_\-unit\_\-type}, 
\hyperlink{unity_8h_a698ff4e23791882278b041c9c0c8d7d3a7c1b25467f932a7cd8d5ae1d0d7b2601}{function\_\-application\_\-type}
 \}
\begin{DoxyCompactList}\small\item\em An enumeration indicating the two types of unit possible in \hyperlink{structunit__struct}{unit\_\-struct}. \end{DoxyCompactList}\item 
enum \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} \{ \par
\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea7f66619b144f5c9a81a6075ffc06044a}{UNITY\_\-SYNTAX\_\-FITS}, 
\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ead9ff0a0ca02c6e1bb6fbdb53d4e8ec0f}{UNITY\_\-SYNTAX\_\-OGIP}, 
\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea4664ed1aeb383806001cc91809776973}{UNITY\_\-SYNTAX\_\-CDS}, 
\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14eab5cb458cada7bec0cf580f41102dad54}{UNITY\_\-SYNTAX\_\-VOUNITS}, 
\par
\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea23a33cbecbb10170622d6c0ddc319f2f}{UNITY\_\-SYNTAX\_\-LATEX}, 
\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea32f7de5d19e049c59f9341e1a8b4fc9a}{UNITY\_\-SYNTAX\_\-DEBUG}, 
\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14eadd461cc813145a18f14b9b5e9a57720f}{UNITY\_\-SYNTAX\_\-NONE}
 \}
\begin{DoxyCompactList}\small\item\em Constants for the various syntaxes which the library knows about. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{unity_8h_a76f1553b4a9a2b687140deb3e99fc26a}{unity\_\-check\_\-expression} (const \hyperlink{struct_unit_expression}{UnitExpression} $\ast$ue, const \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} syntax, const int flags)
\begin{DoxyCompactList}\small\item\em Indicates whether the units in the expression are being used in a way which satisfies the indicated constraints. \end{DoxyCompactList}\item 
int \hyperlink{unity_8h_ad7068b8cc977b9b79c1ecaa1507ab797}{unity\_\-check\_\-unit} (const \hyperlink{structunit__struct}{Unit} $\ast$u, const \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} syntax, const int flags)
\begin{DoxyCompactList}\small\item\em Indicates whether the unit is being used in a way which satisfies the indicated constraints in the gived syntax. \end{DoxyCompactList}\item 
int \hyperlink{unity_8h_a0f587d7943d1cd4e3034d407b781f5cd}{unity\_\-equal\_\-expression\_\-p} (const \hyperlink{struct_unit_expression}{UnitExpression} $\ast$, const \hyperlink{struct_unit_expression}{UnitExpression} $\ast$)
\begin{DoxyCompactList}\small\item\em Tests whether two unit expressions are equal. \end{DoxyCompactList}\item 
int \hyperlink{unity_8h_a6d9111615dba1654e92737a75eb8b9d4}{unity\_\-equal\_\-unit\_\-p} (const \hyperlink{structunit__struct}{Unit} $\ast$, const \hyperlink{structunit__struct}{Unit} $\ast$)
\begin{DoxyCompactList}\small\item\em Test whether two units are equal. \end{DoxyCompactList}\item 
const char $\ast$$\ast$ \hyperlink{unity_8h_a302711451c8a2f6d597218374b1dc752}{unity\_\-formatter\_\-names} (void)
\begin{DoxyCompactList}\small\item\em Return the available formatter names. \end{DoxyCompactList}\item 
\hypertarget{unity_8h_ad0bc8446cc3f84ffca77ea288a7ef746}{
void \hyperlink{unity_8h_ad0bc8446cc3f84ffca77ea288a7ef746}{unity\_\-free\_\-expression} (const \hyperlink{struct_unit_expression}{UnitExpression} $\ast$u)}
\label{unity_8h_ad0bc8446cc3f84ffca77ea288a7ef746}

\begin{DoxyCompactList}\small\item\em Frees a previously obtained unit-\/expression. \end{DoxyCompactList}\item 
const \hyperlink{structfunction__definition}{FunctionDef} $\ast$ \hyperlink{unity_8h_a28c412699a50115c0a170f09a0d9689a}{unity\_\-get\_\-functiondef\_\-from\_\-string} (const char $\ast$abbrev, \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} syntax)
\begin{DoxyCompactList}\small\item\em Retrieves a function definition object. \end{DoxyCompactList}\item 
const \hyperlink{structfunction__definition}{FunctionDef} $\ast$ \hyperlink{unity_8h_ac932c0b51c7f26d0730505550b3cb352}{unity\_\-get\_\-functiondef\_\-from\_\-unit} (const \hyperlink{structunit__struct}{Unit} $\ast$)
\begin{DoxyCompactList}\small\item\em Retrieves the definition of a known function-\/application unit. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_a98bf5bf59684a057477a99f8d60931a1}{unity\_\-get\_\-syntax\_\-name} (\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} syntax)
\begin{DoxyCompactList}\small\item\em Looks up the name of the syntax with the given index. \end{DoxyCompactList}\item 
const \hyperlink{structunit__struct}{Unit} $\ast$ \hyperlink{unity_8h_ab12e3bbbb51b4ecd1b9d9877813ebcf6}{unity\_\-get\_\-unit\_\-by\_\-index} (const \hyperlink{struct_unit_expression}{UnitExpression} $\ast$, int i)
\begin{DoxyCompactList}\small\item\em Returns the i'th unit in the given expression. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_a49ff56e4584cdf19f58eca4fcbc96cab}{unity\_\-get\_\-unit\_\-description} (const \hyperlink{struct_unit_def}{UnitDef} $\ast$)
\begin{DoxyCompactList}\small\item\em Returns a description of the unit. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_abdd775e7e9ae12f94b6513c7aab59130}{unity\_\-get\_\-unit\_\-dimension} (const \hyperlink{struct_unit_def}{UnitDef} $\ast$)
\begin{DoxyCompactList}\small\item\em Returns the dimensions of the unit. \end{DoxyCompactList}\item 
\hypertarget{unity_8h_a67663cb0665ac767df6598ba60bb4dbc}{
const char $\ast$ \hyperlink{unity_8h_a67663cb0665ac767df6598ba60bb4dbc}{unity\_\-get\_\-unit\_\-latex\_\-form} (const \hyperlink{struct_unit_def}{UnitDef} $\ast$)}
\label{unity_8h_a67663cb0665ac767df6598ba60bb4dbc}

\begin{DoxyCompactList}\small\item\em A LaTeX version of the unit symbol, if there is one defined. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_ace601881a45159d4e0cd3b359182c28c}{unity\_\-get\_\-unit\_\-name} (const \hyperlink{struct_unit_def}{UnitDef} $\ast$)
\begin{DoxyCompactList}\small\item\em Returns the name of the unit. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_afb2f7581201ffe8217cd35bd03c71d4a}{unity\_\-get\_\-unit\_\-type} (const \hyperlink{struct_unit_def}{UnitDef} $\ast$)
\begin{DoxyCompactList}\small\item\em Returns the type of the unit, as a URI naming the 'kind' of thing this measures. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_ab3dc026fd51a88024286c01740bbc516}{unity\_\-get\_\-unit\_\-uri} (const \hyperlink{struct_unit_def}{UnitDef} $\ast$)
\begin{DoxyCompactList}\small\item\em Returns the name of this unit, as a URI. \end{DoxyCompactList}\item 
const \hyperlink{struct_unit_def}{UnitDef} $\ast$ \hyperlink{unity_8h_a2e2840523fcc4091feb51fb2ed39b685}{unity\_\-get\_\-unitdef\_\-from\_\-string} (const char $\ast$abbrev, \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} syntax)
\begin{DoxyCompactList}\small\item\em Retrieves a unit definition. \end{DoxyCompactList}\item 
const \hyperlink{struct_unit_def}{UnitDef} $\ast$ \hyperlink{unity_8h_a5f76debd6a15d7ce533e5e29609c6f7b}{unity\_\-get\_\-unitdef\_\-from\_\-unit} (const \hyperlink{structunit__struct}{Unit} $\ast$)
\begin{DoxyCompactList}\small\item\em Retrieves the definition of a known unit. \end{DoxyCompactList}\item 
\hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} \hyperlink{unity_8h_a54f8531a2b2b7d94e83f0534cb425e83}{unity\_\-identify\_\-parser} (const char $\ast$parser\_\-name)
\begin{DoxyCompactList}\small\item\em Obtain the parser ID from a parser name. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_aaa8fb7f144bda13949d475caab78a9e3}{unity\_\-parse\_\-error} (void)
\begin{DoxyCompactList}\small\item\em Retrieve the most recent lexing or parsing error. \end{DoxyCompactList}\item 
const \hyperlink{struct_unit_expression}{UnitExpression} $\ast$ \hyperlink{unity_8h_ad69075d38de1f46e442b97605bd468d7}{unity\_\-parse\_\-string} (const char $\ast$unit\_\-string, const \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} syntax)
\begin{DoxyCompactList}\small\item\em Parse a string. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_ac8daf277946414cbc473116b5fd50f24}{unity\_\-parser\_\-name} (const \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} parser\_\-id)
\begin{DoxyCompactList}\small\item\em Finds a parser name from an ID. \end{DoxyCompactList}\item 
const char $\ast$$\ast$ \hyperlink{unity_8h_a213d5b2b69f8932142419c76e5dbc370}{unity\_\-parser\_\-names} (void)
\begin{DoxyCompactList}\small\item\em Return the available parser names. \end{DoxyCompactList}\item 
int \hyperlink{unity_8h_aed0d983bb105f68b0b032187a52dd6a9}{unity\_\-version\_\-number} ()
\begin{DoxyCompactList}\small\item\em Return a number which indicates the version and release numbers of the library. \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{unity_8h_a50d1ad56e8e3302e476fbe20e00b9b0d}{unity\_\-version\_\-string} ()
\begin{DoxyCompactList}\small\item\em Return a version string for the library. \end{DoxyCompactList}\item 
char $\ast$ \hyperlink{unity_8h_a65393419adce33a293a12a77d8ca5986}{unity\_\-write\_\-formatted} (char $\ast$buf, int buflen, const \hyperlink{struct_unit_expression}{UnitExpression} $\ast$, \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax})
\begin{DoxyCompactList}\small\item\em Write a unit-\/expression to the given buffer. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The Library to support parsing unit strings. 

\subsection{Define Documentation}
\hypertarget{unity_8h_a1320721039eab15bbe218466a179bd27}{
\index{unity.h@{unity.h}!UNITY\_\-CHECK\_\-ALL@{UNITY\_\-CHECK\_\-ALL}}
\index{UNITY\_\-CHECK\_\-ALL@{UNITY\_\-CHECK\_\-ALL}!unity.h@{unity.h}}
\subsubsection[{UNITY\_\-CHECK\_\-ALL}]{\setlength{\rightskip}{0pt plus 5cm}\#define UNITY\_\-CHECK\_\-ALL~UNITY\_\-CHECK\_\-RECOGNISED $|$ UNITY\_\-CHECK\_\-RECOMMENDED $|$ UNITY\_\-CHECK\_\-CONSTRAINTS}}
\label{unity_8h_a1320721039eab15bbe218466a179bd27}


Flag: perform all checks. 

Do not rely on the numerical value of this or its related constants, which may change between library versions without notice. See \hyperlink{unity_8h_ad7068b8cc977b9b79c1ecaa1507ab797}{unity\_\-check\_\-unit} \hypertarget{unity_8h_aaac121f3891035ae9b77b51fbab2fe7c}{
\index{unity.h@{unity.h}!UNITY\_\-CHECK\_\-CONSTRAINTS@{UNITY\_\-CHECK\_\-CONSTRAINTS}}
\index{UNITY\_\-CHECK\_\-CONSTRAINTS@{UNITY\_\-CHECK\_\-CONSTRAINTS}!unity.h@{unity.h}}
\subsubsection[{UNITY\_\-CHECK\_\-CONSTRAINTS}]{\setlength{\rightskip}{0pt plus 5cm}\#define UNITY\_\-CHECK\_\-CONSTRAINTS~4}}
\label{unity_8h_aaac121f3891035ae9b77b51fbab2fe7c}


Flag: check whether the unit is used in a way which satisfies constraints. 

See \hyperlink{unity_8h_ad7068b8cc977b9b79c1ecaa1507ab797}{unity\_\-check\_\-unit} \hypertarget{unity_8h_abe3e8af418a23a13ece5068f3a2f85d3}{
\index{unity.h@{unity.h}!UNITY\_\-CHECK\_\-RECOGNISED@{UNITY\_\-CHECK\_\-RECOGNISED}}
\index{UNITY\_\-CHECK\_\-RECOGNISED@{UNITY\_\-CHECK\_\-RECOGNISED}!unity.h@{unity.h}}
\subsubsection[{UNITY\_\-CHECK\_\-RECOGNISED}]{\setlength{\rightskip}{0pt plus 5cm}\#define UNITY\_\-CHECK\_\-RECOGNISED~1}}
\label{unity_8h_abe3e8af418a23a13ece5068f3a2f85d3}


Flag: check whether the unit is recognised. 

See \hyperlink{unity_8h_ad7068b8cc977b9b79c1ecaa1507ab797}{unity\_\-check\_\-unit} \hypertarget{unity_8h_a268b93e7e08712a4c312f488a5553748}{
\index{unity.h@{unity.h}!UNITY\_\-CHECK\_\-RECOMMENDED@{UNITY\_\-CHECK\_\-RECOMMENDED}}
\index{UNITY\_\-CHECK\_\-RECOMMENDED@{UNITY\_\-CHECK\_\-RECOMMENDED}!unity.h@{unity.h}}
\subsubsection[{UNITY\_\-CHECK\_\-RECOMMENDED}]{\setlength{\rightskip}{0pt plus 5cm}\#define UNITY\_\-CHECK\_\-RECOMMENDED~2}}
\label{unity_8h_a268b93e7e08712a4c312f488a5553748}


Flag: check whether the unit is recommended. 

See \hyperlink{unity_8h_ad7068b8cc977b9b79c1ecaa1507ab797}{unity\_\-check\_\-unit} 

\subsection{Enumeration Type Documentation}
\hypertarget{unity_8h_a698ff4e23791882278b041c9c0c8d7d3}{
\index{unity.h@{unity.h}!UnitTypes@{UnitTypes}}
\index{UnitTypes@{UnitTypes}!unity.h@{unity.h}}
\subsubsection[{UnitTypes}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf UnitTypes}}}
\label{unity_8h_a698ff4e23791882278b041c9c0c8d7d3}


An enumeration indicating the two types of unit possible in \hyperlink{structunit__struct}{unit\_\-struct}. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{simple\_\-unit\_\-type@{simple\_\-unit\_\-type}!unity.h@{unity.h}}\index{unity.h@{unity.h}!simple\_\-unit\_\-type@{simple\_\-unit\_\-type}}\item[{\em 
\hypertarget{unity_8h_a698ff4e23791882278b041c9c0c8d7d3a008905ef7596382c552525e4879e1697}{
simple\_\-unit\_\-type}
\label{unity_8h_a698ff4e23791882278b041c9c0c8d7d3a008905ef7596382c552525e4879e1697}
}]Simple unit type (eg ‘MHz’) \index{function\_\-application\_\-type@{function\_\-application\_\-type}!unity.h@{unity.h}}\index{unity.h@{unity.h}!function\_\-application\_\-type@{function\_\-application\_\-type}}\item[{\em 
\hypertarget{unity_8h_a698ff4e23791882278b041c9c0c8d7d3a7c1b25467f932a7cd8d5ae1d0d7b2601}{
function\_\-application\_\-type}
\label{unity_8h_a698ff4e23791882278b041c9c0c8d7d3a7c1b25467f932a7cd8d5ae1d0d7b2601}
}]Function-\/of unit type (eg {\ttfamily log(MHz)}) \end{description}
\end{Desc}

\hypertarget{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{
\index{unity.h@{unity.h}!UnitySyntax@{UnitySyntax}}
\index{UnitySyntax@{UnitySyntax}!unity.h@{unity.h}}
\subsubsection[{UnitySyntax}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf UnitySyntax}}}
\label{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}


Constants for the various syntaxes which the library knows about. 

\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{UNITY\_\-SYNTAX\_\-FITS@{UNITY\_\-SYNTAX\_\-FITS}!unity.h@{unity.h}}\index{unity.h@{unity.h}!UNITY\_\-SYNTAX\_\-FITS@{UNITY\_\-SYNTAX\_\-FITS}}\item[{\em 
\hypertarget{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea7f66619b144f5c9a81a6075ffc06044a}{
UNITY\_\-SYNTAX\_\-FITS}
\label{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea7f66619b144f5c9a81a6075ffc06044a}
}]Indicates the 'FITS' syntax. Parses unit strings according to the prescriptions in the FITS specification, v3.0, section 4.3 (W.D. Pence et al., A\&A 524, A42, 2010. \href{http://dx.doi.org/10.1051/0004-6361/201015362}{\tt doi:10.1051/0004-\/6361/201015362}). \begin{DoxySeeAlso}{See also}
\hyperlink{unity_8h_a54f8531a2b2b7d94e83f0534cb425e83}{unity\_\-identify\_\-parser} 
\end{DoxySeeAlso}
\index{UNITY\_\-SYNTAX\_\-OGIP@{UNITY\_\-SYNTAX\_\-OGIP}!unity.h@{unity.h}}\index{unity.h@{unity.h}!UNITY\_\-SYNTAX\_\-OGIP@{UNITY\_\-SYNTAX\_\-OGIP}}\item[{\em 
\hypertarget{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ead9ff0a0ca02c6e1bb6fbdb53d4e8ec0f}{
UNITY\_\-SYNTAX\_\-OGIP}
\label{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ead9ff0a0ca02c6e1bb6fbdb53d4e8ec0f}
}]Indicates the 'OGIP' syntax. The format defined in OGIP memo OGIP/93-\/001, 1993 (\href{ftp://legacy.gsfc.nasa.gov/fits_info/fits_formats/docs/general/ogip_93_001/ogip_93_001.ps}{\tt postscript via FTP}) \begin{DoxySeeAlso}{See also}
\hyperlink{unity_8h_a54f8531a2b2b7d94e83f0534cb425e83}{unity\_\-identify\_\-parser} 
\end{DoxySeeAlso}
\index{UNITY\_\-SYNTAX\_\-CDS@{UNITY\_\-SYNTAX\_\-CDS}!unity.h@{unity.h}}\index{unity.h@{unity.h}!UNITY\_\-SYNTAX\_\-CDS@{UNITY\_\-SYNTAX\_\-CDS}}\item[{\em 
\hypertarget{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea4664ed1aeb383806001cc91809776973}{
UNITY\_\-SYNTAX\_\-CDS}
\label{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea4664ed1aeb383806001cc91809776973}
}]Indicates the 'CDS' syntax. A syntax based on the CDS document {\itshape Standards for Astronomical Catalogues, Version 2.0\/}, 2000, specifically section 3.2. See \href{http://cdsweb.u-strasbg.fr/doc/catstd-3.2.htx}{\tt {\ttfamily http://cdsweb.u-\/strasbg.fr/doc/catstd-\/3.2.htx}} \begin{DoxySeeAlso}{See also}
\hyperlink{unity_8h_a54f8531a2b2b7d94e83f0534cb425e83}{unity\_\-identify\_\-parser} 
\end{DoxySeeAlso}
\index{UNITY\_\-SYNTAX\_\-VOUNITS@{UNITY\_\-SYNTAX\_\-VOUNITS}!unity.h@{unity.h}}\index{unity.h@{unity.h}!UNITY\_\-SYNTAX\_\-VOUNITS@{UNITY\_\-SYNTAX\_\-VOUNITS}}\item[{\em 
\hypertarget{unity_8h_a1440b566d6ce90bf45ca53b6abaff14eab5cb458cada7bec0cf580f41102dad54}{
UNITY\_\-SYNTAX\_\-VOUNITS}
\label{unity_8h_a1440b566d6ce90bf45ca53b6abaff14eab5cb458cada7bec0cf580f41102dad54}
}]Indicates the 'VOUNITS' syntax. This is intended to be as nearly as possible in the intersection of the various other grammars. It is a strict subset of the FITS and CDS grammars (in the sense that any VOUnit unit string is a valid FITS and CDS string, too), and it is almost a subset of the OGIP grammar, except that it uses the dot for multiplication rather than star. See \href{http://ivoa.net/Documents/VOUnits/}{\tt IVOA VOUnits Proposed Recommendation}. \begin{DoxySeeAlso}{See also}
\hyperlink{unity_8h_a54f8531a2b2b7d94e83f0534cb425e83}{unity\_\-identify\_\-parser} 
\end{DoxySeeAlso}
\index{UNITY\_\-SYNTAX\_\-LATEX@{UNITY\_\-SYNTAX\_\-LATEX}!unity.h@{unity.h}}\index{unity.h@{unity.h}!UNITY\_\-SYNTAX\_\-LATEX@{UNITY\_\-SYNTAX\_\-LATEX}}\item[{\em 
\hypertarget{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea23a33cbecbb10170622d6c0ddc319f2f}{
UNITY\_\-SYNTAX\_\-LATEX}
\label{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea23a33cbecbb10170622d6c0ddc319f2f}
}]Indicates the 'LaTeX' syntax. This produces output which is intended to be used with the LaTeX 'siunitx' package. This is for writing only. \index{UNITY\_\-SYNTAX\_\-DEBUG@{UNITY\_\-SYNTAX\_\-DEBUG}!unity.h@{unity.h}}\index{unity.h@{unity.h}!UNITY\_\-SYNTAX\_\-DEBUG@{UNITY\_\-SYNTAX\_\-DEBUG}}\item[{\em 
\hypertarget{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea32f7de5d19e049c59f9341e1a8b4fc9a}{
UNITY\_\-SYNTAX\_\-DEBUG}
\label{unity_8h_a1440b566d6ce90bf45ca53b6abaff14ea32f7de5d19e049c59f9341e1a8b4fc9a}
}]The formatter (not parser) for debugging output. This is intended to display the results of a parse unambiguously. The format of the output is not specified, and may change without notice. \index{UNITY\_\-SYNTAX\_\-NONE@{UNITY\_\-SYNTAX\_\-NONE}!unity.h@{unity.h}}\index{unity.h@{unity.h}!UNITY\_\-SYNTAX\_\-NONE@{UNITY\_\-SYNTAX\_\-NONE}}\item[{\em 
\hypertarget{unity_8h_a1440b566d6ce90bf45ca53b6abaff14eadd461cc813145a18f14b9b5e9a57720f}{
UNITY\_\-SYNTAX\_\-NONE}
\label{unity_8h_a1440b566d6ce90bf45ca53b6abaff14eadd461cc813145a18f14b9b5e9a57720f}
}]A non-\/syntax. This is an error return value. \end{description}
\end{Desc}



\subsection{Function Documentation}
\hypertarget{unity_8h_a76f1553b4a9a2b687140deb3e99fc26a}{
\index{unity.h@{unity.h}!unity\_\-check\_\-expression@{unity\_\-check\_\-expression}}
\index{unity\_\-check\_\-expression@{unity\_\-check\_\-expression}!unity.h@{unity.h}}
\subsubsection[{unity\_\-check\_\-expression}]{\setlength{\rightskip}{0pt plus 5cm}int unity\_\-check\_\-expression (
\begin{DoxyParamCaption}
\item[{const {\bf UnitExpression} $\ast$}]{ue, }
\item[{const {\bf UnitySyntax}}]{syntax, }
\item[{const int}]{flags}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a76f1553b4a9a2b687140deb3e99fc26a}


Indicates whether the units in the expression are being used in a way which satisfies the indicated constraints. 

This checks each unit using \hyperlink{unity_8h_ad7068b8cc977b9b79c1ecaa1507ab797}{unity\_\-check\_\-unit}.


\begin{DoxyParams}{Parameters}
{\em ue} & the \hyperlink{struct_unit_expression}{UnitExpression} to be checked \\
\hline
{\em syntax} & the syntax whose rules are to be checked \\
\hline
{\em flags} & the checks to be performed \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true (non-\/zero) if the checks pass 
\end{DoxyReturn}
\hypertarget{unity_8h_ad7068b8cc977b9b79c1ecaa1507ab797}{
\index{unity.h@{unity.h}!unity\_\-check\_\-unit@{unity\_\-check\_\-unit}}
\index{unity\_\-check\_\-unit@{unity\_\-check\_\-unit}!unity.h@{unity.h}}
\subsubsection[{unity\_\-check\_\-unit}]{\setlength{\rightskip}{0pt plus 5cm}int unity\_\-check\_\-unit (
\begin{DoxyParamCaption}
\item[{const {\bf Unit} $\ast$}]{u, }
\item[{const {\bf UnitySyntax}}]{syntax, }
\item[{const int}]{flags}
\end{DoxyParamCaption}
)}}
\label{unity_8h_ad7068b8cc977b9b79c1ecaa1507ab797}


Indicates whether the unit is being used in a way which satisfies the indicated constraints in the gived syntax. 

Units can be 
\begin{DoxyEnumerate}
\item ‘known’, which means the (prose) definition of the syntax recognises this unit and has something to say about it -\/-\/ all the syntaxes ‘know’ the metre; 
\item ‘deprecated’, which means that the definition acknowledges the existence of the unit but advises against it -\/-\/ for example the ‘erg’ is either unknown or deprecated in this sense (below, we take ‘recommended’ to be a synonym for ‘not deprecated’); or 
\item ‘unknown’, which means that the definition knows nothing about this unit -\/-\/ the ‘furlong’ tends not to be well-\/used in the scientific literature. 
\end{DoxyEnumerate}

The checks are indicated by the bitwise OR of the following flags:

{\ttfamily UNITY\_\-CHECK\_\-RECOGNISED}: the unit is a ‘known’ unit, in the sense that it is listed in the specification of the corresponding syntax.

{\ttfamily UNITY\_\-CHECK\_\-RECOMMENDED}: the unit is a ‘known’ unit, and is additionally not deprecated.

{\ttfamily UNITY\_\-CHECK\_\-CONSTRAINTS}: the unit is being used in conformance with any other constraints placed on it. Most typically, it is either allowed to have such a prefix, or it has no SI prefix. Possibly surprisingly, an ‘unknown’ unit has no (known) constraints, so it satisfies all of them.

The constant {\ttfamily UNITY\_\-CHECK\_\-ALL} performs all checks.

The VOUnits syntax includes the notion of a ‘quoted’ unit (see \hyperlink{structunit__struct}{unit\_\-struct}). Such a unit is always ‘unrecognised’.


\begin{DoxyParams}{Parameters}
{\em u} & the Unit to be checked \\
\hline
{\em syntax} & the syntax whose rules are to be checked \\
\hline
{\em flags} & the checks to be performed \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true (non-\/zero) if the checks pass 
\end{DoxyReturn}
\hypertarget{unity_8h_a0f587d7943d1cd4e3034d407b781f5cd}{
\index{unity.h@{unity.h}!unity\_\-equal\_\-expression\_\-p@{unity\_\-equal\_\-expression\_\-p}}
\index{unity\_\-equal\_\-expression\_\-p@{unity\_\-equal\_\-expression\_\-p}!unity.h@{unity.h}}
\subsubsection[{unity\_\-equal\_\-expression\_\-p}]{\setlength{\rightskip}{0pt plus 5cm}int unity\_\-equal\_\-expression\_\-p (
\begin{DoxyParamCaption}
\item[{const {\bf UnitExpression} $\ast$}]{ue1, }
\item[{const {\bf UnitExpression} $\ast$}]{ue2}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a0f587d7943d1cd4e3034d407b781f5cd}


Tests whether two unit expressions are equal. 

Returns false if either argument is NULL. \begin{DoxyReturn}{Returns}
true (non-\/zero) if the two expressions are equal 
\end{DoxyReturn}
\hypertarget{unity_8h_a6d9111615dba1654e92737a75eb8b9d4}{
\index{unity.h@{unity.h}!unity\_\-equal\_\-unit\_\-p@{unity\_\-equal\_\-unit\_\-p}}
\index{unity\_\-equal\_\-unit\_\-p@{unity\_\-equal\_\-unit\_\-p}!unity.h@{unity.h}}
\subsubsection[{unity\_\-equal\_\-unit\_\-p}]{\setlength{\rightskip}{0pt plus 5cm}int unity\_\-equal\_\-unit\_\-p (
\begin{DoxyParamCaption}
\item[{const {\bf Unit} $\ast$}]{u1, }
\item[{const {\bf Unit} $\ast$}]{u2}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a6d9111615dba1654e92737a75eb8b9d4}


Test whether two units are equal. 

Returns false if either argument is NULL. \begin{DoxyReturn}{Returns}
true (non-\/zero) if the two units are equal 
\end{DoxyReturn}
\hypertarget{unity_8h_a302711451c8a2f6d597218374b1dc752}{
\index{unity.h@{unity.h}!unity\_\-formatter\_\-names@{unity\_\-formatter\_\-names}}
\index{unity\_\-formatter\_\-names@{unity\_\-formatter\_\-names}!unity.h@{unity.h}}
\subsubsection[{unity\_\-formatter\_\-names}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$$\ast$ unity\_\-formatter\_\-names (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a302711451c8a2f6d597218374b1dc752}


Return the available formatter names. 

If this is impossible for some reason (which can really only be memory exhaustion, which should never happen), print an error message and return NULL. The returned list is statically allocated, and should not be freed by the caller. \begin{DoxyReturn}{Returns}
a NULL-\/terminated list of pointers to formatter names 
\end{DoxyReturn}
\hypertarget{unity_8h_a28c412699a50115c0a170f09a0d9689a}{
\index{unity.h@{unity.h}!unity\_\-get\_\-functiondef\_\-from\_\-string@{unity\_\-get\_\-functiondef\_\-from\_\-string}}
\index{unity\_\-get\_\-functiondef\_\-from\_\-string@{unity\_\-get\_\-functiondef\_\-from\_\-string}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-functiondef\_\-from\_\-string}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf FunctionDef}$\ast$ unity\_\-get\_\-functiondef\_\-from\_\-string (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{abbrev, }
\item[{const {\bf UnitySyntax}}]{syntax}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a28c412699a50115c0a170f09a0d9689a}


Retrieves a function definition object. 

Returns NULL if the abbreviation is not recognised in the indicated syntax (or if the syntax is invalid). 
\begin{DoxyParams}{Parameters}
{\em abbrev} & a function abbreviation, for example \char`\"{}log\char`\"{} for Common Logarithm \\
\hline
{\em syntax} & one of the UNITY\_\-SYNTAX\_\-$\ast$ constants \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to a function definitions string, or NULL if none such exists in this syntax 
\end{DoxyReturn}
\hypertarget{unity_8h_ac932c0b51c7f26d0730505550b3cb352}{
\index{unity.h@{unity.h}!unity\_\-get\_\-functiondef\_\-from\_\-unit@{unity\_\-get\_\-functiondef\_\-from\_\-unit}}
\index{unity\_\-get\_\-functiondef\_\-from\_\-unit@{unity\_\-get\_\-functiondef\_\-from\_\-unit}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-functiondef\_\-from\_\-unit}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf FunctionDef}$\ast$ unity\_\-get\_\-functiondef\_\-from\_\-unit (
\begin{DoxyParamCaption}
\item[{const {\bf Unit} $\ast$}]{u}
\end{DoxyParamCaption}
)}}
\label{unity_8h_ac932c0b51c7f26d0730505550b3cb352}


Retrieves the definition of a known function-\/application unit. 

Returns null if the unit is not a function-\/application unit \begin{DoxyReturn}{Returns}
the functiondef if this is a known unit, or NULL if not 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{unity_8h_a5f76debd6a15d7ce533e5e29609c6f7b}{unity\_\-get\_\-unitdef\_\-from\_\-unit} 
\end{DoxySeeAlso}
\hypertarget{unity_8h_a98bf5bf59684a057477a99f8d60931a1}{
\index{unity.h@{unity.h}!unity\_\-get\_\-syntax\_\-name@{unity\_\-get\_\-syntax\_\-name}}
\index{unity\_\-get\_\-syntax\_\-name@{unity\_\-get\_\-syntax\_\-name}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-syntax\_\-name}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-get\_\-syntax\_\-name (
\begin{DoxyParamCaption}
\item[{const {\bf UnitySyntax}}]{syntax}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a98bf5bf59684a057477a99f8d60931a1}


Looks up the name of the syntax with the given index. 

Thus, this is the inverse of \hyperlink{unity_8h_a54f8531a2b2b7d94e83f0534cb425e83}{unity\_\-identify\_\-parser}. 
\begin{DoxyParams}{Parameters}
{\em syntax} & one of the constants UNITY\_\-SYNTAX\_\-FITS, ... \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a string name for the syntax, or NULL if this is an unrecognised syntax 
\end{DoxyReturn}
\hypertarget{unity_8h_ab12e3bbbb51b4ecd1b9d9877813ebcf6}{
\index{unity.h@{unity.h}!unity\_\-get\_\-unit\_\-by\_\-index@{unity\_\-get\_\-unit\_\-by\_\-index}}
\index{unity\_\-get\_\-unit\_\-by\_\-index@{unity\_\-get\_\-unit\_\-by\_\-index}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-unit\_\-by\_\-index}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf Unit}$\ast$ unity\_\-get\_\-unit\_\-by\_\-index (
\begin{DoxyParamCaption}
\item[{const {\bf UnitExpression} $\ast$}]{ue, }
\item[{const int}]{idx}
\end{DoxyParamCaption}
)}}
\label{unity_8h_ab12e3bbbb51b4ecd1b9d9877813ebcf6}


Returns the i'th unit in the given expression. 


\begin{DoxyParams}{Parameters}
{\em ue} & a non-\/NULL unit expression \\
\hline
{\em idx} & the index of the unit to be retrieved from the expression (zero-\/offset) \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the unit at the given position, or NULL if i is out of range 
\end{DoxyReturn}
\hypertarget{unity_8h_a49ff56e4584cdf19f58eca4fcbc96cab}{
\index{unity.h@{unity.h}!unity\_\-get\_\-unit\_\-description@{unity\_\-get\_\-unit\_\-description}}
\index{unity\_\-get\_\-unit\_\-description@{unity\_\-get\_\-unit\_\-description}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-unit\_\-description}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-get\_\-unit\_\-description (
\begin{DoxyParamCaption}
\item[{const {\bf UnitDef} $\ast$}]{d}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a49ff56e4584cdf19f58eca4fcbc96cab}


Returns a description of the unit. 

This may be NULL if there is nothing more to be said beyond the unit name. \hypertarget{unity_8h_abdd775e7e9ae12f94b6513c7aab59130}{
\index{unity.h@{unity.h}!unity\_\-get\_\-unit\_\-dimension@{unity\_\-get\_\-unit\_\-dimension}}
\index{unity\_\-get\_\-unit\_\-dimension@{unity\_\-get\_\-unit\_\-dimension}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-unit\_\-dimension}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-get\_\-unit\_\-dimension (
\begin{DoxyParamCaption}
\item[{const {\bf UnitDef} $\ast$}]{d}
\end{DoxyParamCaption}
)}}
\label{unity_8h_abdd775e7e9ae12f94b6513c7aab59130}


Returns the dimensions of the unit. 

A dimensions string consists of a sequence of capital letter dimensions, and powers, for example \char`\"{}M L2T-\/2\char`\"{} for the dimensions of \char`\"{}kg m2 s-\/2\char`\"{}.

The known dimensions are \begin{TabularC}{3}
\hline
Symbol&Name&SI base unit \\\cline{1-3}
U&Dimensionless&Unity \\\cline{1-3}
L&Length&Metre \\\cline{1-3}
M&Mass&Kilogramme \\\cline{1-3}
T&Time&Second \\\cline{1-3}
I&Electric current&Amp√®re \\\cline{1-3}
Œò&Thermodynamic temperature&Kelvin \\\cline{1-3}
N&Amount of substance&Mole \\\cline{1-3}
J&Luminous intensity&Candela \\\cline{1-3}
\end{TabularC}
\hypertarget{unity_8h_ace601881a45159d4e0cd3b359182c28c}{
\index{unity.h@{unity.h}!unity\_\-get\_\-unit\_\-name@{unity\_\-get\_\-unit\_\-name}}
\index{unity\_\-get\_\-unit\_\-name@{unity\_\-get\_\-unit\_\-name}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-unit\_\-name}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-get\_\-unit\_\-name (
\begin{DoxyParamCaption}
\item[{const {\bf UnitDef} $\ast$}]{d}
\end{DoxyParamCaption}
)}}
\label{unity_8h_ace601881a45159d4e0cd3b359182c28c}


Returns the name of the unit. 

This is a human-\/readable name such as 'Metre' or 'Julian year', not the abbreviation 'm' \hypertarget{unity_8h_afb2f7581201ffe8217cd35bd03c71d4a}{
\index{unity.h@{unity.h}!unity\_\-get\_\-unit\_\-type@{unity\_\-get\_\-unit\_\-type}}
\index{unity\_\-get\_\-unit\_\-type@{unity\_\-get\_\-unit\_\-type}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-unit\_\-type}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-get\_\-unit\_\-type (
\begin{DoxyParamCaption}
\item[{const {\bf UnitDef} $\ast$}]{d}
\end{DoxyParamCaption}
)}}
\label{unity_8h_afb2f7581201ffe8217cd35bd03c71d4a}


Returns the type of the unit, as a URI naming the 'kind' of thing this measures. 

This indicates 'Length' or 'Capacitance'. \hypertarget{unity_8h_ab3dc026fd51a88024286c01740bbc516}{
\index{unity.h@{unity.h}!unity\_\-get\_\-unit\_\-uri@{unity\_\-get\_\-unit\_\-uri}}
\index{unity\_\-get\_\-unit\_\-uri@{unity\_\-get\_\-unit\_\-uri}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-unit\_\-uri}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-get\_\-unit\_\-uri (
\begin{DoxyParamCaption}
\item[{const {\bf UnitDef} $\ast$}]{d}
\end{DoxyParamCaption}
)}}
\label{unity_8h_ab3dc026fd51a88024286c01740bbc516}


Returns the name of this unit, as a URI. 

These unit definitions follow the \href{http://qudt.org}{\tt QUDT} framework, though they are not restricted to the units described there.

This framework also supports the definition of unit kinds and dimensions. \begin{DoxyReturn}{Returns}
a URI as a string 
\end{DoxyReturn}
\hypertarget{unity_8h_a2e2840523fcc4091feb51fb2ed39b685}{
\index{unity.h@{unity.h}!unity\_\-get\_\-unitdef\_\-from\_\-string@{unity\_\-get\_\-unitdef\_\-from\_\-string}}
\index{unity\_\-get\_\-unitdef\_\-from\_\-string@{unity\_\-get\_\-unitdef\_\-from\_\-string}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-unitdef\_\-from\_\-string}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf UnitDef}$\ast$ unity\_\-get\_\-unitdef\_\-from\_\-string (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{abbrev, }
\item[{{\bf UnitySyntax}}]{syntax}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a2e2840523fcc4091feb51fb2ed39b685}


Retrieves a unit definition. 

Returns NULL if the abbreviation is not recognised in the indicated syntax (or if the syntax is invalid) 
\begin{DoxyParams}{Parameters}
{\em abbrev} & a unit abbreviation, for example \char`\"{}m\char`\"{} for \char`\"{}metre\char`\"{} \\
\hline
{\em syntax} & one of the UNITY\_\-SYNTAX\_\-$\ast$ constants \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to a the unit definition which this abbreviation corresponds to 
\end{DoxyReturn}
\hypertarget{unity_8h_a5f76debd6a15d7ce533e5e29609c6f7b}{
\index{unity.h@{unity.h}!unity\_\-get\_\-unitdef\_\-from\_\-unit@{unity\_\-get\_\-unitdef\_\-from\_\-unit}}
\index{unity\_\-get\_\-unitdef\_\-from\_\-unit@{unity\_\-get\_\-unitdef\_\-from\_\-unit}!unity.h@{unity.h}}
\subsubsection[{unity\_\-get\_\-unitdef\_\-from\_\-unit}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf UnitDef}$\ast$ unity\_\-get\_\-unitdef\_\-from\_\-unit (
\begin{DoxyParamCaption}
\item[{const {\bf Unit} $\ast$}]{u}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a5f76debd6a15d7ce533e5e29609c6f7b}


Retrieves the definition of a known unit. 

Returns null if the unit is a function-\/application unit \begin{DoxyReturn}{Returns}
the unitdef if this is a known unit, or NULL if not 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{unity_8h_ac932c0b51c7f26d0730505550b3cb352}{unity\_\-get\_\-functiondef\_\-from\_\-unit} 
\end{DoxySeeAlso}
\hypertarget{unity_8h_a54f8531a2b2b7d94e83f0534cb425e83}{
\index{unity.h@{unity.h}!unity\_\-identify\_\-parser@{unity\_\-identify\_\-parser}}
\index{unity\_\-identify\_\-parser@{unity\_\-identify\_\-parser}!unity.h@{unity.h}}
\subsubsection[{unity\_\-identify\_\-parser}]{\setlength{\rightskip}{0pt plus 5cm}{\bf UnitySyntax} unity\_\-identify\_\-parser (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{parser\_\-name}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a54f8531a2b2b7d94e83f0534cb425e83}


Obtain the parser ID from a parser name. 

The recognised parser names are those returned by \hyperlink{unity_8h_a213d5b2b69f8932142419c76e5dbc370}{unity\_\-parser\_\-names}, and the returned IDs can be given as arguments to \hyperlink{unity_8h_ad69075d38de1f46e442b97605bd468d7}{unity\_\-parse\_\-string}.

An identifier for the returned parser identifier, as a \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax}. 
\begin{DoxyParams}{Parameters}
{\em parser\_\-name} & a name such as \char`\"{}fits\char`\"{} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
returns \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14eadd461cc813145a18f14b9b5e9a57720f}{UNITY\_\-SYNTAX\_\-NONE} if the name is not recognised 
\end{DoxyReturn}
\hypertarget{unity_8h_aaa8fb7f144bda13949d475caab78a9e3}{
\index{unity.h@{unity.h}!unity\_\-parse\_\-error@{unity\_\-parse\_\-error}}
\index{unity\_\-parse\_\-error@{unity\_\-parse\_\-error}!unity.h@{unity.h}}
\subsubsection[{unity\_\-parse\_\-error}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-parse\_\-error (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{unity_8h_aaa8fb7f144bda13949d475caab78a9e3}


Retrieve the most recent lexing or parsing error. 

Immediately after the parser has returned with an error (that is function \hyperlink{unity_8h_ad69075d38de1f46e442b97605bd468d7}{unity\_\-parse\_\-string} has returned NULL) this function can be called to obtain an explanation. However, a non-\/null response from this function does not imply that the most recent call to `unity\_\-parse\_\-string' failed.

The returned string should not be freed by the caller. \begin{DoxyReturn}{Returns}
a static string containing an explanation of a parse error 
\end{DoxyReturn}
\hypertarget{unity_8h_ad69075d38de1f46e442b97605bd468d7}{
\index{unity.h@{unity.h}!unity\_\-parse\_\-string@{unity\_\-parse\_\-string}}
\index{unity\_\-parse\_\-string@{unity\_\-parse\_\-string}!unity.h@{unity.h}}
\subsubsection[{unity\_\-parse\_\-string}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf UnitExpression}$\ast$ unity\_\-parse\_\-string (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{unit\_\-string, }
\item[{const {\bf UnitySyntax}}]{syntax}
\end{DoxyParamCaption}
)}}
\label{unity_8h_ad69075d38de1f46e442b97605bd468d7}


Parse a string. 

If this returns with an error, then there should be an error message available from \hyperlink{unity_8h_aaa8fb7f144bda13949d475caab78a9e3}{unity\_\-parse\_\-error}.


\begin{DoxyParams}{Parameters}
{\em unit\_\-string} & the string to be parsed \\
\hline
{\em syntax} & the syntax to be used to parse the string \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a parsed representation of the unit expression, or NULL on error 
\end{DoxyReturn}
\hypertarget{unity_8h_ac8daf277946414cbc473116b5fd50f24}{
\index{unity.h@{unity.h}!unity\_\-parser\_\-name@{unity\_\-parser\_\-name}}
\index{unity\_\-parser\_\-name@{unity\_\-parser\_\-name}!unity.h@{unity.h}}
\subsubsection[{unity\_\-parser\_\-name}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-parser\_\-name (
\begin{DoxyParamCaption}
\item[{const {\bf UnitySyntax}}]{stx}
\end{DoxyParamCaption}
)}}
\label{unity_8h_ac8daf277946414cbc473116b5fd50f24}


Finds a parser name from an ID. 


\begin{DoxyParams}{Parameters}
{\em stx} & one of the members of the \hyperlink{unity_8h_a1440b566d6ce90bf45ca53b6abaff14e}{UnitySyntax} enumeration \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a name for the parser, which will not be NULL 
\end{DoxyReturn}
\hypertarget{unity_8h_a213d5b2b69f8932142419c76e5dbc370}{
\index{unity.h@{unity.h}!unity\_\-parser\_\-names@{unity\_\-parser\_\-names}}
\index{unity\_\-parser\_\-names@{unity\_\-parser\_\-names}!unity.h@{unity.h}}
\subsubsection[{unity\_\-parser\_\-names}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$$\ast$ unity\_\-parser\_\-names (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a213d5b2b69f8932142419c76e5dbc370}


Return the available parser names. 

The returned list is statically allocated, and should not be freed by the caller. \begin{DoxyReturn}{Returns}
a NULL-\/terminated list of pointers to parser names 
\end{DoxyReturn}
\hypertarget{unity_8h_aed0d983bb105f68b0b032187a52dd6a9}{
\index{unity.h@{unity.h}!unity\_\-version\_\-number@{unity\_\-version\_\-number}}
\index{unity\_\-version\_\-number@{unity\_\-version\_\-number}!unity.h@{unity.h}}
\subsubsection[{unity\_\-version\_\-number}]{\setlength{\rightskip}{0pt plus 5cm}int unity\_\-version\_\-number (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{unity_8h_aed0d983bb105f68b0b032187a52dd6a9}


Return a number which indicates the version and release numbers of the library. 

The number is formed by major\_\-version $\ast$ 1e6 + minor\_\-version $\ast$ 1e3 + release\_\-number \begin{DoxySeeAlso}{See also}
\hyperlink{unity_8h_a50d1ad56e8e3302e476fbe20e00b9b0d}{unity\_\-version\_\-string} 
\end{DoxySeeAlso}
\hypertarget{unity_8h_a50d1ad56e8e3302e476fbe20e00b9b0d}{
\index{unity.h@{unity.h}!unity\_\-version\_\-string@{unity\_\-version\_\-string}}
\index{unity\_\-version\_\-string@{unity\_\-version\_\-string}!unity.h@{unity.h}}
\subsubsection[{unity\_\-version\_\-string}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ unity\_\-version\_\-string (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a50d1ad56e8e3302e476fbe20e00b9b0d}


Return a version string for the library. 

The form of the string is unspecified, but is intended to be printable \begin{DoxySeeAlso}{See also}
\hyperlink{unity_8h_aed0d983bb105f68b0b032187a52dd6a9}{unity\_\-version\_\-number} 
\end{DoxySeeAlso}
\hypertarget{unity_8h_a65393419adce33a293a12a77d8ca5986}{
\index{unity.h@{unity.h}!unity\_\-write\_\-formatted@{unity\_\-write\_\-formatted}}
\index{unity\_\-write\_\-formatted@{unity\_\-write\_\-formatted}!unity.h@{unity.h}}
\subsubsection[{unity\_\-write\_\-formatted}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ unity\_\-write\_\-formatted (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{buf, }
\item[{int}]{buflen, }
\item[{const {\bf UnitExpression} $\ast$}]{ue, }
\item[{{\bf UnitySyntax}}]{stx}
\end{DoxyParamCaption}
)}}
\label{unity_8h_a65393419adce33a293a12a77d8ca5986}


Write a unit-\/expression to the given buffer. 

The available formats are those returned by the function \hyperlink{unity_8h_a213d5b2b69f8932142419c76e5dbc370}{unity\_\-parser\_\-names}.


\begin{DoxyParams}{Parameters}
{\em buf} & the buffer to be written to \\
\hline
{\em buflen} & the length of the input buffer \\
\hline
{\em ue} & the unit-\/expression to be written \\
\hline
{\em stx} & one of the available formats \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
buf on success, or NULL on error 
\end{DoxyReturn}
