<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.14">
  <compounddef id="getline__win32_8h" kind="file" language="C++">
    <compoundname>getline_win32.h</compoundname>
      <sectiondef kind="define">
      <memberdef kind="define" id="getline__win32_8h_1a2d6569aa794c2f23e90691e60d2f3ad2" prot="public" static="no">
        <name>SSIZE_MAX</name>
        <initializer>LONG_MAX</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/getline_win32.h" line="8" column="10" bodyfile="/root/cis_interface/cis_interface/cis_interface/getline_win32.h" bodystart="8" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="getline__win32_8h_1a1af71306b7430b08abf21341cd14333c" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <type>int</type>
        <definition>static int getline</definition>
        <argsstring>(char **lineptr, size_t *n, FILE *stream)</argsstring>
        <name>getline</name>
        <param>
          <type>char **</type>
          <declname>lineptr</declname>
        </param>
        <param>
          <type>size_t *</type>
          <declname>n</declname>
        </param>
        <param>
          <type>FILE *</type>
          <declname>stream</declname>
        </param>
        <briefdescription>
<para>Implementation of getline in C for MSVC. Reads in a single line from a file using fgets. </para>        </briefdescription>
        <detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername direction="out">lineptr</parametername>
</parameternamelist>
<parameterdescription>
<para>char** reference to location where line should be stored. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="out">n</parametername>
</parameternamelist>
<parameterdescription>
<para>int* reference to location where the size of the allocated lineptr memory block should be stored. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername direction="in">stream</parametername>
</parameternamelist>
<parameterdescription>
<para>FILE* Stream that line should be read from. </para></parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>Number of characters read, -1 on failure. </para></simplesect>
</para>        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/root/cis_interface/cis_interface/cis_interface/getline_win32.h" line="22" column="1" bodyfile="/root/cis_interface/cis_interface/cis_interface/getline_win32.h" bodystart="22" bodyend="59"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="preprocessor">#ifndef<sp/>GETLINE_WIN32_H_</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>GETLINE_WIN32_H_</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>defined(_WIN64)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>SSIZE_MAX<sp/>_I64_MAX</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="8"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>SSIZE_MAX<sp/>LONG_MAX</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="9"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight></codeline>
<codeline lineno="11"><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">inline</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>getline(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">**<sp/>lineptr,<sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal">*<sp/>n,<sp/>FILE*<sp/>stream)<sp/>{</highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>nread<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="25"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="26"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(1)<sp/>{</highlight></codeline>
<codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*<sp/>prev<sp/>=<sp/>*lineptr<sp/>+<sp/>nread;</highlight></codeline>
<codeline lineno="28"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(fgets(prev,<sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)(*n)<sp/>-<sp/>nread,<sp/>stream)<sp/>!=<sp/>prev)</highlight></codeline>
<codeline lineno="29"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="30"><highlight class="normal"><sp/><sp/><sp/><sp/>nread<sp/>=<sp/>(int)strlen(*lineptr);</highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Break<sp/>if<sp/>new<sp/>line<sp/>reached<sp/>or<sp/>buffer<sp/>not<sp/>filled</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((nread<sp/>&lt;<sp/>(*n<sp/>-<sp/>1))<sp/>||<sp/>((*lineptr)[nread<sp/>-<sp/>1]<sp/>==<sp/></highlight><highlight class="charliteral">&apos;\n&apos;</highlight><highlight class="normal">))</highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>nread;</highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Stop<sp/>if<sp/>max<sp/>size<sp/>exceeded</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="37"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(*n<sp/>==<sp/>SSIZE_MAX)</highlight></codeline>
<codeline lineno="38"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Get<sp/>size</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>new_n;</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((*n<sp/>&gt;&gt;<sp/>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal">)<sp/>*<sp/>8<sp/>-<sp/>1))<sp/>==<sp/>1)</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>new_n<sp/>=<sp/>SSIZE_MAX;</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>new_n<sp/>=<sp/>2<sp/>*<sp/>(*n);</highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Realloc</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*<sp/>new_lineptr<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)realloc(*lineptr,<sp/>new_n);</highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(new_lineptr<sp/>==<sp/>NULL)</highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Assign</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/>*n<sp/>=<sp/>new_n;</highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/>*lineptr<sp/>=<sp/>new_lineptr;</highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>nread;</highlight></codeline>
<codeline lineno="59"><highlight class="normal">};</highlight></codeline>
<codeline lineno="60"><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*GETLINE_WIN32_H_*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="/root/cis_interface/cis_interface/cis_interface/getline_win32.h"/>
  </compounddef>
</doxygen>
