#include <sparse/QuadTree.h>
#include <string.h>
#include <cgraph/agxbuf.h>
+#include <cgraph/prisize_t.h>
#include <cgraph/cgraph.h>
#include "make_map.h"
#include <sfdpgen/stress_model.h>
if (np > 0){
if (fill >= 0){
- agxbprint(sbuff, " c %zu -%s C %zu -%s P %d ", strlen(cstring), cstring, strlen(cstring), cstring, np);
+ agxbprint(sbuff, " c %" PRISIZE_T " -%s C %" PRISIZE_T " -%s P %d ",
+ strlen(cstring), cstring, strlen(cstring), cstring, np);
} else {
if (line_width > 0){
size_t len_swidth = (size_t)snprintf(NULL, 0, "%f", line_width);
- agxbprint(sbuff, " c %zu -%s S %zu -setlinewidth(%f) L %d ",
- strlen(cstring), cstring, len_swidth + 14, line_width, np);
+ agxbprint(sbuff, " c %" PRISIZE_T " -%s S %" PRISIZE_T
+ " -setlinewidth(%f) L %d ", strlen(cstring), cstring,
+ len_swidth + 14, line_width, np);
} else {
- agxbprint(sbuff, " c %zu -%s L %d ", strlen(cstring), cstring, np);
+ agxbprint(sbuff, " c %" PRISIZE_T " -%s L %d ", strlen(cstring), cstring, np);
}
}
for (int i = 0; i < np; i++){
cgraph.h
itos.h
likely.h
+ prisize_t.h
sprint.h
strcasecmp.h
unreachable.h
AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/lib/cdt
pkginclude_HEADERS = cgraph.h
-noinst_HEADERS = agxbuf.h cghdr.h itos.h likely.h sprint.h strcasecmp.h \
- unreachable.h
+noinst_HEADERS = agxbuf.h cghdr.h itos.h likely.h prisize_t.h sprint.h \
+ strcasecmp.h unreachable.h
noinst_LTLIBRARIES = libcgraph_C.la
lib_LTLIBRARIES = libcgraph.la
pkgconfig_DATA = libcgraph.pc
<ClInclude Include="cgraph.h" />
<ClInclude Include="itos.h" />
<ClInclude Include="likely.h" />
+ <ClInclude Include="prisize_t.h" />
<ClInclude Include="sprint.h" />
<ClInclude Include="strcasecmp.h" />
<ClInclude Include="unreachable.h" />
<ClInclude Include="likely.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="prisize_t.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
<ClInclude Include="sprint.h">
<Filter>Header Files</Filter>
</ClInclude>
--- /dev/null
+#pragma once
+
+// `PRIu64`-alike for printing size_t
+#ifdef __MINGW64__
+ // Microsoft’s Visual C Runtime (msvcrt) ships a printf that does not
+ // understand "%zu". MSVC itself uses a different printf that does not rely on
+ // this, but MinGW uses msvcrt and so cannot handle "%zu".
+#define PRISIZE_T "llu"
+#elif defined(__MINGW32__)
+#define PRISIZE_T "u"
+#else
+#define PRISIZE_T "zu"
+#endif
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
+#include <cgraph/prisize_t.h>
#include <common/render.h>
#include <pack/pack.h>
if (MARKED(&stk,n) || !isPinned(n))
continue;
if (!out) {
- sprintf(name + len, "%zu", c_cnt);
+ sprintf(name + len, "%" PRISIZE_T, c_cnt);
out = agsubg(g, name,1);
agbindrec(out, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
ccs[c_cnt] = out;
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (MARKED(&stk,n))
continue;
- sprintf(name + len, "%zu", c_cnt);
+ sprintf(name + len, "%" PRISIZE_T, c_cnt);
out = agsubg(g, name,1);
agbindrec(out, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
if (dfs(g, n, out, &stk) == SIZE_MAX) {
for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
if (MARKED(&stk,n))
continue;
- sprintf(name + len, "%zu", c_cnt);
+ sprintf(name + len, "%" PRISIZE_T, c_cnt);
out = agsubg(g, name,1);
agbindrec(out, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE); //node custom data
if (dfs(g, n, out, &stk) == SIZE_MAX) {
for (dn = agfstnode(dg); dn; dn = agnxtnode(dg, dn)) {
if (MARKED(&stk,dn))
continue;
- sprintf(name + len, "%zu", c_cnt);
+ sprintf(name + len, "%" PRISIZE_T, c_cnt);
dout = agsubg(dg, name, 1);
out = agsubg(g, name, 1);
agbindrec(out, GRECNAME, sizeof(ccgraphinfo_t), FALSE);
ccs[c_cnt] = out;
agdelete(dg, dout);
if (Verbose)
- fprintf(stderr, "(%4zu) %7zu nodes %7zu edges\n",
- c_cnt, n_cnt, e_cnt);
+ fprintf(stderr, "(%4" PRISIZE_T ") %7" PRISIZE_T " nodes %7" PRISIZE_T
+ " edges\n", c_cnt, n_cnt, e_cnt);
c_cnt++;
}
if (Verbose)
- fprintf(stderr, " %7d nodes %7d edges %7zu components %s\n",
+ fprintf(stderr, " %7d nodes %7d edges %7" PRISIZE_T " components %s\n",
agnnodes(g), agnedges(g), c_cnt, agnameof(g));
agclose(dg);
*************************************************************************/
#include <assert.h>
+#include <cgraph/prisize_t.h>
#include <limits.h>
#include <sparse/BinaryHeap.h>
#include <stdlib.h>
}
fprintf(stderr, "\nSpare keys =");
for (size_t i = 0; i <= h->id_stack->last; i++) {
- fprintf(stderr, "%d(%zu) ", h->id_stack->stack[i],
+ fprintf(stderr, "%d(%" PRISIZE_T ") ", h->id_stack->stack[i],
h->id_to_pos[h->id_stack->stack[i]]);
}
fprintf(stderr, "\n");
* Contributors: Details at https://graphviz.org
*************************************************************************/
+#include <cgraph/prisize_t.h>
#include <xdot/xdot.h>
#include <stdlib.h>
#include <string.h>
{
char buf[30];
- snprintf(buf, sizeof(buf), " %zu -", strlen(p));
+ snprintf(buf, sizeof(buf), " %" PRISIZE_T " -", strlen(p));
print(buf, info);
print(p, info);
}
#include <gvc/gvplugin_render.h>
#include <gvc/gvplugin_device.h>
#include <cgraph/agxbuf.h>
+#include <cgraph/prisize_t.h>
#include <cgraph/unreachable.h>
#include <common/utils.h>
#include <gvc/gvc.h>
static void xdot_str_xbuf (agxbuf* xb, char* pfx, const char* s)
{
- agxbprint (xb, "%s%zu -%s ", pfx, strlen(s), s);
+ agxbprint (xb, "%s%" PRISIZE_T " -%s ", pfx, strlen(s), s);
}
static void xdot_str (GVJ_t *job, char* pfx, const char* s)
#include <cstdlib>
#include "VisioGraphic.h"
+#include <cgraph/prisize_t.h>
#include <gvc/gvcjob.h>
#include <gvc/gvio.h>
gvprintf(job, "<Y F='Height*%f'/>", (_points.back().y - first.y) * yscale);
/* Knot[P-1] */
- gvprintf(job, "<A>%zu</A>", _points.size() < 4 ? 0 : (_points.size() - 4));
+ gvprintf(job, "<A>%" PRISIZE_T "</A>",
+ _points.size() < 4 ? 0 : (_points.size() - 4));
/* Ctl[P-1].Weight */
gvputs(job, "<B>1</B>");
gvputs(job, "<D>1</D>");
/* Knot[P], Degree, XType, YType */
- gvprintf(job, "<E F='NURBS(%zu, 3, 0, 0", _points.size() < 3 ? 0 : (_points.size() - 3));
+ gvprintf(job, "<E F='NURBS(%" PRISIZE_T ", 3, 0, 0",
+ _points.size() < 3 ? 0 : (_points.size() - 3));
for (size_t i = 1; i < _points.size(); ++i)
/* Ctl[i].X, Ctl[i].Y, Knot[i], Ctl[i].Weight */
- gvprintf(job, ", %f, %f, %zu, 1",
+ gvprintf(job, ", %f, %f, %" PRISIZE_T ", 1",
(_points[i].x - first.x) * xscale,
(_points[i].y - first.y) * yscale,
i < 3 ? 0 : (i - 3));