[GRASS-SVN] r37265 -
grass/branches/releasebranch_6_4/lib/vector/diglib
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 18 13:52:28 EDT 2009
Author: martinl
Date: 2009-05-18 13:52:28 -0400 (Mon, 18 May 2009)
New Revision: 37265
Modified:
grass/branches/releasebranch_6_4/lib/vector/diglib/file.c
Log:
doxygen updated (diglib/file.c)
(merge from trunk, r37263)
Modified: grass/branches/releasebranch_6_4/lib/vector/diglib/file.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/diglib/file.c 2009-05-18 17:24:10 UTC (rev 37264)
+++ grass/branches/releasebranch_6_4/lib/vector/diglib/file.c 2009-05-18 17:52:28 UTC (rev 37265)
@@ -1,19 +1,22 @@
+/*!
+ \file diglib/file.c
-/****************************************************************************
-*
-* MODULE: Vector library
-*
-* AUTHOR(S): Dave Gerdes, Radim Blazek
-*
-* PURPOSE: Lower level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT: (C) 2001 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
+ \brief Vector library (diglib) - file management
+
+ Lower level functions for reading/writing/manipulating vectors.
+
+ Note: seems that the time is almost the same for both cases:
+ - reading from file
+ - load whole file to memory and read from memory
+
+ (C) 2001-2009 by the GRASS Development Team
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Dave Gerdes, Radim Blazek
+ */
+
#include <string.h>
#include <stdio.h>
#include <unistd.h>
@@ -21,32 +24,42 @@
#include <sys/stat.h>
#include <grass/gis.h>
#include <grass/Vect.h>
+#include <grass/glocale.h>
-/*
- * Note: seems that the time is almost the same for both cases:
- * - reading from file
- * - load whole file to memory and read from memory
- */
+/*!
+ \brief Get GVFILE position.
-/* Get GVFILE position.
- *
- * Returns: current file position
- */
-long dig_ftell(GVFILE * file)
+ \param file pointer to GVFILE structure
+
+ \return current file position
+*/
+long dig_ftell(GVFILE *file)
{
- if (file->loaded) /* using memory */
+ if (file->loaded) /* using memory */
return (file->current - file->start);
return (ftell(file->file));
}
-/* Set GVFILE position.
- *
- * Returns: 0 OK, -1 error
- */
+/*!
+ \brief Set GVFILE position.
+
+ Start positions:
+
+ - SEEK_SET (start)
+ - SEEK_CUR (current position)
+ - SEEK_END (end)
+
+ \param file pointer to GVFILE structure
+ \param offset offset position
+ \param whence start position
+
+ \return 0 OK
+ \return -1 error
+*/
int dig_fseek(GVFILE * file, long offset, int whence)
{
- if (file->loaded) { /* using memory */
+ if (file->loaded) { /* using memory */
switch (whence) {
case SEEK_SET:
file->current = file->start + offset;
@@ -64,13 +77,14 @@
return (fseek(file->file, offset, whence));
}
-/* Rewind GVFILE position.
- *
- * Returns: nothing
- */
+/*!
+ \brief Rewind GVFILE position.
+
+ \param file pointer to GVFILE structure
+*/
void dig_rewind(GVFILE * file)
{
- if (file->loaded) { /* using memory */
+ if (file->loaded) { /* using memory */
file->current = file->start;
}
else {
@@ -78,13 +92,16 @@
}
}
-/* Flush GVFILE.
- *
- * Returns: nothing
- */
+/*!
+ \brief Flush GVFILE.
+
+ \param file pointer to GVFILE structure
+
+ \return 0
+*/
int dig_fflush(GVFILE * file)
{
- if (file->loaded) { /* using memory */
+ if (file->loaded) { /* using memory */
return 0;
}
else {
@@ -92,17 +109,23 @@
}
}
-/* Read GVFILE.
- *
- * Returns: number of read members
+/*!
+ \brief Read GVFILE.
+
+ \param[out] ptr data buffer
+ \param size buffer size
+ \param nmemb number of members
+ \param file pointer to GVFILE structure
+
+ \return number of read members
*/
-size_t dig_fread(void *ptr, size_t size, size_t nmemb, GVFILE * file)
+size_t dig_fread(void *ptr, size_t size, size_t nmemb, GVFILE *file)
{
long tot;
size_t cnt;
- if (file->loaded) { /* using memory */
- if (file->current >= file->end) { /* EOF */
+ if (file->loaded) { /* using memory */
+ if (file->current >= file->end) { /* EOF */
return 0;
}
tot = size * nmemb;
@@ -118,24 +141,31 @@
return (fread(ptr, size, nmemb, file->file));
}
-/* Write GVFILE.
- *
- * Returns: number of items written
+/*!
+ \brief Write GVFILE.
+
+ \param ptr data buffer
+ \param size buffer size
+ \param nmemb number of members
+ \param[out] file pointer to GVFILE structure
+
+ \return number of items written
*/
-size_t dig_fwrite(void *ptr, size_t size, size_t nmemb, GVFILE * file)
+size_t dig_fwrite(void *ptr, size_t size, size_t nmemb, GVFILE *file)
{
- if (file->loaded) { /* using memory */
- G_fatal_error("Writing to file loaded to memory not supported");
+ if (file->loaded) { /* using memory */
+ G_fatal_error(_("Writing to file loaded to memory not supported"));
}
return fwrite(ptr, size, nmemb, file->file);
}
-/* Init GVFILE.
- *
- * Returns: nothing
- */
-void dig_file_init(GVFILE * file)
+/*!
+ \brief Initialize GVFILE.
+
+ \param[out] file pointer to GVFILE structure
+*/
+void dig_file_init(GVFILE *file)
{
file->file = NULL;
file->start = NULL;
@@ -146,11 +176,17 @@
file->loaded = 0;
}
-/* Load opened GVFILE to memory.
- * Warning: position in file is set to the beginning.
- *
- * Returns: 1 loaded, 0, not loaded, -1 Error
- */
+/*!
+ \brief Load opened GVFILE to memory.
+
+ Warning: position in file is set to the beginning.
+
+ \param file pointer to GVFILE structure
+
+ \return 1 loaded
+ \return 0 not loaded
+ \return -1 error
+*/
int dig_file_load(GVFILE * file)
{
int ret, mode, load;
@@ -161,7 +197,7 @@
G_debug(2, "dig_file_load ()");
if (file->file == NULL) {
- G_warning("Cannot load file to memory, file not open.");
+ G_warning(_("Unable to load file to memory, file not open"));
return -1;
}
@@ -176,16 +212,16 @@
else if (G_strcasecmp(cmode, "AUTO") == 0)
mode = GV_MEMORY_AUTO;
else
- G_warning("Vector memory mode not supported, using 'AUTO'");
+ G_warning(_("Vector memory mode not supported, using 'AUTO'"));
}
G_debug(2, " requested mode = %d", mode);
fstat(fileno(file->file), &sbuf);
size = sbuf.st_size;
-
+
G_debug(2, " size = %u", size);
-
+
/* Decide if the file should be loaded */
/* TODO: I don't know how to get size of free memory (portability) to decide if load or not for auto */
if (mode == GV_MEMORY_AUTO)
@@ -225,10 +261,11 @@
return 0;
}
-/* Free GVFILE.
- *
- * Returns: nothing
- */
+/*!
+ \brief Free GVFILE.
+
+ \param file pointer to GVFILE structure
+*/
void dig_file_free(GVFILE * file)
{
if (file->loaded) {
More information about the grass-commit
mailing list