jot

Overview

Module that has the usefull macro functions jot_c_ and jotln_c_.

Example
#include "clingo/io/jot.h"
#include "clingo/lang/expect.h"

int main()
{
   init_tap_c_();

   cRecorder* rec = &recorder_c_( 1024 );

   expect_c_( jotln_c_( rec, "boah: ", 128, c_c( " >= " ), 12 ) );
   expect_c_( jotln_c_( rec, "the result value is: ", bool_c_( true ), "!" ) );

   expect_c_( jot_c_( rec,
      "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",  //  13
      "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",  //  26
      "\n",                                                             //  27
      "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_",  //  40
      "\n",                                                             //  41
      "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",  //  54
      "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",  //  67
      "\n",                                                             //  68
      "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_",  //  81
      "\n",                                                             //  82
      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,    // 102
      "\n",                                                             // 103
      "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_",  // 116
      "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",  // 129
      "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",  // 142
      "\n",                                                             // 143
      "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_",  // 156
      "\n",                                                             // 157
      "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",  // 170
      "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",  // 183
      "\n",                                                             // 184
      "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_",  // 197
      "\n",                                                             // 198
      0, 1, 2, 3, 4, 5, 6, 7, 8, 9,                                     // 208
      "\n",                                                             // 209
      "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_", "+", "_",  // 222
      "\n",                                                             // 223
      "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",  // 236
      "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",  // 249
      "\n",                                                             // 250
      1, 2, 3, 4                                                        // 254
   ) );
   jot_c_( rec, "the result value is: ", true, "!" );

   expect_c_( recorded_is_c( rec, "boah: 128 >= 12\n"
                                  "the result value is: true!\n"
                                  "abcdefghijklmnopqrstuvwxyz\n"
                                  "_+_+_+_+_+_+_\n"
                                  "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n"
                                  "_+_+_+_+_+_+_\n"
                                  "012345678901234567890\n"
                                  "_+_+_+_+_+_+_abcdefghijklmnopqrstuvwxyz\n"
                                  "_+_+_+_+_+_+_\n"
                                  "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n"
                                  "_+_+_+_+_+_+_\n"
                                  "0123456789\n"
                                  "_+_+_+_+_+_+_\n"
                                  "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n"
                                  "1234the result value is: 1!" ) );

   return finish_tap_c_();
}

Type and Definitions

cJotDefaultMapping_

#define c_JotDefaultMapping_

Defines the default types that the corresponding jot function that should be used.

The supported types are: * cByte * char * bool * cRange * cRune * double * float * int8_t * int16_t * int32_t * int64_t * uint16_t * uint32_t * uint64_t * cBytes * cChars * char* * char const* * cRecorder* * cRecorder const* * cScanner* * cScanner const*

Functions

jot_type_c_

#define jot_type_c_( Rec, Val )

Util macro function that writes Val to the recorder Rec. The type of Val must exist in cJotDefaultMapping_.

jot_call_c_

#define jot_call_c_( Func, Rec, ... )

Util macro function that calls Func with Rec and each value in VA_ARGS. The function Func takes a recorder and a single value, like jot_type_c_.

jot_c_

#define jot_c_( Rec, ... )

jot writes the VA_ARGS values using the in the mapping defined function into the recorder Rec. The function returns true if it is possible to write all values.

jotln_c_

#define jotln_c_( Rec, ... )

Works like jot_c_ with the addition that a '\n' will be added at the end.

jotx_c_

#define jot1_c_( Func, Rec, Val )
#define jot2_c_( Func, Rec, Val, ... )
...
#define jot255_c_( Func, Rec, Val, ... )

Via script generated macro functions that jot_call_c_ uses.