NOTES.msvc revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw Microsoft Visual C Stuff
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw[Tom Moog 2-Oct-98
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw Users of Microsoft Visual C++ should download a separate
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ready-to-run zip file from my web site. It contains
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw binaries, static library, and a sample project.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw[
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw Two notes added by Tom Moog 23-Sep-97. I believe the *.dsp and
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *.mak files that were once at the end of this file are now obsolete.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw The following MSVC .dsp and .mak files for pccts and sorcerer
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw were contributed by Stanislaw Bochnak (S.Bochnak@microtool.com.pl)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw and Jeff Vincent (jvincent@novell.com)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw PCCTS Distribution Kit
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ----------------------
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh pccts/antlr/AntlrMSVC50.dsp
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw pccts/antlr/AntlrMSVC50.mak
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw pccts/dlg/DlgMSVC50.dsp
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown pccts/dlg/DlgMSVC50.mak
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as pccts/support/genmk/watgenmk.mak
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw pccts/support/msvc.dsp
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan Wright Sorcerer Distribution Kit
b1352070d318187b41b088da3533692976f3f225Alan Wright -------------------------
b1352070d318187b41b088da3533692976f3f225Alan Wright pccts/sorcerer/SorcererMSVC50.dsp
b1352070d318187b41b088da3533692976f3f225Alan Wright pccts/sorcerer/SorcererMSVC50.mak
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan Wright pccts/sorcerer/lib/msvc.dsp
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan Wright I do not have an MS based computer. If you discover problems
b1352070d318187b41b088da3533692976f3f225Alan Wright please report them so as to save trouble for others in the future.
b1352070d318187b41b088da3533692976f3f225Alan Wright]
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan Wright[
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown Modified by Terence Parr (September 1995) to change .C to .cpp
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown]
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown[
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown This file contains notes on MSVC for Windows NT console execs by Dave
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown Seidel and an explanation of flags etc.. by John Hall; good luck,
b1352070d318187b41b088da3533692976f3f225Alan Wright Terence
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown]
037cac007b685e7ea79f6ef7e8e62bfd342a4d56joyce mcintosh
b1352070d318187b41b088da3533692976f3f225Alan Wright===============================================================================
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwDate: Sat, 31 Dec 1994 11:40:36 -0500 (EST)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan BrownFrom: David Seidel <75342.2034@compuserve.com>
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan BrownI've succesfully build 1.31b3 with djgpp for DOS and MSVC 2.0 for Windows
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwNT. The only (minor) problem I had was that GNU make (version 3.71, in the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwdjgpp port) complained about "multiple targets" in both the antlr and dlg
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwmakefiles. I got around the error by, in each makefile, commenting out the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw$(SRC) dependency, for example:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw antlr: $(OBJ) #$(SRC)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwI don't know why this is happenning, since you haven't changed that part of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwthe makefile at all, and I think this used to work ok...
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwHere are the makefiles I built from within the MSVC 2.0 environment for antlr
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwand dlg and Windows NT console executables. Please feel free to pass them
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwon. Of course, as soon as 1.31 "goes gold", I will send you nice new
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwbinaries. I'm not going to bother to keep doing both Borland and djgpp for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwDOS however. Instead, I'll just keep the djgpp version up to date and also
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownprovide WinNT binaries.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
7b59d02d2a384be9a08087b14defadd214b3c1ddjbDave
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb===============================================================================
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States How to port PCCTS 1.10 (and 1.32 hopefully) to Visual C++
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb By
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States John Hall <jhall@ivy.wpi.edu>
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United StatesHere is how to compile an ANTLR grammar in Visual C++. These steps
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbdescribe how to have your ANTLR grammar parse the input file the user
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United Statesselects when they choose File Open in your Windows application. (Even
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbif you aren't using Visual C++, the steps should be portable enough to
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbother compilers.)
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * Make sure that ANTLR and DLG generate ANSI code (use the -ga
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb switch).
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * Set the following compiler flags in Visual C++ (these are in the
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb Memory Model category of the compiler options in the Project
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb Options menu):
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb FLAG MEANING
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb ==== ==============================================================
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb /AL Large memory model (multiple data segments; data items must be
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb smaller than 64K).
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb /Gtn Allocates all items whose size is greater than or equal to n
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw in a new data segment. (I let n be 256: /Gt256.)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States /Gx- All references to data items are done with far addressing in
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States case they are placed in a far segment.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * Add the following member variable to the attributes section of your
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw derived CDocument class (you will need to make sure you also
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw include stdio.h):
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw FILE *fp;
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Add the following method to your derived CDocument class:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States BOOL CAppDoc::OnOpenDocument(const char* pszPathName)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States // Call CDocument's OnOpenDocument to do housekeeping for us
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States // DON'T add anything to the loading section of Serialize
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (!CDocument::OnOpenDocument(pszPathName))
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States return FALSE;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown // Open input file
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if ((fp = fopen(pszPathName, "r")) == NULL)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return FALSE;
b1352070d318187b41b088da3533692976f3f225Alan Wright
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb // Parse input file
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ANTLR(start(), fp);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
7b59d02d2a384be9a08087b14defadd214b3c1ddjb // Close input file
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb fclose(fp);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return TRUE;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan Wright (Note: additional code may be necessary, depending on your parser.
b1352070d318187b41b088da3533692976f3f225Alan Wright For example, if your parser uses PCCTS's symbol table library, you
b1352070d318187b41b088da3533692976f3f225Alan Wright will need to insert calls to zzs_init and zzs_done.)
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan Wright * Compile the generated C files as C++ files. (I renamed the files
b1352070d318187b41b088da3533692976f3f225Alan Wright to have a .CPP extension to fool Visual C++ into thinking they were
b1352070d318187b41b088da3533692976f3f225Alan Wright C++ files. One might also use the /Tp switch, but that switch
b1352070d318187b41b088da3533692976f3f225Alan Wright requires you separately include the filename.) [I used this step
b1352070d318187b41b088da3533692976f3f225Alan Wright as an easy out for all the external linking errors I was getting
b1352070d318187b41b088da3533692976f3f225Alan Wright that I couldn't fix by declaring things extern "C".]
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown
b1352070d318187b41b088da3533692976f3f225Alan Wright * Make sure the __STDC__ portion of the generated files gets
b1352070d318187b41b088da3533692976f3f225Alan Wright compiled. (Either define __STDC__ yourself or else change all
b1352070d318187b41b088da3533692976f3f225Alan Wright occurrences of __STDC__ to __cplusplus in the generated files. You
b1352070d318187b41b088da3533692976f3f225Alan Wright can define __STDC__ in the Preprocessor category of the compiler
b1352070d318187b41b088da3533692976f3f225Alan Wright options.)
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan Wright ================================================================
b1352070d318187b41b088da3533692976f3f225Alan Wright = Note 23-Sep-97: This is probably not necessary any more. =
b1352070d318187b41b088da3533692976f3f225Alan Wright = With 1.33MRxxx the use of __STDC__ was replaced with the =
b1352070d318187b41b088da3533692976f3f225Alan Wright = macro __USE_PROTOS to control the compilation of prototypes. =
b1352070d318187b41b088da3533692976f3f225Alan Wright ================================================================
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan WrightThat last step is important for Visual C++, but may not apply to other
b1352070d318187b41b088da3533692976f3f225Alan Wrightcompilers. For C++ compilers, whether __STDC__ is defined is
b1352070d318187b41b088da3533692976f3f225Alan Wrightimplementation dependent (ARM, page 379). Apparently, Visual C++ does
b1352070d318187b41b088da3533692976f3f225Alan Wrightnot to define it; it also does not support "old style" C function
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwdefinitions (which is okay, according to page 404 of the ARM). Those
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtwo things together caused problems when trying to port the code.
b1352070d318187b41b088da3533692976f3f225Alan WrightWhen it saw this:
b1352070d318187b41b088da3533692976f3f225Alan Wright
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as#ifdef __STDC__
b1352070d318187b41b088da3533692976f3f225Alan Wrightvoid
b1352070d318187b41b088da3533692976f3f225Alan Wrightglobals(AST **_root)
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as#else
b1352070d318187b41b088da3533692976f3f225Alan Wrightglobals(_root)
b1352070d318187b41b088da3533692976f3f225Alan WrightAST **_root;
b1352070d318187b41b088da3533692976f3f225Alan Wright#endif
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan Wrightit skipped the __STDC__ section and tried to process the "old style"
b1352070d318187b41b088da3533692976f3f225Alan Wrightfunction definition, where it choked.
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan WrightWhen you finally get your parser to compile and link without error,
b1352070d318187b41b088da3533692976f3f225Alan Wrightyou may get General Protection Fault errors at run time. The problem
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United StatesI had was that a NULL was passed to a variable argument function
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Stateswithout an explicit cast. The function grabbed a pointer (32-bits)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesoff the stack using va_arg, but the NULL was passed silently as the
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesinteger 0 (16 bits), making the resulting pointer was invalid. (This
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Stateswas in PCCTS's sample C parser.)
b1352070d318187b41b088da3533692976f3f225Alan Wright
b1352070d318187b41b088da3533692976f3f225Alan WrightThere is one other thing I might suggest to help you avoid a run-time
b1352070d318187b41b088da3533692976f3f225Alan Wrighterror. Make sure you redefine the default error reporting function,
b1352070d318187b41b088da3533692976f3f225Alan Wrightzzsyn. To do this, put "#define USER_ZZSYN" in your #header section
b1352070d318187b41b088da3533692976f3f225Alan Wrightand put your own zzsyn somewhere. You can then pop up a MessageBox or
b1352070d318187b41b088da3533692976f3f225Alan Wrightprint the error to some output window.
b1352070d318187b41b088da3533692976f3f225Alan Wright===============================================================================
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States