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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1800 - (hide annotations) (download) (as text)
Mon Jul 14 04:33:11 2008 UTC (14 years ago) by jpye
File MIME type: text/x-csrc
File size: 2024 byte(s)
Adding 'most refined note' support.
1 jpye 1800 /* ASCEND modelling environment
2     Copyright (C) 2008 Carnegie Mellon University
3    
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2, or (at your option)
7     any later version.
8    
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     GNU General Public License for more details.
13    
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 59 Temple Place - Suite 330,
17     Boston, MA 02111-1307, USA.
18     *//** @file
19     Query function(s) for the NOTES database in notate.h
20     */
21    
22     #include "notequery.h"
23     #include "notate.h"
24     #include "symtab.h"
25     #include <utilities/error.h>
26    
27     const char *notes_get_for_variable(symchar *dbid
28     , const struct TypeDescription *t
29     , const symchar *varname
30     , const symchar *notetype
31     ){
32     struct gl_list_t *noteslist;
33    
34     struct gl_list_t *types = GetAncestorNames(t);
35     struct gl_list_t *langs = gl_create(1);
36     struct gl_list_t *methods = gl_create(1);
37     struct gl_list_t *nds = gl_create(1);
38     struct gl_list_t *ids = gl_create(1);
39    
40     int i;
41     for(i=1; i<=gl_length(types); ++i){
42     CONSOLE_DEBUG("ancestor %d: %s",i,SCP((symchar *)gl_fetch(types,i)));
43     }
44    
45     symchar *inl = AddSymbol("inline");
46     gl_append_ptr(langs,(VOIDPTR)inl);
47    
48     gl_append_ptr(ids,(VOIDPTR)varname);
49    
50     noteslist = GetNotesList(dbid,types,langs,ids,NOTESWILDLIST,NOTESWILDLIST);
51    
52     CONSOLE_DEBUG("noteslist = %ld items",gl_length(noteslist));
53    
54     if(gl_length(noteslist)==0){
55     CONSOLE_DEBUG("empty notes list returned");
56     return NULL;
57     }
58     struct Note *n = (struct Note *)gl_fetch(noteslist,1);
59    
60     CONSOLE_DEBUG("note ID = %s, lang = %s",SCP(GetNoteId(n)),SCP(GetNoteLanguage(n)));
61    
62     CONSOLE_DEBUG("note text = %s",BraceCharString(GetNoteText(n)));
63    
64     return BraceCharString(GetNoteText(n));
65     }
66    

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