From bob@ca.nrc.iit.ai Tue Aug  9 20:28:32 1994
Received: from castle.ed.ac.uk by aiai.ed.ac.uk; Tue, 9 Aug 94 20:28:28 BST
Received: from itisgate.nrc.ca by castle.ed.ac.uk id aa11034; 9 Aug 94 20:27 BST
Message-Id: <9408091923.AA26449@ai.iit.nrc.ca>
Date: Tue, 9 Aug 94 15:23:36 EDT
From: Bob Orchard <bob@ca.nrc.iit.ai>
To: J.Smart@ed
Subject: wx FuzzyCLIPS
Status: REO

Julian:

I have finally finished the creation of modified versions of wxfuzzy
for the PC and for Sun systems (open look). There are 2 files that
have the executables and a few other files (including a dynamic demo).

1. wxfuzzy.zip    - PC
2. wxfuzzy.tar.Z  - Sun

found on ai.iit.nrc.ca in pub/fzclips.

I would expect you might want to update your distributed version. 
I have not included everything but can send any other files you
might want. Below is a set of notes I made about the effort in 
getting things up and running. In particular note item 12 below 
since it explains why your version did not work correctly (pattern.h).


Regards, Bob.



---------------------------------------------------------
Some Notes on making wxlib and other wx related libraries and programs - August 1994

R. Orchard, NRCC


Unix (Sun) Version
------------------

NOTE: using sun's CC to compile C++ code and cc comand to compile CLIPS/FuzzyCLIPS code.

1. In wxutils.cc had problems with redefinition of major and minor in wxGetOSVersion

   - did #undef major
         #undef minor

    before this function definition.

2. In wb_list.cc and wb_form.cc va_start, va_end, va_arg, va_list were all redefined.

   - added #undef va_start
           #undef va_end
           #undef va_arg
           #undef va_list

     before the #include <stdarg> because some include references xview/pkg.h which includes
     <varargs.h> and <stdarg.h> and <varargs.h> are not compatable.

3. Similar changes for wx_utils.cc (as in 2 above).

   Also put the #include's fro wx_setup, wx_utils and wx_menu before the #include for <stdarg.h>.
   Also added #undef major
              #undef minor
   as in 1 above.
   Also commented out the 'select' definition and uncommented the 'gethostname' definition.

4. Needed to create a lib directory under wxlib

5. When making the Hello Demo could not find sb_scrol.o (was not created!).
   Changed makefile.unx (wxwin/src/x) to force it to be created --
        added lines    xview:  objects_ol/sb_scrol.o
                               make -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol

        after the motif: definition

6. Commented out the XLIB and XINCLUDE definitions in makefile.unx (wxwin/src/x).

7. For all sample programs in their respective makefiles (makefile.unx) 

     - removed DEBUG = gdb and WARN = Wall 
     - removed -lg++ from the LDLIBS definition

8. Couldn't successfully make prologio -- problem with varargs.h in utils/prologio/src/read.cc

9. fixed wxinstall so it would 

     make -wxtree  (make -wxgraph)
  
   rather than 

     make -tree (make -graph)

10. For wxgraph had va_start, va_end problem as in 2 above.
    Also had to undef min and max which were defined somewhere.

11. Tex2rtf failed -- undefined symbol  ___start_libm


FuzzyCLIPS related

12. The following files replace the FuzzyCLIPS 6.02 files.

    (if nor comments then used the file distributed with wxfuzzy)

    classexm.c
    classcom.c
    clsltpsr.c
    commline.c - changed the definition of the routine ExecuteBatcFile to read
                          ExecuteBatchFile( filename )
                          char *filename;
                 so it would compile with a non-ANSI compiler.
    defins.c
    factcom.c
    genrcpsr.c
    inherpsr.c
    insmngr.c
    inspsr.c
    multifld.c
    multifun.c
    strngfun.c
    sysdep.c
    expressn.c
    msgpsr.c
    engine.h
    pattern.h  - changed so that the line 

                     #if (!defined(NO_PATTERN_PARSER) && !defined(WXCLIPS))

                 read

                     #if !defined(NO_PATTERN_PARSER)

                 since it would not work properly when compiling CLIPS/FuzzyCLIPS files
                 and with wxclips.cc and wx_cmds.cc at the same time. 

                 NOTE: this was the reason that wxfuzzy did not work on the PC as
                       distributed since some routines did not have proper declarations

                 Also repositioned the #if stmt to be before the #if ANSI line since the 
                 scope of the #if was incorrect.

