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

<root>
  <func>
    <title>cnc_rdproginfo</title>


    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_rdproginfo(unsigned short FlibHndl, short type, short length, ODBNC *prginfo);</prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            <p>Reads the management data of NC programs already registered in CNC.</p>
            <p>
                The management data of NC program are
                <ul>
                    <li>Number of registered programs</li>
                    <li>Number of available programs</li>
                    <li>Character number of used memory</li>
                    <li>Character number of unused memory</li>
                </ul>
                This function returns these data with binary format or ASCII string format.
            </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>
                        <p>Specify the output format.</p>
                        <table class="dd">
                            <tr>
                                <td>0</td><td>:</td><td>binary</td>
                            </tr>
                            <tr>
                                <td>1</td><td>:</td><td>ASCII</td>
                            </tr>
                        </table>
                    </content>
                </item>
                <item>
                    <name>length</name>
                    <type>in</type>
                    <content>
                        <p>Specify the length of data block.</p>
                        <ul>
                            <table>
                                <tr>
                                    <td>12</td><td>:</td><td>binary</td>
                                </tr>
                                <tr>
                                    <td>31</td><td>:</td><td>ASCII</td>
                                </tr>
                            </table>
                        </ul>
                    </content>
                </item>
                <item>
                    <name>prginfo</name>
                    <type>out</type>
                    <content>
                        <p>
                        prginfo Pointer to the ODBNC structure including the program directory.<br/>
                        The ODBNC structure is as follows.</p>
<pre>
typedef struct odbnc {
     union {
        struct {
             short   reg_prg ;   /* Number of registered programs. */
             short   unreg_prg ; /* Number of available programs. */
             long    used_mem ;  /* Character number of used memory. */
             long    unused_mem ;/* Character number of unused memory. */
        } bin ;
        char asc[31] ;           /* Buffer for ASCII format */
     } u ;
} ODBNC ;
</pre>
                        <dl>
                            <dt>type=0</dt>
                                <dd>Each data are stored in each members of the structure with binary format.</dd><br/>
                                <table class="dd">
                                    <colgroup width="45%">
                                    <tr>
                                        <td>prginfo.bin.reg_prg</td>
                                        <td>Number of registered programs.</td>
                                    </tr>
                                    <tr>
                                        <td>prginfo.bin.unreg_prg</td>
                                        <td>Number of available programs.</td>
                                    </tr>
                                    <tr>
                                        <td>prginfo.bin.used_mem</td>
                                        <td>Character number of used memory.</td>
                                    </tr>
                                    <tr>
                                        <td>prginfo.bin.unused_mem</td>
                                        <td>Character number of unused memory.</td>
                                    </tr>
                                    </colgroup>
                                </table>

                            <dt>type=1</dt>
                                <dd>ASCII strings are stored in "prginfo.u.asc" with following format.</dd><br/>
                                <blockquote>
                                % LF d1 LF d2 LF d3 LF d4 LF %
                                </blockquote>

                                <table class="dd">
                                    <colgroup width="5%">
                                    <tr>
                                        <td>LF</td>
                                        <td>0x0A ('\n')</td>
                                    </tr>
                                    <tr>
                                        <td>d1</td>
                                        <td>Number of registered programs</td>
                                    </tr>
                                    <tr>
                                        <td>d2</td>
                                        <td>Number of available programs</td>
                                    </tr>
                                    <tr>
                                        <td>d3</td>
                                        <td>Character number of used memory</td>
                                    </tr>
                                    <tr>
                                        <td>d4</td>
                                        <td>Character number of unused memory</td>
                                    </tr>
                                    </colgroup>
                                </table>
                                d1 - d4 are ASCII strings without the leading '0'.
                        </dl>
                    </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>
                            <p>Specify the output format.</p>
                            <table class="dd">
                                <tr>
                                    <td>0</td><td>:</td><td>binary</td>
                                </tr>
                                <tr>
                                    <td>1</td><td>:</td><td>ASCII</td>
                                </tr>
                            </table>
                        </content>
                    </item>
                    <item>
                        <name>length</name>
                        <type>in</type>
                        <content>
                            <p>Specify the length of data block.</p>
                            <ul>
                                <table>
                                    <tr>
                                        <td>12</td><td>:</td><td>binary</td>
                                    </tr>
                                    <tr>
                                        <td>31</td><td>:</td><td>ASCII</td>
                                    </tr>
                                </table>
                            </ul>
                        </content>
                    </item>
                    <item>
                        <name>prginfo</name>
                        <type>out</type>
                        <content>
                            <p>
                            prginfo Pointer to the ODBNC structure including the program directory.<br/>
                            The ODBNC structure is as follows.</p>
