IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Objective-C Discussion :

[Objective-C] Macro Mac OS X ?


Sujet :

Objective-C

  1. #1
    Membre expérimenté Avatar de Ceylo
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2007
    Messages
    1 216
    Détails du profil
    Informations personnelles :
    Âge : 33
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 216
    Points : 1 312
    Points
    1 312
    Par défaut [Objective-C] Macro Mac OS X ?
    Bonjour à tous,

    Je cherche désespéremment le nom de la macro définie uniquement sur l'OS Mac OS X de façon à pouvoir écrire mon code Objective-C en fonction de l'OS sur lequel mon projet sera compilé. Afin d'être le plus portable possible, voici les OS que j'ai déjà pris en compte dans mon code :

    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
    #if defined(linux) || defined(__linux__) /* linux -> GLX */
     
    /* use : glXGetCurrentContext() */
     
    #elif defined(_MSDOS) || defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN__) /* windows -> WGL */
     
    /* use : wglGetCurrentContext() */
     
    #elif defined() /* mac os x -> AGL */
     
    /* use : algGetCurrentContext() */
     
    #else
    #error unknown OS
    #endif

    Voilà, je ne sais pas quoi mettre pour #elif defined() /* mac os x -> AGL */. J'ai bien essayé __MACOS__, MACOS, macos, __macos__, macosx, MACOSX, __MACOSX__, __macosx__ mais rien à faire, je ne trouve pas.

    Merci,

    Bon développement

  2. #2
    Membre éprouvé

    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    733
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2005
    Messages : 733
    Points : 1 119
    Points
    1 119
    Par défaut
    et _MACOS?

  3. #3
    Membre expérimenté Avatar de Ceylo
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2007
    Messages
    1 216
    Détails du profil
    Informations personnelles :
    Âge : 33
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 216
    Points : 1 312
    Points
    1 312
    Par défaut
    Non plus. Peut-être qu'il faut include un fichier d'en-tête présent sur tous les OS et qui définit cette macro, mais je n'ai aucune idée duquel.

  4. #4
    Membre expérimenté Avatar de Ceylo
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2007
    Messages
    1 216
    Détails du profil
    Informations personnelles :
    Âge : 33
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 216
    Points : 1 312
    Points
    1 312
    Par défaut
    J'ai trouvé ça dans /usr/include/TargetConditionals.h. Je crois que c'est le bon filon.

    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    #if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
     
    #endif

    D'ailleurs dedans j'ai les macros de tous les autres OS, c'est cool.

    Edit: en fait j'ai toutes les infos :

    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
     
    /****************************************************************************************************
     
        TARGET_CPU_*    
        These conditionals specify which microprocessor instruction set is being
        generated.  At most one of these is true, the rest are false.
     
            TARGET_CPU_PPC          - Compiler is generating PowerPC instructions
            TARGET_CPU_68K          - Compiler is generating 680x0 instructions
            TARGET_CPU_X86          - Compiler is generating x86 instructions
            TARGET_CPU_MIPS         - Compiler is generating MIPS instructions
            TARGET_CPU_SPARC        - Compiler is generating Sparc instructions
            TARGET_CPU_ALPHA        - Compiler is generating Dec Alpha instructions
     
     
        TARGET_OS_* 
        These conditionals specify in which Operating System the generated code will
        run. At most one of the these is true, the rest are false.
     
            TARGET_OS_MAC           - Generate code will run under Mac OS
            TARGET_OS_WIN32         - Generate code will run under 32-bit Windows
            TARGET_OS_UNIX          - Generate code will run under some unix flavor
     
     
        TARGET_RT_* 
        These conditionals specify in which runtime the generated code will
        run. This is needed when the OS and CPU support more than one runtime
        (e.g. Mac OS X supports CFM and mach-o).
     
            TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
            TARGET_RT_BIG_ENDIAN    - Generated code uses big endian format for integers    
            TARGET_RT_MAC_CFM       - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
            TARGET_RT_MAC_MACHO     - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used
     
    ****************************************************************************************************/

  5. #5
    Expert confirmé
    Homme Profil pro
    Inscrit en
    Septembre 2006
    Messages
    2 936
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations forums :
    Inscription : Septembre 2006
    Messages : 2 936
    Points : 4 356
    Points
    4 356
    Par défaut
    man gcc

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    -dD Dump all macro definitions, at the end of preprocessing, in
                   addition to normal output.

  6. #6
    Membre expérimenté Avatar de Ceylo
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2007
    Messages
    1 216
    Détails du profil
    Informations personnelles :
    Âge : 33
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 216
    Points : 1 312
    Points
    1 312
    Par défaut
    En fait j'ai trouvé encore mieux grâce à la SDL dans SDL_platform.h :

    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
     
    /*
        SDL - Simple DirectMedia Layer
        Copyright (C) 1997-2006 Sam Lantinga
     
        This library is free software; you can redistribute it and/or
        modify it under the terms of the GNU Lesser General Public
        License as published by the Free Software Foundation; either
        version 2.1 of the License, or (at your option) any later version.
     
        This library is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
        Lesser General Public License for more details.
     
        You should have received a copy of the GNU Lesser General Public
        License along with this library; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     
        Sam Lantinga
        slouken@libsdl.org
    */
     
    /* Try to get a standard set of platform defines */
     
    #ifndef _SDL_platform_h
    #define _SDL_platform_h
     
    #if defined(_AIX)
    #undef __AIX__
    #define __AIX__		1
    #endif
    #if defined(AMIGA) || defined(__AMIGA) || defined(__amigados__)
    #undef __AMIGA__
    #define __AMIGA__	1
    #endif
    #if defined(__BEOS__)
    #undef __BEOS__
    #define __BEOS__	1
    #endif
    #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
    #undef __BSDI__
    #define __BSDI__	1
    #endif
    #if defined(_arch_dreamcast)
    #undef __DREAMCAST__
    #define __DREAMCAST__	1
    #endif
    #if defined(__FreeBSD__) || defined(__DragonFly__)
    #undef __FREEBSD__
    #define __FREEBSD__	1
    #endif
    #if defined(hpux) || defined(__hpux) || defined(__hpux__)
    #undef __HPUX__
    #define __HPUX__	1
    #endif
    #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
    #undef __IRIX__
    #define __IRIX__	1
    #endif
    #if defined(linux) || defined(__linux) || defined(__linux__)
    #undef __LINUX__
    #define __LINUX__	1
    #endif
    #if defined(__APPLE__)
    #undef __MACOSX__
    #define __MACOSX__	1
    #elif defined(macintosh)
    #undef __MACOS__
    #define __MACOS__	1
    #endif
    #if defined(__NetBSD__)
    #undef __NETBSD__
    #define __NETBSD__	1
    #endif
    #if defined(__OpenBSD__)
    #undef __OPENBSD__
    #define __OPENBSD__	1
    #endif
    #if defined(__OS2__)
    #undef __OS2__
    #define __OS2__		1
    #endif
    #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
    #undef __OSF__
    #define __OSF__		1
    #endif
    #if defined(__QNXNTO__)
    #undef __QNXNTO__
    #define __QNXNTO__	1
    #endif
    #if defined(riscos) || defined(__riscos) || defined(__riscos__)
    #undef __RISCOS__
    #define __RISCOS__	1
    #endif
    #if defined(__SVR4)
    #undef __SOLARIS__
    #define __SOLARIS__	1
    #endif
    #if defined(WIN32) || defined(_WIN32)
    #undef __WIN32__
    #define __WIN32__	1
    #endif
     
    #endif /* _SDL_platform_h */

    Les lignes les plus intéressantes pour moi sont celles-ci :
    Code C : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
     
    #if defined(linux) || defined(__linux) || defined(__linux__)
    #undef __LINUX__
    #define __LINUX__       1
    #endif
     
    #if defined(__APPLE__)
    #undef __MACOSX__
    #define __MACOSX__      1
    #elif defined(macintosh)
    #undef __MACOS__
    #define __MACOS__       1
    #endif
     
    #if defined(WIN32) || defined(_WIN32)
    #undef __WIN32__
    #define __WIN32__       1
    #endif

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. ouvrir un ole object de macro
    Par snow_cap dans le forum Visio
    Réponses: 0
    Dernier message: 03/10/2009, 18h02
  2. Passage macro Window =>Mac
    Par Jojo6 dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 13/06/2008, 17h18
  3. Réponses: 2
    Dernier message: 11/04/2008, 15h48
  4. [VBA] utilisation d'une macro excel 2003 sur excel 2004 for mac
    Par fofika dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 08/11/2007, 15h30
  5. [LOGICIEL] Macro WORD 2004 MAC
    Par tralalere dans le forum Apple
    Réponses: 1
    Dernier message: 10/08/2007, 17h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo