Compiling Aladdin for Windows


Jeong-Rae Cho (e-mail : chojr@kict.re.kr) has ported Aladdin to Windows using DJGPP compiler, the GNU gcc complier for Dos or Windows platform. DJGPP with bison & flex utility is available from www.delorie.com.

The method to compile is as follows:

  1. In the first part of grammar.y, insert the definition of exteranal variable fip, finp.
    %{
    #include  
    #include  "defs.h"
    #include  "units.h"
    #include  "matrix.h"
    #include  "fe_database.h"
    #include  "symbol.h"
    #include  "code.h"
     
    extern FILE *fin;                <- inserted
    extern FILE *finp;              <- inserted
     
    #define   Code2(c1,c2)     Code(c1); Code(c2)
    #define   Code3(c1,c2,c3)  Code(c1); Code(c2); Code(c3)
    #define   Code5(c1,c2,c3,c4,c5)  Code(c1); Code(c2); Code(c3); Code(c4);
                                     Code(c5)
    

  2. The last part of init.c, replace MyMalloc function to MyCalloc function, because MyMalloc function has a serious problem in memory initialization.
        for (i = 0; i < NO_PARAMETERS; i++) {
            s = build_table(fe_parameters[i].name, QUAN, 0.0);
     
            s->u.q =        (QUANTITY *) MyCalloc(1,sizeof(QUANTITY));
            s->u.q->value   = fe_parameters[i].value;
            if(UNITS_SWITCH==ON) {
               s->u.q->dimen   = (DIMENSIONS *)MyCalloc(1,sizeof(DIMENSIONS));
               ZeroUnits(s->u.q->dimen);
               s->u.q->dimen->units_type = SI_US;
            }
        } 
    

  3. Change CC=cc to
      CC = gcc
    

    in Makefile

  4. Download Dos versions of the Bison and flex utilities from www.delorie.com . Compile Aladdin in command line as followings:
    > bison -y -d grammar.y
    > ren y.tab.c grammar.c                           
    > make
    

  5. If there is Dos version of mv unix command, simple type make.


Using Visual C++ 6.0, the step-by-step procedure for creating a Windows version of Aladdin 2.1 is as follows:

  1. Download Dos versions of the Bison and flex utilities from www.delorie.com .

  2. In the first part of grammar.y, insert the definition of exteranal variable fip, finp.
    %{
    #include  
    #include  "defs.h"
    #include  "units.h"
    #include  "matrix.h"
    #include  "fe_database.h"
    #include  "symbol.h"
    #include  "code.h"
     
    extern FILE *fin;       <- inserted
    extern FILE *finp;      <- inserted
     
    #define   Code2(c1,c2)     Code(c1); Code(c2)
    #define   Code3(c1,c2,c3)  Code(c1); Code(c2); Code(c3)
    #define   Code5(c1,c2,c3,c4,c5)  Code(c1); Code(c2); Code(c3); Code(c4);
                                     Code(c5)
    

  3. The last part of init.c, replace MyMalloc function to MyCalloc function, because MyMalloc function has a serious problem in memory initialization.
        for (i = 0; i < NO_PARAMETERS; i++) {
            s = build_table(fe_parameters[i].name, QUAN, 0.0);
     
            s->u.q =        (QUANTITY *) MyCalloc(1,sizeof(QUANTITY));
            s->u.q->value   = fe_parameters[i].value;
            if(UNITS_SWITCH==ON) {
               s->u.q->dimen   = (DIMENSIONS *)MyCalloc(1,sizeof(DIMENSIONS));
               ZeroUnits(s->u.q->dimen);
               s->u.q->dimen->units_type = SI_US;
            }
        } 
    

  4. In the line 592 of fe_print.c, add the semicolon
        m1 = val_arg(arg_ptr, MATRIX*);
    

  5. In command line,
        > bison -y -d grammar.y
        > ren y.tab.c grammar.c                           
    

  6. Make workspace with Visual C++ 6.0. The target application is Win32 Console Application.

  7. Add all .C files to the workspace and build.

The above method is for Aladdin version 2.1. If version 1.0, additional correction is needed;

  1. In grammar.c, alloca function need to be defined by _alloca

  2. In grammar.c, index function need to be replaced by strchr


Developed in August 2000 by Mark Austin,
Copyright © 2000, Mark Austin, University of Maryland.