<pre>
typedef struct odbnc {
     union {
        struct {
             short   reg_prg ;   /* Number of registered programs. */
             short   unreg_prg ; /* Number of available programs. */
             long    used_mem ;  /* Character number of used memory. */
             long    unused_mem ;/* Character number of unused memory. */
        } bin ;
        char asc[31] ;           /* Buffer for ASCII format */
     } u ;
} ODBNC ;
</pre>
                            <dl>
                                <dt>type=0</dt>
                                    <dd>Each data are stored in each members of the structure with binary format.</dd><br/>
                                    <table class="dd">
                                        <colgroup width="45%">
                                        <tr>
                                            <td>prginfo.bin.reg_prg</td>
                                            <td>Number of registered programs.</td>
                                        </tr>
                                        <tr>
                                            <td>prginfo.bin.unreg_prg</td>
                                            <td>Number of available programs.</td>
                                        </tr>
                                        <tr>
                                            <td>prginfo.bin.used_mem</td>
                                            <td>Character number of used memory.</td>
                                        </tr>
                                        <tr>
                                            <td>prginfo.bin.unused_mem</td>
                                            <td>Character number of unused memory.</td>
                                        </tr>
                                        </colgroup>
                                    </table>

                                <dt>type=1</dt>
                                    <dd>ASCII strings are stored in "prginfo.u.asc" with following format.</dd><br/>
                                    <blockquote>
                                    % LF d1 LF d2 LF d3 LF d4 LF %
                                    </blockquote>

                                    <table class="dd">
                                        <colgroup width="5%">
                                        <tr>
                                            <td>LF</td>
                                            <td>0x0A ('\n')</td>
                                        </tr>
                                        <tr>
                                            <td>d1</td>
                                            <td>Number of registered programs</td>
                                        </tr>
                                        <tr>
                                            <td>d2</td>
                                            <td>Number of available programs</td>
                                        </tr>
                                        <tr>
                                            <td>d3</td>
                                            <td>Character number of used memory</td>
                                        </tr>
                                        <tr>
                                            <td>d4</td>
                                            <td>Character number of unused memory</td>
                                        </tr>
                                        </colgroup>
                                    </table>
                                    d1 - d4 are ASCII strings without the leading '0'.
                            </dl>
                        </content>
                    </item>
                </vc>
            </hssb>
        </is>
    </argument>



    <errcode>
        <item>
            <name>EW_LENGTH</name>
            <content>
                Data block length error<br/>
                Length of the block (length) is illegal.
            </content>
        </item>
        <item>
            <name>EW_ATTRIB</name>
            <content>
                Data attribute error<br/>
                Output format (type) is illegal.
            </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>
    </option>



    <parameter>
    </parameter>



    <mode>
    </mode>



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



    <reference>
    </reference>



    <example>
        <vc>
The following program reads the management data of NC program, and displays them.

#include "fwlib32.h"

void example( void )
{
        ODBNC buf ;
        short ret ;
        ret = cnc_rdproginfo( h, 0, 16, &#38;buf ) ;
        if ( ret )
                printf( "ERROR: %d\n", ret ) ;
        else {
                printf( "Registered program number   = %d\n",
                        buf.u.bin.reg_prg ) ;
                printf( "Registerable program number = %d\n",
                        buf.u.bin.unreg_prg ) ;
                printf( "Used memory                 = %ld\n",
                        buf.u.bin.used_mem ) ;
                printf( "Free memory                 = %ld\n",
                        buf.u.bin.unused_mem ) ;
        }
}</vc>
    </example>



  </func>
</root>
