How to add an new entry in the "FunctionList"?



  • Hi,
    I’m using NP++ when programming TCL files, UDE files and DEF files and I’ve using a “userDefineLang.xml” to highlight syntax word in NP++.
    Now I would like to use the “FunctionList” to easily see(grab) specific word in the FunctionList window.
    I’ve tried to copy and create a “tcl.xml” and put that file in “Functionlist” dir, but when I open a TCL file(.tcl) or a NX UDE(.cdl) or a NX DEF(.def), nothing is visible in the FunctionList View.

    pic5.jpg pic1.jpg pic2.jpg pic3.jpg pic4.jpg

    What have I done wrong or don’t understand?

    I have used “npp.7.9.1.portable.x64.7z” to extract and then started NP++. (The FunctionList works when I open a xml file)

    BR Magnus



  • @Magnus-Berglund ,

    If the directory listing you showed is accurate, you did not update overrideMap.xml. Without the pointer in that file, Notepad++ has no idea which functionList\___.xml file to use for the file ending in .tcl or .def .

    The contents of the overrideMap.xml are described in the user manual at https://npp-user-manual.org/docs/config-files/#v7-9-1-and-later-versions.

    But, in brief, for the three types you mentioned, you should have something like:

    <association id= "tcl.xml"				userDefinedLangName="TCL"/>
    <association id= "ude.xml"				userDefinedLangName="UDE"/>
    <association id= "def.xml"				userDefinedLangName="DEF"/>
    

    or, if they all use the same functionList definition,

    <association id= "tcl.xml"				userDefinedLangName="TCL"/>
    <association id= "tcl.xml"				userDefinedLangName="UDE"/>
    <association id= "tcl.xml"				userDefinedLangName="DEF"/>
    

    Either way, the name in the userDefinedLangName="..." should match the name you use for your UDL.



  • @Magnus-Berglund ,

    I reread your original screenshots, and saw that you defined three different parsers in the same XML file. As of v7.9.1, each language gets its own file, so there should only be one <parser> tag per XML file. I would also separate those into three (thus meaning you use my first overrideMap.xml example.

    Also, even once you have that, it is possible that your regex need to be tweaked to accurately grab the “function names” for the Function List. If you are sure you have the files right (three parser XML files, plus editing the overrideMap to match), then provide us with the text (paste in your reply, highlight, then click on the </> button in the forum post editor toolbar) – because transcribing your XML from the images is error-prone on our part. If it doesn’t show up in the black box in the preview window, you haven’t gotten the </> button correctly applied to your example text.

    So if fixing the config arrangement works, let us know, and that’s great. If not, give us some stuff we can copy/paste and run experiments on our own.

    Good luck,



  • @PeterJones Thanks for the support!
    How can I upload a 7z file?
    (i’m new in this forum… ;-) )
    //magnus



  • @Magnus-Berglund said in How to add an new entry in the "FunctionList"?:

    How can I upload a 7z file?

    You cannot upload 7z or other such files to the forum itself. In theory, you could upload them to a file-sharing site, but many (like me) have such sites blocked by I.T., so wouldn’t be able to grab the files to look at them.

    As I said, to give us the files, you would paste the contents in the post, and mark them up using the </> button. Really, if you just pasted the 8 lines of the TCL parser, that would give us enough to experiment with; once we were able to help you get that one working, you might be able to see what’s going wrong with the others…



  • @Magnus-Berglund ,

    So, since you hadn’t posted, I did try to implement the TCL. It works for me.

    68cc1de9-747b-445b-845f-9ad546a99ea4-image.png

    However, there is the caveat: TCL is a built-in language, it just didn’t have the functionList bundled with Notepad++ (not all the built-in languages have functionList files, unfortunately). So you don’t actually need to add a UDL for TCL, and you don’t need to edit the overrideMap.xml, because TCL (language #29) by default maps to tcl.xml. You just need the functionList\tcl.xml to validly represent the procedure names.

    I took your regex and put them into tcl.xml, as seen below; I then re-loaded Notepad++, and opened ex.tcl file, with a simplified version of what was in your image, and it saw the two functions show up in the list.

    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- ==========================================================================\
    |
    |   To learn how to make your own language parser, please check the following
    |   link:
    |       https://npp-user-manual.org/docs/function-list/
    |
    \=========================================================================== -->
    <NotepadPlus>
    	<functionList>
    			<parser
    				displayName="TCL"
    				id         ="tcl_procedure"
    				commentExpr="(#)"
    			>
    				<function
    					mainExpr="^[\t ]*((proc)[\s]+)[^\s]+"
    				>
    					<functionName>
    						<nameExpr expr="(proc)\s+[\x21-\x7E]+" />
    						<nameExpr expr="\s+[^\s]+" />
    					</functionName>
    				</function>
    			</parser>
    	</functionList>
    </NotepadPlus>
    


  • @PeterJones , Sorry I needed to go home but up’n running again :-)

    Here’s a tcl example.

    
    #=============================================================
    proc PB_CMD_force_G_feed { } {
    #=============================================================
    # Ds6803 2012-01-09
    
    MOM_force ONCE G_feed F
    
    } ;# End proc
    
    
    #=============================================================
    proc MOM_robot_prg {} {
    #=============================================================
    # Variables from this UDE are passes forward to PB_CMD_create_robot_tape.
    # Ds6803 2012-05-18
    
    
    } ;# End proc
    
    
    

    and here is a UDE example

    #---------------------------------------------------------------------------
    
    EVENT block_jump
    {
       UI_LABEL "VRX Block jump"
       CATEGORY MILL DRILL LATHE
    
       PARAM command_status
       {
          TYPE o
          DEFVAL "Active"
          OPTIONS "Active","Inactive","User Defined"
          UI_LABEL "Status"
       }
       PARAM ude_block_jump
       {
          TYPE s
          DEFVAL "#199=#4314"
          UI_LABEL "Read sequence number command"
       }
    }
    
    #---------------------------------------------------------------------------
    
    EVENT btd
    {
       UI_LABEL "VRX BTD"
       CATEGORY MILL DRILL LATHE
    
       PARAM command_status
       {
          TYPE o
          DEFVAL "Active"
          OPTIONS "Active","Inactive","User Defined"
          UI_LABEL "Status"
       }
       PARAM ude_btd_optional_skip
       {
          TYPE o
          DEFVAL "/3"
          OPTIONS "NONE","/1","/2","/3","/4","/5","/6","/7","/8","/9"
          UI_LABEL "Optional skip?"
       }
       PARAM ude_btd_prg
       {
          TYPE s
          TOGGLE On
          DEFVAL "M98 P9997"
          UI_LABEL "Sub program call"
       }
       PARAM ude_btd_tool_text
       {
          TYPE   s
          TOGGLE Off
          DEFVAL "BTD"
          UI_LABEL "Text"
       }
    }
    
    

    and finally the DEF example

      ADDRESS LF_SPEED
      {
          FORMAT      Rev
          FORCE       always
          LEADER      ""
          ZERO_FORMAT Zero_int
      }
    
      ADDRESS LF_ZABS
      {
          FORMAT      AbsCoord
          FORCE       always
          LEADER      ""
          ZERO_FORMAT Zero_real
      }
    
    
    ############ BLOCK TEMPLATE DECLARATIONS #############
      BLOCK_TEMPLATE absolute_mode
      {
           G_cutcom[$mom_sys_cutcom_code(OFF)]
           G_plane[$mom_sys_cutcom_plane_code(XY)]
           G_adjust[$mom_sys_adjust_cancel_code]
           G_feed[$mom_sys_feed_rate_mode_code($feed_mode)]
           G_return[$mom_sys_cycle_ret_code(AUTO)]
           G_motion[$mom_sys_rapid_code]
           G_mode[$mom_sys_output_code(ABSOLUTE)]
      }
    
      BLOCK_TEMPLATE auxfun
      {
           M[$mom_auxfun]
           Text[$smc_auxfun_text]\opt
      }
    
      BLOCK_TEMPLATE circular_c
      {
           G_motion[$mom_sys_linear_code]
           G_mode[$mom_sys_output_code($mom_output_mode)]\opt
           fifth_axis[$mom_out_angle_pos(1)]
           F[$feed]
      }
    
    


  • @Magnus-Berglund ,

    All three work for me.
    798dfcb4-5b8c-4ae7-9fae-0738d010defe-image.png
    a1464e4a-3bbb-473d-b23b-d9a5e9842e4a-image.png
    23cfb8e6-4522-486e-9ecf-5e0f94295216-image.png

    ude.xml:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- ==========================================================================\
    |
    |   To learn how to make your own language parser, please check the following
    |   link:
    |       https://npp-user-manual.org/docs/function-list/
    |
    \=========================================================================== -->
    <NotepadPlus>
    	<functionList>
    			<parser
    				displayName="UDE"
    				id         ="ude_procedure"
    				commentExpr="(#)"
    			>
    				<function
    					mainExpr="^[\t ]*((EVENT)[\s]+)[^\s]+"
    				>
    					<functionName>
    						<nameExpr expr="(EVENT)\s+[\x21-\x7E]+" />
    						<nameExpr expr="\s+[^\s]+" />
    					</functionName>
    				</function>
    			</parser>
    	</functionList>
    </NotepadPlus>
    

    def.xml:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- ==========================================================================\
    |
    |   To learn how to make your own language parser, please check the following
    |   link:
    |       https://npp-user-manual.org/docs/function-list/
    |
    \=========================================================================== -->
    <NotepadPlus>
    	<functionList>
    			<parser
    				displayName="DEF"
    				id         ="def_procedure"
    				commentExpr="(#)"
    			>
    				<function
    					mainExpr="^[\t ]*((ADDRESS|BLOCK_TEMPLATE)[\s]+)[^\s]+"
    				>
    					<functionName>
    						<nameExpr expr="(ADDRESS|BLOCK_TEMPLATE)\s+[\x21-\x7E]+" />
    						<nameExpr expr="\s+[^\s]+" />
    					</functionName>
    				</function>
    			</parser>
    	</functionList>
    </NotepadPlus>
    

    my overrideMap.xml has two new entries, next to the other UDL entries:

    			<association id= "ude.xml"		userDefinedLangName="UDE"/>
    			<association id= "def.xml"		userDefinedLangName="DEF"/>
    

    For my UDL definitions, I do not have a TCL UserDefinedLanguage, because TCL is a builtin language. I have a minimal UDL definition for UDE (all that’s saved is the extension = ude) and a minimal definition for the DEF (all that’s saved is the extension def). If I open your example TCL, UDE, or DEF files, they open associated as builtin TCL, user defined UDE, or user-defined DEF, and the functionList recognizes their functions, as shown in the screenshots above.



  • @PeterJones
    I’ve removed my “portable installation”, installed from “npp.7.9.1.Installer.x64.exe”, started NP++, closed NP++ and then copied the edited (as above) “ude.xml”, “def.xml” and “overrideMap.xml” to “C:\Users\me\AppData\Roaming\Notepad++\functionList”. Started NP++ and open a tcl file(or a def or a cdl) but nothing show up in the Functionlist.

    ???

    I also uses a own “userDefineLang.xml”. Can this have impact on the FunctionList?

    pic1.jpg



  • @Magnus-Berglund

    Since your UDL are called “NX UDE” and “NX DEF”, change the overrideMap to match.

    			<association id= "ude.xml"		userDefinedLangName="NX UDE"/>
    			<association id= "def.xml"		userDefinedLangName="NX DEF"/>
    


  • @PeterJones
    I tried but… :-(
    below you see my files in the dir “C:\Users\me\AppData\Roaming\Notepad++\functionList”

    def.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- ==========================================================================\
    |
    |   To learn how to make your own language parser, please check the following
    |   link:
    |       https://npp-user-manual.org/docs/function-list/
    |
    \=========================================================================== -->
    <NotepadPlus>
    	<functionList>
    			<parser
    				displayName="NX DEF"
    				id         ="def_procedure"
    				commentExpr="(#)"
    			>
    				<function
    					mainExpr="^[\t ]*((ADDRESS|BLOCK_TEMPLATE)[\s]+)[^\s]+"
    				>
    					<functionName>
    						<nameExpr expr="(ADDRESS|BLOCK_TEMPLATE)\s+[\x21-\x7E]+" />
    						<nameExpr expr="\s+[^\s]+" />
    					</functionName>
    				</function>
    			</parser>
    	</functionList>
    </NotepadPlus>
    

    ude.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- ==========================================================================\
    |
    |   To learn how to make your own language parser, please check the following
    |   link:
    |       https://npp-user-manual.org/docs/function-list/
    |
    \=========================================================================== -->
    <NotepadPlus>
    	<functionList>
    			<parser
    				displayName="NX UDE"
    				id         ="ude_procedure"
    				commentExpr="(#)"
    			>
    				<function
    					mainExpr="^[\t ]*((EVENT)[\s]+)[^\s]+"
    				>
    					<functionName>
    						<nameExpr expr="(EVENT)\s+[\x21-\x7E]+" />
    						<nameExpr expr="\s+[^\s]+" />
    					</functionName>
    				</function>
    			</parser>
    	</functionList>
    </NotepadPlus>
    

    and finally overrideMap.xml

    <!-- ==================== User Defined Languages =============== -->
    		<association id= "krl.xml"				userDefinedLangName="KRL"/>
    		<association id= "sinumerik.xml"		userDefinedLangName="Sinumerik"/>
    		<association id= "universe_basic.xml"	userDefinedLangName="UniVerse BASIC"/>
    		<association id= "ude.xml"				userDefinedLangName="NX UDE"/>
    		<association id= "def.xml"				userDefinedLangName="NX DEF"/>
    <!-- ==================================================== -->
    

    I’ll close for tonight and the weekend and made more tries during next week.
    If You come up any idea what my issue is, I appriciate your support.
    Thanks and have a nice weekend!



  • @Magnus-Berglund said in How to add an new entry in the "FunctionList"?:

    any idea what my issue is

    Sorry, if I name my UDL “NX UDE”, assigned to the same .cdl extension your image showed, with the overrideMap and ude.xml as shown, it works for me. I cannot see what’s going wrong with yours.

    Maybe this weekend, I’ll create a zipfile with the working Portable with the UDL and functionList , and put it temporarily on my website for you to download a working setup, and compare that to what you have. If I get that done, I’ll post a link



  • @Magnus-Berglund ,

    here is a temporary link to a zipfile. This will unzip a portable Notepad++ v7.9.1-x64 which has an existing session with the example TCL, UDE, and DEF files open; the UDL is defined for NX UDE (.cdl) and NX DEF (.def). The functionList folder has files for tcl.xml, nx_ude.xml, nx_def.xml, and an updated overrideMap.xml which points to those file names.

    For future readers: the download link may be invalid in the future; sorry.

    When I use this portable, I see the following, showing that
    4326c7d0-e4c0-4396-8eff-d628d296e8a4-image.png
    04179fab-c3b1-48fc-b078-e546b4880107-image.png
    8cd32354-3155-4bff-a804-50b90393fa3b-image.png

    (PS: I do not claim that my UDL definitions for those languages are any good; I just made a quick-and-dirty UDL for them to prove that the UDL was properly recognized; your UDL definition for those files is most likely much better than mine.)



  • @PeterJones
    Hello Peter,
    What a fantastic zipfile! :-)
    It works even for me, jippy!

    Thanks for the support!
    Have a great Christmas together with your family


Log in to reply