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

gEDA-cvs: CVS update: g_smob.c



  User: cnieves 
  Date: 06/12/13 15:57:45

  Modified:    .        g_smob.c
  Log:
  * include/prototype.h, src/g_smob.c:
  
    Added a new scheme function: get-object-type, returning
  
    the object type (object->type as a scheme string) of the given
  
    object.
  
  
  
  
  Revision  Changes    Path
  1.11      +33 -0     eda/geda/gaf/libgeda/src/g_smob.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_smob.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/g_smob.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- g_smob.c	5 Dec 2006 22:47:23 -0000	1.10
  +++ g_smob.c	13 Dec 2006 20:57:45 -0000	1.11
  @@ -400,6 +400,38 @@
     return returned;
   }
   
  +/*! \brief Get the object type.
  + *  \par Function Description
  + *  This function returns a string with the type of a given object smob.
  + *
  + *  \param [in] object_smob  The object smob to get the type from.
  + *  \return A string with the type of the given object. 
  + *   Actually it is the object->type character converted into a string.
  + */
  +SCM g_get_object_type(SCM object_smob)
  +{
  +  struct st_object_smob *object_struct;
  +  OBJECT *object;
  +  SCM returned = SCM_EOL;
  +  char type[2];
  +
  +  SCM_ASSERT ( SCM_NIMP(object_smob) && 
  +               ((long) SCM_CAR(object_smob) == object_smob_tag),
  +               object_smob, SCM_ARG1, "get-object-type");
  +
  +  object_struct = (struct st_object_smob *)SCM_CDR(object_smob);
  +
  +  g_assert (object_struct && object_struct->object);
  +  
  +  object = (OBJECT *) object_struct->object;
  +  
  +  sprintf(type, "%c", object->type);
  +
  +  returned = scm_makfrom0str(type);
  +
  +  return returned;
  +}
  +
   /*! \brief Initialize the framework to support an object smob.
    *  \par Function Description
    *  Initialize the framework to support an object smob.
  @@ -414,6 +446,7 @@
     scm_set_smob_print(object_smob_tag, g_print_object_smob);
   
     scm_c_define_gsubr("get-object-attributes", 1, 0, 0, g_get_object_attributes);
  +  scm_c_define_gsubr("get-object-type", 1, 0, 0, g_get_object_type);
   
     return;
   }
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs