<?xml version="1.0" encoding="Shift_JIS"?>
<?xml-stylesheet type="text/xsl" href="../Fmethod_xsl/fmethod_he_c.xsl"?>

<root>
  <func>
    <title>cnc_rdprogdir3</title>


    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_rdprogdir3(unsigned short FlibHndl, short type, long *top_prog, short *num_prog, PRGDIR3 *buf);
        </prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            <p>Reads the program directory of all the programs registered in the CNC.</p>
            <p>
                Reads "Program Number", "Comment", "Date (created and modified)" and Program size" data of 
                which the specified amount of programs are registered programs in the CNC, starting from the program
                with the specified Program number.
            </p>
        </cmn>
    </doc>



    <argument>
        <common>
            <vc>
                <item>
                    <name>FlibHndl</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the library handle.
                            See "<a href="handle.htm" target="_parent">Library handle</a>" for details.
                        </p>
                    </content>
                </item>
                <item>
                    <name>type</name>
                    <type>in</type>
                       <content>
                            <table class="dd">
                                <tr>
                                    <td>0   </td><td>:  </td><td>"Program number" only</td>
                                </tr>
                                <tr>
                                    <td>1   </td><td>:  </td><td>"Program number" and "Comment"</td>
                                </tr>
                                <tr>
                                    <td>2   </td><td>:  </td><td>"Program number", "Comment", "Date" and "Program size"</td>
                                </tr>
                           </table>
                        </content>
                </item>
                <item>
                    <name>top_prog</name>
                    <type>in / out</type>
                    <content>
                        <p>
                            Pointer to the starting program number.<br/>
                            The program number of the first program actually read is stored after this function call.
                        </p>
                    </content>
                </item>
                <item>
                    <name>num_prog</name>
                    <type>in / out</type>
                    <content>
                        <p>
                            Pointer to the number of programs to be read.<br/>
                            Actual number of programs being read is stored after this function call.
                        </p>
                    </content>
                </item>
                <item>
                    <name>buf</name>
                    <type>out</type>
                    <content>
                        <div class="dd">
                        <p>
                            Pointer to the PRGDIR3 structure where program directory data are returned.<br/>
                            The PRGDIR3 structure is as follows.
                        </p>
<pre>
typedef struct prgdir3 {
        long    number;
        long    length;
        long    page;
        char    comment[52];
        struct{
                short   year;
                short   month;
                short   day;
                short   hour;
                short   minute;
                short   dummy;
        } mdate;
        struct{
                short   year;
                short   month;
                short   day;
                short   hour;
                short   minute;
                short   dummy;
        } cdate;
} PRGDIR3;
</pre>

                        <dl>
                            <dt>number</dt>
                                <dd>Program number</dd>
                                <dd>Program number is returned.</dd>

                            <dt>length</dt>
                                <dd>Program size (number of characters)</dd>
                                <dd>Program size is returned by character unit.</dd>
                                <dd>Valid when 2 is specified for the arguments "type".</dd>

                            <dt>page</dt>
                                <dd>Program size (number of pages)</dd>
                                <dd>(160i/180i-W only)</dd>
                                <dd>Program size is returned by page unit.</dd>
                                <dd>Valid when 2 is specified for the arguments "type".</dd>

                            <dt>comment</dt>
                                <dd>Comment</dd>
                                <dd>The "Comment" stored next to the "Program number" in the CNC is returned.<br/>
                                    The maximum length of the comment stored is 48 characters (50 characters including
                                    leading "("; and trailing ")" ).
                                    When the "Comment" is longer than 48 characters, the part after the 48th character is
                                    ignored.
                                    When no "Comment" is registered only parentheses ( "()" ) are returned.
                                </dd>
                                <dd>The "Comment" character string is terminated with NULL character.</dd>
                                <dd>Valid when 1 or 2 is specified for the argument "type".</dd>

                            <dt>mdate</dt>
                                <dd>Modified date (Invaid for Series 150i)</dd>
                                <dd>Modified date is returned.</dd>
                                <dd>Valid when 2 is specified for the argument "type".</dd>
                                <dd>The meaning of structure is as follows. </dd>
                                <dd><table class="dd">
                                    <tr><td>year    </td><td>:</td><td>Year      </td></tr>
                                    <tr><td>month   </td><td>:</td><td>Month         </td></tr>
                                    <tr><td>day     </td><td>:</td><td>Day          </td></tr>
                                    <tr><td>hour    </td><td>:</td><td>Hour (Invaid for 160i/180i-W)</td></tr>
                                    <tr><td>minute  </td><td>:</td><td>Minute (Invaid for 160i/180i-W)</td></tr>
                                    </table>
                                </dd>
                            <dt>cdate</dt>
                                <dd>Created date (160i/180i-W only)</dd>
                                <dd>Created date is returned.</dd>
                                <dd>Valid when 2 is specified for the arguments "type".</dd>
                                <dd>The meaning of structure is equal to mdate.</dd>
                        </dl>
                        <p>
                            When no programs are registered or no programs match the specified condition,
                            "0" is returned to "num_prog".
                        </p>
                        </div>
                    </content>
                </item>
            </vc>
        </common>
        
        <is>
            <hssb>
                <vc>
                    <item>
                        <name>FlibHndl</name>
                        <type>in</type>
                        <content>
                            <p>
                                Specify the library handle.
                                See "<a href="handle.htm" target="_parent">Library handle</a>" for details.
                            </p>
                        </content>
                    </item>
                    <item>
                        <name>type</name>
                        <type>in</type>
                        <content>
                            Specify the type of the program directory to read.
                                <table class="dd">
                                    <tr>
                                        <td>0   </td><td>:  </td><td>"Program number" only</td>
                                    </tr>
                                    <tr>
                                        <td>1   </td><td>:  </td><td>"Program number" and "Comment"</td>
                                    </tr>
                                    <tr>
                                        <td>2   </td><td>:  </td><td>"Program number", "Comment", "Date" and "Program size"</td>
                                    </tr>
                               </table>
                            </content>
                    </item>
                    <item>
                        <name>top_prog</name>
                        <type>in / out</type>
                        <content>
                            <p>
                                Pointer to the starting program number.<br/>
                                The program number of the first program actually read is stored after this function call.
                            </p>
                        </content>
                    </item>
                    <item>
                        <name>num_prog</name>
                        <type>in / out</type>
                        <content>
                            <p>
                                Pointer to the number of programs to be read. Actual number of programs being read is
                                stored after this function call. 
                            </p>
                        </content>
                    </item>
                    <item>
                        <name>buf</name>
                        <type>out</type>
                        <content>
                            <div class="dd">
                            <p>
                                Pointer to the PRGDIR3 structure where program directory data are returned.<br/>
                                The PRGDIR3 structure is as follows.
                            </p>
<pre>
typedef struct prgdir3 {
        long    number;
        long    length;
        long    page;
        char    comment[52];
        struct{
                short   year;
                short   month;
                short   day;
                short   hour;
                short   minute;
                short   dummy;
        } mdate;
        struct{
                short   year;
                short   month;
                short   day;
                short   hour;
                short   minute;
                short   dummy;
        } cdate;
} PRGDIR3;
</pre>
                            <dl>
                                <dt>number</dt>
                                    <dd>Program number</dd>
                                    <dd>Program number is returned.</dd>

                                <dt>length</dt>
                                    <dd>Program size (number of characters)</dd>
                                    <dd>Program size is returned by character unit.</dd>
                                    <dd>Valid when 2 is specified for the arguments "type".</dd>

                                <dt>page</dt>
                                    <dd>unused</dd>

                                <dt>comment</dt>
                                    <dd>Comment</dd>
                                    <dd>The "Comment" stored next to the "Program number" in the CNC is returned.
                                        The maximum length of the comment stored is 48 characters (50 characters including
                                        leading "(" and trailing ")"). When the "Comment" is longer than 48 characters,
                                        the part after the 48th character is ignored.
                                        When no "Comment" is registered only parentheses ("()") are returned.
                                    </dd>
                                    <dd>The "Comment" character string is terminated with NULL character.</dd>
                                    <dd>Valid when 1 or 2 is specified for the argument "type".</dd>

                                <dt>mdate</dt>
                                    <dd>Modified date</dd>
                                    <dd>Modified date is returned.</dd>
                                    <dd>Valid when 2 is specified for the arguments "type".</dd>
                                    <dd>The meaning of structure is as follows.</dd>
                                    <dd><table class="dd">
                                        <tr><td>year    </td><td>:</td><td>Year      </td></tr>
                                        <tr><td>month   </td><td>:</td><td>Month     </td></tr>
                                        <tr><td>day     </td><td>:</td><td>Day       </td></tr>
                                        <tr><td>hour    </td><td>:</td><td>Hour</td></tr>
                                        <tr><td>minute  </td><td>:</td><td>Minute</td></tr>
                                        </table>
                                    </dd>
                                    
                                <dt>cdate</dt>
                                    <dd>unused</dd>
                            </dl>
                            <p>
                                When no programs are registered or no programs match the specified condition, "0" is returned to "num_prog". 
                            </p>
                            </div>
                        </content>
                    </item>
                </vc>
            </hssb>
        </is>
    </argument>



    <errcode>
        <item>
            <name>EW_LENGTH</name>
            <content>
                Data block length error<br/>
                The number of readout (num_prog) is wrong.
            </content>
        </item>
        <item>
            <name>EW_NUMBER</name>
            <content>
                Data number error<br/>
                The start number of program (top_prog) is wrong.
            </content>
        </item>
        <item>
            <name>EW_ATTRIB</name>
            <content>
                Data attribute error<br/>
                Output format (type) is wrong.
            </content>
        </item>
    </errcode>



    <option>
        <hssb>The extended driver/library function is necessary.</hssb>
        <ethr><p>The Ethernet function and the extended driver/library function are necessary.</p>
              <p>However, in case of Series 160i/180i/210i/0i MODEL B and 300i, the required CNC option is as follows.</p>
              <p>When Embedded Ethernet is used,</p>
              <p><ul>above two optional functions are not required.</ul></p>
              <p>When Ethernet board is used,</p>
              <p><ul>only Ethernet function is required.</ul></p>
        </ethr>
       <type>
            <li> Series 150/150i</li><br/>
            <ul>
                Program name 48 characters<br/>
                If this option does not exist, the maximum program name is 16 characters.
            </ul>
       </type>
        <is>
            <hssb>The extended driver/library function is necessary.</hssb>
        </is>
    </option>



    <parameter></parameter>



    <mode>
    </mode>



    <support>
        <m>
            <fs0ia>X</fs0ia>
            <fs0ib>O</fs0ib>
            <fs15>X</fs15>
            <fs15i>E</fs15i>
            <fs16>X</fs16>
            <fs18>X</fs18>
            <fs21>X</fs21>
            <fs16ia>O</fs16ia>
            <fs18ia>O</fs18ia>
            <fs21ia>O</fs21ia>
            <fs16ib>O</fs16ib>
            <fs18ib>O</fs18ib>
            <fs21ib>O</fs21ib>
            <fs30i>O</fs30i>
        </m>
        <t>
            <fs0ia>X</fs0ia>
            <fs0ib>O</fs0ib>
            <fs15>X</fs15>
            <fs15i>X</fs15i>
            <fs16>X</fs16>
            <fs18>X</fs18>
            <fs21>X</fs21>
            <fs16ia>O</fs16ia>
            <fs18ia>O</fs18ia>
            <fs21ia>O</fs21ia>
            <fs16ib>O</fs16ib>
            <fs18ib>O</fs18ib>
            <fs21ib>O</fs21ib>
            <fs30i>O</fs30i>
        </t>
        <lc>
            <fs0ia>X</fs0ia>
            <fs0ib>X</fs0ib>
            <fs15>X</fs15>
            <fs15i>X</fs15i>
            <fs16>X</fs16>
            <fs18>X</fs18>
            <fs21>X</fs21>
            <fs16ia>X</fs16ia>
            <fs18ia>X</fs18ia>
            <fs21ia>X</fs21ia>
            <fs16ib>X</fs16ib>
            <fs18ib>X</fs18ib>
            <fs21ib>X</fs21ib>
            <fs30i>X</fs30i>
        </lc>
        <p>
            <fs16i>O</fs16i>
            <fs18i>O</fs18i>
        </p>
        <l>
            <fs16i>O</fs16i>
            <fs18i>X</fs18i>
        </l>
        <w>
            <fs16i>E</fs16i>
            <fs18i>E</fs18i>
        </w>
        <pw>
            <d>E</d>
            <h>E</h>
        </pw>
        
        <is>
            <m>
                <fs30is>O</fs30is>
            </m>
            <t>
                <fs30is>O</fs30is>
            </t>
        </is>
    </support>



    <reference>
        <item class="xis">
            <name>cnc_rdprogdir</name>
            <file>Program/cnc_rdprogdir.htm</file>
        </item>
        <item>
            <name>cnc_rdprogdir2</name>
            <file>Program/cnc_rdprogdir2.htm</file>
        </item>
        <item class="xis">
            <name>cnc_rdprogdir4</name>
            <file>Program/cnc_rdprogdir4.htm</file>
        </item>
    </reference>



    <example>
<vc>
The following program reads all registration information of NC program,
and displays program number list.

#include "fwlib32.h"

#define BUFSIZE 100

void example()
{
        PRGDIR3 prg[BUFSIZE];
        short i, num;
        short top = 0;

        do {
                num = BUFSIZE;
                ret = cnc_rdprogdir3( h, 0, &#38;top, &#38;num, prg );
                if ( ret == EW_NUMBER ) {
                        break;
                }
                if ( ret ) {
                        printf( "ERROR: %d\n", ret );
                        break;
                }
                for ( i = 0 ; i &#60; num ; i++ ) {
                        printf( "O%d\n", prg[i].number );
                }
                top = prg[num-1].number + 1;
        } while ( num &#62;= BUFSIZE );
}
</vc>
    </example>



  </func>
</root>
