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

<root>
  <func>
    <title>cnc_searchword</title>


    <declare>
      <vc>
        <include>#include "fwlib32.h"</include>
        <prottype>FWLIBAPI short WINAPI cnc_searchword(unsigned short FlibHndl, long prog_no, unsigned long line_no, short type, short direct, unsigned long repeat, char *prog_data);</prottype>
      </vc>
    </declare>



    <doc>
        <cmn>
            <p>Searches the string within the NC program.</p>
            <p>The basic order to search is as follows.</p>
            <p><img src="Program/srchword.gif"/></p>
            <p>The conditions of the function about CNC mode and the kind of programare as follows.
                <table border="1" class="dd">
                    <tr><td></td><td>EDIT mode</td><td>MDI mode</td><td>Other mode</td></tr>
                    <tr><td>MDI program</td>            <td>&#215;</td><td>O</td><td>&#215;</td></tr>
                    <tr><td>Selected program</td>       <td>O</td><td>&#215;</td><td>&#215;</td></tr>
                    <tr><td>Not selected program</td>   <td>O</td><td>O</td><td>O</td></tr>
                </table>
              <span class="dd">O: Available / &#215;: Not available (The return code is EW_MODE)</span>
            </p>
            <p>If you have the playback option, TJOG/THND mode is the same as EDIT.</p>
            <p>This function works normally if OP signal is 1 but STL signal is 0
               (for example, feed hold stopping, single block stopping, etc).</p>
            <p>After you use this function for the MDI program or the selected program in the following situations, the execution pointer goes to a certain place.
                <ul>
                <li>MDI program in MDI mode.</li>
                <li>Selected program in EDIT mode.</li>
                <li>Selected program in TJOG/THND mode with the playback option.</li>
                </ul>
            </p>
            <p>
                In those cases, the execution pointer moves to the following place.
                <ul>
                <li>If the target string could be found, the pointer would move to the line where includes the target string.</li>
                <li>If the target string could not be found, the pointer would move to the top of the program in case of the parameter "direct=0", or the bottom of the program in case of the parameter "direct=1".</li>
                </ul>
            </p>
        </cmn>
    </doc>



    <argument>
        <hssb>
            <cmn>
                <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>prog_no</name>
                    <type>in</type>
                    <content>
                        <p>Specify the program number to search.<br/>
                           When you write the MDI program, you have to specify -1.
                        </p>
                    </content>
                </item>
                <item>
                    <name>line_no</name>
                    <type>in</type>
                    <content>
                        <p>Specify the line number to search from.<br/>
                           When you search from the first line of a program, you have to specify 0.<br/>
                           When you specify other than the existing line number, this function never returns error result as the return code.<br/>
                           In this case, next <a href="Program/cnc_searchresult.htm" target="_parent">cnc_searchresult</a> function would return EW_NUMBER error.
                        </p>
                    </content>
                </item>
                <item>
                    <name>type</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the type of the search operation.
                            <table class="dd">
                                <tr><td>0</td><td>:</td><td>Character search (Search the one address character.)</td></tr>
                                <tr><td>1</td><td>:</td><td>Word search (Search the string by word basis.)</td></tr>
                                <tr><td>2</td><td>:</td><td>Last line search (Search the bottom of line)</td></tr>
                            </table>
                            <br/>
                            When you commands "Character search", you have to set the only one address character as the target string. <br/>
                            If you set except the address character or more than two characters, this function returns EW_DATA error.
                        </p>
                        <p>When you commands "Word search" for the only one address character, you have no error and the address character is going to be searched.
                        </p>
                        <p>When you commands "Last line search", this function ignores the parameters direct, repeat and prog_data.
                        </p>
                    </content>
                </item>
                <item>
                    <name>direct</name>
                    <type>in</type>
                    <content>
                        <p>
                            Specify the direction to search.
                            <table class="dd">
                                <tr><td>0</td><td>:</td><td>Search towards the top of the program.</td></tr>
                                <tr><td>1</td><td>:</td><td>Search towards the bottom of the program.</td></tr>
                            </table>
                        </p>
                    </content>
                </item>
                <item>
                    <name>repeat</name>
                    <type>in</type>
                    <content>
                        <p>Specify the limitation of times the string is found when there are many strings matching within the program.<br/>
                           If you specify 0, this function returns EW_DATA error.
                        </p>
                    </content>
                </item>
                <item>
                    <name>prog_data</name>
                    <type>in</type>
                    <content>
                        <p>Specify the pointer to the buffer holding the target string to search.<br/>
                           It is a NULL terminated ASCII string. The size of string, including NULL character, must be within 34(300i/310i/320i:127). If it were more than maximum charactors, this function would return EW_DATA error.
                        </p>
                        <p>The first character of the string must be an address character (G, F, etc).<br/>
                           After the address character, the next character must be a number, '+', '-' or '-'.<br/>
                           If you use one of the following characters, you get EW_DATA error as the return code.<br/>
                            <ul>
                                <li>Except the available code for CNC</li>
                                <li>The small letter of alphabets</li>
                                <li>Address 'O' or the string consisted of 'O' + program number</li>
                                <li>'%'(EOR)</li>
                            </ul>
                        </p>
                    </content>
                </item>
            </cmn>
        </hssb>
    </argument>



    <errcode>
        <item>
            <name>EW_BUSY</name>
            <content>
                Busy<br/>
                <ul style="margin-top:0;margin-bottom:0">
                    <li>except 300i/310i/320i</li>
                    Some alarm has existed or CNC is searching the program text right now.
                    <li>300i/310i/320i</li>
                    CNC is searching the program text right now.
                </ul>
            </content>
        </item>
        <item>
            <name>EW_DATA</name>
            <content>
                Data error<br/>
                In order to get more information for this err_no return value, execute <a href="Misc/cnc_getdtailerr.htm" target="_parent">cnc_getdtailerr</a> function.<br/>
                The following detail status will be set onto the member, err_no of ODBERR structure.
                <table>
                    <tr><td>1</td><td>:</td><td>The program number(prog_no) error</td></tr>
                    <tr><td>3</td><td>:</td><td>The search type(type) error</td></tr>
                    <tr><td>4</td><td>:</td><td>The search direction(direct) error</td></tr>
                    <tr><td>5</td><td>:</td><td>The repeat count(repeat) error</td></tr>
                    <tr><td>6</td><td>:</td><td>The size of string error</td></tr>
                    <tr><td>7</td><td>:</td><td>The content of the string error</td></tr>
                </table>
            </content>
        </item>
        <item>
            <name>EW_NOOPT</name>
            <content>
                No option<br/>
                The extended driver/library function is necessary.
            </content>
        </item>
        <item>
            <name>EW_MODE</name>
            <content>
                CNC mode error
            </content>
        </item>
        <item>
            <name>EW_PROT</name>
            <content>
                Write protection in CNC side<br/>
                CNC parameter is a state of write-protection(O8000-/O9000- protection, encoding). 
            </content>
        </item>
        <item>
            <name>EW_REJECT</name>
            <content>
                 CNC execution denied<br/>
                <ul style="margin-top:0;margin-bottom:0">
                    <li>except 300i/310i/320i</li>
                    MDI edit or Background edit processing in CNC side. 
                    <li>300i/310i/320i</li>
                    CNC is in the emergency stop.
                </ul>
            </content>
        </item>
    </errcode>



    <option>
        <hssb>
            <p>The extended driver/library function is necessary.</p>
        </hssb>
    </option>



    <parameter></parameter>



    <mode>
        <cmn>
            See the above description.
        </cmn>
    </mode>



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



    <reference>
        <item>
            <name>cnc_rdprogline</name>
            <file>Program/cnc_rdprogline.htm</file>
        </item>
        <item>
            <name>cnc_rdprogline2</name>
            <file>Program/cnc_rdprogline2.htm</file>
        </item>
        <item>
            <name>cnc_wrprogline</name>
            <file>Program/cnc_wrprogline.htm</file>
        </item>
        <item>
            <name>cnc_delprogline</name>
            <file>Program/cnc_delprogline.htm</file>
        </item>
        <item>
            <name>cnc_searchresult</name>
            <file>Program/cnc_searchresult.htm</file>
        </item>
    </reference>



    <example></example>



  </func>
</root>
