summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2005-03-19 11:54:08 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2005-03-19 11:54:08 (GMT)
commit10c08b51c954106e42a5e42c7f726834a7787fc6 (patch) (side-by-side diff)
tree55b183b997c9c418a0aa660ad7adcd4c0a0c1847
parente6b82b1e33b2a61353cd87b1a99b46ff05b93f5c (diff)
downloadcflow-10c08b51c954106e42a5e42c7f726834a7787fc6.tar.gz
cflow-10c08b51c954106e42a5e42c7f726834a7787fc6.tar.bz2
Added to the repository
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--AUTHORS1
-rw-r--r--Makefile.am23
-rw-r--r--NEWS37
-rw-r--r--THANKS0
-rw-r--r--configure.ac65
-rw-r--r--doc/Makefile.am20
-rw-r--r--src/Makefile.am22
-rw-r--r--src/gnu.c93
-rw-r--r--src/posix.c81
9 files changed, 342 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..c5a9530
--- a/dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Sergey Poznyakoff <gray@gnu.org>
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..97a3207
--- a/dev/null
+++ b/Makefile.am
@@ -0,0 +1,23 @@
+# This file is part of GNU cflow
+# Copyright (C) 2005 Free Software Foundation, Inc.
+#
+# Written by Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+AUTOMAKE_OPTIONS = gnits 1.8 dist-bzip2
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = src elisp doc
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..71fdf5c
--- a/dev/null
+++ b/NEWS
@@ -0,0 +1,37 @@
+GNU cflow NEWS -- history of user-visible changes. 2005-03-19
+Copyright (C) 2005 Sergey Poznyakoff
+See the end of file for copying conditions.
+
+Please send mailutils bug reports to <gray@gnu.org>.
+
+
+Version 0.2:
+
+* Added autoconf suite.
+* Added POSIX output support.
+
+
+Version 0.1:
+
+Initial version restored from 1997 snapshots.
+
+
+----------------------------------------------------------------------
+* Copyright information:
+
+Copyright (C) 2005 Sergey Poznyakoff
+
+ Permission is granted to anyone to make or distribute verbatim copies
+ of this document as received, in any medium, provided that the
+ copyright notice and this permission notice are preserved,
+ thus giving the recipient permission to redistribute in turn.
+
+ Permission is granted to distribute modified versions
+ of this document, or of portions of it,
+ under the above conditions, provided also that they
+ carry prominent notices stating who last changed them.
+
+Local variables:
+mode: outline
+paragraph-separate: "[ ]*$"
+end:
diff --git a/THANKS b/THANKS
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/THANKS
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..083a6e5
--- a/dev/null
+++ b/configure.ac
@@ -0,0 +1,65 @@
+# This file is part of GNU cflow
+# Copyright (C) 2005 Free Software Foundation, Inc.
+#
+# Written by Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+AC_PREREQ(2.59)
+AC_INIT([GNU cflow], [0.2], [gray@gnu.org])
+AC_CONFIG_SRCDIR([src/cflow.h])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LEX
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-ll':
+#AC_CHECK_LIB([l], [main])
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_FUNC_OBSTACK
+
+# Checks for library functions.
+AC_FUNC_ERROR_AT_LINE
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_FUNC_STAT
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([memmove memset strdup strerror strtol])
+
+### Check for Emacs site-lisp directory
+AM_PATH_LISPDIR
+
+if test "$EMACS" != "no"; then
+ lisp_LISP='$(LISPSRC)'
+fi
+AC_SUBST(lisp_LISP)
+
+AC_SUBST(LEXDIR)
+LEXDIR="$datadir/$PACKAGE_VERSION"
+
+AC_CONFIG_FILES([Makefile
+ doc/Makefile
+ elisp/Makefile
+ src/Makefile])
+AC_OUTPUT
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..a0b8960
--- a/dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,20 @@
+# This file is part of GNU cflow
+# Copyright (C) 2005 Free Software Foundation, Inc.
+#
+# Written by Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+EXTRA_DIST = cflow.txt \ No newline at end of file
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..55880f2
--- a/dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,22 @@
+# This file is part of GNU cflow
+# Copyright (C) 2005 Free Software Foundation, Inc.
+#
+# Written by Sergey Poznyakoff
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+bin_PROGRAMS = cflow
+cflow_SOURCES = main.c rc.c parser.c c.l output.c symbol.c cflow.h version.h parser.h gnu.c posix.c
+AM_LEXFLAGS=-dbvppl
diff --git a/src/gnu.c b/src/gnu.c
new file mode 100644
index 0000000..2e90bf6
--- a/dev/null
+++ b/src/gnu.c
@@ -0,0 +1,93 @@
+/* This file is part of GNU cflow
+ Copyright (C) 1997,2005 Sergey Poznyakoff
+
+ GNU cflow is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GNU cflow is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU cflow; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <cflow.h>
+
+/* Print current tree level
+ */
+static void
+print_level(int lev, int last)
+{
+ int i;
+
+ if (print_levels)
+ fprintf(outfile, "%4d ", lev);
+ fprintf(outfile, "%s", level_begin);
+ for (i = 0; i < lev; i++)
+ fprintf(outfile, "%s", level_indent[ level_mark[i] ]);
+ fprintf(outfile, "%s", level_end[last]);
+}
+
+void
+print_function_name(Symbol *sym, int has_subtree)
+{
+ fprintf(outfile, "%s()", sym->name);
+ if (sym->v.func.type)
+ fprintf(outfile, " <%s at %s:%d>",
+ sym->v.func.type,
+ sym->v.func.source,
+ sym->v.func.def_line);
+ if (sym->active) {
+ fprintf(outfile, " (recursive: see %d)", sym->active-1);
+ return;
+ }
+ if (sym->v.func.recursive)
+ fprintf(outfile, " (R)");
+ if (!print_as_tree && has_subtree)
+ fprintf(outfile, ":");
+}
+
+
+static void
+print_symbol(FILE *outfile, int line, struct output_symbol *s)
+{
+ if (s->direct) {
+ print_level(s->level, s->last);
+ print_function_name(s->sym, s->sym->v.func.callee != NULL);
+
+ if (brief_listing) {
+ if (s->sym->expand_line)
+ fprintf(outfile, " [see %d]", s->sym->expand_line);
+ else if (s->sym->v.func.callee)
+ s->sym->expand_line = line;
+ }
+ } else {
+ print_level(s->level, s->last);
+ print_function_name(s->sym, s->sym->v.func.caller != NULL);
+ }
+}
+
+void
+gnu_output_handler(cflow_output_command cmd,
+ FILE *outfile, int line,
+ void *data, void *handler_data)
+{
+ switch (cmd) {
+ case cflow_output_begin:
+ case cflow_output_end:
+ break;
+ case cflow_output_newline:
+ case cflow_output_separator:
+ fprintf(outfile, "\n");
+ break;
+ case cflow_output_text:
+ fprintf(outfile, "%s\n", data);
+ break;
+ case cflow_output_symbol:
+ print_symbol(outfile, line, data);
+ }
+}
diff --git a/src/posix.c b/src/posix.c
new file mode 100644
index 0000000..9d1b4c9
--- a/dev/null
+++ b/src/posix.c
@@ -0,0 +1,81 @@
+/* This file is part of GNU cflow
+ Copyright (C) 1997,2005 Sergey Poznyakoff
+
+ GNU cflow is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GNU cflow is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU cflow; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <cflow.h>
+
+static void
+print_symbol(FILE *outfile, int line, struct output_symbol *s)
+{
+ if (s->direct) {
+ fprintf(outfile, "%d %*s%s: ", \
+ line,
+ 3*s->level, "",
+ s->sym->name);
+
+ if (s->sym->v.func.type) {
+ char *p = s->sym->v.func.type;
+
+ while (*p) {
+ char *q = p;
+
+ /* Skip whitespace */
+ while (*q && isspace (*q))
+ q++;
+
+ if (*q == '(') {
+ /* Do not print function name */
+ p = q;
+ break;
+ }
+
+ /* Skip identifier */
+ while (*q && !isspace (*q))
+ q++;
+
+ for (; p < q; p++)
+ fputc(*p, outfile);
+ }
+
+ fprintf(outfile, "%s, <%s %d>",
+ p,
+ s->sym->v.func.source,
+ s->sym->v.func.def_line);
+ } else
+ fprintf(outfile, "<>");
+ }
+}
+
+void
+posix_output_handler(cflow_output_command cmd,
+ FILE *outfile, int line,
+ void *data, void *handler_data)
+{
+ switch (cmd) {
+ case cflow_output_begin:
+ case cflow_output_end:
+ break;
+ case cflow_output_newline:
+ case cflow_output_separator:
+ fprintf(outfile, "\n");
+ break;
+ case cflow_output_text:
+ fprintf(outfile, "%s\n", data);
+ break;
+ case cflow_output_symbol:
+ print_symbol(outfile, line, data);
+ }
+}

Return to:

Send suggestions and report system problems to the System administrator.