summaryrefslogtreecommitdiff
path: root/src/cr-parsing-location.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cr-parsing-location.c')
-rw-r--r--src/cr-parsing-location.c64
1 files changed, 42 insertions, 22 deletions
diff --git a/src/cr-parsing-location.c b/src/cr-parsing-location.c
index 38a75a6..4fe4acc 100644
--- a/src/cr-parsing-location.c
+++ b/src/cr-parsing-location.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; indent-tabs-mode: ni; c-basic-offset: 8 -*- */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
* This file is part of The Croco Library
@@ -25,21 +25,25 @@
#include "cr-parsing-location.h"
/**
- *@file
+ *@CRParsingLocation:
+ *
*Definition of the #CRparsingLocation class.
*/
/**
+ * cr_parsing_location_new:
*Instanciates a new parsing location.
- *@return the newly instanciated #CRParsingLocation.
+ *
+ *Returns the newly instanciated #CRParsingLocation.
*Must be freed by cr_parsing_location_destroy()
*/
CRParsingLocation *
cr_parsing_location_new (void)
{
- CRParsingLocation *result =
- (CRParsingLocation *)g_try_malloc (sizeof (CRParsingLocation)) ;
+ CRParsingLocation * result = NULL ;
+
+ result = g_try_malloc (sizeof (CRParsingLocation)) ;
if (!result) {
cr_utils_trace_info ("Out of memory error") ;
return NULL ;
@@ -49,9 +53,12 @@ cr_parsing_location_new (void)
}
/**
+ * cr_parsing_location_init:
+ *@a_this: the current instance of #CRParsingLocation.
+ *
*Initializes the an instance of #CRparsingLocation.
- *@param a_this the current instance of #CRParsingLocation.
- *@return CR_OK upon
+ *
+ *Returns CR_OK upon succesful completion, an error code otherwise.
*/
enum CRStatus
cr_parsing_location_init (CRParsingLocation *a_this)
@@ -63,16 +70,19 @@ cr_parsing_location_init (CRParsingLocation *a_this)
}
/**
- *Copies an instance of CRParsingLocation into another one.
- *@param a_to the destination of the copy.
+ * cr_parsing_location_copy:
+ *@a_to: the destination of the copy.
*Must be allocated by the caller.
- *@param a_from the source of the copy.
- *@return CR_OK upon succesful completion, an error code
+ *@a_from: the source of the copy.
+ *
+ *Copies an instance of CRParsingLocation into another one.
+ *
+ *Returns CR_OK upon succesful completion, an error code
*otherwise.
*/
enum CRStatus
cr_parsing_location_copy (CRParsingLocation *a_to,
- CRParsingLocation *a_from)
+ CRParsingLocation const *a_from)
{
g_return_val_if_fail (a_to && a_from, CR_BAD_PARAM_ERROR) ;
@@ -81,24 +91,26 @@ cr_parsing_location_copy (CRParsingLocation *a_to,
}
/**
- *@param a_this the current instance of #CRParsingLocation.
- *@param a_mask a bitmap that defines which parts of the
+ * cr_parsing_location_to_string:
+ *@a_this: the current instance of #CRParsingLocation.
+ *@a_mask: a bitmap that defines which parts of the
*parsing location are to be serialized (line, column or byte offset)
- *@return the serialized string or NULL in case of an error.
+ *
+ *Returns the serialized string or NULL in case of an error.
*/
gchar *
-cr_parsing_location_to_string (CRParsingLocation *a_this,
+cr_parsing_location_to_string (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask)
{
+ GString *result = NULL ;
gchar *str = NULL ;
g_return_val_if_fail (a_this, NULL) ;
if (!a_mask) {
- a_mask = (enum CRParsingLocationSerialisationMask)
- ((int)DUMP_LINE | (int)DUMP_COLUMN | (int)DUMP_BYTE_OFFSET) ;
+ a_mask = DUMP_LINE | DUMP_COLUMN | DUMP_BYTE_OFFSET ;
}
- GString *result = (GString *)g_string_new (NULL) ;
+ result =g_string_new (NULL) ;
if (!result)
return NULL ;
if (a_mask & DUMP_LINE) {
@@ -122,8 +134,14 @@ cr_parsing_location_to_string (CRParsingLocation *a_this,
return str ;
}
+/**
+ * cr_parsing_location_dump:
+ * @a_this: current instance of #CRParsingLocation
+ * @a_mask: the serialization mask.
+ * @a_fp: the file pointer to dump the parsing location to.
+ */
void
-cr_parsing_location_dump (CRParsingLocation *a_this,
+cr_parsing_location_dump (CRParsingLocation const *a_this,
enum CRParsingLocationSerialisationMask a_mask,
FILE *a_fp)
{
@@ -139,9 +157,11 @@ cr_parsing_location_dump (CRParsingLocation *a_this,
}
/**
- *Destroys the current instance of #CRParsingLocation
- *@param a_this the current instance of #CRParsingLocation. Must
+ * cr_parsing_location_destroy:
+ *@a_this: the current instance of #CRParsingLocation. Must
*have been allocated with cr_parsing_location_new().
+ *
+ *Destroys the current instance of #CRParsingLocation
*/
void
cr_parsing_location_destroy (CRParsingLocation *a_this)