[VCDImager Bugs/Devel] Re: macos port
Herbert Valerio Riedel <[email protected]> 04 Mar 2003 15:14:58 +0100
| Newsgroups | gmane.comp.gnu.vcdimager.bugs |
|---|---|
| Organization | HVRLAB |
| Message-ID | <[email protected]> |
just fyi, [email protected] is meant for developers... :-) On Mon, 2003-03-03 at 14:28, Rolando Abarca (aka funkaster) wrote: > Hi, > I compiled the code in the cvs repository and it's working. I only had a > problem with some structures that needed to be packed. > In vcd_types.h you define this: > #if !defined(__GNUC__) && !defined(macintosh) > /* should work with most EDG-frontend based compilers */ > # define PRAGMA_BEGIN_PACKED _Pragma("pack(1)") > # define PRAGMA_END_PACKED _Pragma("pack()") > #else > /* for GCC we try to use GNUC_PACKED instead */ > # define PRAGMA_BEGIN_PACKED > # define PRAGMA_END_PACKED > #endif > the problem here (at least for MacOS) is that I can't include preprocessor > directives in a preprocessor directive, although #pragma is not really a > preprocessor directive. that's what ISO C99's _Pragma() is for btw... otherwise I would have used '#pragma' directly above... > So a simple solution was to add -align packed to > the C compiler options. This packs every structure. I don't know the side > effects of this. most likely some structures defined in the standard system headers will get compacted as well... the question remains, whether this changes anything relevant on the ABI level... > Another solution could be to add #ifdef macintosh/#endif > between every struct that needs to be packed and there add the #pragma. ...extremely ugly :-/ of course you can do that, but I won't add something like that to CVS so soon... > One last thing: I don't know how you feel about this macos port, I mean if > you want it to be "official" or just unsopported. I can send you the files > that needed some changes to make them work with macos... if the changes are minimal, I'll most likely merge them, but stuff like adding #ifdef macintosh around various places is not going to be merged... ;-) > #include <stdio.h> /* square root by Newton's zero-finder method */ > #include <float.h> /* by Rolando Abarca rabarca at ing.uchile.cl */ > int main(int c, char* v[]){if (c==2){long d=atol(v[1]);double r1,r2=0; > double E=DBL_MIN;for(r1=(1+d)/2;((r1-r2>0)?r1-r2:r2-r1)>E;){r2=r1;r1=( > r2+d/r2)/2;}printf("%.15f\n",r1);}else printf(" usage: fsqrt <n>\n");} -- Herbert Valerio Riedel / Phone: (EUROPE) +43-1-58801-18840 Email: [email protected] / Finger [email protected] for GnuPG Public Key GnuPG Key Fingerprint: 7BB9 2D6C D485 CE64 4748 5F65 4981 E064 883F 4142