MCStas

Andrew Garrett agarrett at ccbsf0.kek.jp
Tue Nov 10 22:56:20 CET 1998


Kristian,

  Thanks for getting back to me so quickly, I'd like to get this working.  Pity it
wasn't the #line comments, I had high hopes for that being it, since it looked
fairly easy to fix...  One mis-communication, though.  I don't have a compiler
error, the program compiles just fine (under Boorland C++ 4.52, BTW)  I had to
replace the srtcasecmp statements, but can handle alloca without any problems.

  The problem comes when I run the program, calling MCStas with an instrument file -
I'm using linup-1, from your examples directory, renamed linup1.ins to avoid long
name problems.  I get an "illegal operation error" after starting the program,
nothing more specific than that, I'm afraid.  By inserting printf's into the main
program, I've been trying to track down where this occurs.

  In general, but not always, the program gets to the line in main(), 'err =
yyparse();'  I cannot get the program to compile if I put printf's inside yyparse()
though.  When seraching for the component, it does make one call to
try_open_component, and tries to find a file with a .comp extension, but then it
fails after that, without making a second call.

  I'm still working on this, and will keep you informed.  If you've got any ideas,
please let me know.  Thanks,

  Andrew Garrett

> This file is not related to your problem. The #line bit just tells your
> C compiler that the following code was copied from a file of that name,
> so that error messages can refer to the original file. You can safely
> delete all the #line's, but that is unlikely to make any difference.
>
> You do not give much information, perhaps you could send me the exact
> error message of the compiler (and perhaps also information on what
> compiler you are using)?
>
> As far as I know, with Microsoft visual C two problems occur, both in
> the linker phase. One is a missing strcasecmp() function and one is a
> missing alloca() function. I believe you can solve this by replacing
> strcasecmp() with stricmp() (or plain strcmp() if stricmp also does not
> work); and by having the compiler define the preprocessor symbol MSDOS
> (or put the line '#define MSDOS 1' in mcstas.h).
>
> >   As to other changes that have been required, most have revolved around
> > the file system, changing the separator '/' to '\'.  Also, I had to
>
> Yes.
>
> > declare the variable read_components in mcstas.h as extern, or I got an
> > error for this being declared in every file.  I'm not sure if that will
> > cause problems down the road - was that defined anywhere else?
>
> Yes, this is a bug! I have fixed it in my source, it wil be in the next version.
>
> >   Thanks for your help,
>
> You are welcome. Let me know what you find; once we get it working you
> should send me your changes so that the next version of McStas works
> with Windows.
>
>  - Kristian.





More information about the mcstas-users mailing list