Skip to content

Commit

Permalink
refactor: move write_impl functions into private
Browse files Browse the repository at this point in the history
  • Loading branch information
aiq committed Dec 26, 2024
1 parent 3e02f8f commit ba59fd7
Show file tree
Hide file tree
Showing 7 changed files with 565 additions and 576 deletions.
11 changes: 0 additions & 11 deletions doc/clingo/io/write.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,6 @@ The default implementatio of the function is write_format_arg_c.
//********************************************************************* overall
=== overall
==== write_format_arg_c
[source,c]
----
bool write_format_arg_c( cRecorder rec[static 1],
va_list* list,
cChars type,
char const fmt[static 1] );
----
Writes the current element in the list into the recorder.
==== write_c
[souce,c]
----
Expand Down
14 changes: 0 additions & 14 deletions inc/clingo/io/fwrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
fwrite
*******************************************************************************/

CLINGO_API bool fwrite_impl_c( FILE* file,
cErrorStack es[static 1],
c_get_va_arg getArgFunc,
c_write_va_arg writeArgFunc,
int n,
va_list list );

CLINGO_API
bool fwrite_list_c( FILE* file, cErrorStack es[static 1], int n, va_list list );

Expand All @@ -28,13 +21,6 @@ CLINGO_API bool fwrite_c( FILE* file, cErrorStack es[static 1], int n, ... );
fwriteln
*******************************************************************************/

CLINGO_API bool fwriteln_impl_c( FILE* file,
cErrorStack es[static 1],
c_get_va_arg getArgFunc,
c_write_va_arg writeArgFunc,
int n,
va_list list );

CLINGO_API bool fwriteln_list_c( FILE* file,
cErrorStack es[static 1],
int n,
Expand Down
66 changes: 0 additions & 66 deletions inc/clingo/io/write.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,72 +7,12 @@
#include "clingo/io/cTape.h"
#include "clingo/lang/func.h"

/*******************************************************************************
********************************************************* Types and Definitions
**+*****************************************************************************
Definitions
*******************************************************************************/

union cVaArg
{
int8_t i8;
int16_t i16;
int32_t i32;
int64_t i64;
uint8_t u8;
uint16_t u16;
uint32_t u32;
uint64_t u64;
float f;
double d;
cByte b;
char c;
cError const* e;
cRune r;
bool bool_;
cRange rng;
char const* s;
cBytes bs;
cChars cs;
cRecorder const* rec;
cScanner const* sca;
cTape t;
};

typedef union cVaArg cVaArg;

typedef bool ( *c_get_va_arg )( va_list* list,
cChars type,
cVaArg arg[static 1] );

typedef bool ( *c_write_va_arg )( cRecorder rec[static 1],
cChars type,
cVaArg arg,
char const fmt[static 1] );

/*******************************************************************************
********************************************************************* Functions
********************************************************************************
*******************************************************************************/

CLINGO_API bool get_va_arg_c( va_list* list, cChars type, cVaArg arg[static 1] );

CLINGO_API bool write_va_arg_c( cRecorder rec[static 1],
cChars type,
cVaArg arg,
char const fmt[static 1] );

/*******************************************************************************
write
*******************************************************************************/

CLINGO_API bool write_impl_c( cRecorder rec[static 1],
c_get_va_arg getArgFunc,
c_write_va_arg writeArgFunc,
int n,
va_list list );

CLINGO_API bool write_list_c( cRecorder rec[static 1], int n, va_list list );

#define write_c_( Rec, ... ) \
Expand All @@ -83,12 +23,6 @@ CLINGO_API bool write_c( cRecorder rec[static 1], int n, ... );
writeln
*******************************************************************************/

CLINGO_API bool writeln_impl_c( cRecorder rec[static 1],
c_get_va_arg getArgFunc,
c_write_va_arg writeArgFunc,
int n,
va_list list );

CLINGO_API bool writeln_list_c( cRecorder rec[static 1], int n, va_list list );

#define writeln_c_( Rec, ... ) \
Expand Down
Loading

0 comments on commit ba59fd7

Please sign in to comment.