您的位置:首页 > 其它

阅读Sofia-SIP源码三 源码文件结构

2014-09-01 16:02 281 查看
将分别介绍.c文件结构和.h文件结构。

.c文件结构

Sofia-SIP库中.c文件的头部一般如下面所示:

/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/

/**@CFILE url_tag.c  URL Tag classes
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Wed Feb 21 10:15:20 2001 ppessi
*/

最前面那段是标准的,所有.c文件头部都包括,而且内容都一样。第二段是个模板,有三个信息。每条信息都有起始字串。信息之间用一个空行来分隔。@CFILE,说明这是一个.c源文件,然后一个空格后跟着的是文件名,然后再是一个空格,最后一串内容是简短的介绍性文字。@author,说明这条信息是指出本文件作者的姓名,以及电子邮件。@date Created:,说明这条信息是指出本文件的创建时间以及作者姓名。

.h文件结构

Sofia-SIP库中.h文件的头部一般如下面所示:

/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/

#ifndef URL_TAG_H
/** Defined when <sofia-sip/url_tag.h> has been included. */
#define URL_TAG_H
/**@file  url_tag.h
* @brief Tags for URLs
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
*
* @date Created: Wed Feb 21 11:01:45 2001 ppessi
*/

与.c文件的头部非常相似。最前面那段是标准的,所有.h文件头部都包括,而且内容都一样。然后一小段与.c文件不同,此处有包含卫哨,是个宏定义。这一小段也是个模板,所有的.h文件都有。第三段是个模板,有四个信息。每条信息都有起始字串。信息之间用一个空行来分隔。@file,说明这是一个.c源文件,然后一个空格后跟着的是文件名。@brief,说明其后跟着的是一串内容是本头文件简短的介绍性文字。@author,说明这条信息是指出本文件作者的姓名,以及电子邮件。@date Created:,说明这条信息是指出本文件的创建时间以及作者姓名。

我想作者使用了emacs工具来创建这些源代码文件,这些通用信息都是由工具自动填写的。规范化、格式化的信息利于使用其它工具来抽取他们形成其它文档。

后来我在看Sofia-SIP官网的“文档化”章节时,那也提到了上述内容,可做参考。http://sofia-sip.sourceforge.net/refdocs/docguide.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: