Test for certain characters in a file question(Ctrl-L)

Product Compare Forums Multi-Edit Support Test for certain characters in a file question(Ctrl-L)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2807
    MewUser
    Participant

    I wish to be able to search for the character generated by Ctrl-L(default).
    I hit Alt-K, then Ctrl-L, and it did not list any action associated with it, yet it generates the character associated with page breaks.
    MEWs ASCII table shows a solid rectangle for ^L.

    I would like to be able to search through a file to determine the total number of functions that I have created in each. For each function, I designate it with Ctrl-L, and Use the Page breaks to move from function to function.

    Thank you for any assistance in this matter.

    #9141
    Clay Martin
    Keymaster

    Hi,
    You can try this. Open a file, and add a Cntl L, then switch to hex mode (Text-Hex mode), then note the hex value of the Cntl-L. You can then do a regular expression search (unix style) on \xHH where HH is the hex value for the character.

    Thanks,
    Clay

    #9142
    MewUser
    Participant

    Thanks for the response, Clay.

    Here is what I have so far. When I run it, it does find the proper page break, however, when it gets to the last one, regardless of which file I run it on(*.c,*.s), it reports that a page break exists on every 2 lines until the end of file. I do not understand what is going on here, or what I need to change to resolve this.

    [code:2nqwz7ax]

    int FindFunctions() // Function to add up number of functions in (a) file(s)
    {
    int NumFunctions = 0;
    str NewPageStr = "\x0C";
    int TurnOffRefresh, T_Refresh = refresh;

    TurnOffRefresh = SetRefresh();
    tof;
    while ( !at_eof)
    {
    search_fwd(NewPageStr, 0);
    int CurLine = c_line();
    MsgDlg ( "Line "+str(CurLine), "", "FindFunctions", 1);
    down;
    down;
    goto_col(1);
    NumFunctions += 1;
    } // end while ( !at_eof)
    MsgDlg ( "Functions Found "+str(NumFunctions), "", "FindFunctions", 1);
    ReSetRefresh(TurnOffRefresh, T_Refresh); // return screen updating to prior
    return(1);
    } // FindFunctions
    [/code:2nqwz7ax]

    #9140
    Clay Martin
    Keymaster

    Hi,
    The one thing that struck me is that in the not eof loop, you do two downs, which may take you past the eof, if the last line of the file contains the character you are looking for. You might want to check eof before the downs.

    HTH,
    Clay

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.