Skip to content

Commit

Permalink
oops! backport changes to qrintf.h to the generator
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed May 11, 2015
1 parent db0cde3 commit 3398198
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions misc/gen-qrintf.h.pl
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ sub build_x {
EOT
}

open my $fh, '>', 'share/qrintf/qrintf.h'
or die "failed to open share/qrintf/qrintf.h:$!";
open my $fh, '>', 'include/qrintf.h'
or die "failed to open include/qrintf.h:$!";

print $fh build_mt(template => << 'EOT', escape_func => undef)->(\&build_d, \&build_u, \&build_x)->as_string;
? my ($build_d, $build_u, $build_x) = @_;
Expand All @@ -156,8 +156,17 @@ sub build_x {
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef qrintf_h
#define qrintf_h
#if !defined(QRINTF_INCLUDE_COUNT)
# define QRINTF_INCLUDE_COUNT 1
#elif QRINTF_INCLUDE_COUNT==1
# undef QRINTF_INCLUDE_COUNT
# define QRINTF_INCLUDE_COUNT 2
#elif QRINTF_INCLUDE_COUNT==2
# undef QRINTF_INCLUDE_COUNT
# define QRINTF_INCLUDE_COUNT 3
#endif
#if (!defined(QRINTF_NO_AUTO_INCLUDE) && QRINTF_INCLUDE_COUNT==1) || (defined(QRINTF_NO_AUTO_INCLUDE) && QRINTF_INCLUDE_COUNT==2)
#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -308,6 +317,21 @@ sub build_x {
}
? }
static inline qrintf_nck_t _qrintf_nck_maxwidth_s(qrintf_nck_t ctx, int maxwidth, const char *s)
{
for (; maxwidth != 0 && *s != '\0'; --maxwidth, ++s)
ctx.str[ctx.off++] = *s;
return ctx;
}
static inline qrintf_chk_t _qrintf_chk_maxwidth_s(qrintf_chk_t ctx, int maxwidth, const char *s)
{
size_t len = 0;
for (; maxwidth != 0 && s[len] != '\0'; --maxwidth, ++len)
;
return _qrintf_chk_s_len(ctx, s, len);
}
static inline const char *_qrintf_get_digit_table(void)
{
static const char digits_table[] = {
Expand Down

0 comments on commit 3398198

Please sign in to comment.