Ira L. Gershenhorn & Co., Inc.
mgFargo - Translate Magic control files to flat source files
[ What's New | Downloads | How To | Feedback | Bugs | Background | Copyright

[ Previous| Next| Random Site| List Sites| Home]

ActiveState Tool Corp for Perl
mgFargo (formerly known as Mgtrans) is a utility that dumps your control file to source files having C-like statement syntax allowing the use of traditional text processing tools.

Latest News

  9 December 2006   MgFargo perl-only version 0.804   This is a 9.4-only release. It may work with other versions of 9, but it definitely will not work with any version below 9.
  9 December 2006   MgFargo perl-only version 0.615   Fixes some 8.3 issues. Works better with text editors that recognize and color C code
  31 January 2005   Mgtrans perl-only version 0.611     Fixes a few 8.3 issues.
  09 November 2001   Mgtrans executable version 0.604     Fixes many 8.3 issues. This is a major revision.
  25 November 2000    Mgtrans executable version 0.589      Same as script, but you don't need to install Perl or Perlcrt.dll.
  25 November 2000    Mgtrans Wizard version 1.01      Supports the executable. Screen Shot
  25 November 2000 script version 0.589      Release to support the executable version of the script.


Recent Program Updates

Want to be able to really understand your own code? Try this!

How mgtrans output is best viewed

Click here to see the best way to view mgtrans output files.

Other Functionality - mgtrans-22.e and doc_ezr.eng

Click here to see epsilon macros which can convert 5.xx program document exports to a readable format -- no need to export the whole application.

Bug Report Summary. :-(

Sample Output of mgtrans

Now, about this script...

Yes, this is a Perl script.  And by publishing this in script form, I'm letting it all hang out.  Its not great Perl. Its not elegant.  It was written by a rank beginner.  I think its easily modifiable.  If I were doing it again I'd make better use of Perl's ability to remember where it is in a search. And, maybe, because its not great Perl, its also not tricky Perl, so what's happening should be fairly obvious to most programmers.


I created the mgtrans utility so I could work with Magic PC applications in ways I had grown accustomed with C projects.  It allowed me to do the following: I'm distributing this free because I think its useful, and maybe, if someone else likes it, they may pitch in with improving it.  Check it out.  I'll listen and maybe even implement your suggestions. 
Mgtrans output helps you read the code.  A good Magician needs a fabulous memory.  My memory's not what it used to be.  Magic lets you see your code, but only in snippets.  Showing the expression for the current line helps but there's nothing like seeing big chunks of code at once.   I've always found the presentation very fragmented.  And nothing about the organization of the statements tells you anything about the operation of your code.  I expect blocks to be indented!

Allows you to search the code for anything.  What if I want to know every place a variable is set or used in a task, program, application, or which program is emitting a particular warning message, or do I have blocks of code common to more than one program? Since the output is just text, you can use any off-the-shelf tools to process it.

Assignment statements are always coded as: "variable <tab> =".  Search on that and you won't get confused with other references to the variable.

Compare versions of the code.  If my group releases a new version of a program and now some function no longer works the same, I can compare the two versions and find out immediately what was changed to cause the different behavior.  BTW, the ediff-buffers function in NT Emacs version 20 shows the differences color-coded word-by-word.

What does the generated output look like? I tried to make it look like C without curly braces.  Download and try it, or, look at this directory where I used version 0.587 to generate the source for Magic 8.30's Monitor application.  The fields area needs some work.  Here is the documentation for mgtrans in HTML. I use the mgtrans output with either Lugaru Epsilon or GNU Emacs text editors.  These editors are wonderful for searching and their grep functions support next-previous match commands, where after you do a search, with one command you can go from match to match with the editor automatically opening the file and positioning you to the match.  I have made a minor modification to Epsilon that puts the name of the task on the buffer's status line (screen shot).  I've also enabled C-style code coloring (screen shot). 

mgtrans is written in Perl.  It was developed on the standard version 5.04.  I have currently run it on ActiveState's 5.006 Build 620.   I have also generated an executable from the script, mgtrans-0589.exe, that runs without Perl installed.  This was made possible by Perl2Exe.

If you want to use the script form of mgtrans or any of the other Perl scripts, you will need to install Perl.  My recommendation is that you install ActiveState Perl Community Edition (free)


The mgtrans program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The mgtrans program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.


I'm open to comments and suggestions.  I like to give credit where its due, so if you don't mind me mentioning your name when I implement your suggestion or bugfix, please indicate so.  I will only use someone's name if given permission.

Lugaru Epsilon

Lugaru Software, Ltd. makes the Epsilon Programmer's Editor, an advanced EMACS-style programmer's text editor for Windows, DOS, and OS/2.


Emacs is available from a number of suppliers.  The most prolific is the Free Software Foundation, home of the GNU ("Gnu's Not Unix") Project.  They distribute GNU Emacs.  On NT and Windows 95, the most common version of Emacs is NT Emacs, a direct port of GNU Emacs.  For help with installing Emacs, do an Altavista search using: nt emacs


Orange County Magic User Group

[ What's New | Downloads | How To | Feedback | Bugs | Background | Copyright ]

Last Updated: Nov 09 2001      Copyright  © 1998,1999,2000,2001 Ira L. Gershenhorn.  All rights reserved.