"plain2 fan" is a set of old pages. Care the versions !!!

You can visit "plain2 fan" by following links.

Moreover, pwrap --- a wrapper program of plain2 is available.

Source Hack to complie on modern compiler

Some modern compiler does not accept plain2's source. And compiled program may cause running error if you can compilt that. I met such problem with gcc 4.4.6 on CentOS 6.2 .

plain2 modifies data area. Modern compilers dislike it. These programs expect that data area is constant. Then, the duplication those on heap area from data area avoids this problem.

Here, a sample of source hack. Own your risk.

  1. edit macro.c; add the loop of duplication. You can see that marked with #if 1 and #endif in following source fragment.
    initMacroDefs(mcp) struct macDefs *mcp; { #if 1 char * Xstrdup(char *src); char *work; struct macDefs *firstmcp; firstmcp = mcp; /* save */ while(mcp->mdef_number >= 0) { if (outMacro[mcp->mdef_number] == NULL) work = Xstrdup(mcp->mdef_def); mcp->mdef_def = work; mcp++; } mcp = firstmcp; /* restore */ #endif while(mcp->mdef_number >= 0) { if (outMacro[mcp->mdef_number] == NULL) outMacro[mcp->mdef_number] = macroParse(mcp->mdef_def, mcp->mdef_number, mcp->mdef_def); mcp++; } }
  2. add Xstrdup()
    char * Xstrdup(char *src) { char *dst; dst = (char*)malloc(strlen(src)*2+1); strcpy(dst, src); return dst; }
    no garanty of the length (currently double size.) I can only say "It is work in my situation." You may enlarge that.
As you know, some patches are publicated. This hack focuses version 2.53 and related. However it is acceptable in other versions.
Updated 2014/10/6.