Just while on the subject and Jamie is involved, here is my biggest
issue at the moment with regard to paths and selective parsing. In the
following "joke/testbed code" notice
1) inclusion of fstab.h. This is in /usr/include.
2) the inclusion of <asm/thread_info.h>. This is in
~/programming/c/linux.....
All files have been "cscope'd" for easy file opening from structure references.
I open my test file and move to the line "pfstabEntry->". I try inline
completion. I do not get the structure values. I open the
/usr/include/fstab.h using cscope navigation command, and *then*
completion works. Semantic is now aware of fstab.
However, if I move to the "pti->" line having opened the thread_info.h
file in a similar way, then completion does not work. I know this is
going to be down to some path issue, but I tried Jamie's suggestion
earlier specifying the complete directory as well as header root for the
thread_info file in the c-mode-hook e.g
,----
| (defun semantic-c-mode-hook ()
| (semantic-add-system-include "/home/programming/c/linux-source-2.6.20/include/asm"))
| (add-hook 'c-mode-common-hook 'semantic-c-mode-hook)
| (add-hook 'c-mode-hook 'semantic-c-mode-hook)
`----
C test Code below.
#include <stdio.h>
#include <stdlib.h>
#include <fstab.h>
#include <gtk/gtk.h>
#include <sched.h>
#include <asm/thread_info.h>
#include "filesystems.h"
/* START GLOBALS */
/* The head of the fstab copies */
GList * pfstab;
struct fstab * pfstabEntry = p;
struct thread_info * pti;
/* END GLOBALS */
/* release all memory reserved for a temporary fstab structure */
void fstabFreeEntry(gpointer p, gpointer ignore){
pti->
pfstabEntry->
g_free(pfstabEntry->fs_spec);
g_free(pfstabEntry->fs_file);
g_free(pfstabEntry->fs_vfstype);
g_free(pfstabEntry->fs_);
g_free(p);
}
"Jamie Macbeth" <jamie.macbeth@...> writes:
> Hi, Hadron, Eric, and others
>
> I went through some of the same difficulty with semantic intellisense
> completion a couple of months ago. i hope that you guys don't mind me
> putting my two cents in. please correct me on any of these points if
> i'm wrong
>
> first, semantic does require that you include the header file of
> interest in order to get completion on any symbols. to me this seems
> to be a nice optimization. by default semantic performs a recursive
> search through included header files to collect tags for completion,
> so if your fstab.h header file includes other header files that are
> needed to perform the completion they will be searched.
>
> second, and way more important, usually semantic needs to be able to
> find the header file itself in the filesystem before it gets it's
> tags. it needs the full path to the header before it tries to find
> the tag table for the header in any database. semantic stores tag
> caches on a directory by directory basis, so it wants the full path to
> the file to know which directory cache to look in.
>
> for system databases, i found that i needed to add the path in
> manually before creating the database. i put this in my .emacs.
>
> (defun semantic-c-mode-hook ()
> (semantic-add-system-include "/path/to/header/files"))
> (add-hook 'c-mode-common-hook 'semantic-c-mode-hook)
> (add-hook 'c-mode-hook 'semantic-c-mode-hook)
>
> one easy way to make sure that semantic is indeed caching tags and
> creating system databases correctly is by looking for a file called
> "semantic.cache" in the directory of interest. it is a text file and
> you can look through it. by the way, if you try to create a database
> where you don't have permission to write a file i think it will fail
> ... i always put this in my .emacs.
>
> (setq semanticdb-default-save-directory "/home/directory/.semanticdb")
>
> and it stores all of the caches there.
>
> finally, if the "unloaded" flag is not set in the
> semanticdb-find-default-throttle, semantic will not automatically open
> a header file that it has never seen, even if it has the path to it.
>
> Jamie
>
>
> On 5/6/07, Hadron <hadronquark@...> wrote:
>>
>>
>> (1) Persistence of semantic completion.
>>
>> If I add this line to some C
>>
>> struct fstab fs;
>>
>> and then try to complete "fs.", it doesn't work. This is fine. So I add
>>
>> #include <fstab.h>
>>
>> Still doesnt complete "fs.". OK, so I visit the file. Bingo! Completion
>> now works. So far as I expected.
>>
>> I then do a semanticdb-save-all-db. So why doesnt it remember the
>> fstab.h completion candidates the next time I open my test file and try
>> to complete "fs."? What does the save function actually save?
>>
>> (2) semantic search
>>
>> There is a blur in my mind between tags and semantic search. Can someone
>> explain how & what the differences are.
>>
>> If I have a few files open, cant I use a semantic search to locate a
>> varable definition? At the moment I use cscope for that. So whats the
>> use of the semantic search functions? They appear to be no more than in
>> "in buffer" search. Does semantic offer a "jump to definition"
>> functionality similar to cscope?
>>
>> thanks for any explanations and/or pointers.
>>
>>
>> --
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> cedet-semantic mailing list
>> cedet-semantic@...
>> https://lists.sourceforge.net/lists/listinfo/cedet-semantic
>>
>
--
|