SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Slick-C® Macro Programming => Topic started by: Gary on November 27, 2007, 10:44:03 am

Title: Convert Keil uVision Workspace
Post by: Gary on November 27, 2007, 10:44:03 am
I have made a new approach to open Keil uVision project files which does not require to hack the system macros shipped with SlickEdit which is not recommended according to the SlickCMacroBestPractices.pdf document saying "Modifying macros that ship with SlickEdit - Don't do it! Take your hands away from the keyboard..."  ;D

This version is an adaption of the cwprojconv.e macro shipped with SlickEdit 12.0.0.0.

The macro allows to import the folder and files used in a .uv2 file. It does so by parsing the original file and using SlickEdit's API to create the folders and adding the respective source files. Import of tools etc. is not supported yet.   

My recommendation is to add the function to the [Project] menu. You can do so by selecting '_mdi_menu' from the [Macro][Menus...]. Add the function 'OpenUvisionProject' to the menu [Project][Open Other Workspace].


This thread shall be used for new versions of this macro only. Please post questions, bugs, feature requests, etc. here:  http://community.slickedit.com/index.php?topic=2407
Title: Re: Convert Keil uVision Workspace
Post by: Gary on December 09, 2007, 08:21:53 am
Attached you find an updated version with the changes requested by roguebear. Also a thank you to HS2 for the input on executing shell commands from SlickEdit and outputting to the build window.

File Version: 0.9.1
File Changes:
 
Title: Re: Convert Keil uVision Workspace
Post by: LM54 on September 03, 2008, 03:39:37 pm
Our company only has licences for V10.0, will this macro work with this version?
Title: Re: Convert Keil uVision Workspace
Post by: LM54 on September 03, 2008, 04:07:44 pm
Never mind, it does work ;D
Title: Re: Convert Keil uVision Workspace
Post by: roguebear on August 14, 2010, 02:54:45 am
the keil has new verison uv4.  can sb modify the .e to confit uv2, uv3, uv4 ?
Title: Re: Convert Keil uVision Workspace
Post by: Gary on August 14, 2010, 06:36:08 pm
the keil has new verison uv4.  can sb modify the .e to confit uv2, uv3, uv4 ?

Hi all, I am out of the embedded business so i do not intend to maintain this macro anymore.
uv4 uses an XML project file now - it should not be too complicated to write a new converter - volunteers are welcome ;) roguebear?  ;D ;D ;D
Title: Re: Convert Keil uVision Workspace
Post by: hs2 on August 15, 2010, 12:03:47 pm
Luckily SE uses XML (project) files as well. So hopefully the required parsing funtions (e.g. _xmlcfg_*) are already there.
Just a hint.
Good luck, HS2
Title: Re: Convert Keil uVision Workspace
Post by: roguebear on November 07, 2011, 01:11:20 am
_xmlcfg_.. function cann't get the content between <tag>...</tag>.  so I can't convert keil or iar project to slickedit...  anyone can help?
Title: Re: Convert Keil uVision Workspace
Post by: chrisant on November 07, 2011, 06:55:46 am
I thought that's what _xmlcfg_get_value_ does?
Title: Re: Convert Keil uVision Workspace
Post by: roguebear on November 07, 2011, 08:27:44 am
get_value only can get the attribute value. such as.
<name attribute = "12345">,  but can't get the value of <name>12345</name>
Title: Re: Convert Keil uVision Workspace
Post by: chrisant on November 07, 2011, 09:05:08 am
You're right, _xmlcfg_get_value_ can't get that.
But for completeness here's what _xmlcfg_get_value_ gets, which isn't an attribute; there's a separate function for getting attribute values.

Code: [Select]
<Field name="Comment">
        <Value>
                <![CDATA[It can extract this, right here.]]>
        </Value>
</Field>
Title: Re: Convert Keil uVision Workspace
Post by: roguebear on November 08, 2011, 12:15:37 am
_xmlcfg_get_value_ gets  ???

I can't find this function.  I use slickedit 16.0.0.3. the newest version.

