/[guile]/guile/guile-core/libguile/struct.c
ViewVC logotype

Diff of /guile/guile-core/libguile/struct.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.91 by ttn, Thu Mar 14 03:47:43 2002 UTC revision 1.92 by xxhanwen, Sat Jul 20 14:08:34 2002 UTC
# Line 440  SCM_DEFINE (scm_make_struct, "make-struc Line 440  SCM_DEFINE (scm_make_struct, "make-struc
440    scm_t_bits * data;    scm_t_bits * data;
441    SCM handle;    SCM handle;
442    
443    SCM_VALIDATE_VTABLE (1,vtable);    SCM_VALIDATE_VTABLE (1, vtable);
444    SCM_VALIDATE_INUM (2,tail_array_size);    SCM_VALIDATE_INUM (2, tail_array_size);
445    SCM_VALIDATE_REST_ARGUMENT (init);    SCM_VALIDATE_REST_ARGUMENT (init);
446    
447    layout = SCM_PACK (SCM_STRUCT_DATA (vtable) [scm_vtable_index_layout]);    layout = SCM_PACK (SCM_STRUCT_DATA (vtable) [scm_vtable_index_layout]);
# Line 569  SCM_DEFINE (scm_struct_ref, "struct-ref" Line 569  SCM_DEFINE (scm_struct_ref, "struct-ref"
569    char field_type = 0;    char field_type = 0;
570        
571    
572    SCM_VALIDATE_STRUCT (1,handle);    SCM_VALIDATE_STRUCT (1, handle);
573    SCM_VALIDATE_INUM (2,pos);    SCM_VALIDATE_INUM (2, pos);
574    
575    layout = SCM_STRUCT_LAYOUT (handle);    layout = SCM_STRUCT_LAYOUT (handle);
576    data = SCM_STRUCT_DATA (handle);    data = SCM_STRUCT_DATA (handle);
# Line 579  SCM_DEFINE (scm_struct_ref, "struct-ref" Line 579  SCM_DEFINE (scm_struct_ref, "struct-ref"
579    fields_desc = SCM_SYMBOL_CHARS (layout);    fields_desc = SCM_SYMBOL_CHARS (layout);
580    n_fields = data[scm_struct_i_n_words];    n_fields = data[scm_struct_i_n_words];
581        
582    SCM_ASSERT_RANGE(1,pos, p < n_fields);    SCM_ASSERT_RANGE(1, pos, p < n_fields);
583    
584    if (p * 2 < SCM_SYMBOL_LENGTH (layout))    if (p * 2 < SCM_SYMBOL_LENGTH (layout))
585      {      {
# Line 645  SCM_DEFINE (scm_struct_set_x, "struct-se Line 645  SCM_DEFINE (scm_struct_set_x, "struct-se
645    char * fields_desc;    char * fields_desc;
646    char field_type = 0;    char field_type = 0;
647    
648    SCM_VALIDATE_STRUCT (1,handle);    SCM_VALIDATE_STRUCT (1, handle);
649    SCM_VALIDATE_INUM (2,pos);    SCM_VALIDATE_INUM (2, pos);
650    
651    layout = SCM_STRUCT_LAYOUT (handle);    layout = SCM_STRUCT_LAYOUT (handle);
652    data = SCM_STRUCT_DATA (handle);    data = SCM_STRUCT_DATA (handle);
# Line 655  SCM_DEFINE (scm_struct_set_x, "struct-se Line 655  SCM_DEFINE (scm_struct_set_x, "struct-se
655    fields_desc = SCM_SYMBOL_CHARS (layout);    fields_desc = SCM_SYMBOL_CHARS (layout);
656    n_fields = data[scm_struct_i_n_words];    n_fields = data[scm_struct_i_n_words];
657    
658    SCM_ASSERT_RANGE (1,pos, p < n_fields);    SCM_ASSERT_RANGE (1, pos, p < n_fields);
659    
660    if (p * 2 < SCM_SYMBOL_LENGTH (layout))    if (p * 2 < SCM_SYMBOL_LENGTH (layout))
661      {      {
# Line 708  SCM_DEFINE (scm_struct_vtable, "struct-v Line 708  SCM_DEFINE (scm_struct_vtable, "struct-v
708              "Return the vtable structure that describes the type of @var{struct}.")              "Return the vtable structure that describes the type of @var{struct}.")
709  #define FUNC_NAME s_scm_struct_vtable  #define FUNC_NAME s_scm_struct_vtable
710  {  {
711    SCM_VALIDATE_STRUCT (1,handle);    SCM_VALIDATE_STRUCT (1, handle);
712    return SCM_STRUCT_VTABLE (handle);    return SCM_STRUCT_VTABLE (handle);
713  }  }
714  #undef FUNC_NAME  #undef FUNC_NAME
# Line 719  SCM_DEFINE (scm_struct_vtable_tag, "stru Line 719  SCM_DEFINE (scm_struct_vtable_tag, "stru
719              "Return the vtable tag of the structure @var{handle}.")              "Return the vtable tag of the structure @var{handle}.")
720  #define FUNC_NAME s_scm_struct_vtable_tag  #define FUNC_NAME s_scm_struct_vtable_tag
721  {  {
722    SCM_VALIDATE_VTABLE (1,handle);    SCM_VALIDATE_VTABLE (1, handle);
723    return scm_long2num ((long) SCM_STRUCT_DATA (handle) >> 3);    return scm_long2num ((long) SCM_STRUCT_DATA (handle) >> 3);
724  }  }
725  #undef FUNC_NAME  #undef FUNC_NAME
# Line 758  SCM_DEFINE (scm_struct_vtable_name, "str Line 758  SCM_DEFINE (scm_struct_vtable_name, "str
758              "Return the name of the vtable @var{vtable}.")              "Return the name of the vtable @var{vtable}.")
759  #define FUNC_NAME s_scm_struct_vtable_name  #define FUNC_NAME s_scm_struct_vtable_name
760  {  {
761    SCM_VALIDATE_VTABLE (1,vtable);    SCM_VALIDATE_VTABLE (1, vtable);
762    return SCM_STRUCT_TABLE_NAME (SCM_CDR (scm_struct_create_handle (vtable)));    return SCM_STRUCT_TABLE_NAME (SCM_CDR (scm_struct_create_handle (vtable)));
763  }  }
764  #undef FUNC_NAME  #undef FUNC_NAME
# Line 768  SCM_DEFINE (scm_set_struct_vtable_name_x Line 768  SCM_DEFINE (scm_set_struct_vtable_name_x
768              "Set the name of the vtable @var{vtable} to @var{name}.")              "Set the name of the vtable @var{vtable} to @var{name}.")
769  #define FUNC_NAME s_scm_set_struct_vtable_name_x  #define FUNC_NAME s_scm_set_struct_vtable_name_x
770  {  {
771    SCM_VALIDATE_VTABLE (1,vtable);    SCM_VALIDATE_VTABLE (1, vtable);
772    SCM_VALIDATE_SYMBOL (2,name);    SCM_VALIDATE_SYMBOL (2, name);
773    SCM_SET_STRUCT_TABLE_NAME (SCM_CDR (scm_struct_create_handle (vtable)),    SCM_SET_STRUCT_TABLE_NAME (SCM_CDR (scm_struct_create_handle (vtable)),
774                               name);                               name);
775    return SCM_UNSPECIFIED;    return SCM_UNSPECIFIED;

Legend:
Removed from v.1.91  
changed lines
  Added in v.1.92

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26