New function for creating a parameter including the file and line information needed for correctly displaying warnings in typemaps (to show relevant file and line)

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7128 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-03-30 22:34:34 +00:00
commit cea876777c
2 changed files with 21 additions and 4 deletions

View file

@ -23,10 +23,10 @@ char cvsroot_parms_c[] = "$Header$";
/* ------------------------------------------------------------------------
* NewParm()
*
* Create a new parameter from datatype 'type' and name 'n'.
* Create a new parameter from datatype 'type' and name 'name'.
* ------------------------------------------------------------------------ */
Parm *NewParm(SwigType *type, const String_or_char *n) {
Parm *NewParm(SwigType *type, const String_or_char *name) {
Parm *p = NewHash();
if (type) {
@ -34,7 +34,23 @@ Parm *NewParm(SwigType *type, const String_or_char *n) {
Setattr(p,"type",ntype);
Delete(ntype);
}
Setattr(p,"name",n);
Setattr(p,"name",name);
return p;
}
/* ------------------------------------------------------------------------
* NewParmFromNode()
*
* Create a new parameter from datatype 'type' and name 'name'.
* Sets the file and line number for the parameter for error handling by
* making a (shallow) copy of file and line number from Node 'n'.
* ------------------------------------------------------------------------ */
Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
Parm *p = NewParm(type, name);
Setfile(p, Getfile(n));
Setline(p, Getline(n));
return p;
}

View file

@ -332,7 +332,8 @@ extern SwigType *Swig_symbol_template_param_eval(const SwigType *p, Symtab *symt
/* Parameters are really just hidden behind a DOH object. The following
interface will probably be simplified even further. */
extern Parm *NewParm(SwigType *type, const String_or_char *n);
extern Parm *NewParm(SwigType *type, const String_or_char *name);
extern Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n);
extern Parm *CopyParm(Parm *p);
extern ParmList *CopyParmList(ParmList *);
extern int ParmList_len(ParmList *);