I am crazy for this problem many weeks!!
Title: Re: Convert Keil uVision Workspace
Post by: chrisant on November 08, 2011, 05:11:13 am
The XMLCFG APIs are for parsing certain kinds of specially formed XML intended for use by SlickEdit for storing configuration settings.

I don't think XMLCFG is designed to be capable of what you're looking for.
Title: Re: Convert Keil uVision Workspace
Post by: roguebear on November 08, 2011, 11:48:22 am
Have any suggestion about how to get the "12345" between <node>12345</node>??
Title: Re: Convert Keil uVision Workspace
Post by: chrisant on November 08, 2011, 05:22:37 pm
I don't know the bigger picture about what needs to be done.  If it's converting a Keil uVision workspace to a SlickEdit workspace, then I'd just write an external program and invoke that.

Slick-C is portable, but it's a macro language, and there are limits to its sophistication.
Title: Re: Convert Keil uVision Workspace
Post by: roguebear on November 09, 2011, 02:21:40 am
     Most people use keil and IAR. can you write a program which can convert keil and IAR project to slickedit. 
    I think it's maybe a big project. the newest version of keil arm is 4.22a, keil c51 is 9.05 , IAR arm is 6.20.
    Need get *.c *.h *.a *.asm or *.cpp file, and include path, even the parameter which can use it debug project directly in slickedit. so I think it takes a long time to make this software perfect.
    So i think use slickeedit's macro to write this function maybe the best choice. if i can get the value between <node> </node>, I'll maintain it, upgrade it continuously.
Title: Re: Convert Keil uVision Workspace
Post by: Graeme on November 09, 2011, 05:40:38 am
     Most people use keil and IAR. can you write a program which can convert keil and IAR project to slickedit. 
    I think it's maybe a big project. the newest version of keil arm is 4.22a, keil c51 is 9.05 , IAR arm is 6.20.
    Need get *.c *.h *.a *.asm or *.cpp file, and include path, even the parameter which can use it debug project directly in slickedit. so I think it takes a long time to make this software perfect.
    So i think use slickeedit's macro to write this function maybe the best choice. if i can get the value between <node> </node>, I'll maintain it, upgrade it continuously.

How do you know _xmlcfg_get_value doesn't do what you want?

Slickedit's hotfix mechanism uses _xmlcfg_get_value to get the value of the Defect nodes in the function hotfixGetFixDescriptions below.  _xmlcfg_get_attribute gets the value of the attribute.


Code: [Select]
<Defect Ids="12138" Modules="window.e">
List untitled windows in Windows list.
</Defect>

Code: [Select]
static _str hotfixGetFixDescriptions(int handle)
{
   // the text is PCDATA
   description := "";

   // now get the individual defect descriptions
   typeless defects[];
   status := _xmlcfg_find_simple_array(handle, "/HotFix/Defect", defects);
   if (defects._length() > 0) {
      description :+= "<ul>";
      foreach (auto node in defects) {
         modules := _xmlcfg_get_attribute(handle, node, "Modules");
         ids     := _xmlcfg_get_attribute(handle, node, "Ids");
         if (modules=='') modules="general fix";
         description :+= "<li><font color=\"darkred\">":+modules:+"</font> -- ";
         text_node := _xmlcfg_get_first_child(handle, node, VSXMLCFG_NODE_PCDATA);
         if (text_node > 0) {
            _str defect_info = _xmlcfg_get_value(handle, text_node);
            description :+= stranslate(defect_info, " ", "[\t\n\r]",'r');
         }
         description :+= "</li>";
      }
      description :+= "</ul>";
   }

   // that's all folks
   return description;
}

Title: Re: Convert Keil uVision Workspace
Post by: roguebear on November 10, 2011, 01:46:01 am
great! It works . thank you very much.
  to get the text value, must use.

foreach(auto node ....)
 
then use _...get_firstchild_...

then....

    now, I can go on my works.
Title: Re: Convert Keil uVision Workspace
Post by: koji on December 10, 2013, 08:44:29 am
has uvprojconv.e for uv4 come out? can sb share it?  :) :) :)