glib/gobject/gparamspecs.c
changeset 18 47c74d1534e1
equal deleted inserted replaced
0:e4d67989cc36 18:47c74d1534e1
       
     1 /* GObject - GLib Type, Object, Parameter and Signal Library
       
     2  * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
       
     3  * Portions copyright (c) 2006-2009 Nokia Corporation.  All rights reserved.
       
     4  *
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Lesser General
       
    16  * Public License along with this library; if not, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 /*
       
    22  * MT safe
       
    23  */
       
    24 
       
    25 #include "config.h"
       
    26 
       
    27 #include <string.h>
       
    28 
       
    29 #include "gparamspecs.h"
       
    30 #include "gvaluecollector.h"
       
    31 #include "gvaluearray.h"
       
    32 #include "gobjectalias.h"
       
    33 
       
    34 #ifdef __SYMBIAN32__
       
    35 #include "gobject_wsd.h"
       
    36 #endif /* __SYMBIAN32__ */
       
    37 /**
       
    38  * SECTION:param_value_types
       
    39  * @short_description: Standard Parameter and Value Types
       
    40  * @see_also: #GParamSpec, #GValue, g_object_class_install_property().
       
    41  * @title: Parameters and Values
       
    42  *
       
    43  * #GValue provides an abstract container structure which can be
       
    44  * copied, transformed and compared while holding a value of any
       
    45  * (derived) type, which is registered as a #GType with a
       
    46  * #GTypeValueTable in its #GTypeInfo structure.  Parameter
       
    47  * specifications for most value types can be created as #GParamSpec
       
    48  * derived instances, to implement e.g. #GObject properties which
       
    49  * operate on #GValue containers.
       
    50  *
       
    51  * Parameter names need to start with a letter (a-z or A-Z). Subsequent
       
    52  * characters can be letters, numbers or a '-'.
       
    53  * All other characters are replaced by a '-' during construction.
       
    54  */
       
    55 
       
    56 
       
    57 #define	G_FLOAT_EPSILON		(1e-30)
       
    58 #define	G_DOUBLE_EPSILON	(1e-90)
       
    59 
       
    60 #if EMULATOR
       
    61 
       
    62 PLS(g_param_spec_types ,gparamspecs,GType *)
       
    63 #define g_param_spec_types  (*FUNCTION_NAME(g_param_spec_types ,gparamspecs)())
       
    64 
       
    65 #endif /* EMULATOR */
       
    66 
       
    67 
       
    68 /* --- param spec functions --- */
       
    69 static void
       
    70 param_char_init (GParamSpec *pspec)
       
    71 {
       
    72   GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec);
       
    73   
       
    74   cspec->minimum = 0x7f;
       
    75   cspec->maximum = 0x80;
       
    76   cspec->default_value = 0;
       
    77 }
       
    78 
       
    79 static void
       
    80 param_char_set_default (GParamSpec *pspec,
       
    81 			GValue	   *value)
       
    82 {
       
    83   value->data[0].v_int = G_PARAM_SPEC_CHAR (pspec)->default_value;
       
    84 }
       
    85 
       
    86 static gboolean
       
    87 param_char_validate (GParamSpec *pspec,
       
    88 		     GValue     *value)
       
    89 {
       
    90   GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec);
       
    91   gint oval = value->data[0].v_int;
       
    92   
       
    93   value->data[0].v_int = CLAMP (value->data[0].v_int, cspec->minimum, cspec->maximum);
       
    94   
       
    95   return value->data[0].v_int != oval;
       
    96 }
       
    97 
       
    98 static void
       
    99 param_uchar_init (GParamSpec *pspec)
       
   100 {
       
   101   GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec);
       
   102   
       
   103   uspec->minimum = 0;
       
   104   uspec->maximum = 0xff;
       
   105   uspec->default_value = 0;
       
   106 }
       
   107 
       
   108 static void
       
   109 param_uchar_set_default (GParamSpec *pspec,
       
   110 			 GValue	    *value)
       
   111 {
       
   112   value->data[0].v_uint = G_PARAM_SPEC_UCHAR (pspec)->default_value;
       
   113 }
       
   114 
       
   115 static gboolean
       
   116 param_uchar_validate (GParamSpec *pspec,
       
   117 		      GValue     *value)
       
   118 {
       
   119   GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec);
       
   120   guint oval = value->data[0].v_uint;
       
   121   
       
   122   value->data[0].v_uint = CLAMP (value->data[0].v_uint, uspec->minimum, uspec->maximum);
       
   123   
       
   124   return value->data[0].v_uint != oval;
       
   125 }
       
   126 
       
   127 static void
       
   128 param_boolean_set_default (GParamSpec *pspec,
       
   129 			   GValue     *value)
       
   130 {
       
   131   value->data[0].v_int = G_PARAM_SPEC_BOOLEAN (pspec)->default_value;
       
   132 }
       
   133 
       
   134 static gboolean
       
   135 param_boolean_validate (GParamSpec *pspec,
       
   136 			GValue     *value)
       
   137 {
       
   138   gint oval = value->data[0].v_int;
       
   139   
       
   140   value->data[0].v_int = value->data[0].v_int != FALSE;
       
   141   
       
   142   return value->data[0].v_int != oval;
       
   143 }
       
   144 
       
   145 static void
       
   146 param_int_init (GParamSpec *pspec)
       
   147 {
       
   148   GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
       
   149   
       
   150   ispec->minimum = 0x7fffffff;
       
   151   ispec->maximum = 0x80000000;
       
   152   ispec->default_value = 0;
       
   153 }
       
   154 
       
   155 static void
       
   156 param_int_set_default (GParamSpec *pspec,
       
   157 		       GValue     *value)
       
   158 {
       
   159   value->data[0].v_int = G_PARAM_SPEC_INT (pspec)->default_value;
       
   160 }
       
   161 
       
   162 static gboolean
       
   163 param_int_validate (GParamSpec *pspec,
       
   164 		    GValue     *value)
       
   165 {
       
   166   GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
       
   167   gint oval = value->data[0].v_int;
       
   168   
       
   169   value->data[0].v_int = CLAMP (value->data[0].v_int, ispec->minimum, ispec->maximum);
       
   170   
       
   171   return value->data[0].v_int != oval;
       
   172 }
       
   173 
       
   174 static gint
       
   175 param_int_values_cmp (GParamSpec   *pspec,
       
   176 		      const GValue *value1,
       
   177 		      const GValue *value2)
       
   178 {
       
   179   if (value1->data[0].v_int < value2->data[0].v_int)
       
   180     return -1;
       
   181   else
       
   182     return value1->data[0].v_int > value2->data[0].v_int;
       
   183 }
       
   184 
       
   185 static void
       
   186 param_uint_init (GParamSpec *pspec)
       
   187 {
       
   188   GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec);
       
   189   
       
   190   uspec->minimum = 0;
       
   191   uspec->maximum = 0xffffffff;
       
   192   uspec->default_value = 0;
       
   193 }
       
   194 
       
   195 static void
       
   196 param_uint_set_default (GParamSpec *pspec,
       
   197 			GValue     *value)
       
   198 {
       
   199   value->data[0].v_uint = G_PARAM_SPEC_UINT (pspec)->default_value;
       
   200 }
       
   201 
       
   202 static gboolean
       
   203 param_uint_validate (GParamSpec *pspec,
       
   204 		     GValue     *value)
       
   205 {
       
   206   GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec);
       
   207   guint oval = value->data[0].v_uint;
       
   208   
       
   209   value->data[0].v_uint = CLAMP (value->data[0].v_uint, uspec->minimum, uspec->maximum);
       
   210   
       
   211   return value->data[0].v_uint != oval;
       
   212 }
       
   213 
       
   214 static gint
       
   215 param_uint_values_cmp (GParamSpec   *pspec,
       
   216 		       const GValue *value1,
       
   217 		       const GValue *value2)
       
   218 {
       
   219   if (value1->data[0].v_uint < value2->data[0].v_uint)
       
   220     return -1;
       
   221   else
       
   222     return value1->data[0].v_uint > value2->data[0].v_uint;
       
   223 }
       
   224 
       
   225 static void
       
   226 param_long_init (GParamSpec *pspec)
       
   227 {
       
   228   GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec);
       
   229   
       
   230 #if SIZEOF_LONG == 4
       
   231   lspec->minimum = 0x7fffffff;
       
   232   lspec->maximum = 0x80000000;
       
   233 #else /* SIZEOF_LONG != 4 (8) */
       
   234   lspec->minimum = 0x7fffffffffffffff;
       
   235   lspec->maximum = 0x8000000000000000;
       
   236 #endif
       
   237   lspec->default_value = 0;
       
   238 }
       
   239 
       
   240 static void
       
   241 param_long_set_default (GParamSpec *pspec,
       
   242 			GValue     *value)
       
   243 {
       
   244   value->data[0].v_long = G_PARAM_SPEC_LONG (pspec)->default_value;
       
   245 }
       
   246 
       
   247 static gboolean
       
   248 param_long_validate (GParamSpec *pspec,
       
   249 		     GValue     *value)
       
   250 {
       
   251   GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec);
       
   252   glong oval = value->data[0].v_long;
       
   253   
       
   254   value->data[0].v_long = CLAMP (value->data[0].v_long, lspec->minimum, lspec->maximum);
       
   255   
       
   256   return value->data[0].v_long != oval;
       
   257 }
       
   258 
       
   259 static gint
       
   260 param_long_values_cmp (GParamSpec   *pspec,
       
   261 		       const GValue *value1,
       
   262 		       const GValue *value2)
       
   263 {
       
   264   if (value1->data[0].v_long < value2->data[0].v_long)
       
   265     return -1;
       
   266   else
       
   267     return value1->data[0].v_long > value2->data[0].v_long;
       
   268 }
       
   269 
       
   270 static void
       
   271 param_ulong_init (GParamSpec *pspec)
       
   272 {
       
   273   GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec);
       
   274   
       
   275   uspec->minimum = 0;
       
   276 #if SIZEOF_LONG == 4
       
   277   uspec->maximum = 0xffffffff;
       
   278 #else /* SIZEOF_LONG != 4 (8) */
       
   279   uspec->maximum = 0xffffffffffffffff;
       
   280 #endif
       
   281   uspec->default_value = 0;
       
   282 }
       
   283 
       
   284 static void
       
   285 param_ulong_set_default (GParamSpec *pspec,
       
   286 			 GValue     *value)
       
   287 {
       
   288   value->data[0].v_ulong = G_PARAM_SPEC_ULONG (pspec)->default_value;
       
   289 }
       
   290 
       
   291 static gboolean
       
   292 param_ulong_validate (GParamSpec *pspec,
       
   293 		      GValue     *value)
       
   294 {
       
   295   GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec);
       
   296   gulong oval = value->data[0].v_ulong;
       
   297   
       
   298   value->data[0].v_ulong = CLAMP (value->data[0].v_ulong, uspec->minimum, uspec->maximum);
       
   299   
       
   300   return value->data[0].v_ulong != oval;
       
   301 }
       
   302 
       
   303 static gint
       
   304 param_ulong_values_cmp (GParamSpec   *pspec,
       
   305 			const GValue *value1,
       
   306 			const GValue *value2)
       
   307 {
       
   308   if (value1->data[0].v_ulong < value2->data[0].v_ulong)
       
   309     return -1;
       
   310   else
       
   311     return value1->data[0].v_ulong > value2->data[0].v_ulong;
       
   312 }
       
   313 
       
   314 static void
       
   315 param_int64_init (GParamSpec *pspec)
       
   316 {
       
   317   GParamSpecInt64 *lspec = G_PARAM_SPEC_INT64 (pspec);
       
   318   
       
   319   lspec->minimum = G_MININT64;
       
   320   lspec->maximum = G_MAXINT64;
       
   321   lspec->default_value = 0;
       
   322 }
       
   323 
       
   324 static void
       
   325 param_int64_set_default (GParamSpec *pspec,
       
   326 			GValue     *value)
       
   327 {
       
   328   value->data[0].v_int64 = G_PARAM_SPEC_INT64 (pspec)->default_value;
       
   329 }
       
   330 
       
   331 static gboolean
       
   332 param_int64_validate (GParamSpec *pspec,
       
   333 		     GValue     *value)
       
   334 {
       
   335   GParamSpecInt64 *lspec = G_PARAM_SPEC_INT64 (pspec);
       
   336   gint64 oval = value->data[0].v_int64;
       
   337   
       
   338   value->data[0].v_int64 = CLAMP (value->data[0].v_int64, lspec->minimum, lspec->maximum);
       
   339   
       
   340   return value->data[0].v_int64 != oval;
       
   341 }
       
   342 
       
   343 static gint
       
   344 param_int64_values_cmp (GParamSpec   *pspec,
       
   345 		       const GValue *value1,
       
   346 		       const GValue *value2)
       
   347 {
       
   348   if (value1->data[0].v_int64 < value2->data[0].v_int64)
       
   349     return -1;
       
   350   else
       
   351     return value1->data[0].v_int64 > value2->data[0].v_int64;
       
   352 }
       
   353 
       
   354 static void
       
   355 param_uint64_init (GParamSpec *pspec)
       
   356 {
       
   357   GParamSpecUInt64 *uspec = G_PARAM_SPEC_UINT64 (pspec);
       
   358   
       
   359   uspec->minimum = 0;
       
   360   uspec->maximum = G_MAXUINT64;
       
   361   uspec->default_value = 0;
       
   362 }
       
   363 
       
   364 static void
       
   365 param_uint64_set_default (GParamSpec *pspec,
       
   366 			 GValue     *value)
       
   367 {
       
   368   value->data[0].v_uint64 = G_PARAM_SPEC_UINT64 (pspec)->default_value;
       
   369 }
       
   370 
       
   371 static gboolean
       
   372 param_uint64_validate (GParamSpec *pspec,
       
   373 		      GValue     *value)
       
   374 {
       
   375   GParamSpecUInt64 *uspec = G_PARAM_SPEC_UINT64 (pspec);
       
   376   guint64 oval = value->data[0].v_uint64;
       
   377   
       
   378   value->data[0].v_uint64 = CLAMP (value->data[0].v_uint64, uspec->minimum, uspec->maximum);
       
   379   
       
   380   return value->data[0].v_uint64 != oval;
       
   381 }
       
   382 
       
   383 static gint
       
   384 param_uint64_values_cmp (GParamSpec   *pspec,
       
   385 			const GValue *value1,
       
   386 			const GValue *value2)
       
   387 {
       
   388   if (value1->data[0].v_uint64 < value2->data[0].v_uint64)
       
   389     return -1;
       
   390   else
       
   391     return value1->data[0].v_uint64 > value2->data[0].v_uint64;
       
   392 }
       
   393 
       
   394 static void
       
   395 param_unichar_init (GParamSpec *pspec)
       
   396 {
       
   397   GParamSpecUnichar *uspec = G_PARAM_SPEC_UNICHAR (pspec);
       
   398   
       
   399   uspec->default_value = 0;
       
   400 }
       
   401 
       
   402 static void
       
   403 param_unichar_set_default (GParamSpec *pspec,
       
   404 			 GValue     *value)
       
   405 {
       
   406   value->data[0].v_uint = G_PARAM_SPEC_UNICHAR (pspec)->default_value;
       
   407 }
       
   408 
       
   409 static gboolean
       
   410 param_unichar_validate (GParamSpec *pspec,
       
   411 		        GValue     *value)
       
   412 {
       
   413   gunichar oval = value->data[0].v_uint;
       
   414   gboolean changed = FALSE;
       
   415 
       
   416   if (!g_unichar_validate (oval))
       
   417     {
       
   418       value->data[0].v_uint = 0;
       
   419       changed = TRUE;
       
   420     }
       
   421 
       
   422   return changed;
       
   423 }
       
   424 
       
   425 static gint
       
   426 param_unichar_values_cmp (GParamSpec   *pspec,
       
   427 			const GValue *value1,
       
   428 			const GValue *value2)
       
   429 {
       
   430   if (value1->data[0].v_uint < value2->data[0].v_uint)
       
   431     return -1;
       
   432   else
       
   433     return value1->data[0].v_uint > value2->data[0].v_uint;
       
   434 }
       
   435 
       
   436 static void
       
   437 param_enum_init (GParamSpec *pspec)
       
   438 {
       
   439   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
       
   440   
       
   441   espec->enum_class = NULL;
       
   442   espec->default_value = 0;
       
   443 }
       
   444 
       
   445 static void
       
   446 param_enum_finalize (GParamSpec *pspec)
       
   447 {
       
   448   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
       
   449   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_ENUM));
       
   450   
       
   451   if (espec->enum_class)
       
   452     {
       
   453       g_type_class_unref (espec->enum_class);
       
   454       espec->enum_class = NULL;
       
   455     }
       
   456   
       
   457   parent_class->finalize (pspec);
       
   458 }
       
   459 
       
   460 static void
       
   461 param_enum_set_default (GParamSpec *pspec,
       
   462 			GValue     *value)
       
   463 {
       
   464   value->data[0].v_long = G_PARAM_SPEC_ENUM (pspec)->default_value;
       
   465 }
       
   466 
       
   467 static gboolean
       
   468 param_enum_validate (GParamSpec *pspec,
       
   469 		     GValue     *value)
       
   470 {
       
   471   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
       
   472   glong oval = value->data[0].v_long;
       
   473   
       
   474   if (!espec->enum_class ||
       
   475       !g_enum_get_value (espec->enum_class, value->data[0].v_long))
       
   476     value->data[0].v_long = espec->default_value;
       
   477   
       
   478   return value->data[0].v_long != oval;
       
   479 }
       
   480 
       
   481 static void
       
   482 param_flags_init (GParamSpec *pspec)
       
   483 {
       
   484   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
       
   485   
       
   486   fspec->flags_class = NULL;
       
   487   fspec->default_value = 0;
       
   488 }
       
   489 
       
   490 static void
       
   491 param_flags_finalize (GParamSpec *pspec)
       
   492 {
       
   493   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
       
   494   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_FLAGS));
       
   495   
       
   496   if (fspec->flags_class)
       
   497     {
       
   498       g_type_class_unref (fspec->flags_class);
       
   499       fspec->flags_class = NULL;
       
   500     }
       
   501   
       
   502   parent_class->finalize (pspec);
       
   503 }
       
   504 
       
   505 static void
       
   506 param_flags_set_default (GParamSpec *pspec,
       
   507 			 GValue     *value)
       
   508 {
       
   509   value->data[0].v_ulong = G_PARAM_SPEC_FLAGS (pspec)->default_value;
       
   510 }
       
   511 
       
   512 static gboolean
       
   513 param_flags_validate (GParamSpec *pspec,
       
   514 		      GValue     *value)
       
   515 {
       
   516   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
       
   517   gulong oval = value->data[0].v_ulong;
       
   518   
       
   519   if (fspec->flags_class)
       
   520     value->data[0].v_ulong &= fspec->flags_class->mask;
       
   521   else
       
   522     value->data[0].v_ulong = fspec->default_value;
       
   523   
       
   524   return value->data[0].v_ulong != oval;
       
   525 }
       
   526 
       
   527 static void
       
   528 param_float_init (GParamSpec *pspec)
       
   529 {
       
   530   GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec);
       
   531   
       
   532   fspec->minimum = -G_MAXFLOAT;
       
   533   fspec->maximum = G_MAXFLOAT;
       
   534   fspec->default_value = 0;
       
   535   fspec->epsilon = G_FLOAT_EPSILON;
       
   536 }
       
   537 
       
   538 static void
       
   539 param_float_set_default (GParamSpec *pspec,
       
   540 			 GValue     *value)
       
   541 {
       
   542   value->data[0].v_float = G_PARAM_SPEC_FLOAT (pspec)->default_value;
       
   543 }
       
   544 
       
   545 static gboolean
       
   546 param_float_validate (GParamSpec *pspec,
       
   547 		      GValue     *value)
       
   548 {
       
   549   GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec);
       
   550   gfloat oval = value->data[0].v_float;
       
   551   
       
   552   value->data[0].v_float = CLAMP (value->data[0].v_float, fspec->minimum, fspec->maximum);
       
   553   
       
   554   return value->data[0].v_float != oval;
       
   555 }
       
   556 
       
   557 static gint
       
   558 param_float_values_cmp (GParamSpec   *pspec,
       
   559 			const GValue *value1,
       
   560 			const GValue *value2)
       
   561 {
       
   562   gfloat epsilon = G_PARAM_SPEC_FLOAT (pspec)->epsilon;
       
   563   
       
   564   if (value1->data[0].v_float < value2->data[0].v_float)
       
   565     return - (value2->data[0].v_float - value1->data[0].v_float > epsilon);
       
   566   else
       
   567     return value1->data[0].v_float - value2->data[0].v_float > epsilon;
       
   568 }
       
   569 
       
   570 static void
       
   571 param_double_init (GParamSpec *pspec)
       
   572 {
       
   573   GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
       
   574   
       
   575   dspec->minimum = -G_MAXDOUBLE;
       
   576   dspec->maximum = G_MAXDOUBLE;
       
   577   dspec->default_value = 0;
       
   578   dspec->epsilon = G_DOUBLE_EPSILON;
       
   579 }
       
   580 
       
   581 static void
       
   582 param_double_set_default (GParamSpec *pspec,
       
   583 			  GValue     *value)
       
   584 {
       
   585   value->data[0].v_double = G_PARAM_SPEC_DOUBLE (pspec)->default_value;
       
   586 }
       
   587 
       
   588 static gboolean
       
   589 param_double_validate (GParamSpec *pspec,
       
   590 		       GValue     *value)
       
   591 {
       
   592   GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
       
   593   gdouble oval = value->data[0].v_double;
       
   594   
       
   595   value->data[0].v_double = CLAMP (value->data[0].v_double, dspec->minimum, dspec->maximum);
       
   596   
       
   597   return value->data[0].v_double != oval;
       
   598 }
       
   599 
       
   600 static gint
       
   601 param_double_values_cmp (GParamSpec   *pspec,
       
   602 			 const GValue *value1,
       
   603 			 const GValue *value2)
       
   604 {
       
   605   gdouble epsilon = G_PARAM_SPEC_DOUBLE (pspec)->epsilon;
       
   606   
       
   607   if (value1->data[0].v_double < value2->data[0].v_double)
       
   608     return - (value2->data[0].v_double - value1->data[0].v_double > epsilon);
       
   609   else
       
   610     return value1->data[0].v_double - value2->data[0].v_double > epsilon;
       
   611 }
       
   612 
       
   613 static void
       
   614 param_string_init (GParamSpec *pspec)
       
   615 {
       
   616   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
       
   617   
       
   618   sspec->default_value = NULL;
       
   619   sspec->cset_first = NULL;
       
   620   sspec->cset_nth = NULL;
       
   621   sspec->substitutor = '_';
       
   622   sspec->null_fold_if_empty = FALSE;
       
   623   sspec->ensure_non_null = FALSE;
       
   624 }
       
   625 
       
   626 static void
       
   627 param_string_finalize (GParamSpec *pspec)
       
   628 {
       
   629   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
       
   630   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_STRING));
       
   631   
       
   632   g_free (sspec->default_value);
       
   633   g_free (sspec->cset_first);
       
   634   g_free (sspec->cset_nth);
       
   635   sspec->default_value = NULL;
       
   636   sspec->cset_first = NULL;
       
   637   sspec->cset_nth = NULL;
       
   638   
       
   639   parent_class->finalize (pspec);
       
   640 }
       
   641 
       
   642 static void
       
   643 param_string_set_default (GParamSpec *pspec,
       
   644 			  GValue     *value)
       
   645 {
       
   646   value->data[0].v_pointer = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value);
       
   647 }
       
   648 
       
   649 static gboolean
       
   650 param_string_validate (GParamSpec *pspec,
       
   651 		       GValue     *value)
       
   652 {
       
   653   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
       
   654   gchar *string = value->data[0].v_pointer;
       
   655   guint changed = 0;
       
   656   
       
   657   if (string && string[0])
       
   658     {
       
   659       gchar *s;
       
   660       
       
   661       if (sspec->cset_first && !strchr (sspec->cset_first, string[0]))
       
   662 	{
       
   663           if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
       
   664             {
       
   665               value->data[0].v_pointer = g_strdup (string);
       
   666               string = value->data[0].v_pointer;
       
   667               value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
       
   668             }
       
   669 	  string[0] = sspec->substitutor;
       
   670 	  changed++;
       
   671 	}
       
   672       if (sspec->cset_nth)
       
   673 	for (s = string + 1; *s; s++)
       
   674 	  if (!strchr (sspec->cset_nth, *s))
       
   675 	    {
       
   676               if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
       
   677                 {
       
   678                   value->data[0].v_pointer = g_strdup (string);
       
   679                   s = (gchar*) value->data[0].v_pointer + (s - string);
       
   680                   string = value->data[0].v_pointer;
       
   681                   value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
       
   682                 }
       
   683 	      *s = sspec->substitutor;
       
   684 	      changed++;
       
   685 	    }
       
   686     }
       
   687   if (sspec->null_fold_if_empty && string && string[0] == 0)
       
   688     {
       
   689       if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
       
   690         g_free (value->data[0].v_pointer);
       
   691       else
       
   692         value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
       
   693       value->data[0].v_pointer = NULL;
       
   694       changed++;
       
   695       string = value->data[0].v_pointer;
       
   696     }
       
   697   if (sspec->ensure_non_null && !string)
       
   698     {
       
   699       value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
       
   700       value->data[0].v_pointer = g_strdup ("");
       
   701       changed++;
       
   702       string = value->data[0].v_pointer;
       
   703     }
       
   704 
       
   705   return changed;
       
   706 }
       
   707 
       
   708 static gint
       
   709 param_string_values_cmp (GParamSpec   *pspec,
       
   710 			 const GValue *value1,
       
   711 			 const GValue *value2)
       
   712 {
       
   713   if (!value1->data[0].v_pointer)
       
   714     return value2->data[0].v_pointer != NULL ? -1 : 0;
       
   715   else if (!value2->data[0].v_pointer)
       
   716     return value1->data[0].v_pointer != NULL;
       
   717   else
       
   718     return strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer);
       
   719 }
       
   720 
       
   721 static void
       
   722 param_param_init (GParamSpec *pspec)
       
   723 {
       
   724   /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
       
   725 }
       
   726 
       
   727 static void
       
   728 param_param_set_default (GParamSpec *pspec,
       
   729 			 GValue     *value)
       
   730 {
       
   731   value->data[0].v_pointer = NULL;
       
   732 }
       
   733 
       
   734 static gboolean
       
   735 param_param_validate (GParamSpec *pspec,
       
   736 		      GValue     *value)
       
   737 {
       
   738   /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
       
   739   GParamSpec *param = value->data[0].v_pointer;
       
   740   guint changed = 0;
       
   741   
       
   742   if (param && !g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec)))
       
   743     {
       
   744       g_param_spec_unref (param);
       
   745       value->data[0].v_pointer = NULL;
       
   746       changed++;
       
   747     }
       
   748   
       
   749   return changed;
       
   750 }
       
   751 
       
   752 static void
       
   753 param_boxed_init (GParamSpec *pspec)
       
   754 {
       
   755   /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
       
   756 }
       
   757 
       
   758 static void
       
   759 param_boxed_set_default (GParamSpec *pspec,
       
   760 			 GValue     *value)
       
   761 {
       
   762   value->data[0].v_pointer = NULL;
       
   763 }
       
   764 
       
   765 static gboolean
       
   766 param_boxed_validate (GParamSpec *pspec,
       
   767 		      GValue     *value)
       
   768 {
       
   769   /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
       
   770   guint changed = 0;
       
   771 
       
   772   /* can't do a whole lot here since we haven't even G_BOXED_TYPE() */
       
   773   
       
   774   return changed;
       
   775 }
       
   776 
       
   777 static gint
       
   778 param_boxed_values_cmp (GParamSpec    *pspec,
       
   779 			 const GValue *value1,
       
   780 			 const GValue *value2)
       
   781 {
       
   782   guint8 *p1 = value1->data[0].v_pointer;
       
   783   guint8 *p2 = value2->data[0].v_pointer;
       
   784 
       
   785   /* not much to compare here, try to at least provide stable lesser/greater result */
       
   786 
       
   787   return p1 < p2 ? -1 : p1 > p2;
       
   788 }
       
   789 
       
   790 static void
       
   791 param_pointer_init (GParamSpec *pspec)
       
   792 {
       
   793   /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */
       
   794 }
       
   795 
       
   796 static void
       
   797 param_pointer_set_default (GParamSpec *pspec,
       
   798 			   GValue     *value)
       
   799 {
       
   800   value->data[0].v_pointer = NULL;
       
   801 }
       
   802 
       
   803 static gboolean
       
   804 param_pointer_validate (GParamSpec *pspec,
       
   805 			GValue     *value)
       
   806 {
       
   807   /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */
       
   808   guint changed = 0;
       
   809   
       
   810   return changed;
       
   811 }
       
   812 
       
   813 static gint
       
   814 param_pointer_values_cmp (GParamSpec   *pspec,
       
   815 			  const GValue *value1,
       
   816 			  const GValue *value2)
       
   817 {
       
   818   guint8 *p1 = value1->data[0].v_pointer;
       
   819   guint8 *p2 = value2->data[0].v_pointer;
       
   820 
       
   821   /* not much to compare here, try to at least provide stable lesser/greater result */
       
   822 
       
   823   return p1 < p2 ? -1 : p1 > p2;
       
   824 }
       
   825 
       
   826 static void
       
   827 param_value_array_init (GParamSpec *pspec)
       
   828 {
       
   829   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
       
   830 
       
   831   aspec->element_spec = NULL;
       
   832   aspec->fixed_n_elements = 0; /* disable */
       
   833 }
       
   834 
       
   835 static inline guint
       
   836 value_array_ensure_size (GValueArray *value_array,
       
   837 			 guint        fixed_n_elements)
       
   838 {
       
   839   guint changed = 0;
       
   840 
       
   841   if (fixed_n_elements)
       
   842     {
       
   843       while (value_array->n_values < fixed_n_elements)
       
   844 	{
       
   845 	  g_value_array_append (value_array, NULL);
       
   846 	  changed++;
       
   847 	}
       
   848       while (value_array->n_values > fixed_n_elements)
       
   849 	{
       
   850 	  g_value_array_remove (value_array, value_array->n_values - 1);
       
   851 	  changed++;
       
   852 	}
       
   853     }
       
   854   return changed;
       
   855 }
       
   856 
       
   857 static void
       
   858 param_value_array_finalize (GParamSpec *pspec)
       
   859 {
       
   860   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
       
   861   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_VALUE_ARRAY));
       
   862 
       
   863   if (aspec->element_spec)
       
   864     {
       
   865       g_param_spec_unref (aspec->element_spec);
       
   866       aspec->element_spec = NULL;
       
   867     }
       
   868 
       
   869   parent_class->finalize (pspec);
       
   870 }
       
   871 
       
   872 static void
       
   873 param_value_array_set_default (GParamSpec *pspec,
       
   874 			       GValue     *value)
       
   875 {
       
   876   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
       
   877 
       
   878   if (!value->data[0].v_pointer && aspec->fixed_n_elements)
       
   879     value->data[0].v_pointer = g_value_array_new (aspec->fixed_n_elements);
       
   880 
       
   881   if (value->data[0].v_pointer)
       
   882     {
       
   883       /* g_value_reset (value);  already done */
       
   884       value_array_ensure_size (value->data[0].v_pointer, aspec->fixed_n_elements);
       
   885     }
       
   886 }
       
   887 
       
   888 static gboolean
       
   889 param_value_array_validate (GParamSpec *pspec,
       
   890 			    GValue     *value)
       
   891 {
       
   892   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
       
   893   GValueArray *value_array = value->data[0].v_pointer;
       
   894   guint changed = 0;
       
   895 
       
   896   if (!value->data[0].v_pointer && aspec->fixed_n_elements)
       
   897     value->data[0].v_pointer = g_value_array_new (aspec->fixed_n_elements);
       
   898 
       
   899   if (value->data[0].v_pointer)
       
   900     {
       
   901       /* ensure array size validity */
       
   902       changed += value_array_ensure_size (value_array, aspec->fixed_n_elements);
       
   903       
       
   904       /* ensure array values validity against a present element spec */
       
   905       if (aspec->element_spec)
       
   906 	{
       
   907 	  GParamSpec *element_spec = aspec->element_spec;
       
   908 	  guint i;
       
   909 	  
       
   910 	  for (i = 0; i < value_array->n_values; i++)
       
   911 	    {
       
   912 	      GValue *element = value_array->values + i;
       
   913 	      
       
   914 	      /* need to fixup value type, or ensure that the array value is initialized at all */
       
   915 	      if (!g_value_type_compatible (G_VALUE_TYPE (element), G_PARAM_SPEC_VALUE_TYPE (element_spec)))
       
   916 		{
       
   917 		  if (G_VALUE_TYPE (element) != 0)
       
   918 		    g_value_unset (element);
       
   919 		  g_value_init (element, G_PARAM_SPEC_VALUE_TYPE (element_spec));
       
   920 		  g_param_value_set_default (element_spec, element);
       
   921 		  changed++;
       
   922 		}
       
   923 	      /* validate array value against element_spec */
       
   924 	      changed += g_param_value_validate (element_spec, element);
       
   925 	    }
       
   926 	}
       
   927     }
       
   928 
       
   929   return changed;
       
   930 }
       
   931 
       
   932 static gint
       
   933 param_value_array_values_cmp (GParamSpec   *pspec,
       
   934 			      const GValue *value1,
       
   935 			      const GValue *value2)
       
   936 {
       
   937   GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
       
   938   GValueArray *value_array1 = value1->data[0].v_pointer;
       
   939   GValueArray *value_array2 = value2->data[0].v_pointer;
       
   940 
       
   941   if (!value_array1 || !value_array2)
       
   942     return value_array2 ? -1 : value_array1 != value_array2;
       
   943 
       
   944   if (value_array1->n_values != value_array2->n_values)
       
   945     return value_array1->n_values < value_array2->n_values ? -1 : 1;
       
   946   else if (!aspec->element_spec)
       
   947     {
       
   948       /* we need an element specification for comparisons, so there's not much
       
   949        * to compare here, try to at least provide stable lesser/greater result
       
   950        */
       
   951       return value_array1->n_values < value_array2->n_values ? -1 : value_array1->n_values > value_array2->n_values;
       
   952     }
       
   953   else /* value_array1->n_values == value_array2->n_values */
       
   954     {
       
   955       guint i;
       
   956 
       
   957       for (i = 0; i < value_array1->n_values; i++)
       
   958 	{
       
   959 	  GValue *element1 = value_array1->values + i;
       
   960 	  GValue *element2 = value_array2->values + i;
       
   961 	  gint cmp;
       
   962 
       
   963 	  /* need corresponding element types, provide stable result otherwise */
       
   964 	  if (G_VALUE_TYPE (element1) != G_VALUE_TYPE (element2))
       
   965 	    return G_VALUE_TYPE (element1) < G_VALUE_TYPE (element2) ? -1 : 1;
       
   966 	  cmp = g_param_values_cmp (aspec->element_spec, element1, element2);
       
   967 	  if (cmp)
       
   968 	    return cmp;
       
   969 	}
       
   970       return 0;
       
   971     }
       
   972 }
       
   973 
       
   974 static void
       
   975 param_object_init (GParamSpec *pspec)
       
   976 {
       
   977   /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */
       
   978 }
       
   979 
       
   980 static void
       
   981 param_object_set_default (GParamSpec *pspec,
       
   982 			  GValue     *value)
       
   983 {
       
   984   value->data[0].v_pointer = NULL;
       
   985 }
       
   986 
       
   987 static gboolean
       
   988 param_object_validate (GParamSpec *pspec,
       
   989 		       GValue     *value)
       
   990 {
       
   991   GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec);
       
   992   GObject *object = value->data[0].v_pointer;
       
   993   guint changed = 0;
       
   994   
       
   995   if (object && !g_value_type_compatible (G_OBJECT_TYPE (object), G_PARAM_SPEC_VALUE_TYPE (ospec)))
       
   996     {
       
   997       g_object_unref (object);
       
   998       value->data[0].v_pointer = NULL;
       
   999       changed++;
       
  1000     }
       
  1001   
       
  1002   return changed;
       
  1003 }
       
  1004 
       
  1005 static gint
       
  1006 param_object_values_cmp (GParamSpec   *pspec,
       
  1007 			 const GValue *value1,
       
  1008 			 const GValue *value2)
       
  1009 {
       
  1010   guint8 *p1 = value1->data[0].v_pointer;
       
  1011   guint8 *p2 = value2->data[0].v_pointer;
       
  1012 
       
  1013   /* not much to compare here, try to at least provide stable lesser/greater result */
       
  1014 
       
  1015   return p1 < p2 ? -1 : p1 > p2;
       
  1016 }
       
  1017 
       
  1018 static void
       
  1019 param_override_init (GParamSpec *pspec)
       
  1020 {
       
  1021   /* GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec); */
       
  1022 }
       
  1023 
       
  1024 static void
       
  1025 param_override_finalize (GParamSpec *pspec)
       
  1026 {
       
  1027   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
       
  1028   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_OVERRIDE));
       
  1029   
       
  1030   if (ospec->overridden)
       
  1031     {
       
  1032       g_param_spec_unref (ospec->overridden);
       
  1033       ospec->overridden = NULL;
       
  1034     }
       
  1035   
       
  1036   parent_class->finalize (pspec);
       
  1037 }
       
  1038 
       
  1039 static void
       
  1040 param_override_set_default (GParamSpec *pspec,
       
  1041 			    GValue     *value)
       
  1042 {
       
  1043   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
       
  1044 
       
  1045   g_param_value_set_default (ospec->overridden, value);
       
  1046 }
       
  1047 
       
  1048 static gboolean
       
  1049 param_override_validate (GParamSpec *pspec,
       
  1050 			 GValue     *value)
       
  1051 {
       
  1052   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
       
  1053   
       
  1054   return g_param_value_validate (ospec->overridden, value);
       
  1055 }
       
  1056 
       
  1057 static gint
       
  1058 param_override_values_cmp (GParamSpec   *pspec,
       
  1059 			   const GValue *value1,
       
  1060 			   const GValue *value2)
       
  1061 {
       
  1062   GParamSpecOverride *ospec = G_PARAM_SPEC_OVERRIDE (pspec);
       
  1063 
       
  1064   return g_param_values_cmp (ospec->overridden, value1, value2);
       
  1065 }
       
  1066 
       
  1067 static void
       
  1068 param_gtype_init (GParamSpec *pspec)
       
  1069 {
       
  1070 }
       
  1071 
       
  1072 static void
       
  1073 param_gtype_set_default (GParamSpec *pspec,
       
  1074 			 GValue     *value)
       
  1075 {
       
  1076   GParamSpecGType *tspec = G_PARAM_SPEC_GTYPE (pspec);
       
  1077 
       
  1078   value->data[0].v_long = tspec->is_a_type;
       
  1079 }
       
  1080 
       
  1081 static gboolean
       
  1082 param_gtype_validate (GParamSpec *pspec,
       
  1083 		      GValue     *value)
       
  1084 {
       
  1085   GParamSpecGType *tspec = G_PARAM_SPEC_GTYPE (pspec);
       
  1086   GType gtype = value->data[0].v_long;
       
  1087   guint changed = 0;
       
  1088   
       
  1089   if (tspec->is_a_type != G_TYPE_NONE && !g_type_is_a (gtype, tspec->is_a_type))
       
  1090     {
       
  1091       value->data[0].v_long = tspec->is_a_type;
       
  1092       changed++;
       
  1093     }
       
  1094   
       
  1095   return changed;
       
  1096 }
       
  1097 
       
  1098 static gint
       
  1099 param_gtype_values_cmp (GParamSpec   *pspec,
       
  1100 			const GValue *value1,
       
  1101 			const GValue *value2)
       
  1102 {
       
  1103   GType p1 = value1->data[0].v_long;
       
  1104   GType p2 = value2->data[0].v_long;
       
  1105 
       
  1106   /* not much to compare here, try to at least provide stable lesser/greater result */
       
  1107 
       
  1108   return p1 < p2 ? -1 : p1 > p2;
       
  1109 }
       
  1110 
       
  1111 /* --- type initialization --- */
       
  1112 #if !(EMULATOR)
       
  1113 GType *g_param_spec_types = NULL;
       
  1114 #endif /* EMULATOR */
       
  1115 
       
  1116 #ifdef __SYMBIAN32__
       
  1117 EXPORT_C GType **_g_param_spec_types(void)
       
  1118 	{
       
  1119 	return &g_param_spec_types;
       
  1120 	}
       
  1121 #endif//__SYMBIAN32__
       
  1122 
       
  1123 #if EMULATOR
       
  1124 PLS(pspec_info,g_param_spec_types_init ,GParamSpecTypeInfo)
       
  1125 const GParamSpecTypeInfo temp_pspec_info = {
       
  1126       sizeof (GParamSpecValueArray),	/* instance_size */
       
  1127       0,				/* n_preallocs */
       
  1128       param_value_array_init,		/* instance_init */
       
  1129       0xdeadbeef,			/* value_type, assigned further down */
       
  1130       param_value_array_finalize,	/* finalize */
       
  1131       param_value_array_set_default,	/* value_set_default */
       
  1132       param_value_array_validate,	/* value_validate */
       
  1133       param_value_array_values_cmp,	/* values_cmp */
       
  1134     };
       
  1135 #endif /* EMULATOR */
       
  1136 
       
  1137 void
       
  1138 g_param_spec_types_init (void)	
       
  1139 {
       
  1140   const guint n_types = 22;
       
  1141   GType type, *spec_types, *spec_types_bound;
       
  1142 
       
  1143   g_param_spec_types = g_new0 (GType, n_types);
       
  1144   spec_types = g_param_spec_types;
       
  1145   spec_types_bound = g_param_spec_types + n_types;
       
  1146   
       
  1147   /* G_TYPE_PARAM_CHAR
       
  1148    */
       
  1149   {
       
  1150     static const GParamSpecTypeInfo pspec_info = {
       
  1151       sizeof (GParamSpecChar),	/* instance_size */
       
  1152       16,			/* n_preallocs */
       
  1153       param_char_init,		/* instance_init */
       
  1154       G_TYPE_CHAR,		/* value_type */
       
  1155       NULL,			/* finalize */
       
  1156       param_char_set_default,	/* value_set_default */
       
  1157       param_char_validate,	/* value_validate */
       
  1158       param_int_values_cmp,	/* values_cmp */
       
  1159     };
       
  1160     type = g_param_type_register_static (g_intern_static_string ("GParamChar"), &pspec_info);
       
  1161     *spec_types++ = type;
       
  1162     g_assert (type == G_TYPE_PARAM_CHAR);
       
  1163   }
       
  1164   
       
  1165   /* G_TYPE_PARAM_UCHAR
       
  1166    */
       
  1167   {
       
  1168     static const GParamSpecTypeInfo pspec_info = {
       
  1169       sizeof (GParamSpecUChar), /* instance_size */
       
  1170       16,                       /* n_preallocs */
       
  1171       param_uchar_init,         /* instance_init */
       
  1172       G_TYPE_UCHAR,		/* value_type */
       
  1173       NULL,			/* finalize */
       
  1174       param_uchar_set_default,	/* value_set_default */
       
  1175       param_uchar_validate,	/* value_validate */
       
  1176       param_uint_values_cmp,	/* values_cmp */
       
  1177     };
       
  1178     type = g_param_type_register_static (g_intern_static_string ("GParamUChar"), &pspec_info);
       
  1179     *spec_types++ = type;
       
  1180     g_assert (type == G_TYPE_PARAM_UCHAR);
       
  1181   }
       
  1182   
       
  1183   /* G_TYPE_PARAM_BOOLEAN
       
  1184    */
       
  1185   {
       
  1186     static const GParamSpecTypeInfo pspec_info = {
       
  1187       sizeof (GParamSpecBoolean), /* instance_size */
       
  1188       16,                         /* n_preallocs */
       
  1189       NULL,			  /* instance_init */
       
  1190       G_TYPE_BOOLEAN,             /* value_type */
       
  1191       NULL,                       /* finalize */
       
  1192       param_boolean_set_default,  /* value_set_default */
       
  1193       param_boolean_validate,     /* value_validate */
       
  1194       param_int_values_cmp,       /* values_cmp */
       
  1195     };
       
  1196     type = g_param_type_register_static (g_intern_static_string ("GParamBoolean"), &pspec_info);
       
  1197     *spec_types++ = type;
       
  1198     g_assert (type == G_TYPE_PARAM_BOOLEAN);
       
  1199   }
       
  1200   
       
  1201   /* G_TYPE_PARAM_INT
       
  1202    */
       
  1203   {
       
  1204     static const GParamSpecTypeInfo pspec_info = {
       
  1205       sizeof (GParamSpecInt),   /* instance_size */
       
  1206       16,                       /* n_preallocs */
       
  1207       param_int_init,           /* instance_init */
       
  1208       G_TYPE_INT,		/* value_type */
       
  1209       NULL,			/* finalize */
       
  1210       param_int_set_default,	/* value_set_default */
       
  1211       param_int_validate,	/* value_validate */
       
  1212       param_int_values_cmp,	/* values_cmp */
       
  1213     };
       
  1214     type = g_param_type_register_static (g_intern_static_string ("GParamInt"), &pspec_info);
       
  1215     *spec_types++ = type;
       
  1216     g_assert (type == G_TYPE_PARAM_INT);
       
  1217   }
       
  1218   
       
  1219   /* G_TYPE_PARAM_UINT
       
  1220    */
       
  1221   {
       
  1222     static const GParamSpecTypeInfo pspec_info = {
       
  1223       sizeof (GParamSpecUInt),  /* instance_size */
       
  1224       16,                       /* n_preallocs */
       
  1225       param_uint_init,          /* instance_init */
       
  1226       G_TYPE_UINT,		/* value_type */
       
  1227       NULL,			/* finalize */
       
  1228       param_uint_set_default,	/* value_set_default */
       
  1229       param_uint_validate,	/* value_validate */
       
  1230       param_uint_values_cmp,	/* values_cmp */
       
  1231     };
       
  1232     type = g_param_type_register_static (g_intern_static_string ("GParamUInt"), &pspec_info);
       
  1233     *spec_types++ = type;
       
  1234     g_assert (type == G_TYPE_PARAM_UINT);
       
  1235   }
       
  1236   
       
  1237   /* G_TYPE_PARAM_LONG
       
  1238    */
       
  1239   {
       
  1240     static const GParamSpecTypeInfo pspec_info = {
       
  1241       sizeof (GParamSpecLong),  /* instance_size */
       
  1242       16,                       /* n_preallocs */
       
  1243       param_long_init,          /* instance_init */
       
  1244       G_TYPE_LONG,		/* value_type */
       
  1245       NULL,			/* finalize */
       
  1246       param_long_set_default,	/* value_set_default */
       
  1247       param_long_validate,	/* value_validate */
       
  1248       param_long_values_cmp,	/* values_cmp */
       
  1249     };
       
  1250     type = g_param_type_register_static (g_intern_static_string ("GParamLong"), &pspec_info);
       
  1251     *spec_types++ = type;
       
  1252     g_assert (type == G_TYPE_PARAM_LONG);
       
  1253   }
       
  1254   
       
  1255   /* G_TYPE_PARAM_ULONG
       
  1256    */
       
  1257   {
       
  1258     static const GParamSpecTypeInfo pspec_info = {
       
  1259       sizeof (GParamSpecULong), /* instance_size */
       
  1260       16,                       /* n_preallocs */
       
  1261       param_ulong_init,         /* instance_init */
       
  1262       G_TYPE_ULONG,		/* value_type */
       
  1263       NULL,			/* finalize */
       
  1264       param_ulong_set_default,	/* value_set_default */
       
  1265       param_ulong_validate,	/* value_validate */
       
  1266       param_ulong_values_cmp,	/* values_cmp */
       
  1267     };
       
  1268     type = g_param_type_register_static (g_intern_static_string ("GParamULong"), &pspec_info);
       
  1269     *spec_types++ = type;
       
  1270     g_assert (type == G_TYPE_PARAM_ULONG);
       
  1271   }
       
  1272 
       
  1273   /* G_TYPE_PARAM_INT64
       
  1274    */
       
  1275   {
       
  1276     static const GParamSpecTypeInfo pspec_info = {
       
  1277       sizeof (GParamSpecInt64),  /* instance_size */
       
  1278       16,                       /* n_preallocs */
       
  1279       param_int64_init,         /* instance_init */
       
  1280       G_TYPE_INT64,		/* value_type */
       
  1281       NULL,			/* finalize */
       
  1282       param_int64_set_default,	/* value_set_default */
       
  1283       param_int64_validate,	/* value_validate */
       
  1284       param_int64_values_cmp,	/* values_cmp */
       
  1285     };
       
  1286     type = g_param_type_register_static (g_intern_static_string ("GParamInt64"), &pspec_info);
       
  1287     *spec_types++ = type;
       
  1288     g_assert (type == G_TYPE_PARAM_INT64);
       
  1289   }
       
  1290   
       
  1291   /* G_TYPE_PARAM_UINT64
       
  1292    */
       
  1293   {
       
  1294     static const GParamSpecTypeInfo pspec_info = {
       
  1295       sizeof (GParamSpecUInt64), /* instance_size */
       
  1296       16,                       /* n_preallocs */
       
  1297       param_uint64_init,        /* instance_init */
       
  1298       G_TYPE_UINT64,		/* value_type */
       
  1299       NULL,			/* finalize */
       
  1300       param_uint64_set_default,	/* value_set_default */
       
  1301       param_uint64_validate,	/* value_validate */
       
  1302       param_uint64_values_cmp,	/* values_cmp */
       
  1303     };
       
  1304     type = g_param_type_register_static (g_intern_static_string ("GParamUInt64"), &pspec_info);
       
  1305     *spec_types++ = type;
       
  1306     g_assert (type == G_TYPE_PARAM_UINT64);
       
  1307   }
       
  1308 
       
  1309   /* G_TYPE_PARAM_UNICHAR
       
  1310    */
       
  1311   {
       
  1312     static const GParamSpecTypeInfo pspec_info = {
       
  1313       sizeof (GParamSpecUnichar), /* instance_size */
       
  1314       16,                        /* n_preallocs */
       
  1315       param_unichar_init,	 /* instance_init */
       
  1316       G_TYPE_UINT,		 /* value_type */
       
  1317       NULL,			 /* finalize */
       
  1318       param_unichar_set_default, /* value_set_default */
       
  1319       param_unichar_validate,	 /* value_validate */
       
  1320       param_unichar_values_cmp,	 /* values_cmp */
       
  1321     };
       
  1322     type = g_param_type_register_static (g_intern_static_string ("GParamUnichar"), &pspec_info);
       
  1323     *spec_types++ = type;
       
  1324     g_assert (type == G_TYPE_PARAM_UNICHAR);
       
  1325   }
       
  1326 
       
  1327  /* G_TYPE_PARAM_ENUM
       
  1328    */
       
  1329   {
       
  1330     static const GParamSpecTypeInfo pspec_info = {
       
  1331       sizeof (GParamSpecEnum),  /* instance_size */
       
  1332       16,                       /* n_preallocs */
       
  1333       param_enum_init,          /* instance_init */
       
  1334       G_TYPE_ENUM,		/* value_type */
       
  1335       param_enum_finalize,	/* finalize */
       
  1336       param_enum_set_default,	/* value_set_default */
       
  1337       param_enum_validate,	/* value_validate */
       
  1338       param_long_values_cmp,	/* values_cmp */
       
  1339     };
       
  1340     type = g_param_type_register_static (g_intern_static_string ("GParamEnum"), &pspec_info);
       
  1341     *spec_types++ = type;
       
  1342     g_assert (type == G_TYPE_PARAM_ENUM);
       
  1343   }
       
  1344   
       
  1345   /* G_TYPE_PARAM_FLAGS
       
  1346    */
       
  1347   {
       
  1348     static const GParamSpecTypeInfo pspec_info = {
       
  1349       sizeof (GParamSpecFlags),	/* instance_size */
       
  1350       16,			/* n_preallocs */
       
  1351       param_flags_init,		/* instance_init */
       
  1352       G_TYPE_FLAGS,		/* value_type */
       
  1353       param_flags_finalize,	/* finalize */
       
  1354       param_flags_set_default,	/* value_set_default */
       
  1355       param_flags_validate,	/* value_validate */
       
  1356       param_ulong_values_cmp,	/* values_cmp */
       
  1357     };
       
  1358     type = g_param_type_register_static (g_intern_static_string ("GParamFlags"), &pspec_info);
       
  1359     *spec_types++ = type;
       
  1360     g_assert (type == G_TYPE_PARAM_FLAGS);
       
  1361   }
       
  1362   
       
  1363   /* G_TYPE_PARAM_FLOAT
       
  1364    */
       
  1365   {
       
  1366     static const GParamSpecTypeInfo pspec_info = {
       
  1367       sizeof (GParamSpecFloat), /* instance_size */
       
  1368       16,                       /* n_preallocs */
       
  1369       param_float_init,         /* instance_init */
       
  1370       G_TYPE_FLOAT,		/* value_type */
       
  1371       NULL,			/* finalize */
       
  1372       param_float_set_default,	/* value_set_default */
       
  1373       param_float_validate,	/* value_validate */
       
  1374       param_float_values_cmp,	/* values_cmp */
       
  1375     };
       
  1376     type = g_param_type_register_static (g_intern_static_string ("GParamFloat"), &pspec_info);
       
  1377     *spec_types++ = type;
       
  1378     g_assert (type == G_TYPE_PARAM_FLOAT);
       
  1379   }
       
  1380   
       
  1381   /* G_TYPE_PARAM_DOUBLE
       
  1382    */
       
  1383   {
       
  1384     static const GParamSpecTypeInfo pspec_info = {
       
  1385       sizeof (GParamSpecDouble),	/* instance_size */
       
  1386       16,				/* n_preallocs */
       
  1387       param_double_init,		/* instance_init */
       
  1388       G_TYPE_DOUBLE,			/* value_type */
       
  1389       NULL,				/* finalize */
       
  1390       param_double_set_default,		/* value_set_default */
       
  1391       param_double_validate,		/* value_validate */
       
  1392       param_double_values_cmp,		/* values_cmp */
       
  1393     };
       
  1394     type = g_param_type_register_static (g_intern_static_string ("GParamDouble"), &pspec_info);
       
  1395     *spec_types++ = type;
       
  1396     g_assert (type == G_TYPE_PARAM_DOUBLE);
       
  1397   }
       
  1398   
       
  1399   /* G_TYPE_PARAM_STRING
       
  1400    */
       
  1401   {
       
  1402     static const GParamSpecTypeInfo pspec_info = {
       
  1403       sizeof (GParamSpecString),	/* instance_size */
       
  1404       16,				/* n_preallocs */
       
  1405       param_string_init,		/* instance_init */
       
  1406       G_TYPE_STRING,			/* value_type */
       
  1407       param_string_finalize,		/* finalize */
       
  1408       param_string_set_default,		/* value_set_default */
       
  1409       param_string_validate,		/* value_validate */
       
  1410       param_string_values_cmp,		/* values_cmp */
       
  1411     };
       
  1412     type = g_param_type_register_static (g_intern_static_string ("GParamString"), &pspec_info);
       
  1413     *spec_types++ = type;
       
  1414     g_assert (type == G_TYPE_PARAM_STRING);
       
  1415   }
       
  1416   
       
  1417   /* G_TYPE_PARAM_PARAM
       
  1418    */
       
  1419   {
       
  1420     static const GParamSpecTypeInfo pspec_info = {
       
  1421       sizeof (GParamSpecParam),	/* instance_size */
       
  1422       16,			/* n_preallocs */
       
  1423       param_param_init,		/* instance_init */
       
  1424       G_TYPE_PARAM,		/* value_type */
       
  1425       NULL,			/* finalize */
       
  1426       param_param_set_default,	/* value_set_default */
       
  1427       param_param_validate,	/* value_validate */
       
  1428       param_pointer_values_cmp,	/* values_cmp */
       
  1429     };
       
  1430     type = g_param_type_register_static (g_intern_static_string ("GParamParam"), &pspec_info);
       
  1431     *spec_types++ = type;
       
  1432     g_assert (type == G_TYPE_PARAM_PARAM);
       
  1433   }
       
  1434   
       
  1435   /* G_TYPE_PARAM_BOXED
       
  1436    */
       
  1437   {
       
  1438     static const GParamSpecTypeInfo pspec_info = {
       
  1439       sizeof (GParamSpecBoxed),	/* instance_size */
       
  1440       4,			/* n_preallocs */
       
  1441       param_boxed_init,		/* instance_init */
       
  1442       G_TYPE_BOXED,		/* value_type */
       
  1443       NULL,			/* finalize */
       
  1444       param_boxed_set_default,	/* value_set_default */
       
  1445       param_boxed_validate,	/* value_validate */
       
  1446       param_boxed_values_cmp,	/* values_cmp */
       
  1447     };
       
  1448     type = g_param_type_register_static (g_intern_static_string ("GParamBoxed"), &pspec_info);
       
  1449     *spec_types++ = type;
       
  1450     g_assert (type == G_TYPE_PARAM_BOXED);
       
  1451   }
       
  1452 
       
  1453   /* G_TYPE_PARAM_POINTER
       
  1454    */
       
  1455   {
       
  1456     static const GParamSpecTypeInfo pspec_info = {
       
  1457       sizeof (GParamSpecPointer),  /* instance_size */
       
  1458       0,                           /* n_preallocs */
       
  1459       param_pointer_init,	   /* instance_init */
       
  1460       G_TYPE_POINTER,  		   /* value_type */
       
  1461       NULL,			   /* finalize */
       
  1462       param_pointer_set_default,   /* value_set_default */
       
  1463       param_pointer_validate,	   /* value_validate */
       
  1464       param_pointer_values_cmp,	   /* values_cmp */
       
  1465     };
       
  1466     type = g_param_type_register_static (g_intern_static_string ("GParamPointer"), &pspec_info);
       
  1467     *spec_types++ = type;
       
  1468     g_assert (type == G_TYPE_PARAM_POINTER);
       
  1469   }
       
  1470   
       
  1471   /* G_TYPE_PARAM_VALUE_ARRAY
       
  1472    */
       
  1473   {
       
  1474     #if EMULATOR
       
  1475     #define pspec_info (*FUNCTION_NAME(pspec_info,g_param_spec_types_init )())
       
  1476     #else
       
  1477     static /* const */ GParamSpecTypeInfo pspec_info = {
       
  1478       sizeof (GParamSpecValueArray),	/* instance_size */
       
  1479       0,				/* n_preallocs */
       
  1480       param_value_array_init,		/* instance_init */
       
  1481       0xdeadbeef,			/* value_type, assigned further down */
       
  1482       param_value_array_finalize,	/* finalize */
       
  1483       param_value_array_set_default,	/* value_set_default */
       
  1484       param_value_array_validate,	/* value_validate */
       
  1485       param_value_array_values_cmp,	/* values_cmp */
       
  1486     };
       
  1487     #endif /*EMULATOR */
       
  1488     pspec_info.value_type = G_TYPE_VALUE_ARRAY;
       
  1489     type = g_param_type_register_static (g_intern_static_string ("GParamValueArray"), &pspec_info);
       
  1490     *spec_types++ = type;
       
  1491     g_assert (type == G_TYPE_PARAM_VALUE_ARRAY);
       
  1492     #if EMULATOR
       
  1493     #undef pspec_info
       
  1494     #endif /* EMULATOR */
       
  1495   }
       
  1496 
       
  1497   /* G_TYPE_PARAM_OBJECT
       
  1498    */
       
  1499   {
       
  1500     static const GParamSpecTypeInfo pspec_info = {
       
  1501       sizeof (GParamSpecObject), /* instance_size */
       
  1502       16,                        /* n_preallocs */
       
  1503       param_object_init,	 /* instance_init */
       
  1504       G_TYPE_OBJECT,		 /* value_type */
       
  1505       NULL,			 /* finalize */
       
  1506       param_object_set_default,	 /* value_set_default */
       
  1507       param_object_validate,	 /* value_validate */
       
  1508       param_object_values_cmp,	 /* values_cmp */
       
  1509     };
       
  1510     type = g_param_type_register_static (g_intern_static_string ("GParamObject"), &pspec_info);
       
  1511     *spec_types++ = type;
       
  1512     g_assert (type == G_TYPE_PARAM_OBJECT);
       
  1513   }
       
  1514 
       
  1515   /* G_TYPE_PARAM_OVERRIDE
       
  1516    */
       
  1517   {
       
  1518     static const GParamSpecTypeInfo pspec_info = {
       
  1519       sizeof (GParamSpecOverride), /* instance_size */
       
  1520       16,                        /* n_preallocs */
       
  1521       param_override_init,	 /* instance_init */
       
  1522       G_TYPE_NONE,		 /* value_type */
       
  1523       param_override_finalize,	 /* finalize */
       
  1524       param_override_set_default, /* value_set_default */
       
  1525       param_override_validate,	  /* value_validate */
       
  1526       param_override_values_cmp,  /* values_cmp */
       
  1527     };
       
  1528     type = g_param_type_register_static (g_intern_static_string ("GParamOverride"), &pspec_info);
       
  1529     *spec_types++ = type;
       
  1530     g_assert (type == G_TYPE_PARAM_OVERRIDE);
       
  1531   }
       
  1532 
       
  1533   /* G_TYPE_PARAM_GTYPE
       
  1534    */
       
  1535   {
       
  1536     GParamSpecTypeInfo pspec_info = {
       
  1537       sizeof (GParamSpecGType),	/* instance_size */
       
  1538       0,			/* n_preallocs */
       
  1539       param_gtype_init,		/* instance_init */
       
  1540       0xdeadbeef,		/* value_type, assigned further down */
       
  1541       NULL,			/* finalize */
       
  1542       param_gtype_set_default,	/* value_set_default */
       
  1543       param_gtype_validate,	/* value_validate */
       
  1544       param_gtype_values_cmp,	/* values_cmp */
       
  1545     };
       
  1546     pspec_info.value_type = G_TYPE_GTYPE;
       
  1547     type = g_param_type_register_static (g_intern_static_string ("GParamGType"), &pspec_info);
       
  1548     *spec_types++ = type;
       
  1549     g_assert (type == G_TYPE_PARAM_GTYPE);
       
  1550   }
       
  1551 
       
  1552   g_assert (spec_types == spec_types_bound);
       
  1553 }
       
  1554 
       
  1555 /* --- GParamSpec initialization --- */
       
  1556 
       
  1557 /**
       
  1558  * g_param_spec_char:
       
  1559  * @name: canonical name of the property specified
       
  1560  * @nick: nick name for the property specified
       
  1561  * @blurb: description of the property specified
       
  1562  * @minimum: minimum value for the property specified
       
  1563  * @maximum: maximum value for the property specified
       
  1564  * @default_value: default value for the property specified
       
  1565  * @flags: flags for the property specified
       
  1566  *
       
  1567  * Creates a new #GParamSpecChar instance specifying a %G_TYPE_CHAR property.
       
  1568  *
       
  1569  * Returns: a newly created parameter specification
       
  1570  */
       
  1571 EXPORT_C GParamSpec*
       
  1572 g_param_spec_char (const gchar *name,
       
  1573 		   const gchar *nick,
       
  1574 		   const gchar *blurb,
       
  1575 		   gint8	minimum,
       
  1576 		   gint8	maximum,
       
  1577 		   gint8	default_value,
       
  1578 		   GParamFlags	flags)
       
  1579 {
       
  1580   GParamSpecChar *cspec;
       
  1581 
       
  1582   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  1583 
       
  1584   cspec = g_param_spec_internal (G_TYPE_PARAM_CHAR,
       
  1585 				 name,
       
  1586 				 nick,
       
  1587 				 blurb,
       
  1588 				 flags);
       
  1589   
       
  1590   cspec->minimum = minimum;
       
  1591   cspec->maximum = maximum;
       
  1592   cspec->default_value = default_value;
       
  1593   
       
  1594   return G_PARAM_SPEC (cspec);
       
  1595 }
       
  1596 
       
  1597 /**
       
  1598  * g_param_spec_uchar:
       
  1599  * @name: canonical name of the property specified
       
  1600  * @nick: nick name for the property specified
       
  1601  * @blurb: description of the property specified
       
  1602  * @minimum: minimum value for the property specified
       
  1603  * @maximum: maximum value for the property specified
       
  1604  * @default_value: default value for the property specified
       
  1605  * @flags: flags for the property specified
       
  1606  *
       
  1607  * Creates a new #GParamSpecUChar instance specifying a %G_TYPE_UCHAR property.
       
  1608  *
       
  1609  * Returns: a newly created parameter specification
       
  1610  */
       
  1611 EXPORT_C GParamSpec*
       
  1612 g_param_spec_uchar (const gchar *name,
       
  1613 		    const gchar *nick,
       
  1614 		    const gchar *blurb,
       
  1615 		    guint8	 minimum,
       
  1616 		    guint8	 maximum,
       
  1617 		    guint8	 default_value,
       
  1618 		    GParamFlags	 flags)
       
  1619 {
       
  1620   GParamSpecUChar *uspec;
       
  1621 
       
  1622   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  1623 
       
  1624   uspec = g_param_spec_internal (G_TYPE_PARAM_UCHAR,
       
  1625 				 name,
       
  1626 				 nick,
       
  1627 				 blurb,
       
  1628 				 flags);
       
  1629   
       
  1630   uspec->minimum = minimum;
       
  1631   uspec->maximum = maximum;
       
  1632   uspec->default_value = default_value;
       
  1633   
       
  1634   return G_PARAM_SPEC (uspec);
       
  1635 }
       
  1636 
       
  1637 /**
       
  1638  * g_param_spec_boolean:
       
  1639  * @name: canonical name of the property specified
       
  1640  * @nick: nick name for the property specified
       
  1641  * @blurb: description of the property specified
       
  1642  * @default_value: default value for the property specified
       
  1643  * @flags: flags for the property specified
       
  1644  *
       
  1645  * Creates a new #GParamSpecBoolean instance specifying a %G_TYPE_BOOLEAN
       
  1646  * property.
       
  1647  *
       
  1648  * See g_param_spec_internal() for details on property names.
       
  1649  *
       
  1650  * Returns: a newly created parameter specification
       
  1651  */
       
  1652 EXPORT_C GParamSpec*
       
  1653 g_param_spec_boolean (const gchar *name,
       
  1654 		      const gchar *nick,
       
  1655 		      const gchar *blurb,
       
  1656 		      gboolean	   default_value,
       
  1657 		      GParamFlags  flags)
       
  1658 {
       
  1659   GParamSpecBoolean *bspec;
       
  1660 
       
  1661   g_return_val_if_fail (default_value == TRUE || default_value == FALSE, NULL);
       
  1662 
       
  1663   bspec = g_param_spec_internal (G_TYPE_PARAM_BOOLEAN,
       
  1664 				 name,
       
  1665 				 nick,
       
  1666 				 blurb,
       
  1667 				 flags);
       
  1668   
       
  1669   bspec->default_value = default_value;
       
  1670   
       
  1671   return G_PARAM_SPEC (bspec);
       
  1672 }
       
  1673 
       
  1674 /**
       
  1675  * g_param_spec_int:
       
  1676  * @name: canonical name of the property specified
       
  1677  * @nick: nick name for the property specified
       
  1678  * @blurb: description of the property specified
       
  1679  * @minimum: minimum value for the property specified
       
  1680  * @maximum: maximum value for the property specified
       
  1681  * @default_value: default value for the property specified
       
  1682  * @flags: flags for the property specified
       
  1683  *
       
  1684  * Creates a new #GParamSpecInt instance specifying a %G_TYPE_INT property.
       
  1685  *
       
  1686  * See g_param_spec_internal() for details on property names.
       
  1687  *
       
  1688  * Returns: a newly created parameter specification
       
  1689  */
       
  1690 EXPORT_C GParamSpec*
       
  1691 g_param_spec_int (const gchar *name,
       
  1692 		  const gchar *nick,
       
  1693 		  const gchar *blurb,
       
  1694 		  gint	       minimum,
       
  1695 		  gint	       maximum,
       
  1696 		  gint	       default_value,
       
  1697 		  GParamFlags  flags)
       
  1698 {
       
  1699   GParamSpecInt *ispec;
       
  1700 
       
  1701   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  1702 
       
  1703   ispec = g_param_spec_internal (G_TYPE_PARAM_INT,
       
  1704 				 name,
       
  1705 				 nick,
       
  1706 				 blurb,
       
  1707 				 flags);
       
  1708   
       
  1709   ispec->minimum = minimum;
       
  1710   ispec->maximum = maximum;
       
  1711   ispec->default_value = default_value;
       
  1712   
       
  1713   return G_PARAM_SPEC (ispec);
       
  1714 }
       
  1715 
       
  1716 /**
       
  1717  * g_param_spec_uint:
       
  1718  * @name: canonical name of the property specified
       
  1719  * @nick: nick name for the property specified
       
  1720  * @blurb: description of the property specified
       
  1721  * @minimum: minimum value for the property specified
       
  1722  * @maximum: maximum value for the property specified
       
  1723  * @default_value: default value for the property specified
       
  1724  * @flags: flags for the property specified
       
  1725  *
       
  1726  * Creates a new #GParamSpecUInt instance specifying a %G_TYPE_UINT property.
       
  1727  *
       
  1728  * See g_param_spec_internal() for details on property names.
       
  1729  *
       
  1730  * Returns: a newly created parameter specification
       
  1731  */
       
  1732 EXPORT_C GParamSpec*
       
  1733 g_param_spec_uint (const gchar *name,
       
  1734 		   const gchar *nick,
       
  1735 		   const gchar *blurb,
       
  1736 		   guint	minimum,
       
  1737 		   guint	maximum,
       
  1738 		   guint	default_value,
       
  1739 		   GParamFlags	flags)
       
  1740 {
       
  1741   GParamSpecUInt *uspec;
       
  1742 
       
  1743   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  1744 
       
  1745   uspec = g_param_spec_internal (G_TYPE_PARAM_UINT,
       
  1746 				 name,
       
  1747 				 nick,
       
  1748 				 blurb,
       
  1749 				 flags);
       
  1750   
       
  1751   uspec->minimum = minimum;
       
  1752   uspec->maximum = maximum;
       
  1753   uspec->default_value = default_value;
       
  1754   
       
  1755   return G_PARAM_SPEC (uspec);
       
  1756 }
       
  1757 
       
  1758 /**
       
  1759  * g_param_spec_long:
       
  1760  * @name: canonical name of the property specified
       
  1761  * @nick: nick name for the property specified
       
  1762  * @blurb: description of the property specified
       
  1763  * @minimum: minimum value for the property specified
       
  1764  * @maximum: maximum value for the property specified
       
  1765  * @default_value: default value for the property specified
       
  1766  * @flags: flags for the property specified
       
  1767  *
       
  1768  * Creates a new #GParamSpecLong instance specifying a %G_TYPE_LONG property.
       
  1769  *
       
  1770  * See g_param_spec_internal() for details on property names.
       
  1771  *
       
  1772  * Returns: a newly created parameter specification
       
  1773  */
       
  1774 EXPORT_C GParamSpec*
       
  1775 g_param_spec_long (const gchar *name,
       
  1776 		   const gchar *nick,
       
  1777 		   const gchar *blurb,
       
  1778 		   glong	minimum,
       
  1779 		   glong	maximum,
       
  1780 		   glong	default_value,
       
  1781 		   GParamFlags	flags)
       
  1782 {
       
  1783   GParamSpecLong *lspec;
       
  1784 
       
  1785   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  1786 
       
  1787   lspec = g_param_spec_internal (G_TYPE_PARAM_LONG,
       
  1788 				 name,
       
  1789 				 nick,
       
  1790 				 blurb,
       
  1791 				 flags);
       
  1792   
       
  1793   lspec->minimum = minimum;
       
  1794   lspec->maximum = maximum;
       
  1795   lspec->default_value = default_value;
       
  1796   
       
  1797   return G_PARAM_SPEC (lspec);
       
  1798 }
       
  1799 
       
  1800 /**
       
  1801  * g_param_spec_ulong:
       
  1802  * @name: canonical name of the property specified
       
  1803  * @nick: nick name for the property specified
       
  1804  * @blurb: description of the property specified
       
  1805  * @minimum: minimum value for the property specified
       
  1806  * @maximum: maximum value for the property specified
       
  1807  * @default_value: default value for the property specified
       
  1808  * @flags: flags for the property specified
       
  1809  *
       
  1810  * Creates a new #GParamSpecULong instance specifying a %G_TYPE_ULONG
       
  1811  * property.
       
  1812  *
       
  1813  * See g_param_spec_internal() for details on property names.
       
  1814  *
       
  1815  * Returns: a newly created parameter specification
       
  1816  */
       
  1817 EXPORT_C GParamSpec*
       
  1818 g_param_spec_ulong (const gchar *name,
       
  1819 		    const gchar *nick,
       
  1820 		    const gchar *blurb,
       
  1821 		    gulong	 minimum,
       
  1822 		    gulong	 maximum,
       
  1823 		    gulong	 default_value,
       
  1824 		    GParamFlags	 flags)
       
  1825 {
       
  1826   GParamSpecULong *uspec;
       
  1827 
       
  1828   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  1829 
       
  1830   uspec = g_param_spec_internal (G_TYPE_PARAM_ULONG,
       
  1831 				 name,
       
  1832 				 nick,
       
  1833 				 blurb,
       
  1834 				 flags);
       
  1835   
       
  1836   uspec->minimum = minimum;
       
  1837   uspec->maximum = maximum;
       
  1838   uspec->default_value = default_value;
       
  1839   
       
  1840   return G_PARAM_SPEC (uspec);
       
  1841 }
       
  1842 
       
  1843 /**
       
  1844  * g_param_spec_int64:
       
  1845  * @name: canonical name of the property specified
       
  1846  * @nick: nick name for the property specified
       
  1847  * @blurb: description of the property specified
       
  1848  * @minimum: minimum value for the property specified
       
  1849  * @maximum: maximum value for the property specified
       
  1850  * @default_value: default value for the property specified
       
  1851  * @flags: flags for the property specified
       
  1852  *
       
  1853  * Creates a new #GParamSpecInt64 instance specifying a %G_TYPE_INT64 property.
       
  1854  *
       
  1855  * See g_param_spec_internal() for details on property names.
       
  1856  *
       
  1857  * Returns: a newly created parameter specification
       
  1858  */
       
  1859 EXPORT_C GParamSpec*
       
  1860 g_param_spec_int64 (const gchar *name,
       
  1861 		    const gchar *nick,
       
  1862 		    const gchar *blurb,
       
  1863 		    gint64	 minimum,
       
  1864 		    gint64	 maximum,
       
  1865 		    gint64	 default_value,
       
  1866 		    GParamFlags	 flags)
       
  1867 {
       
  1868   GParamSpecInt64 *lspec;
       
  1869   
       
  1870   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  1871 
       
  1872   lspec = g_param_spec_internal (G_TYPE_PARAM_INT64,
       
  1873 				 name,
       
  1874 				 nick,
       
  1875 				 blurb,
       
  1876 				 flags);
       
  1877   
       
  1878   lspec->minimum = minimum;
       
  1879   lspec->maximum = maximum;
       
  1880   lspec->default_value = default_value;
       
  1881   
       
  1882   return G_PARAM_SPEC (lspec);
       
  1883 }
       
  1884 
       
  1885 /**
       
  1886  * g_param_spec_uint64:
       
  1887  * @name: canonical name of the property specified
       
  1888  * @nick: nick name for the property specified
       
  1889  * @blurb: description of the property specified
       
  1890  * @minimum: minimum value for the property specified
       
  1891  * @maximum: maximum value for the property specified
       
  1892  * @default_value: default value for the property specified
       
  1893  * @flags: flags for the property specified
       
  1894  *
       
  1895  * Creates a new #GParamSpecUInt64 instance specifying a %G_TYPE_UINT64
       
  1896  * property.
       
  1897  *
       
  1898  * See g_param_spec_internal() for details on property names.
       
  1899  *
       
  1900  * Returns: a newly created parameter specification
       
  1901  */
       
  1902 EXPORT_C GParamSpec*
       
  1903 g_param_spec_uint64 (const gchar *name,
       
  1904 		     const gchar *nick,
       
  1905 		     const gchar *blurb,
       
  1906 		     guint64	  minimum,
       
  1907 		     guint64	  maximum,
       
  1908 		     guint64	  default_value,
       
  1909 		     GParamFlags  flags)
       
  1910 {
       
  1911   GParamSpecUInt64 *uspec;
       
  1912   
       
  1913   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  1914   
       
  1915   uspec = g_param_spec_internal (G_TYPE_PARAM_UINT64,
       
  1916 				 name,
       
  1917 				 nick,
       
  1918 				 blurb,
       
  1919 				 flags);
       
  1920   
       
  1921   uspec->minimum = minimum;
       
  1922   uspec->maximum = maximum;
       
  1923   uspec->default_value = default_value;
       
  1924   
       
  1925   return G_PARAM_SPEC (uspec);
       
  1926 }
       
  1927 
       
  1928 /**
       
  1929  * g_param_spec_unichar:
       
  1930  * @name: canonical name of the property specified
       
  1931  * @nick: nick name for the property specified
       
  1932  * @blurb: description of the property specified
       
  1933  * @default_value: default value for the property specified
       
  1934  * @flags: flags for the property specified
       
  1935  *
       
  1936  * Creates a new #GParamSpecUnichar instance specifying a %G_TYPE_UINT
       
  1937  * property. #GValue structures for this property can be accessed with
       
  1938  * g_value_set_uint() and g_value_get_uint().
       
  1939  *
       
  1940  * See g_param_spec_internal() for details on property names.
       
  1941  *
       
  1942  * Returns: a newly created parameter specification
       
  1943  */
       
  1944 EXPORT_C GParamSpec*
       
  1945 g_param_spec_unichar (const gchar *name,
       
  1946 		      const gchar *nick,
       
  1947 		      const gchar *blurb,
       
  1948 		      gunichar	   default_value,
       
  1949 		      GParamFlags  flags)
       
  1950 {
       
  1951   GParamSpecUnichar *uspec;
       
  1952 
       
  1953   uspec = g_param_spec_internal (G_TYPE_PARAM_UNICHAR,
       
  1954 				 name,
       
  1955 				 nick,
       
  1956 				 blurb,
       
  1957 				 flags);
       
  1958   
       
  1959   uspec->default_value = default_value;
       
  1960   
       
  1961   return G_PARAM_SPEC (uspec);
       
  1962 }
       
  1963 
       
  1964 /**
       
  1965  * g_param_spec_enum:
       
  1966  * @name: canonical name of the property specified
       
  1967  * @nick: nick name for the property specified
       
  1968  * @blurb: description of the property specified
       
  1969  * @enum_type: a #GType derived from %G_TYPE_ENUM
       
  1970  * @default_value: default value for the property specified
       
  1971  * @flags: flags for the property specified
       
  1972  *
       
  1973  * Creates a new #GParamSpecEnum instance specifying a %G_TYPE_ENUM
       
  1974  * property.
       
  1975  *
       
  1976  * See g_param_spec_internal() for details on property names.
       
  1977  *
       
  1978  * Returns: a newly created parameter specification
       
  1979  */
       
  1980 EXPORT_C GParamSpec*
       
  1981 g_param_spec_enum (const gchar *name,
       
  1982 		   const gchar *nick,
       
  1983 		   const gchar *blurb,
       
  1984 		   GType	enum_type,
       
  1985 		   gint		default_value,
       
  1986 		   GParamFlags	flags)
       
  1987 {
       
  1988   GParamSpecEnum *espec;
       
  1989   GEnumClass *enum_class;
       
  1990   
       
  1991   g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL);
       
  1992 
       
  1993   enum_class = g_type_class_ref (enum_type);
       
  1994 
       
  1995   g_return_val_if_fail (g_enum_get_value (enum_class, default_value) != NULL, NULL);
       
  1996   
       
  1997   espec = g_param_spec_internal (G_TYPE_PARAM_ENUM,
       
  1998 				 name,
       
  1999 				 nick,
       
  2000 				 blurb,
       
  2001 				 flags);
       
  2002   
       
  2003   espec->enum_class = enum_class;
       
  2004   espec->default_value = default_value;
       
  2005   G_PARAM_SPEC (espec)->value_type = enum_type;
       
  2006   
       
  2007   return G_PARAM_SPEC (espec);
       
  2008 }
       
  2009 
       
  2010 /**
       
  2011  * g_param_spec_flags:
       
  2012  * @name: canonical name of the property specified
       
  2013  * @nick: nick name for the property specified
       
  2014  * @blurb: description of the property specified
       
  2015  * @flags_type: a #GType derived from %G_TYPE_FLAGS
       
  2016  * @default_value: default value for the property specified
       
  2017  * @flags: flags for the property specified
       
  2018  *
       
  2019  * Creates a new #GParamSpecFlags instance specifying a %G_TYPE_FLAGS
       
  2020  * property.
       
  2021  *
       
  2022  * See g_param_spec_internal() for details on property names.
       
  2023  *
       
  2024  * Returns: a newly created parameter specification
       
  2025  */
       
  2026 EXPORT_C GParamSpec*
       
  2027 g_param_spec_flags (const gchar *name,
       
  2028 		    const gchar *nick,
       
  2029 		    const gchar *blurb,
       
  2030 		    GType	 flags_type,
       
  2031 		    guint	 default_value,
       
  2032 		    GParamFlags	 flags)
       
  2033 {
       
  2034   GParamSpecFlags *fspec;
       
  2035   GFlagsClass *flags_class;
       
  2036   
       
  2037   g_return_val_if_fail (G_TYPE_IS_FLAGS (flags_type), NULL);
       
  2038 
       
  2039   flags_class = g_type_class_ref (flags_type);
       
  2040 
       
  2041   g_return_val_if_fail ((default_value & flags_class->mask) == default_value, NULL);
       
  2042   
       
  2043   fspec = g_param_spec_internal (G_TYPE_PARAM_FLAGS,
       
  2044 				 name,
       
  2045 				 nick,
       
  2046 				 blurb,
       
  2047 				 flags);
       
  2048   
       
  2049   fspec->flags_class = flags_class;
       
  2050   fspec->default_value = default_value;
       
  2051   G_PARAM_SPEC (fspec)->value_type = flags_type;
       
  2052   
       
  2053   return G_PARAM_SPEC (fspec);
       
  2054 }
       
  2055 
       
  2056 /**
       
  2057  * g_param_spec_float:
       
  2058  * @name: canonical name of the property specified
       
  2059  * @nick: nick name for the property specified
       
  2060  * @blurb: description of the property specified
       
  2061  * @minimum: minimum value for the property specified
       
  2062  * @maximum: maximum value for the property specified
       
  2063  * @default_value: default value for the property specified
       
  2064  * @flags: flags for the property specified
       
  2065  *
       
  2066  * Creates a new #GParamSpecFloat instance specifying a %G_TYPE_FLOAT property.
       
  2067  *
       
  2068  * See g_param_spec_internal() for details on property names.
       
  2069  *
       
  2070  * Returns: a newly created parameter specification
       
  2071  */
       
  2072 EXPORT_C GParamSpec*
       
  2073 g_param_spec_float (const gchar *name,
       
  2074 		    const gchar *nick,
       
  2075 		    const gchar *blurb,
       
  2076 		    gfloat	 minimum,
       
  2077 		    gfloat	 maximum,
       
  2078 		    gfloat	 default_value,
       
  2079 		    GParamFlags	 flags)
       
  2080 {
       
  2081   GParamSpecFloat *fspec;
       
  2082 
       
  2083   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  2084 
       
  2085   fspec = g_param_spec_internal (G_TYPE_PARAM_FLOAT,
       
  2086 				 name,
       
  2087 				 nick,
       
  2088 				 blurb,
       
  2089 				 flags);
       
  2090   
       
  2091   fspec->minimum = minimum;
       
  2092   fspec->maximum = maximum;
       
  2093   fspec->default_value = default_value;
       
  2094   
       
  2095   return G_PARAM_SPEC (fspec);
       
  2096 }
       
  2097 
       
  2098 /**
       
  2099  * g_param_spec_double:
       
  2100  * @name: canonical name of the property specified
       
  2101  * @nick: nick name for the property specified
       
  2102  * @blurb: description of the property specified
       
  2103  * @minimum: minimum value for the property specified
       
  2104  * @maximum: maximum value for the property specified
       
  2105  * @default_value: default value for the property specified
       
  2106  * @flags: flags for the property specified
       
  2107  *
       
  2108  * Creates a new #GParamSpecDouble instance specifying a %G_TYPE_DOUBLE
       
  2109  * property.
       
  2110  *
       
  2111  * See g_param_spec_internal() for details on property names.
       
  2112  *
       
  2113  * Returns: a newly created parameter specification
       
  2114  */
       
  2115 EXPORT_C GParamSpec*
       
  2116 g_param_spec_double (const gchar *name,
       
  2117 		     const gchar *nick,
       
  2118 		     const gchar *blurb,
       
  2119 		     gdouble	  minimum,
       
  2120 		     gdouble	  maximum,
       
  2121 		     gdouble	  default_value,
       
  2122 		     GParamFlags  flags)
       
  2123 {
       
  2124   GParamSpecDouble *dspec;
       
  2125 
       
  2126   g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL);
       
  2127 
       
  2128   dspec = g_param_spec_internal (G_TYPE_PARAM_DOUBLE,
       
  2129 				 name,
       
  2130 				 nick,
       
  2131 				 blurb,
       
  2132 				 flags);
       
  2133   
       
  2134   dspec->minimum = minimum;
       
  2135   dspec->maximum = maximum;
       
  2136   dspec->default_value = default_value;
       
  2137   
       
  2138   return G_PARAM_SPEC (dspec);
       
  2139 }
       
  2140 
       
  2141 /**
       
  2142  * g_param_spec_string:
       
  2143  * @name: canonical name of the property specified
       
  2144  * @nick: nick name for the property specified
       
  2145  * @blurb: description of the property specified
       
  2146  * @default_value: default value for the property specified
       
  2147  * @flags: flags for the property specified
       
  2148  *
       
  2149  * Creates a new #GParamSpecString instance.
       
  2150  *
       
  2151  * See g_param_spec_internal() for details on property names.
       
  2152  *
       
  2153  * Returns: a newly created parameter specification
       
  2154  */
       
  2155 EXPORT_C GParamSpec*
       
  2156 g_param_spec_string (const gchar *name,
       
  2157 		     const gchar *nick,
       
  2158 		     const gchar *blurb,
       
  2159 		     const gchar *default_value,
       
  2160 		     GParamFlags  flags)
       
  2161 {
       
  2162   GParamSpecString *sspec = g_param_spec_internal (G_TYPE_PARAM_STRING,
       
  2163 						   name,
       
  2164 						   nick,
       
  2165 						   blurb,
       
  2166 						   flags);
       
  2167   g_free (sspec->default_value);
       
  2168   sspec->default_value = g_strdup (default_value);
       
  2169   
       
  2170   return G_PARAM_SPEC (sspec);
       
  2171 }
       
  2172 
       
  2173 /**
       
  2174  * g_param_spec_param:
       
  2175  * @name: canonical name of the property specified
       
  2176  * @nick: nick name for the property specified
       
  2177  * @blurb: description of the property specified
       
  2178  * @param_type: a #GType derived from %G_TYPE_PARAM
       
  2179  * @flags: flags for the property specified
       
  2180  *
       
  2181  * Creates a new #GParamSpecParam instance specifying a %G_TYPE_PARAM
       
  2182  * property.
       
  2183  *
       
  2184  * See g_param_spec_internal() for details on property names.
       
  2185  *
       
  2186  * Returns: a newly created parameter specification
       
  2187  */
       
  2188 EXPORT_C GParamSpec*
       
  2189 g_param_spec_param (const gchar *name,
       
  2190 		    const gchar *nick,
       
  2191 		    const gchar *blurb,
       
  2192 		    GType	 param_type,
       
  2193 		    GParamFlags  flags)
       
  2194 {
       
  2195   GParamSpecParam *pspec;
       
  2196   
       
  2197   g_return_val_if_fail (G_TYPE_IS_PARAM (param_type), NULL);
       
  2198   
       
  2199   pspec = g_param_spec_internal (G_TYPE_PARAM_PARAM,
       
  2200 				 name,
       
  2201 				 nick,
       
  2202 				 blurb,
       
  2203 				 flags);
       
  2204   G_PARAM_SPEC (pspec)->value_type = param_type;
       
  2205   
       
  2206   return G_PARAM_SPEC (pspec);
       
  2207 }
       
  2208 
       
  2209 /**
       
  2210  * g_param_spec_boxed:
       
  2211  * @name: canonical name of the property specified
       
  2212  * @nick: nick name for the property specified
       
  2213  * @blurb: description of the property specified
       
  2214  * @boxed_type: %G_TYPE_BOXED derived type of this property
       
  2215  * @flags: flags for the property specified
       
  2216  *
       
  2217  * Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_BOXED
       
  2218  * derived property.
       
  2219  *
       
  2220  * See g_param_spec_internal() for details on property names.
       
  2221  *
       
  2222  * Returns: a newly created parameter specification
       
  2223  */
       
  2224 EXPORT_C GParamSpec*
       
  2225 g_param_spec_boxed (const gchar *name,
       
  2226 		    const gchar *nick,
       
  2227 		    const gchar *blurb,
       
  2228 		    GType	 boxed_type,
       
  2229 		    GParamFlags  flags)
       
  2230 {
       
  2231   GParamSpecBoxed *bspec;
       
  2232   
       
  2233   g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
       
  2234   g_return_val_if_fail (G_TYPE_IS_VALUE_TYPE (boxed_type), NULL);
       
  2235   
       
  2236   bspec = g_param_spec_internal (G_TYPE_PARAM_BOXED,
       
  2237 				 name,
       
  2238 				 nick,
       
  2239 				 blurb,
       
  2240 				 flags);
       
  2241   G_PARAM_SPEC (bspec)->value_type = boxed_type;
       
  2242   
       
  2243   return G_PARAM_SPEC (bspec);
       
  2244 }
       
  2245 
       
  2246 /**
       
  2247  * g_param_spec_pointer:
       
  2248  * @name: canonical name of the property specified
       
  2249  * @nick: nick name for the property specified
       
  2250  * @blurb: description of the property specified
       
  2251  * @flags: flags for the property specified
       
  2252  *
       
  2253  * Creates a new #GParamSpecPoiner instance specifying a pointer property.
       
  2254  *
       
  2255  * See g_param_spec_internal() for details on property names.
       
  2256  *
       
  2257  * Returns: a newly created parameter specification
       
  2258  */
       
  2259 EXPORT_C GParamSpec*
       
  2260 g_param_spec_pointer (const gchar *name,
       
  2261 		      const gchar *nick,
       
  2262 		      const gchar *blurb,
       
  2263 		      GParamFlags  flags)
       
  2264 {
       
  2265   GParamSpecPointer *pspec;
       
  2266   
       
  2267   pspec = g_param_spec_internal (G_TYPE_PARAM_POINTER,
       
  2268 				 name,
       
  2269 				 nick,
       
  2270 				 blurb,
       
  2271 				 flags);
       
  2272   return G_PARAM_SPEC (pspec);
       
  2273 }
       
  2274 
       
  2275 /**
       
  2276  * g_param_spec_gtype:
       
  2277  * @name: canonical name of the property specified
       
  2278  * @nick: nick name for the property specified
       
  2279  * @blurb: description of the property specified
       
  2280  * @is_a_type: a #GType whose subtypes are allowed as values
       
  2281  *  of the property (use %G_TYPE_NONE for any type)
       
  2282  * @flags: flags for the property specified
       
  2283  *
       
  2284  * Creates a new #GParamSpecGType instance specifying a
       
  2285  * %G_TYPE_GTYPE property.
       
  2286  *
       
  2287  * See g_param_spec_internal() for details on property names.
       
  2288  *
       
  2289  * Since: 2.10
       
  2290  *
       
  2291  * Returns: a newly created parameter specification
       
  2292  */
       
  2293 EXPORT_C GParamSpec*
       
  2294 g_param_spec_gtype (const gchar *name,
       
  2295 		    const gchar *nick,
       
  2296 		    const gchar *blurb,
       
  2297 		    GType        is_a_type,
       
  2298 		    GParamFlags  flags)
       
  2299 {
       
  2300   GParamSpecGType *tspec;
       
  2301   
       
  2302   tspec = g_param_spec_internal (G_TYPE_PARAM_GTYPE,
       
  2303 				 name,
       
  2304 				 nick,
       
  2305 				 blurb,
       
  2306 				 flags);
       
  2307 
       
  2308   tspec->is_a_type = is_a_type;
       
  2309 
       
  2310   return G_PARAM_SPEC (tspec);
       
  2311 }
       
  2312 
       
  2313 /**
       
  2314  * g_param_spec_value_array:
       
  2315  * @name: canonical name of the property specified
       
  2316  * @nick: nick name for the property specified
       
  2317  * @blurb: description of the property specified
       
  2318  * @element_spec: a #GParamSpec describing the elements contained in
       
  2319  *  arrays of this property, may be %NULL
       
  2320  * @flags: flags for the property specified
       
  2321  *
       
  2322  * Creates a new #GParamSpecValueArray instance specifying a
       
  2323  * %G_TYPE_VALUE_ARRAY property. %G_TYPE_VALUE_ARRAY is a
       
  2324  * %G_TYPE_BOXED type, as such, #GValue structures for this property
       
  2325  * can be accessed with g_value_set_boxed() and g_value_get_boxed().
       
  2326  *
       
  2327  * See g_param_spec_internal() for details on property names.
       
  2328  *
       
  2329  * Returns: a newly created parameter specification
       
  2330  */
       
  2331 EXPORT_C GParamSpec*
       
  2332 g_param_spec_value_array (const gchar *name,
       
  2333 			  const gchar *nick,
       
  2334 			  const gchar *blurb,
       
  2335 			  GParamSpec  *element_spec,
       
  2336 			  GParamFlags  flags)
       
  2337 {
       
  2338   GParamSpecValueArray *aspec;
       
  2339   
       
  2340   if (element_spec)
       
  2341     g_return_val_if_fail (G_IS_PARAM_SPEC (element_spec), NULL);
       
  2342   
       
  2343   aspec = g_param_spec_internal (G_TYPE_PARAM_VALUE_ARRAY,
       
  2344 				 name,
       
  2345 				 nick,
       
  2346 				 blurb,
       
  2347 				 flags);
       
  2348   if (element_spec)
       
  2349     {
       
  2350       aspec->element_spec = g_param_spec_ref (element_spec);
       
  2351       g_param_spec_sink (element_spec);
       
  2352     }
       
  2353 
       
  2354   return G_PARAM_SPEC (aspec);
       
  2355 }
       
  2356 
       
  2357 /**
       
  2358  * g_param_spec_object:
       
  2359  * @name: canonical name of the property specified
       
  2360  * @nick: nick name for the property specified
       
  2361  * @blurb: description of the property specified
       
  2362  * @object_type: %G_TYPE_OBJECT derived type of this property
       
  2363  * @flags: flags for the property specified
       
  2364  *
       
  2365  * Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_OBJECT
       
  2366  * derived property.
       
  2367  *
       
  2368  * See g_param_spec_internal() for details on property names.
       
  2369  *
       
  2370  * Returns: a newly created parameter specification
       
  2371  */
       
  2372 EXPORT_C GParamSpec*
       
  2373 g_param_spec_object (const gchar *name,
       
  2374 		     const gchar *nick,
       
  2375 		     const gchar *blurb,
       
  2376 		     GType	  object_type,
       
  2377 		     GParamFlags  flags)
       
  2378 {
       
  2379   GParamSpecObject *ospec;
       
  2380   
       
  2381   g_return_val_if_fail (g_type_is_a (object_type, G_TYPE_OBJECT), NULL);
       
  2382   
       
  2383   ospec = g_param_spec_internal (G_TYPE_PARAM_OBJECT,
       
  2384 				 name,
       
  2385 				 nick,
       
  2386 				 blurb,
       
  2387 				 flags);
       
  2388   G_PARAM_SPEC (ospec)->value_type = object_type;
       
  2389   
       
  2390   return G_PARAM_SPEC (ospec);
       
  2391 }
       
  2392 
       
  2393 /**
       
  2394  * g_param_spec_override:
       
  2395  * @name: the name of the property.
       
  2396  * @overridden: The property that is being overridden
       
  2397  *
       
  2398  * Creates a new property of type #GParamSpecOverride. This is used
       
  2399  * to direct operations to another paramspec, and will not be directly
       
  2400  * useful unless you are implementing a new base type similar to GObject.
       
  2401  *
       
  2402  * Since: 2.4
       
  2403  *
       
  2404  * Returns: the newly created #GParamSpec
       
  2405  */
       
  2406 EXPORT_C GParamSpec*
       
  2407 g_param_spec_override (const gchar *name,
       
  2408 		       GParamSpec  *overridden)
       
  2409 {
       
  2410   GParamSpec *pspec;
       
  2411   
       
  2412   g_return_val_if_fail (name != NULL, NULL);
       
  2413   g_return_val_if_fail (G_IS_PARAM_SPEC (overridden), NULL);
       
  2414   
       
  2415   /* Dereference further redirections for property that was passed in
       
  2416    */
       
  2417   while (TRUE)
       
  2418     {
       
  2419       GParamSpec *indirect = g_param_spec_get_redirect_target (overridden);
       
  2420       if (indirect)
       
  2421 	overridden = indirect;
       
  2422       else
       
  2423 	break;
       
  2424     }
       
  2425 
       
  2426   pspec = g_param_spec_internal (G_TYPE_PARAM_OVERRIDE,
       
  2427 				 name, NULL, NULL,
       
  2428 				 overridden->flags);
       
  2429   
       
  2430   pspec->value_type = G_PARAM_SPEC_VALUE_TYPE (overridden);
       
  2431   G_PARAM_SPEC_OVERRIDE (pspec)->overridden = g_param_spec_ref (overridden);
       
  2432 
       
  2433   return pspec;
       
  2434 }
       
  2435 
       
  2436 #define __G_PARAMSPECS_C__
       
  2437 #include "gobjectaliasdef.c"