FreeOS.com logo

FreeOS Most Popular
* Most Read stories
* Commented Stories
* Active Categories
* Non Linux Section
* User Submitters
* Top Polls
* Top Authors
* Top Reviews
* Top Rated
* Top Search Terms

Top Articles
* Writing a Linux device driver
* The Linux filesystem explained
* Samba NT Domain Controller
* Setting up Squid as your caching HTTP/FTP proxy
* Web server tutorial - Part 1

FreeOS Highlights
* Howtos (72)
* Reviews (20)
* Opinions (18)
* Interviews (8)
* News (3)

My FreeOS

Nick:
Pass:
Register

Forgot your password?

Contact Us
Contact Us

       

Project: Linux triangle Articles triangle

More about Motor

By Konstantin Klyagin <konst@konst.org.ua>
Posted: ( 2001-05-31 06:16:00 EST by )

In this article we cover new features that appeared in motor after 2.6.3 version release. We will look into the reasons behind our deciding to implement them and explain why you might feel the need for them. This article can easily be considered a status report.

What is motor?

Motor is an IDE for Linux that works in the console and provides the developer with a useful mcedit-like editor, front-ends to the compiler, linker, debugger (gdb), concurrent version system (cvs), ctags, rpm, automake/autoconf and other useful things. It can also generate distribution packages in any format. Almost everything is done with templates, so any kind of language or distribution can be easily added.

New features

Autoconf/automake support

As autoconf/automake is a de-facto standard for Linux packages, we've been planning to implement support for it in motor for a long time. And now it's finally done. Most of files needed by automake are generated and updated by a script that resides inside.

Makefile.func (see below)

Using automake gives a developer a bunch of benefits such as automatic dependency tracking, ready-to-use standard Makefile targets such as `dist' to generate a tar.gz distribution package, `all' to build the binaries, `clean' and `distclean' to clear generated stuff, etc. So it must have been supported by motor long ago.

To use automake/autoconf with a project you write with motor, you are simply to set "makefile mode" to "automake" value on project creation. If you decided to migrate an existing one to automake, the option is accessible in the "project settings" dialog. Sometimes, it so happens that your Makefile.am's are accidentally removed or broken. In such cases motor has a facility to regenerate it. This can be achieved with selecting the "Project->Regen.build stuff" menu item. You might also need to make some alterations in your Makefile.am's or configure.in. All the files can be found in the "Build stuff" folder of the "Project files" dialog.

Gettext support

Another interesting feature motor 2.15.7 and later versions have is the gettext support. GNU gettext is a localization library designed especially to make Linux programs as well as other GNU software, speak various languages. Any language can be supported just with putting a single file to the special directory.

How it works with motor

Please note that it requires you to be quite familiar with `gettext'. You can turn `on' or `off' the feature with the "Use GNU gettext for internationalization" item either in the "Create a new project" window or, in the "Project settings" dialog.

But turning the option `on' is not enough. You have to create at least one translation file so gettext stuff can be included into your project. For example, you want to translate it into Russian. You open the "Project files" dialog, and add a file named "po/ru.po" to the "Miscellaneous files" folder. As soon as the dialog is closed, all the necessary programs are run and two directories are created. They are standard--named po/ and intl/.

Being familiar with GNU gettext, you know that to make a program multi-lingual you need to add certain code to its source. Usually it's done in the following way:

// ...

#ifdef ENABLE_NLS
#include <libintl.h>
#include <locale.h>
#define     _(c)     gettext(c)
#endif

// ...

int main() {
   // ...
#ifdef ENABLE_NLS
   setlocale(LC_ALL, "");
   bindtextdomain("progname", "/usr/share/locale");

      // Actually the directory for translation files should
      // be specified in a more flexible way, but I left it
      // hard-coded just to keep things simple.

   textdomain("progname);
#endif
   // ...
}

Having done all of this you can now, easily, add .po's to the "Miscellaneous files" folder. If you use automake, they will be compiled and installed automatically.

The magic functional Makefile

It became obvious that previous versions of motor needed more flexibility. Growing amount of external GNU tools needed to be called, more complex scripts, etc. So, we though about how we could group them and came up with a simple solution, to add a template for Makefile that does everything. Its `Makefile.func' and is called to compile and clean the binaries and object files, import files into CVS, call a debugger, and to generate automake required Makefile.am files too.

The output of Makefile.func is displayed every time the execution is performed. Actually it's quite customizable. If you don't want to see all of those annoying and chaotic messages, you can easily turn it off with the appropriate options in the "Motor settings" dialog. Options for compiler and CVS output are separate and hence you can control both of them.

Java support

Since the 2.15.7 release, motor supports Java. Though it's not that deep and great Java support JBuilder has. Motor cannot even debug Java programs, though it's planned for the future. What it can do about this nice language is just support its syntax and generate appropriable Makefiles with automake. Also, motor calls java VM to run a program from the IDE.

You need to have JDK and path to your javac and java binaries present on your PATH environment variable. To create a Java program just follow the standard project creation procedure. Don't forget to select the "terminal program/java" template for it. In the main class of your project, (that what's the "Result file name" from the "Project settings" dialog points to) you should have the standard public static void main() method, which is run when you press F12. That's all to it.

Other nifty facilities

We were often bothered by the fact that `gdb' stepped inside the standard template library (STL) source when passing parameters of string type, lists, vectors and other stuff. That's why we decided to implement an option not to step inside the standard headers when debugging. You can control such a behavior with the "Debug standard headers" option in the "Motor settings" dialog.

If we add some non-standard targets to the Makefile, motor is unable to execute them. But this is taken care by the new "Make a target" item in the "Project" sub-menu. You can add any targets there that are executed from motor, which shows their output.

Plans for future releases

We are frequently asked questions like: "What are you planning to implement in the next release of motor?" Well, here are the some features we plan to include in the future.

CVS front-end improvement

While using our self-made front-end for CVS with motor, we found something we may also need. Aside from checking in and out, viewing the file modification history and module releases, it would be really great to have a branching facility and ability to view `diffs' CVS can generate. Implementing this is a priority.

Regexper tool

This small feature can be of interest to those who like regular expressions and use it in their everyday programming. This will be a dialog that allows construction of regexps. It will try matching to various strings specified and if everything is ok, provide the programmer the ability to insert it into the source.

Sending signals to a program being run

Every time a program we write is being run, looking at the motor screen, we wonder why a developer cannot do anything there? So we think it's a good idea to add some functionality such as sending signals and such others instead of just reporting the program running.

About the author

Konstantin "konst" Klyagin, lives in Kharkov, Ukraine. He is a 4th year System Analysis student of the Kharkov State Polytechnical University. Having a decade of programming experience he currently works as a programmer for the Creative Data Decisions . Personal interests include computers, networking, programming, IT, Linux, digital innovations, art, painting, history, politics and heavy music. Konst's personal site: http://konst.org.ua/

Motor IDE homepage

Other articles by Konstantin Klyagin

Current Rating: [ 8.89 / 10 ] Number of Times Rated: [ 19 ]

More Articles
* Know Linux
* If I could re-write Linux
* Interview with Mozilla engineering director Chris Hofmann
* Response to SCO's Open Letter
* GNU Linux Security

Contents
Articles
  Howtos
  Interviews
  News
  Opinions
  Reviews
Comparison
Links
  Articles
  Howtos
  Interviews
  Opinions
  Reviews
  Websites
News

Linux
About Linux

Print It!
Printer Friendly Version