/**********************************************************/
/* apimagic: cparser-based API normalization utility */
/* Copyright (C) 2015--2016 Z. Gilboa */
/* Released under GPLv2 and GPLv3; see COPYING.APIMAGIC. */
/**********************************************************/
#include <stdio.h>
#include <string.h>
#include <apimagic/apimagic.h>
int amgc_output_pad_symbol(
const char * symbol,
const struct amgc_layout * layout,
FILE * fout)
{
int len = (int)(strlen(symbol));
if (layout->symwidth < 1)
return -1;
if (layout->tabwidth == 0)
return fprintf(fout,"%*c",layout->symwidth-len,' ');
len &= (~(layout->tabwidth-1));
while (len < layout->symwidth) {
if (fputc('\t',fout) < 0)
return -1;
else
len += layout->tabwidth;
}
return 0;
}