aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfdio.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-04-30 20:42:30 +0930
committerAlan Modra <amodra@gmail.com>2023-05-03 15:00:05 +0930
commit717d4bd6d199fcf834f741489aaf3bd800f9769f (patch)
tree41ecfc03c6cd82e376d3b8bfe328842af6a7a250 /bfd/bfdio.c
parenta41bd1c837f9b71b44dbb71c2d47814326cfaa8d (diff)
downloadgdb-717d4bd6d199fcf834f741489aaf3bd800f9769f.zip
gdb-717d4bd6d199fcf834f741489aaf3bd800f9769f.tar.gz
gdb-717d4bd6d199fcf834f741489aaf3bd800f9769f.tar.bz2
Generated docs and include files
bfd/doc/chew.c extracts documentation from source code comments annotated with keywords, and generates much of bfd.h and libbfd.h from those same comments. The docs have suffered from people (me too) adding things like CODE_FRAGMENT to the source to put code into bfd.h without realising that CODE_FRAGMENT also puts @example around said code into the docs. So we have random senseless things in the docs. This patch fixes that problem (well, the senseless things from CODE_FRAGMENT), moves most of the code out of bfd-in.h, and improves a few chew.c features. libbfd.h now automatically gets ATTRIBUTE_HIDDEN prototypes, and indentation in bfd.h and libbfd.h is better.
Diffstat (limited to 'bfd/bfdio.c')
-rw-r--r--bfd/bfdio.c75
1 files changed, 69 insertions, 6 deletions
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 990d349..75a3309 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -225,11 +225,21 @@ DESCRIPTION
.};
.extern const struct bfd_iovec _bfd_memory_iovec;
-
+.
*/
-/* Return value is amount read. */
+/*
+FUNCTION
+ bfd_bread
+
+SYNOPSIS
+ bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+
+DESCRIPTION
+ Attempt to read SIZE bytes from ABFD's iostream to PTR.
+ Return the amount read.
+*/
bfd_size_type
bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
@@ -276,6 +286,18 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
return nread;
}
+/*
+FUNCTION
+ bfd_bwrite
+
+SYNOPSIS
+ bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+
+DESCRIPTION
+ Attempt to write SIZE bytes to ABFD's iostream from PTR.
+ Return the amount written.
+*/
+
bfd_size_type
bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
{
@@ -304,6 +326,17 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
return nwrote;
}
+/*
+FUNCTION
+ bfd_tell
+
+SYNOPSIS
+ file_ptr bfd_tell (bfd *);
+
+DESCRIPTION
+ Return ABFD's iostream file position.
+*/
+
file_ptr
bfd_tell (bfd *abfd)
{
@@ -326,6 +359,17 @@ bfd_tell (bfd *abfd)
return ptr - offset;
}
+/*
+FUNCTION
+ bfd_flush
+
+SYNOPSIS
+ int bfd_flush (bfd *);
+
+DESCRIPTION
+ Flush ABFD's iostream pending IO.
+*/
+
int
bfd_flush (bfd *abfd)
{
@@ -339,8 +383,18 @@ bfd_flush (bfd *abfd)
return abfd->iovec->bflush (abfd);
}
-/* Returns 0 for success, negative value for failure (in which case
- bfd_get_error can retrieve the error code). */
+/*
+FUNCTION
+ bfd_stat
+
+SYNOPSIS
+ int bfd_stat (bfd *, struct stat *);
+
+DESCRIPTION
+ Call fstat on ABFD's iostream. Return 0 on success, and a
+ negative value on failure.
+*/
+
int
bfd_stat (bfd *abfd, struct stat *statbuf)
{
@@ -362,8 +416,17 @@ bfd_stat (bfd *abfd, struct stat *statbuf)
return result;
}
-/* Returns 0 for success, nonzero for failure (in which case bfd_get_error
- can retrieve the error code). */
+/*
+FUNCTION
+ bfd_seek
+
+SYNOPSIS
+ int bfd_seek (bfd *, file_ptr, int);
+
+DESCRIPTION
+ Call fseek on ABFD's iostream. Return 0 on success, and a
+ negative value on failure.
+*/
int
bfd_seek (bfd *abfd, file_ptr position, int direction)