/[ascend]/trunk/base/generic/compiler/notequery.c
ViewVC logotype

Diff of /trunk/base/generic/compiler/notequery.c

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

revision 1800 by jpye, Mon Jul 14 04:33:11 2008 UTC revision 1925 by jpye, Wed Oct 8 02:25:14 2008 UTC
# Line 33  const char *notes_get_for_variable(symch Line 33  const char *notes_get_for_variable(symch
33    
34      struct gl_list_t *types = GetAncestorNames(t);      struct gl_list_t *types = GetAncestorNames(t);
35      struct gl_list_t *langs = gl_create(1);      struct gl_list_t *langs = gl_create(1);
     struct gl_list_t *methods = gl_create(1);  
     struct gl_list_t *nds = gl_create(1);  
36      struct gl_list_t *ids = gl_create(1);      struct gl_list_t *ids = gl_create(1);
37    
38      int i;      int i;
# Line 49  const char *notes_get_for_variable(symch Line 47  const char *notes_get_for_variable(symch
47    
48      noteslist = GetNotesList(dbid,types,langs,ids,NOTESWILDLIST,NOTESWILDLIST);      noteslist = GetNotesList(dbid,types,langs,ids,NOTESWILDLIST,NOTESWILDLIST);
49    
50        gl_destroy(types);
51        gl_destroy(langs);
52        gl_destroy(ids);
53    
54      CONSOLE_DEBUG("noteslist = %ld items",gl_length(noteslist));      CONSOLE_DEBUG("noteslist = %ld items",gl_length(noteslist));
55    
56      if(gl_length(noteslist)==0){      if(gl_length(noteslist)==0){
# Line 64  const char *notes_get_for_variable(symch Line 66  const char *notes_get_for_variable(symch
66      return BraceCharString(GetNoteText(n));      return BraceCharString(GetNoteText(n));
67  }  }
68    
69    struct gl_list_t *notes_get_vars_with_notetype(
70        symchar *dbid
71        , const struct TypeDescription *t
72        , const symchar *notetype
73    ){
74        int i;
75        struct gl_list_t *noteslist;
76        struct gl_list_t *refinednoteslist = gl_create(1);
77    
78        struct gl_list_t *types = GetAncestorNames(t);
79        struct gl_list_t *langs = gl_create(1);
80        struct gl_list_t *ids = gl_create(1);
81    #if 0
82        CONSOLE_DEBUG("type '%s' has %ld ancestor types",SCP(GetName(t)),gl_length(types));
83        for(i=1; i<=gl_length(types); ++i){
84            CONSOLE_DEBUG("ancestor %d: %s",i,SCP((symchar *)gl_fetch(types,i)));
85        }
86    #endif
87    
88        /*CONSOLE_DEBUG("Looking for notes of type '%s'",SCP(notetype));*/
89        gl_append_ptr(langs,(VOIDPTR)notetype);
90    
91        /* create a new list with our top-level type at the start */
92        struct gl_list_t *typesall = gl_create(1);
93        gl_append_ptr(typesall,(VOIDPTR)t);
94        for(i=1;i<=gl_length(types);++i){
95            //CONSOLE_DEBUG("Appending '%s' to typesall",SCP(GetName((struct TypeDescription *)gl_fetch(types,i))));
96            gl_append_ptr(typesall,gl_fetch(types,i));
97        }
98        /* CONSOLE_DEBUG("length of types = %ld, typesall = %ld",gl_length(types), gl_length(typesall));*/
99    
100        gl_destroy(types);
101    
102        noteslist = GetNotesList(dbid,typesall,langs,NOTESWILDLIST,NOTESWILDLIST,NOTESWILDLIST);
103    
104        gl_destroy(typesall);
105        gl_destroy(langs);
106    
107        /*CONSOLE_DEBUG("noteslist = %ld items",gl_length(noteslist));*/
108    
109        const symchar *lastid = NULL;
110        for(i=1; i<=gl_length(noteslist); ++i){
111            struct Note *n = (struct Note *)gl_fetch(noteslist,i);
112            /* CONSOLE_DEBUG("note ID = %s, lastid = %s",GetNoteId(n),lastid); */
113            if(!lastid || lastid != GetNoteId(n)){
114                gl_append_ptr(refinednoteslist,(VOIDPTR)n);
115                lastid = GetNoteId(n);
116            }
117        }
118        gl_destroy(noteslist);
119    
120        if(gl_length(refinednoteslist)==0){
121            gl_destroy(refinednoteslist);
122            /* CONSOLE_DEBUG("empty notes list returned"); */
123            return NULL;
124        }
125    
126        return refinednoteslist;
127    }
128    

Legend:
Removed from v.1800  
changed lines
  Added in v.1925

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22