cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

variator__common_8c.tex (5987B)


      1\hypertarget{variator__common_8c}{\section{C\-:/\-Users/\-D\-E\-L\-L/\-Work/sdlvisualtest/visualtest/src/variator\-\_\-common.c File Reference}
      2\label{variator__common_8c}\index{C\-:/\-Users/\-D\-E\-L\-L/\-Work/sdlvisualtest/visualtest/src/variator\-\_\-common.\-c@{C\-:/\-Users/\-D\-E\-L\-L/\-Work/sdlvisualtest/visualtest/src/variator\-\_\-common.\-c}}
      3}
      4{\ttfamily \#include $<$S\-D\-L\-\_\-test.\-h$>$}\\*
      5{\ttfamily \#include \char`\"{}S\-D\-L\-\_\-visualtest\-\_\-variator\-\_\-common.\-h\char`\"{}}\\*
      6\subsection*{Functions}
      7\begin{DoxyCompactItemize}
      8\item 
      9int \hyperlink{variator__common_8c_aafcecc06c8feb24b6f6a509bfa9db681}{S\-D\-L\-Visual\-Test\-\_\-\-Next\-Value} (\hyperlink{union_s_d_l_visual_test___s_u_t_option_value}{S\-D\-L\-Visual\-Test\-\_\-\-S\-U\-T\-Option\-Value} $\ast$var, \hyperlink{struct_s_d_l_visual_test___s_u_t_option}{S\-D\-L\-Visual\-Test\-\_\-\-S\-U\-T\-Option} $\ast$opt)
     10\item 
     11int \hyperlink{variator__common_8c_ad981c2efab849e76dc878ef8da9d6017}{S\-D\-L\-Visual\-Test\-\_\-\-Make\-Str\-From\-Variation} (\hyperlink{struct_s_d_l_visual_test___variation}{S\-D\-L\-Visual\-Test\-\_\-\-Variation} $\ast$variation, \hyperlink{struct_s_d_l_visual_test___s_u_t_config}{S\-D\-L\-Visual\-Test\-\_\-\-S\-U\-T\-Config} $\ast$config, char $\ast$buffer, int size)
     12\item 
     13int \hyperlink{variator__common_8c_ac87934906c51364778dc910ebca47b6c}{S\-D\-L\-Visual\-Test\-\_\-\-Init\-Variation} (\hyperlink{struct_s_d_l_visual_test___variation}{S\-D\-L\-Visual\-Test\-\_\-\-Variation} $\ast$variation, \hyperlink{struct_s_d_l_visual_test___s_u_t_config}{S\-D\-L\-Visual\-Test\-\_\-\-S\-U\-T\-Config} $\ast$config)
     14\end{DoxyCompactItemize}
     15
     16
     17\subsection{Detailed Description}
     18Source file for some common functionality used by variators. 
     19
     20\subsection{Function Documentation}
     21\hypertarget{variator__common_8c_ac87934906c51364778dc910ebca47b6c}{\index{variator\-\_\-common.\-c@{variator\-\_\-common.\-c}!S\-D\-L\-Visual\-Test\-\_\-\-Init\-Variation@{S\-D\-L\-Visual\-Test\-\_\-\-Init\-Variation}}
     22\index{S\-D\-L\-Visual\-Test\-\_\-\-Init\-Variation@{S\-D\-L\-Visual\-Test\-\_\-\-Init\-Variation}!variator_common.c@{variator\-\_\-common.\-c}}
     23\subsubsection[{S\-D\-L\-Visual\-Test\-\_\-\-Init\-Variation}]{\setlength{\rightskip}{0pt plus 5cm}int S\-D\-L\-Visual\-Test\-\_\-\-Init\-Variation (
     24\begin{DoxyParamCaption}
     25\item[{{\bf S\-D\-L\-Visual\-Test\-\_\-\-Variation} $\ast$}]{variation, }
     26\item[{{\bf S\-D\-L\-Visual\-Test\-\_\-\-S\-U\-T\-Config} $\ast$}]{config}
     27\end{DoxyParamCaption}
     28)}}\label{variator__common_8c_ac87934906c51364778dc910ebca47b6c}
     29Initializes the variation using the following rules\-:
     30\begin{DoxyItemize}
     31\item Boolean options are initialized to S\-D\-L\-\_\-\-F\-A\-L\-S\-E.
     32\item Integer options are initialized to the minimum valid value they can hold.
     33\item Enum options are initialized to the first element in the list of values they can take.
     34\item String options are initialized to the name of the option.
     35\end{DoxyItemize}
     36
     37\begin{DoxyReturn}{Returns}
     381 on success, 0 on failure. 
     39\end{DoxyReturn}
     40\hypertarget{variator__common_8c_ad981c2efab849e76dc878ef8da9d6017}{\index{variator\-\_\-common.\-c@{variator\-\_\-common.\-c}!S\-D\-L\-Visual\-Test\-\_\-\-Make\-Str\-From\-Variation@{S\-D\-L\-Visual\-Test\-\_\-\-Make\-Str\-From\-Variation}}
     41\index{S\-D\-L\-Visual\-Test\-\_\-\-Make\-Str\-From\-Variation@{S\-D\-L\-Visual\-Test\-\_\-\-Make\-Str\-From\-Variation}!variator_common.c@{variator\-\_\-common.\-c}}
     42\subsubsection[{S\-D\-L\-Visual\-Test\-\_\-\-Make\-Str\-From\-Variation}]{\setlength{\rightskip}{0pt plus 5cm}int S\-D\-L\-Visual\-Test\-\_\-\-Make\-Str\-From\-Variation (
     43\begin{DoxyParamCaption}
     44\item[{{\bf S\-D\-L\-Visual\-Test\-\_\-\-Variation} $\ast$}]{variation, }
     45\item[{{\bf S\-D\-L\-Visual\-Test\-\_\-\-S\-U\-T\-Config} $\ast$}]{config, }
     46\item[{char $\ast$}]{buffer, }
     47\item[{int}]{size}
     48\end{DoxyParamCaption}
     49)}}\label{variator__common_8c_ad981c2efab849e76dc878ef8da9d6017}
     50Converts a variation object into a string of command line arguments.
     51
     52
     53\begin{DoxyParams}{Parameters}
     54{\em variation} & Variation object to be converted. \\
     55\hline
     56{\em config} & Config object for the S\-U\-T. \\
     57\hline
     58{\em buffer} & Pointer to the buffer the arguments string will be copied into. \\
     59\hline
     60{\em size} & Size of the buffer.\\
     61\hline
     62\end{DoxyParams}
     63\begin{DoxyReturn}{Returns}
     641 on success, 0 on failure 
     65\end{DoxyReturn}
     66\hypertarget{variator__common_8c_aafcecc06c8feb24b6f6a509bfa9db681}{\index{variator\-\_\-common.\-c@{variator\-\_\-common.\-c}!S\-D\-L\-Visual\-Test\-\_\-\-Next\-Value@{S\-D\-L\-Visual\-Test\-\_\-\-Next\-Value}}
     67\index{S\-D\-L\-Visual\-Test\-\_\-\-Next\-Value@{S\-D\-L\-Visual\-Test\-\_\-\-Next\-Value}!variator_common.c@{variator\-\_\-common.\-c}}
     68\subsubsection[{S\-D\-L\-Visual\-Test\-\_\-\-Next\-Value}]{\setlength{\rightskip}{0pt plus 5cm}int S\-D\-L\-Visual\-Test\-\_\-\-Next\-Value (
     69\begin{DoxyParamCaption}
     70\item[{{\bf S\-D\-L\-Visual\-Test\-\_\-\-S\-U\-T\-Option\-Value} $\ast$}]{var, }
     71\item[{{\bf S\-D\-L\-Visual\-Test\-\_\-\-S\-U\-T\-Option} $\ast$}]{opt}
     72\end{DoxyParamCaption}
     73)}}\label{variator__common_8c_aafcecc06c8feb24b6f6a509bfa9db681}
     74\char`\"{}\-Increments\char`\"{} the value of the option by one and returns the carry. We wrap around to the initial value on overflow which makes the carry one. For example\-: \char`\"{}incrementing\char`\"{} an S\-D\-L\-\_\-\-F\-A\-L\-S\-E option makes it S\-D\-L\-\_\-\-T\-R\-U\-E with no carry, and \char`\"{}incrementing\char`\"{} an S\-D\-L\-\_\-\-T\-R\-U\-E option makes it S\-D\-L\-\_\-\-F\-A\-L\-S\-E with carry one. For integers, a random value in the valid range for the option is used.
     75
     76
     77\begin{DoxyParams}{Parameters}
     78{\em var} & Value of the option \\
     79\hline
     80{\em opt} & Object with metadata about the option\\
     81\hline
     82\end{DoxyParams}
     83\begin{DoxyReturn}{Returns}
     841 if there is a carry for enum and bool type options, 0 otherwise. 1 is always returned for integer and string type options. -\/1 is returned on error. 
     85\end{DoxyReturn}