How to Compile Musixflx.exe for MS-DOS using Borland Turbo C Purpose: To describe a method by which one can restructure and recompile musixflx.c using the FREE Borland Turbo C compiler. Problem: Some older PCs cannot run the compiled musixflx.exe provided with the MusixTex distribution. Also, some users may want to make local changes or recompile it for various reasons. However, certain free C compilers manifest problems when compiling some C code. (Discussing all the various problems is beyond the scope of this article.) Caveat: This article is a bit much, but this is primarily for the "newbies"... Other whiners or complainers should see the final thought at the very end. Background: The original musixflx was (apparently) developed and compiled in the Unix context, using Gcc (for which there is an MSDOS Port.) Gcc implements a "flat" memory model, meaning that all memory available is considered to be one big area with no internal boundaries. Following a simplistic approach, all data for musixflx is stored in large arrays, set up to be bigger than what the most demanding user might need. (This avoids the complications of dynamic memory allocation... maybe that is what should be fixed! :-)) Whatever one's opinion on that issue, as musixflx grew, to handle more cases of "this and that," so also did the internal data arrays until they eventually became too large for the limited "memory partitions" enforced by some of the older C compilers (like Borland Turbo C!) Recently Borland placed the Turbo C 2.01 compiler package in their on-line museum, making it free for all, which provides a simple, yet very significant C compiler for those who are able to download the file and install it. It is great(!!) that Borland Turbo C 2.01 is now free, mainly because it does support older PCs, and it is very simple to install. (Did I mention that it also is very stable?!)... However, it enforces size constraints on static data, such that some of the data needed for musixflx, when grouped together, is rejected because it is too many bytes for the maximum storage allowed for one Turbo C module. The solution is simply to move chunks of static data into as many separate modules as needed to avoid exceeding the limits imposed by the compiler. This method describes that process in a few simple, but detailed steps, such that anyone should be able to restructure the musixflx code and ultimately compile musixflx.exe with Turbo C 2.01. System Requirements: IBM PC (286 or better) with Internet Access. Skills: Ability to work in MS-DOS (console windows) on the PC and make modifications to text files. Process: 1) Download and install the Free Borland Turbo C 2.01 Package available at: http://community.borland.com/museum/borland/software/TC201.zip Install the package and make sure that the installation path (e.g. C:\TC) is added to the PATH variable under MS-DOS. (To do that, you may need to modify C:\autoexec.bat, adding ";C:\TC" at the end of the PATH= statement, or you can temporarily add it to the path once you are in the MS-DOS console window.) To check out your installation: Start an MSDOS console window (MS-DOS Prompt). (For some, this can be selected from START->PROGRAMS->MS-DOS Prompt. If you don't see that, look under PROGRAMS-> ACCESSORIES. No Luck? You can always click START, then RUN and type COMMAND.COM in the box... :-(( At the Dos Prompt type... (I assume you know that C:\> illustrates the prompt provided by the system, but you only type "PATH" followed by the enter key)... C:\> PATH You should see C:\TC in the list of directories printed out. IF NOT, then enter C:\> PATH=C:\TC;%PATH% Now, enter PATH again and see if it is present. (CAUTION: If you had to do this, then you may want to put C:\TC in your PATH statement in C:\Autoexec.bat, and REBOOT. Otherwise, you will need to do the second step EACH TIME you restart the MS-DOS Window.) Finally, type... C:\> tcc You should see the Turbo C 2.01 help screen, explaining compiler options. 2) Obtain the musixflx.c source code from the MusixTex distribution. For this example, the source code in MusixTex .T98 is used (unchanged since .T83). Place the file in a working directory on your PC. (For this example I assume that you created C:\MFX and placed musixflx.c in that directory.) Note: In all the examples below, the Musixflx.c Line Numbers given imply that you are working with the file musixflx.c obtained from the distribution for MusixTex .T98. (Adjust as needed to get the results shown!). 3) Using any suitable editor (Notepad will work fine for this activity), do the following steps... Make sure that all files are placed in the same directory as the musixflx.c file, (which I assume is C:\MFX.)... a) Create the file "globsize.h" and COPY (NOT CUT) lines 42 - 44 from musixflx.c into this file... The end result should look like this: ---- globsize.h starts on the next line -------------- #define MAX_SIGNS 128 /* max signature changes */ #define MAX_SECTIONS 128 /* max sections */ #define MAX_BARS 2048 /* max number of bars */ ---- globsize.h ended at the line above -------------- b) Create the file "ma.c" which includes a new first line, and then the contents of musixflx.c:line 58, edited as shown below (replace the final comma with a ;). The final result should look like this: ---- ma.c starts on the next line ------------ #include "globsize.h" double hardbarlength[MAX_BARS], softbarlength[MAX_BARS]; ---- ma.c ended at the line above ------------- c) Create the file "mb.c" with a new first line, and the contents from musixflx.c:Line 59, edited as shown below (add "double " to at the start, and replace the final comma with a ;). The final result should look like this: ---- mb.c starts on the next line -------- #include "globsize.h" double width_leftrightrepeat[MAX_BARS], width_leftrepeat[MAX_BARS]; ---- mb.c ended at the line above -------- d) Create the file "mc.c" with a new first line, and the contents from musixflx.c:Lines 60-62, edited as shown below. (Add "double " to the beginning of the second line.) ---- mc.c starts on the next line ----- #include "globsize.h" double eff_hardlength[MAX_SECTIONS], eff_softlength[MAX_SECTIONS], oldsignskip[MAX_SIGNS], signskip[MAX_SIGNS], futuresignskip[MAX_SIGNS], tempholdskip, hardsign /* jh-1 */; ---- mc.c ended at the line above ---- Make sure all four files are saved and in the same directory as musixflx.c. 4) Edit musixflx.c to make a two minor changes, as follows: a) Change musixflx.c line 2... (Add +TCC to the version string.) Was(2)--> #define MYVERSION "/T.63dt+jh.2\0" /* Revision jh.2 jh-2 */ New(2)--> #define MYVERSION "/T.63dt+jh.2+TCC\0" /* Revised for TURBO C Compile */ (This change will keep you, and others from confusing the distributed version from your special compiled version.) b) Change musixflx.c line 58... (Add extern at the start of the line.) Was(58)--> double hardbarlength[MAX_BARS], softbarlength[MAX_BARS], New(58)--> extern double hardbarlength[MAX_BARS], softbarlength[MAX_BARS], Save these changes. It is now time to compile! 5) Compiling a revised Musixflx.exe... a) Start an MS-DOS Window (... an "MS-DOS Prompt.") See step 1 if you don't know what this means. Change the default directory to be C:\MFX... CD \MFX (... if that is the name you used...) b) (Check) Type the command DIR (and press enter)... You should see at least the following files in the list of files: ma.c mb.c mc.c globsize.h musixflx.c c) (Check) Type the command TCC (and press enter)... You should see a full screen report of all the compiler options and command line syntax. If you see this, you are ready to compile. If not, then either Turbo C is not installed in the path you think it is (C:\TC ?) or your PATH does not include C:\TC ... As a last resort, try entering PATH=C:\TC;%PATH% and then enter TCC again. Assuming everything checks out as expected... d) Compile the files by entering the following command: TCC -mh musixflx.c ma.c mb.c mc.c The response on your screen should look something like this... Turbo C Version 2.01 Copyright (c) 1987, 1988 Borland International musixflx.c: ma.c: mb.c: mc.c: Turbo Link Version 2.0 Copyright (c) 1987, 1988 Borland International Available memory 295582 <--- (Your mileage may vary :-) If you have any errors, recheck all files and changes carefully. You should now have a file "musixflx.exe" and when you enter MUSIXFLX, you should see the following printout: <<< musixflex 0.83/T.63dt+jh.2+TCC >>> ... decoding command line Usage: musixflx filename [d|f|s] (optional for debug modes) e) Copy this new MUSIXFLX.EXE to replace the distributed version, (if desired), and use it at needed. Helpful Win95 Hint: You can start "Notepad" from the DOS command prompt by simply entering (for example...) notepad musixflx.c Then you can edit files with Windows tools, while keeping the MS-DOS window open for command line entry. (You can also start Windows applications by typing START application.ext. This is really quick for files that are associated with a given windows tool. For example "START MYWORD.DOC" should start Microsoft Word, editing MYWORD.DOC if you have that on your system. (Just for fun, try "START EXPLORER ." ). Acknowledgments: Credit goes to Dirk Laurie (author of M-Tx) for calling my attention to this issue in the first place (over a year ago) and for outlining the general solution! Final Thought: If you didn't need to know this, Good For You! However, everyone was a newbie once, and everyone is still a "newbie" on a great many subjects! Joel Hunsberger [EMAIL PROTECTED] Other References of possible interest (all FREE): MusixTex Archive: ftp://ftp.gmd.de/music/README.html DJGPP: http://www.delorie.com/djgpp/ LCC-WIN: ftp://ftp.cs.virginia.edu/pub/lcc-win32/lccwin32.exe Borland Turbo Pascal 5.5: http://community.borland.com/museum/borland/software/TP55.zip Borland C++ (Free Command Line Tools): ftp://ftpd.inprise.com/download/bcppbuilder/FreeCommandLineTools.exe You may need to enter via... http://www.borland.com/bcppbuilder/freecompiler/cppc55steps.html JFE - A nice C/C++ editor: http://home.t-online.de/home/Jens.Altmann/jfe.htm Syedit - Another nice editor: http://www.mkidesign.com/synedit/info.html The TeX Online Catalog (links to CTAN): ftp://ftp.cdrom.com/pub/tex/ctan/help/Catalogue/catalogue.html C Tutorials: http://www.astentech.com/tutorials/C.html C++ Tutorials: http://www.astentech.com/tutorials/Cpp.html TeX FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html