The files listed below should also be used with wxfuzzy. They are 'new' files modified to
fix known problems as described in README.BUGS in pub/fzclips od ai.iit.nrc.ca. These 
modified files can be found in pub/fzclips/fixes.602A.  

   cfdef.c  fuzzycom.c fuzzylhs.c  fuzzypsr.c  fuzzyrhs.c  fuzzyutl.c
   macmain.c  main.c  xmain.c

(the last 3 are not needed for wxfuzzy)


13. Changed makefile.unx for wxwin/utils/wxclips/src :

# Default is to use XView
# gnu stuff
#DEBUG = -ggdb
#WARN = -Wall

#Sun CC stuff
DEBUG =
WARN =

OPT =
GUI = -Dwx_xview
XVIEW_LINK = $(WXDIR)/src/x/objects_ol/sb_scrol.o
# Must match option in utils/objects/src/makefile.unx, since it changes the header 

CPPFLAGS = $(XINCLUDE) $(INC) -I$(CLIPSDIR)/src -I$(CLIPS2CINC) $(CLIPSOPTIONS) $(GUI) $(DEBUG) $(WARN) $(OPT)
CFLAGS =
LDFLAGS = $(XLIB) -L$(WXDIR)/lib -L$(CLIPSDIR)/lib -L$(CMDSDIR)/lib
# gnu stuff
#LDLIBS = -lclips -lwxcmds_ol -lwx_ol -lxview -lolgx -l
.
.
.
wx:
	cd $(WXDIR)/src/x; make -f makefile.unx

$(CLIPSLIB):
	cd $(CLIPSDIR)/src; make -f makefile.unx      <--- added

clips:
	cd $(CLIPSDIR)/src; make -f makefile.unx


14. Had some problems creating wxclips_ol since setup.h was set with ANSI_COMPILER to 0
    for cc when FuzzyCLIPS library was created BUT needed to be 1 for CC when compiling
    wxclips.cc and wx_cmds.cc. Copied setup.h to same directory as wxclips.cc and added
    #include "setup.h" to wxclips.cc and wx_cmds.cc so it would get definitons from this
    directory.

15. Added the user function sqr for use with fuzzyCLIPS (normally referenced in main.c).
    This required changing a number of files:

    clipscpp.h and clipscp2.h - added declaration for DefineFunction2
    wxclips.cc - added the #include "setup.h"
     
/* following include added at NRCC -- if using nonANSI C compiler for clips and
   ANSI CC compiler for this file must do something like this!! */
#include "setup.h"
#include "clips.h"

    changed the UserFunctions function as follows:

#if FUZZY_DEFTEMPLATES

extern "C" double my_sqr(void);

#endif  /* end of #if FUZZY_DEFTEMPLATES */



void UserFunctions()
{
  wxUserFunctions();

.
.
.


#if FUZZY_DEFTEMPLATES

/* functions for use with fuzzy modifiers - defined in FUZZYUTL.C */

  DefineFunction2("sqr",'d', PTIF my_sqr, "my_sqr", "11n");

#endif  /* end of #if FUZZY_DEFTEMPLATES */

}



There may have been other changes that were made to some makefiles but this describes the major 
effort to get things up and running on the sun with CC and cc being used.



Effort for the PC Version
-------------------------

Once the file pattern.h was correct as discussed in 12 above, the PC version was created
without much trouble.

To create the clipslib use:

    nmake -f makefile.dos clipslib FINAL=1

To create wxclips.exe (fuzzy version) use:

   nmake -f makefile.dos wxclips.exe WXWIN=\wxwin CWORK=\wxfuzzy FINAL=1

   (where \wxwin is place where wxwin is installed and wxfuzzy is where directory
    src has the correct fuzzyCLIPS source files)


