cave-story-solaris/external/fltk/misc/doxystar.cxx
Clownacy ac465d29b4 Mean CMake dependency overhaul
I'm taking a page from Dolphin's book, and including copies of each
dependency's source code. This combines the ease of use of including
pre-built libraries instead of needing to navigate a package manager
 - as is (or was) the case for MSVC - with the portability of using
packages. Granted, this method's more of a jack of all trades,
master of none, since it's *less* user-friendly than prebuilt
packages (compilation times), and you don't get the per-distro
compatibility fixes you'd get from a package manager.

You can still use system libs if you want. In fact, it's still the
default behaviour: compiling the libs manually is just a fallback.
I'll add an option to force-enable this soon, however, since it's a
nicer way to produce static MSYS2 builds than the hackish nightmare
that I was using before. Not to mention, having my own copy of the
sources means I can provide my own fixes and tweaks your package
manager may not. For example, I can combine MSYS2's FreeType
subpixel rendering with vcpkg's fix for SDL2 exporting its symbols
in static builds.
2019-04-26 01:52:02 +01:00

93 lines
2.4 KiB
C++

//
// "$Id$"
//
// Doxygen pre-formatting program for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010 by Matthias Melcher.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
#include <stdio.h>
#include <string.h>
char linebuf[1024];
int main(int argc, char **argv) {
if (argc!=1) {
puts("Add stars (*) in front of multi-line doxygen comments");
puts("to protect comment indentation from code beautifiers.");
puts("usage: cat file | doxystar");
return 0;
}
int state = 0;
char *commentStart;
int i, commentCol;
for (;;) {
if (!fgets(linebuf, 1020, stdin)) break; // EOF or error
switch (state) {
case 0: // line start is source code
commentStart = strstr(linebuf, "/*");
if (commentStart) {
// check if this comment spans multiple lines
if (strstr(commentStart, "*/")==0) {
if ((commentStart[2]=='*' || commentStart[2]=='!') && commentStart[3]!='*') {
state = 2; // Doxygen multiline comment
commentCol = commentStart - linebuf;
} else {
state = 1; // regular multiline comment
}
} else {
// single line comment, do nothing
}
}
fputs(linebuf, stdout);
break;
case 1: // line start is inside a regular multiline comment
if (strstr(linebuf, "*/")) {
state = 0;
} else {
// still inside comment
}
fputs(linebuf, stdout);
break;
case 2: // line start is inside a doxygen multiline comment
for (i=0; i<commentCol; i++) fputc(' ', stdout);
fputs(" *", stdout);
if (strstr(linebuf, "*/")) {
state = 0;
} else {
// still inside comment
}
for (i=0; i<commentCol+1; i++)
if (linebuf[i]!=' ')
break;
if (linebuf[i]=='*') {
if (linebuf[i+1]==' ') {
i+=2;
} else {
i+=1;
}
}
fputs(linebuf+i, stdout);
break;
}
}
return 0;
}
//
// End of "$Id$".
//