Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » "aspect" keyword blocks use of AspectC++

This thread is locked; no one can reply to it. rss feed Print
"aspect" keyword blocks use of AspectC++
Hans Van Broeckhoven
Member #5,529
February 2005

a grep through allegro's include files showed me the use of the variable name 'aspect' in the following file : matrix.h.

This makes allegro completely unusable by the aspectc++ weaver (www.aspectc.org) since aspect is the keyword for defining aspects (as class is a keyword for defining classes in regular C++).

this is a big bummer for my thesis-project :-X

Kitty Cat
Member #2,815
October 2002
avatar

You can try this:

#define aspect _ugly_aspect
#include <allegro.h>
#undef aspect

it's quite ugly, but it might work.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Elias
Member #358
May 2000

Very clever of them creating an extension, which defines a word as new keyword likely being used in existing code :P I mean, why didn't they call it $aspect or something?

Anyway, try this: [Edit: beaten by KittyCat]

Or if there's no way to work around it like this, I wouldn't mind a patch against Allegro to change it, after all we had to change paramters named "y1" and "index" for similiar reasons (although libc is a much stronger reason to change things than aspect).

--
"Either help out or stop whining" - Evert

Krzysztof Kluczek
Member #4,191
January 2004
avatar

Quote:

Very clever of them creating an extension, which defines a word as new keyword likely being used in existing code :P I mean, why didn't they call it $aspect or something?

Ever tried compiling RPG written in C using C++? ;) 'class' (and 'new', too) are quite common there. :)

Thomas Fjellstrom
Member #476
June 2000
avatar

Thats why you always compile C code with a C compiler.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Thomas Harte
Member #33
April 2000
avatar

If I were you, I'd just sever the matrix code from Allegro. Do you really use it at all?

Elias
Member #358
May 2000

Personally, I think we should put all the 3d + matrix code into an addon.

But then, what about backwards compatibility and so on? Dropping backwards compatibility here would be a precedence for dropping it in other places, and so we'd end up trying to do Allegro 5, and history would repeat itself.. :)

[Edit: That is, just removing it in his local copy might be a good idea..]

--
"Either help out or stop whining" - Evert

Thomas Harte
Member #33
April 2000
avatar

Quote:

Personally, I think we should put all the 3d + matrix code into an addon.

But then, what about backwards compatibility and so on?

Why not drop it into a 'semi addon', i.e. an addon included in the core Allegro distribution and installed by default but one that may be disabled by issueing the correct commandline to make? The only precedent you'd set would be for people being able to not build the library with the bits they don't want if those bits are easy to sever.

Elias
Member #358
May 2000

Yes, making it modular. Definitely what we should do. In fact, it should already work.. simply don't include allegro.h, but directly the things you need, like allegro/base.h, allegro/graphics.h, and not allegro/matrix.h and allegro/3d.h and so on.

--
"Either help out or stop whining" - Evert

HoHo
Member #4,534
April 2004
avatar

Another way of doing it would be to predefine whatever #defines the headers define(e.g ALLEGRO_3D_H) one don't want to include prior to #including allegro.h.

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

Peter Wang
Member #23
April 2000

The attached patch is enough, isn't it? I would akkept it.

Raf256
Member #3,501
May 2003

Quote:

Ever tried compiling RPG written in C using C++? ;) 'class' (and 'new', too) are quite common there. :)

Rotfl :D

Evert
Member #794
November 2000
avatar

Quote:

This makes allegro completely unusable by the aspectc++ weaver (www.aspectc.org) since aspect is the keyword for defining aspects (as class is a keyword for defining classes in regular C++).

While I think it's nice to have a workaround for this, I do think that it's not really Allegro's fault for not working on a platform it doesn't support at the moment.

Quote:

Personally, I think we should put all the 3d + matrix code into an addon.

Just dump it in the compatibility layer for 4.3 and be done with it.

Hans Van Broeckhoven
Member #5,529
February 2005

the #define aspect _blah_aspect-trick indeed works! tnx for that...
I had allready changed the sources myself. the only files needing change are :
matrix.h
math3d.c
in functions :
void get_camera_matrix(...);
void get_camera_matrix_f(...);
get_scaling_matrix_f(...);

Now there's still some other stuff necessary to make ac++ work with my allegro-program, but none of it is allegro's "fault"...

Tnx for the help...
Hans

EDIT:

In the meantime I have an allegro-program working together with aspectc++, but had some problems also with _asm used in \ALLEGRO\include\allegro\platform\al386vc.h.

I've been told the _asm keyword is obsolote and MSVC only supports it for compatibility with previous versions (I used the free VC2003Toolkit (VC 7.0) command line compiler).

supported is : asm, _asm or _asm

so i heard.

this can ofcourse be easily solved by adding
#define _asm __asm

Peter Wang
Member #23
April 2000

Does anyone know which versions of MSVC support which of the _asm, _asm, and _asm variants?

Chris Katko
Member #1,881
January 2002
avatar

MSVC6 supports _asm and __asm.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Go to: