Ignore:
Timestamp:
Apr 27, 2004, 8:39:34 PM (21 years ago)
Author:
bird
Message:

GCC v3.3.3 sources.

Location:
branches/GNU/src/gcc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gcc

    • Property svn:ignore
      •  

        old new  
        2626configure.vr
        2727configure.vrs
         28dir.info
        2829Makefile
        29 dir.info
        3030lost+found
        3131update.out
  • branches/GNU/src/gcc/libobjc/class.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r1390 r1391  
    11/* GNU Objective C Runtime class related functions
    2    Copyright (C) 1993, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
     2   Copyright (C) 1993, 1995, 1996, 1997, 2001, 2002
     3     Free Software Foundation, Inc.
    34   Contributed by Kresten Krab Thorup and Dennis Glatting.
    45
     
    164165/* Setup the table.  */
    165166static void
    166 class_table_setup ()
     167class_table_setup (void)
    167168{
    168169  /* Start - nothing in the table.  */
    169   memset (class_table_array, 0, sizeof(class_node_ptr) * CLASS_TABLE_SIZE);
     170  memset (class_table_array, 0, sizeof (class_node_ptr) * CLASS_TABLE_SIZE);
    170171
    171172  /* The table writing mutex.  */
     
    340341/* Debugging function - print the class table.  */
    341342void
    342 class_table_print ()
     343class_table_print (void)
    343344{
    344345  int i;
     
    363364   in real cases.  */
    364365void
    365 class_table_print_histogram ()
     366class_table_print_histogram (void)
    366367{
    367368  int i, j;
     
    409410   objc_lookup_class if the runtime is not able to find the class. 
    410411   This may e.g. try to load in the class using dynamic loading.  */
    411 Class (*_objc_lookup_class)(const char* name) = 0;      /* !T:SAFE */
     412Class (*_objc_lookup_class) (const char *name) = 0;      /* !T:SAFE */
    412413
    413414
     
    416417
    417418
    418 void __objc_init_class_tables()
     419void
     420__objc_init_class_tables (void)
    419421{
    420422  /* Allocate the class hash table.  */
    421423 
    422   if(__class_table_lock)
     424  if (__class_table_lock)
    423425    return;
    424426 
    425   objc_mutex_lock(__objc_runtime_mutex);
     427  objc_mutex_lock (__objc_runtime_mutex);
    426428 
    427429  class_table_setup ();
    428430
    429   objc_mutex_unlock(__objc_runtime_mutex);
     431  objc_mutex_unlock (__objc_runtime_mutex);
    430432
    431433
     
    433435   class a number, unless it's already known.  */
    434436void
    435 __objc_add_class_to_hash(Class class)
     437__objc_add_class_to_hash (Class class)
    436438{
    437439  Class h_class;
    438440
    439   objc_mutex_lock(__objc_runtime_mutex);
     441  objc_mutex_lock (__objc_runtime_mutex);
    440442
    441443  /* Make sure the table is there.  */
    442   assert(__class_table_lock);
     444  assert (__class_table_lock);
    443445
    444446  /* Make sure it's not a meta class.  */
    445   assert(CLS_ISCLASS(class));
     447  assert (CLS_ISCLASS (class));
    446448
    447449  /* Check to see if the class is already in the hash table.  */
    448450  h_class = class_table_get_safe (class->name);
    449   if (!h_class)
     451  if (! h_class)
    450452    {
    451453      /* The class isn't in the hash table.  Add the class and assign a class
     
    453455      static unsigned int class_number = 1;
    454456
    455       CLS_SETNUMBER(class, class_number);
    456       CLS_SETNUMBER(class->class_pointer, class_number);
     457      CLS_SETNUMBER (class, class_number);
     458      CLS_SETNUMBER (class->class_pointer, class_number);
    457459
    458460      ++class_number;
     
    460462    }
    461463
    462   objc_mutex_unlock(__objc_runtime_mutex);
     464  objc_mutex_unlock (__objc_runtime_mutex);
    463465}
    464466
     
    466468   identify a known class, the hook _objc_lookup_class is called.  If
    467469   this fails, nil is returned.  */
    468 Class objc_lookup_class (const char* name)
     470Class
     471objc_lookup_class (const char *name)
    469472{
    470473  Class class;
     
    476479
    477480  if (_objc_lookup_class)
    478     return (*_objc_lookup_class)(name);
     481    return (*_objc_lookup_class) (name);
    479482  else
    480483    return 0;
     
    495498
    496499  if (_objc_lookup_class)
    497     class = (*_objc_lookup_class)(name);
    498 
    499   if(class)
     500    class = (*_objc_lookup_class) (name);
     501
     502  if (class)
    500503    return class;
    501504 
    502   objc_error(nil, OBJC_ERR_BAD_CLASS,
    503              "objc runtime: cannot find class %s\n", name);
     505  objc_error (nil, OBJC_ERR_BAD_CLASS,
     506              "objc runtime: cannot find class %s\n", name);
    504507  return 0;
    505508}
    506509
    507510MetaClass
    508 objc_get_meta_class(const char *name)
    509 {
    510   return objc_get_class(name)->class_pointer;
     511objc_get_meta_class (const char *name)
     512{
     513  return objc_get_class (name)->class_pointer;
    511514}
    512515
     
    517520       id class;
    518521       void *es = NULL;
    519        while ((class = objc_next_class(&es)))
     522       while ((class = objc_next_class (&es)))
    520523         ... do something with class;
    521524*/
    522525Class
    523 objc_next_class(void **enum_state)
     526objc_next_class (void **enum_state)
    524527{
    525528  Class class;
    526529
    527   objc_mutex_lock(__objc_runtime_mutex);
     530  objc_mutex_lock (__objc_runtime_mutex);
    528531 
    529532  /* Make sure the table is there.  */
    530   assert(__class_table_lock);
    531 
    532   class = class_table_next ((struct class_table_enumerator **)enum_state);
    533 
    534   objc_mutex_unlock(__objc_runtime_mutex);
     533  assert (__class_table_lock);
     534
     535  class = class_table_next ((struct class_table_enumerator **) enum_state);
     536
     537  objc_mutex_unlock (__objc_runtime_mutex);
    535538 
    536539  return class;
     
    540543   can be sure of is that the class_pointer for class objects point to
    541544   the right meta class objects.  */
    542 void __objc_resolve_class_links()
     545void
     546__objc_resolve_class_links (void)
    543547{
    544548  struct class_table_enumerator *es = NULL;
     
    546550  Class class1;
    547551
    548   assert(object_class);
    549 
    550   objc_mutex_lock(__objc_runtime_mutex);
     552  assert (object_class);
     553
     554  objc_mutex_lock (__objc_runtime_mutex);
    551555
    552556  /* Assign subclass links.  */
     
    554558    {
    555559      /* Make sure we have what we think we have.  */
    556       assert (CLS_ISCLASS(class1));
    557       assert (CLS_ISMETA(class1->class_pointer));
     560      assert (CLS_ISCLASS (class1));
     561      assert (CLS_ISMETA (class1->class_pointer));
    558562
    559563      /* The class_pointer of all meta classes point to Object's meta
     
    561565      class1->class_pointer->class_pointer = object_class->class_pointer;
    562566
    563       if (!(CLS_ISRESOLV(class1)))
    564         {
    565           CLS_SETRESOLV(class1);
    566           CLS_SETRESOLV(class1->class_pointer);
     567      if (! CLS_ISRESOLV (class1))
     568        {
     569          CLS_SETRESOLV (class1);
     570          CLS_SETRESOLV (class1->class_pointer);
    567571             
    568           if(class1->super_class)
     572          if (class1->super_class)
    569573            {   
    570574              Class a_super_class
     
    608612        {
    609613          sub_class->super_class = class1;
    610           if(CLS_ISCLASS(sub_class))
     614          if (CLS_ISCLASS (sub_class))
    611615            sub_class->class_pointer->super_class = class1->class_pointer;
    612616        }
    613617    }
    614618
    615   objc_mutex_unlock(__objc_runtime_mutex);
     619  objc_mutex_unlock (__objc_runtime_mutex);
    616620}
    617621
     
    623627class_pose_as (Class impostor, Class super_class)
    624628{
    625   if (!CLS_ISRESOLV (impostor))
     629  if (! CLS_ISRESOLV (impostor))
    626630    __objc_resolve_class_links ();
    627631
     
    686690     into impostor.  */
    687691
    688   objc_mutex_lock(__objc_runtime_mutex);
     692  objc_mutex_lock (__objc_runtime_mutex);
    689693
    690694  class_table_replace (super_class, impostor);
    691695
    692   objc_mutex_unlock(__objc_runtime_mutex);
     696  objc_mutex_unlock (__objc_runtime_mutex);
    693697
    694698  /* Next, we update the dispatch tables...  */
Note: See TracChangeset for help on using the changeset viewer.