Re: glib on Symbian



> For example, in gdate.c,
>
>     static gboolean using_twodigit_years = FALSE;
>
> would become
>
>     #if defined(__SYMBIAN32__) && defined(EMULATOR)
>        PLS(using_twodigit_years,gdate, gboolean)
>        #define using_twodigit_years   (*FUNCTION_NAME(using_twodigit_years
> ,gdate)()
>     #else
>         static gboolean using_twodigit_years = FALSE;
>     #endif

OK, I see, I think it would be cleaner to do it like this: in gdate.c
the only change would be to have:

GLIB_STATIC (gboolean, using_twodigit_years, FALSE);

and then have the GLIB_STATIC macro defined in some suitable header:

#if defined(__SYMBIAN32__) && defined(EMULATOR)
#  define GLIB_STATIC(type, name, initvalue) \
      PLS(name, type) \
      static type PTR_name(void) \
      { \
        static type value = initvalue; \
        return &value; \
      }
#else
#  define GLIB_STATIC(type, name, initvalue) type name = initvalue
#endif

and then have a preprocessing script that changes all occurences of
identifiers that are seen in GLIB_STATIC() macros to
(*PTR_identiifier) instead, i.e. for instance it would change all uses
of using_twodigit_years to *(PTR_using_twodigit_years) after it sees
the GLIB_STATIC (gboolean, using_twodigit_years, FALSE) in gdate.c

(This is just a quick sketch, no idea if it actually would work in
general, etc.)

--tml


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]