From 6cab6aab329c30f6832c42916809b8d3c73c7c71 Mon Sep 17 00:00:00 2001 From: Ludovic Jacomme Date: Fri, 8 Mar 2002 14:14:22 +0000 Subject: [PATCH] ajout aut --- alliance/src/aut/Makefile.am | 1 + alliance/src/aut/Makefile.in | 319 ++++++++++++++++ alliance/src/aut/configure.in | 50 +++ alliance/src/aut/src/Makefile.am | 9 + alliance/src/aut/src/Makefile.in | 341 +++++++++++++++++ alliance/src/aut/src/aut.h | 450 ++++++++++++++++++++++ alliance/src/aut/src/autalloc.c | 261 +++++++++++++ alliance/src/aut/src/autalloc.h | 92 +++++ alliance/src/aut/src/autdebug.c | 159 ++++++++ alliance/src/aut/src/autdebug.h | 75 ++++ alliance/src/aut/src/autenv.c | 137 +++++++ alliance/src/aut/src/autenv.h | 79 ++++ alliance/src/aut/src/auterror.c | 173 +++++++++ alliance/src/aut/src/auterror.h | 95 +++++ alliance/src/aut/src/autexit.c | 101 +++++ alliance/src/aut/src/autexit.h | 75 ++++ alliance/src/aut/src/autfree.c | 217 +++++++++++ alliance/src/aut/src/autfree.h | 75 ++++ alliance/src/aut/src/autgraph.c | 622 +++++++++++++++++++++++++++++++ alliance/src/aut/src/autgraph.h | 75 ++++ alliance/src/aut/src/authash.c | 594 +++++++++++++++++++++++++++++ alliance/src/aut/src/authash.h | 89 +++++ alliance/src/aut/src/authash2.c | 555 +++++++++++++++++++++++++++ alliance/src/aut/src/authash2.h | 95 +++++ alliance/src/aut/src/autname.c | 146 ++++++++ alliance/src/aut/src/autname.h | 81 ++++ alliance/src/aut/src/autresize.c | 121 ++++++ alliance/src/aut/src/autresize.h | 75 ++++ alliance/src/aut/src/autsort.c | 189 ++++++++++ alliance/src/aut/src/autsort.h | 80 ++++ alliance/src/aut/src/auttest.c | 537 ++++++++++++++++++++++++++ alliance/src/aut/src/auttest.h | 104 ++++++ alliance/src/aut/src/main.c | 121 ++++++ alliance/src/aut/src/testhash.c | 45 +++ 34 files changed, 6238 insertions(+) create mode 100644 alliance/src/aut/Makefile.am create mode 100644 alliance/src/aut/Makefile.in create mode 100644 alliance/src/aut/configure.in create mode 100644 alliance/src/aut/src/Makefile.am create mode 100644 alliance/src/aut/src/Makefile.in create mode 100644 alliance/src/aut/src/aut.h create mode 100644 alliance/src/aut/src/autalloc.c create mode 100644 alliance/src/aut/src/autalloc.h create mode 100644 alliance/src/aut/src/autdebug.c create mode 100644 alliance/src/aut/src/autdebug.h create mode 100644 alliance/src/aut/src/autenv.c create mode 100644 alliance/src/aut/src/autenv.h create mode 100644 alliance/src/aut/src/auterror.c create mode 100644 alliance/src/aut/src/auterror.h create mode 100644 alliance/src/aut/src/autexit.c create mode 100644 alliance/src/aut/src/autexit.h create mode 100644 alliance/src/aut/src/autfree.c create mode 100644 alliance/src/aut/src/autfree.h create mode 100644 alliance/src/aut/src/autgraph.c create mode 100644 alliance/src/aut/src/autgraph.h create mode 100644 alliance/src/aut/src/authash.c create mode 100644 alliance/src/aut/src/authash.h create mode 100644 alliance/src/aut/src/authash2.c create mode 100644 alliance/src/aut/src/authash2.h create mode 100644 alliance/src/aut/src/autname.c create mode 100644 alliance/src/aut/src/autname.h create mode 100644 alliance/src/aut/src/autresize.c create mode 100644 alliance/src/aut/src/autresize.h create mode 100644 alliance/src/aut/src/autsort.c create mode 100644 alliance/src/aut/src/autsort.h create mode 100644 alliance/src/aut/src/auttest.c create mode 100644 alliance/src/aut/src/auttest.h create mode 100644 alliance/src/aut/src/main.c create mode 100644 alliance/src/aut/src/testhash.c diff --git a/alliance/src/aut/Makefile.am b/alliance/src/aut/Makefile.am new file mode 100644 index 00000000..39207806 --- /dev/null +++ b/alliance/src/aut/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src doc diff --git a/alliance/src/aut/Makefile.in b/alliance/src/aut/Makefile.in new file mode 100644 index 00000000..e02db190 --- /dev/null +++ b/alliance/src/aut/Makefile.in @@ -0,0 +1,319 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ + +SUBDIRS = src doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: install-data-recursive uninstall-data-recursive \ +install-exec-recursive uninstall-exec-recursive installdirs-recursive \ +uninstalldirs-recursive all-recursive check-recursive \ +installcheck-recursive info-recursive dvi-recursive \ +mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alliance/src/aut/configure.in b/alliance/src/aut/configure.in new file mode 100644 index 00000000..b0758a8e --- /dev/null +++ b/alliance/src/aut/configure.in @@ -0,0 +1,50 @@ +dnl +/* +dnl This file is part of the Alliance CAD System +dnl Copyright (C) Laboratoire LIP6 - Département ASIM +dnl Universite Pierre et Marie Curie +dnl +dnl Home page : http://www-asim.lip6.fr/alliance/ +dnl E-mail support : mailto:alliance-support@asim.lip6.fr +dnl +dnl This library is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU Library General Public License as published +dnl by the Free Software Foundation; either version 2 of the License, or (at +dnl your option) any later version. +dnl +dnl Alliance VLSI CAD System is distributed in the hope that it will be +dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +dnl Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with the GNU C Library; see the file COPYING. If not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +dnl +dnl Purpose : Auto stuffing Alliance +dnl Almost ten years since I wrote this stuff, I just can't +dnl believe it +dnl Date : 01/02/2002 +dnl Author : Frederic Petrot +dnl $Id: configure.in,v 1.1 2002/03/08 14:14:22 ludo Exp $ +dnl +dnl +AC_INIT(src/aut.h) +AM_INIT_AUTOMAKE(aut, 1.03) +AC_PROG_INSTALL +AC_PROG_CC +dnl AC_HEADER_STDC +dnl AC_HEADER_SYS_WAIT +dnl AC_CHECK_HEADERS +dnl AC_C_CONST +dnl AC_TYPE_SIGNAL +AC_PROG_RANLIB + + +AC_OUTPUT([ +Makefile +src/Makefile +doc/Makefile +doc/man1/Makefile +doc/man3/Makefile +]) diff --git a/alliance/src/aut/src/Makefile.am b/alliance/src/aut/src/Makefile.am new file mode 100644 index 00000000..233fcfc6 --- /dev/null +++ b/alliance/src/aut/src/Makefile.am @@ -0,0 +1,9 @@ +INCLUDES = -I$(top_srcdir)/../mbk/src +lib_LIBRARIES = libAut.a +include_HEADERS = aut.h +libAut_a_SOURCES = autenv.h autfree.h authash2.h autsort.h \ +autalloc.c auterror.c autgraph.c autname.c auttest.c \ +autalloc.h auterror.h autgraph.h autname.h auttest.h \ +autdebug.c autexit.c authash.c autresize.c main.c \ +autdebug.h autexit.h authash.h autresize.h testhash.c \ +autenv.c autfree.c authash2.c autsort.c diff --git a/alliance/src/aut/src/Makefile.in b/alliance/src/aut/src/Makefile.in new file mode 100644 index 00000000..9f334ffe --- /dev/null +++ b/alliance/src/aut/src/Makefile.in @@ -0,0 +1,341 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ + +INCLUDES = -I$(top_srcdir)/../mbk/src +lib_LIBRARIES = libAut.a +include_HEADERS = aut.h +libAut_a_SOURCES = autenv.h autfree.h authash2.h autsort.h autalloc.c auterror.c autgraph.c autname.c auttest.c autalloc.h auterror.h autgraph.h autname.h auttest.h autdebug.c autexit.c authash.c autresize.c main.c autdebug.h autexit.h authash.h autresize.h testhash.c autenv.c autfree.c authash2.c autsort.c + +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(lib_LIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +libAut_a_LIBADD = +libAut_a_OBJECTS = autalloc.o auterror.o autgraph.o autname.o auttest.o \ +autdebug.o autexit.o authash.o autresize.o main.o testhash.o autenv.o \ +autfree.o authash2.o autsort.o +AR = ar +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +HEADERS = $(include_HEADERS) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/autalloc.P .deps/autdebug.P .deps/autenv.P \ +.deps/auterror.P .deps/autexit.P .deps/autfree.P .deps/autgraph.P \ +.deps/authash.P .deps/authash2.P .deps/autname.P .deps/autresize.P \ +.deps/autsort.P .deps/auttest.P .deps/main.P .deps/testhash.P +SOURCES = $(libAut_a_SOURCES) +OBJECTS = $(libAut_a_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-libLIBRARIES: + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) + +distclean-libLIBRARIES: + +maintainer-clean-libLIBRARIES: + +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(lib_LIBRARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +libAut.a: $(libAut_a_OBJECTS) $(libAut_a_DEPENDENCIES) + -rm -f libAut.a + $(AR) cru libAut.a $(libAut_a_OBJECTS) $(libAut_a_LIBADD) + $(RANLIB) libAut.a + +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir) + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + list='$(include_HEADERS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(includedir)/$$p; \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = src + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign src/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: install-libLIBRARIES +install-exec: install-exec-am + +install-data-am: install-includeHEADERS +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-libLIBRARIES uninstall-includeHEADERS +uninstall: uninstall-am +all-am: Makefile $(LIBRARIES) $(HEADERS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-libLIBRARIES mostlyclean-compile \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-libLIBRARIES clean-compile clean-tags clean-depend \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-libLIBRARIES distclean-compile distclean-tags \ + distclean-depend distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-libLIBRARIES \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ +clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ +install-libLIBRARIES mostlyclean-compile distclean-compile \ +clean-compile maintainer-clean-compile uninstall-includeHEADERS \ +install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ +maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ +clean-depend maintainer-clean-depend info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alliance/src/aut/src/aut.h b/alliance/src/aut/src/aut.h new file mode 100644 index 00000000..e1bd5de9 --- /dev/null +++ b/alliance/src/aut/src/aut.h @@ -0,0 +1,450 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Title : Structures and fonctions for AUT | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------*/ + +# ifndef AUT_103_H +# define AUT_103_H + +/*------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------*/ + +# ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +# endif + +/*------------------------------------------------------\ +| | +| Hash Key | +| | +\------------------------------------------------------*/ + +# define AUT_HASH_KEY_EMPTY (char *)0 +# define AUT_HASH_KEY_DELETED (char *)1 + +/*------------------------------------------------------\ +| | +| Prime Number | +| | +\------------------------------------------------------*/ + +# define AUT_MAX_PRIME_NUMBER 58 + +/*------------------------------------------------------\ +| | +| Alloc | +| | +\------------------------------------------------------*/ + +# define AUT_ALLOC_BLOCK 0 +# define AUT_ALLOC_HEAP 1 + +/*------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Allocation Macros | +| | +\------------------------------------------------------*/ + +# define autallocblock( S ) ( autalloc( (unsigned int)( S ), AUT_ALLOC_BLOCK ) ) +# define autallocheap( S ) ( autalloc( (unsigned int)( S ), AUT_ALLOC_HEAP ) ) +# define autfreeblock( P ) ( autfree( (char *)( P ), 0 ) ) +# define autfreeheap( P, S ) ( autfree( (char *)( P ), (unsigned int)( S ) ) ) + +/*------------------------------------------------------\ +| | +| Resize Macros | +| | +\------------------------------------------------------*/ + +# define autresizeblock( P, O, N ) ( autresize( ( P ), ( O ), ( N ) ) ) + +/*------------------------------------------------------\ +| | +| Debug Macros | +| | +\------------------------------------------------------*/ + +# define autbegin() do { \ + \ + if ( AUT_DEBUG_ON ) addautdebug(__LINE__,__FILE__); } while (0) + +# define autend() do { \ + \ + if ( AUT_DEBUG_ON ) delautdebug(); } while (0) + +/*------------------------------------------------------\ +| | +| Type | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Aut Debug List | +| | +\------------------------------------------------------*/ + + typedef struct autdebug_list + { + struct autdebug_list *NEXT; + int LINE; + char *NAME; + + } autdebug_list; + +/*------------------------------------------------------\ +| | +| Aut Hash Table | +| | +\------------------------------------------------------*/ + + typedef struct authelem + { + char *KEY; + long VALUE; + + } authelem; + + typedef struct authtable + { + authelem *TABLE; + long TABLE_SIZE; + long NUMBER_ELEM; + long NUMBER_ADD; + long NUMBER_SCAN; + long NUMBER_DEL; + long NUMBER_STRETCH; + long (*FUNC_SIZE)(); + long (*FUNC_INDEX)(); + long (*FUNC_KEY)(); + + } authtable; + +/*------------------------------------------------------\ +| | +| Aut Hash Table 2 | +| | +\------------------------------------------------------*/ + + typedef struct auth2elem + { + char *KEY1; + char *KEY2; + long VALUE; + + } auth2elem; + + typedef struct auth2table + { + auth2elem *TABLE; + long TABLE_SIZE; + long NUMBER_ELEM; + long NUMBER_ADD; + long NUMBER_SCAN; + long NUMBER_DEL; + long NUMBER_STRETCH; + long (*FUNC_SIZE)(); + long (*FUNC_INDEX)(); + long (*FUNC_KEY)(); + + } auth2table; + +/*------------------------------------------------------\ +| | +| Aut Graph | +| | +\------------------------------------------------------*/ + + typedef struct autnode_list + { + struct autnode_list *NEXT; + struct autnode_list **PREV; + char *NAME; + chain_list *ARC_FROM; + chain_list *ARC_TO; + long FLAGS; + void *USER; + + } autnode_list; + + typedef struct autarc_list + { + struct autarc_list *NEXT; + struct autarc_list **PREV; + autnode_list *NODE_FROM; + autnode_list *NODE_TO; + long FLAGS; + void *USER; + + } autarc_list; + + typedef struct autgraph + { + autnode_list *NODE; + autarc_list *ARC; + authtable *HASH_NODE; + auth2table *HASH_ARC; + long NUMBER_NODE; + long NUMBER_ARC; + long FLAGS; + void *USER; + + } autgraph; + +/*------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------*/ + + extern autdebug_list *HEAD_AUTDEBUG; + extern char AUT_DEBUG_ON; + extern long AUT_HASH_PRIME_NUMBER[ AUT_MAX_PRIME_NUMBER ]; + extern long AUT_HASH_MAX_SCAN; + extern long AUT_HASH_STRETCH_FACTOR; + +/*------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Env Functions | +| | +\------------------------------------------------------*/ + + extern void autenv __P(()); + +/*------------------------------------------------------\ +| | +| Exit Functions | +| | +\------------------------------------------------------*/ + + extern void autexit __P((int Value)); + +/*------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------*/ + + extern char * autalloc __P((unsigned int Size, char Heap)); + extern authelem * allocauthelem __P((unsigned int Number)); + extern authtable * allocauthtable __P(()); + extern auth2elem * allocauth2elem __P((unsigned int Number)); + extern auth2table * allocauth2table __P(()); + extern autdebug_list * allocautdebug __P(()); + +/*------------------------------------------------------\ +| | +| Resize Functions | +| | +\------------------------------------------------------*/ + + extern char * autresize __P((char *Source, unsigned int OldSize, unsigned int NewSize)); + +/*------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------*/ + + extern void autfree __P((char *Pointer, unsigned int Size)); + extern void freeauthelem __P((authelem *Element)); + extern void freeauthtable __P((authtable *HashTable)); + extern void freeauth2elem __P((auth2elem *Element)); + extern void freeauth2table __P((auth2table *HashTable)); + extern void freeautdebug __P((autdebug_list *Debug)); + +/*------------------------------------------------------\ +| | +| Debug Functions | +| | +\------------------------------------------------------*/ + + extern void autdebug __P(()); + extern void addautdebug __P((int Line, char *File)); + extern void delautdebug __P(()); + +/*------------------------------------------------------\ +| | +| Get Hash Functions | +| | +\------------------------------------------------------*/ + + extern long getauthsize __P((long Size)); + extern long getauthkey __P((authtable *Table, char *Key)); + extern long getauthindex __P((authtable *Table, char *Key, long Index)); + + extern long getauth2size __P((long Size)); + extern long getauth2key __P((auth2table *Table, char *Key1, char *Key2)); + extern long getauth2index __P((auth2table *Table, char *Key1, char *Key2, long Index)); + +/*------------------------------------------------------\ +| | +| Check Hash Functions | +| | +\------------------------------------------------------*/ + + extern int checkauthkey __P((char *Key, int Severity)); + extern int checkauth2key __P((char *Key1, char *Key2, int Severity)); + +/*------------------------------------------------------\ +| | +| Set Hash Functions | +| | +\------------------------------------------------------*/ + + extern void setauthfunc __P((authtable *HashTable, long (*FuncSize)(), \ + long (*FuncKey)() , long (*FuncIndex)())); + + extern void setauth2func __P((auth2table *HashTable, long (*FuncSize)(), \ + long (*FuncKey)(), long (*FuncIndex)())); + +/*------------------------------------------------------\ +| | +| Hash Table Functions | +| | +\------------------------------------------------------*/ + + extern authtable *createauthtable __P((long Length)); + extern void stretchauthtable __P((authtable *HashTable)); + extern void destroyauthtable __P((authtable *HashTable)); + extern void resetauthtable __P((authtable *HashTable)); + extern void viewauthtable __P((authtable *HashTable, void (*FuncView)())); + extern void viewauthelem __P((authelem *Element)); + + extern auth2table *createauth2table __P((long Length)); + extern void stretchauth2table __P((auth2table *HashTable)); + extern void destroyauth2table __P((auth2table *HashTable)); + extern void resetauth2table __P((auth2table *HashTable)); + extern void viewauth2table __P((auth2table *HashTable, void (*FuncView)())); + extern void viewauth2elem __P((auth2elem *Element)); + +/*------------------------------------------------------\ +| | +| Hash Element Functions | +| | +\------------------------------------------------------*/ + + extern authelem *addauthelem __P((authtable *HashTable, char *Key, long Value)); + extern authelem *searchauthelem __P((authtable *HashTable, char *Key)); + extern int delauthelem __P((authtable *HashTable, char *Key)); + + extern auth2elem *addauth2elem __P((auth2table *HashTable, char *Key1, \ + char *Key2, long Value)); + extern auth2elem *searchauth2elem __P((auth2table *HashTable, char *Key1, char *Key2)); + extern int delauth2elem __P((auth2table *HashTable, char *Key1, char *Key2)); + +/*------------------------------------------------------\ +| | +| Hash Test Functions | +| | +\------------------------------------------------------*/ + + extern int testauthtable __P((authtable *HashTable)); + extern int testauth2table __P((auth2table *HashTable)); + +/*------------------------------------------------------\ +| | +| Sort Compare Function | +| | +\------------------------------------------------------*/ + + extern long sortautcompare __P((long *ValueArray, long Index1, long Index2)); + +/*------------------------------------------------------\ +| | +| Sort Function | +| | +\------------------------------------------------------*/ + + extern void sortautarray __P((void *ValueArray, long *IndexArray, \ + long ArraySize, long (*FuncCompare)())); + +/*------------------------------------------------------\ +| | +| File Function | +| | +\------------------------------------------------------*/ + + extern char *autbasename __P((char *Name, char *Extension)); + +/*------------------------------------------------------\ +| | +| Name Functions | +| | +\------------------------------------------------------*/ + + extern char *autnamealloc __P((char *Name)); + +/*------------------------------------------------------\ +| | +| Graph Functions | +| | +\------------------------------------------------------*/ + + extern autnode_list * searchautgraphnode __P((autgraph *Graph, char *Name)); + extern autarc_list * searchautgrapharc __P((autgraph *Graph, autnode_list *NodeFrom, \ + autnode_list *NodeTo)); + + extern autnode_list * addautgraphnode __P((autgraph *Graph, char *Name)); + extern autarc_list * addautgrapharc __P((autgraph *Graph, autnode_list *NodeFrom, \ + autnode_list *NodeTo)); + + extern void delautgraphnode __P((autgraph *Graph, autnode_list *Node)); + extern void delautgrapharc __P((autgraph *Graph, autarc_list *Arc)); + + extern autgraph * createautgraph __P(()); + extern void destroyautgraph __P((autgraph *Graph)); + + extern void viewautgraph __P((autgraph *Graph, void (*FuncViewNode)(), \ + void (*FuncViewArc)())); + extern autgraph * loadautgraph __P((char *FileName)); + extern void driveautgraph __P((autgraph *Graph, char *FileName)); + +# endif diff --git a/alliance/src/aut/src/autalloc.c b/alliance/src/aut/src/autalloc.c new file mode 100644 index 00000000..14269b57 --- /dev/null +++ b/alliance/src/aut/src/autalloc.c @@ -0,0 +1,261 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autalloc.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + + +# include +# include +# include +# include + +# include +# include "aut.h" + +# include "autalloc.h" +# include "autenv.h" +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char *AutHeapHeadArray[ 256 ]; + char InitAutHeapHeadArray = 1; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Alloc | +| | +\------------------------------------------------------------*/ + +char *autalloc( Size, Heap ) + + unsigned int Size; + char Heap; +{ + int Counter; + unsigned int Index; + int HeapSize; + char *Pointer; + char **Prev; + char *Scan; + + if ( ( Heap != AUT_ALLOC_BLOCK ) && + ( Heap != AUT_ALLOC_HEAP ) ) + { + auterror( AUT_ALLOC_ERROR, (char *)0 ); + } + + if ( Size == 0 ) + { + auterror( AUT_ALLOC_SIZE_ERROR, (char *)0 ); + } + + if ( ! AUT_ALLOC_DEBUG ) + { + if ( InitAutHeapHeadArray == 1 ) + { + InitAutHeapHeadArray = 0; + + for ( Counter = 0; Counter < 256 ; Counter++ ) + { + AutHeapHeadArray[ Counter ] = (char *)0; + } + } + + Index = ( Size + 3 ) >> 2; + + if ( ( Heap == AUT_ALLOC_BLOCK ) || + ( Size < sizeof( char *) ) || + ( Index > 255 ) ) + { + if ( ! ( Pointer = malloc( Size ) ) ) + { + auterror( AUT_ALLOC_ERROR, (char *)0 ); + } + + memset( Pointer, 0, Size ); + + return( Pointer ); + } + + Size = Index << 2; + + if ( AutHeapHeadArray[ Index ] == (char *)0 ) + { + HeapSize = ( Size << AUT_ALLOC_SHIFT ); + + if ( ! ( Pointer = malloc( HeapSize ) ) ) + { + auterror( AUT_ALLOC_ERROR, (char *)0 ); + } + + memset( Pointer, 0, HeapSize ); + + Scan = (char *)(Pointer + Size); + + Prev = &AutHeapHeadArray[ Index ]; + + for ( Counter = 1; Counter < AUT_ALLOC_SIZE; Counter++ ) + { + *Prev = Scan; Prev = (char **)Scan; Scan = (char *)(Scan + Size); + } + + *Prev = (char *)0; + + AutHeapHeadArray[ Index ] = (char *)(Pointer + Size); + + return( Pointer ); + } + + Pointer = AutHeapHeadArray[ Index ]; + + AutHeapHeadArray[ Index ] = *((char **)AutHeapHeadArray[ Index ]); + + *(char **)(Pointer ) = (char *)0; + + return( Pointer ); + } + else + { + if ( ! ( Pointer = malloc( Size + sizeof(autallocdebug) ) ) ) + { + auterror( AUT_ALLOC_ERROR, (char *)0 ); + } + + { + autallocdebug *AllocDebug; + + AllocDebug = (autallocdebug *)Pointer; + AllocDebug->POINTER = AllocDebug; + AllocDebug->SIZE = Size; + AllocDebug->HEAP = Heap; + + Pointer += sizeof( autallocdebug ); + } + + memset( Pointer, 0, Size ); + + return( Pointer ); + } +} + +/*------------------------------------------------------------\ +| | +| Aut Alloc Debug | +| | +\------------------------------------------------------------*/ + +autdebug_list *allocautdebug() +{ + return( (autdebug_list *)(autallocheap( sizeof( autdebug_list ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Aut Alloc Hash Element | +| | +\------------------------------------------------------------*/ + +authelem *allocauthelem( Number ) + + unsigned int Number; +{ + return( (authelem *)autallocblock( sizeof( authelem ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Aut Alloc Hash Table | +| | +\------------------------------------------------------------*/ + +authtable *allocauthtable() +{ + return( (authtable *)autallocblock( sizeof( authtable ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Aut Alloc Hash Element | +| | +\------------------------------------------------------------*/ + +auth2elem *allocauth2elem( Number ) + + unsigned int Number; +{ + return( (auth2elem *)autallocblock( sizeof( auth2elem ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Aut Alloc Hash Table | +| | +\------------------------------------------------------------*/ + +auth2table *allocauth2table() +{ + return( (auth2table *)autallocblock( sizeof( auth2table ) ) ); +} diff --git a/alliance/src/aut/src/autalloc.h b/alliance/src/aut/src/autalloc.h new file mode 100644 index 00000000..bf2d97b5 --- /dev/null +++ b/alliance/src/aut/src/autalloc.h @@ -0,0 +1,92 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autalloc.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_ALLOC_H +# define AUT_ALLOC_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define AUT_ALLOC_SIZE 256 +# define AUT_ALLOC_SHIFT 8 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct autallocdebug + { + struct autallocdebug *POINTER; + long SIZE; + long HEAP; + + } autallocdebug; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern char *AutHeapHeadArray[ 256 ]; + extern char InitAutHeapHeadArray; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/autdebug.c b/alliance/src/aut/src/autdebug.c new file mode 100644 index 00000000..75db6bed --- /dev/null +++ b/alliance/src/aut/src/autdebug.c @@ -0,0 +1,159 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autadebug.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include +# include "aut.h" + +# include "autdebug.h" +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + autdebug_list *HEAD_AUTDEBUG = (autdebug_list *)0; + char AUT_DEBUG_ON = 0; + +/*------------------------------------------------------------\ +| | +| Privates | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| trapautdebug | +| | +\------------------------------------------------------------*/ + +void trapautdebug() +{ + autdebug_list *ScanDebug; + + for ( ScanDebug = HEAD_AUTDEBUG; + ScanDebug != (autdebug_list *)0; + ScanDebug = ScanDebug->NEXT ) + { + fprintf( stdout, "autdebug: file %s line %d\n", + ScanDebug->NAME, ScanDebug->LINE ); + } + + signal( SIGQUIT, trapautdebug ); + signal( SIGSEGV, SIG_DFL ); + signal( SIGBUS , SIG_DFL ); + signal( SIGILL , SIG_DFL ); +} + +/*------------------------------------------------------------\ +| | +| autdebug | +| | +\------------------------------------------------------------*/ + +void autdebug() +{ + signal( SIGSEGV, trapautdebug ); + signal( SIGBUS, trapautdebug ); + signal( SIGILL, trapautdebug ); + signal( SIGQUIT, trapautdebug ); + + AUT_DEBUG_ON = 1; +} + +/*------------------------------------------------------------\ +| | +| addautdebug | +| | +\------------------------------------------------------------*/ + +void addautdebug( Line, File ) + + int Line; + char *File; +{ + autdebug_list *NewDebug; + + NewDebug = allocautdebug(); + NewDebug->NEXT = HEAD_AUTDEBUG; + NewDebug->LINE = Line; + NewDebug->NAME = File; + HEAD_AUTDEBUG = NewDebug; +} + +/*------------------------------------------------------------\ +| | +| delautdebug | +| | +\------------------------------------------------------------*/ + +void delautdebug() +{ + autdebug_list *DelDebug; + + DelDebug = HEAD_AUTDEBUG; + + if ( DelDebug != (autdebug_list *)0 ) + { + HEAD_AUTDEBUG = DelDebug->NEXT; + freeautdebug( DelDebug ); + } +} diff --git a/alliance/src/aut/src/autdebug.h b/alliance/src/aut/src/autdebug.h new file mode 100644 index 00000000..4838f3b5 --- /dev/null +++ b/alliance/src/aut/src/autdebug.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autdebug.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_DEBUG_H +# define AUT_DEBUG_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/autenv.c b/alliance/src/aut/src/autenv.c new file mode 100644 index 00000000..0a64533b --- /dev/null +++ b/alliance/src/aut/src/autenv.c @@ -0,0 +1,137 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autenv.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include +# include "aut.h" + +# include "auterror.h" +# include "autenv.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + unsigned char AUT_EXIT_CORE = 0; + unsigned char AUT_ALLOC_DEBUG = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Exit Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Exit | +| | +\------------------------------------------------------------*/ + +void autenv() +{ + if ( mbkgetenv( "AUT_EXIT_CORE" ) ) + { + AUT_EXIT_CORE = 1; + + autwarning( AUT_EXIT_CORE_WARNING, 0 ); + } + + + if ( mbkgetenv( "AUT_ALLOC_DEBUG" ) ) + { + AUT_ALLOC_DEBUG = 1; + + autwarning( AUT_ALLOC_DEBUG_WARNING, 0 ); + } +} + +/*------------------------------------------------------------\ +| | +| Aut Base Name | +| | +\------------------------------------------------------------*/ + +char *autbasename( Name, Extension ) + + char *Name; + char *Extension; +{ + int Index; + char *NewName; + + NewName = mbkstrdup( Name ); + Index = strlen( NewName ) - (strlen( Extension ) + 1); + + if ( Index >= 0 ) + { + if ( ! strcmp( NewName + Index + 1, Extension ) ) + { + if ( NewName[ Index ] == '.' ) + { + NewName[ Index ] = '\0'; + } + } + } + + return( NewName ); +} diff --git a/alliance/src/aut/src/autenv.h b/alliance/src/aut/src/autenv.h new file mode 100644 index 00000000..7cd34d28 --- /dev/null +++ b/alliance/src/aut/src/autenv.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Abl | +| | +| File : autenv.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_ENV_H +# define AUT_ENV_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern unsigned char AUT_EXIT_CORE; + extern unsigned char AUT_ALLOC_DEBUG; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/auterror.c b/alliance/src/aut/src/auterror.c new file mode 100644 index 00000000..ce887fb1 --- /dev/null +++ b/alliance/src/aut/src/auterror.c @@ -0,0 +1,173 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : Aut Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 03.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include +# include "aut.h" + +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Error Function | +| | +\------------------------------------------------------------*/ + +void aut_error( Error, Text, File, Line ) + + int Error; + char *Text; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%ld ", Name, Line ); + + switch( Error ) + { + case AUT_ALLOC_ERROR : + fprintf( stderr, "alloc error, can't continue !\n"); + break; + + case AUT_ALLOC_SIZE_ERROR : + fprintf( stderr, "null size alloc error, can't continue !\n"); + break; + + case AUT_RESIZE_ERROR : + fprintf( stderr, "resize error, can't continue !\n"); + break; + + case AUT_HASH_SIZE_ERROR : + fprintf( stderr, "hash table size %ld error !\n", (long)Text ); + break; + + case AUT_HASH_KEY_ERROR : + fprintf( stderr, "hash key %lx error !\n", (long)Text ); + break; + + case AUT_OPEN_FILE_ERROR : + fprintf( stderr, "open file %s error !\n", Text ); + break; + + case AUT_CLOSE_FILE_ERROR : + fprintf( stderr, "close file %s error !\n", Text ); + break; + + default : + + fprintf( stderr, "unknown internal error %d !\n", Error ); + } + + autexit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Aut Warning Function | +| | +\------------------------------------------------------------*/ + +void aut_warning( Warning, Text, File, Line ) + + int Warning; + char *Text; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%ld ", Name, Line ); + + switch( Warning ) + { + case AUT_EXIT_CORE_WARNING : + fprintf( stderr, "warning: abnormal autexit generates a core file !\n" ); + break; + + case AUT_ALLOC_DEBUG_WARNING : + fprintf( stderr, "warning: autalloc and autfree debug mode on !\n" ); + break; + + case AUT_ABNORMAL_EXIT_WARNING : + fprintf( stderr, "warning: abnormal autexit %ld !\n", (long)Text ); + break; + + default : + + fprintf( stderr, "unknown internal warning %d !\n", Warning ); + } +} + diff --git a/alliance/src/aut/src/auterror.h b/alliance/src/aut/src/auterror.h new file mode 100644 index 00000000..1cba7ade --- /dev/null +++ b/alliance/src/aut/src/auterror.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : Aut Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 03.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_ERROR_H +# define AUT_ERROR_H + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define AUT_ALLOC_ERROR 0 +# define AUT_ALLOC_SIZE_ERROR 1 +# define AUT_RESIZE_ERROR 2 +# define AUT_HASH_SIZE_ERROR 3 +# define AUT_HASH_KEY_ERROR 4 +# define AUT_OPEN_FILE_ERROR 5 +# define AUT_CLOSE_FILE_ERROR 6 + +# define AUT_EXIT_CORE_WARNING 0 +# define AUT_ALLOC_DEBUG_WARNING 1 +# define AUT_ABNORMAL_EXIT_WARNING 2 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define auterror( E, V ) (aut_error( (int)(E), (char *)(V), __FILE__, __LINE__ )) +# define autwarning( W, V ) (aut_warning( (int)(W), (char *)(V), __FILE__, __LINE__ )) + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void aut_error __P((int Error, char *Text, char *File, long Line)); + +# endif diff --git a/alliance/src/aut/src/autexit.c b/alliance/src/aut/src/autexit.c new file mode 100644 index 00000000..8a7a10fa --- /dev/null +++ b/alliance/src/aut/src/autexit.c @@ -0,0 +1,101 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autexit.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include +# include "aut.h" + +# include "autenv.h" +# include "auterror.h" +# include "autexit.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Exit Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Exit | +| | +\------------------------------------------------------------*/ + +void autexit( Value ) + + int Value; +{ + long *Core = (long *)1; + + if ( ( AUT_EXIT_CORE ) && + ( Value != 0 ) ) + { + autwarning( AUT_ABNORMAL_EXIT_WARNING, (char *)Value ); + *Core = 0; + } + + mbkexit( Value ); +} diff --git a/alliance/src/aut/src/autexit.h b/alliance/src/aut/src/autexit.h new file mode 100644 index 00000000..50f41023 --- /dev/null +++ b/alliance/src/aut/src/autexit.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Abl | +| | +| File : autexit.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_EXIT_H +# define AUT_EXIT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/autfree.c b/alliance/src/aut/src/autfree.c new file mode 100644 index 00000000..01b67e8b --- /dev/null +++ b/alliance/src/aut/src/autfree.c @@ -0,0 +1,217 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autfree.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + +# include +# include "aut.h" + +# include "autfree.h" +# include "autenv.h" +# include "autalloc.h" +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Free | +| | +\------------------------------------------------------------*/ + +void autfree( Pointer, Size ) + + char *Pointer; + unsigned int Size; +{ + unsigned int Index; + + if ( ! AUT_ALLOC_DEBUG ) + { + Index = ( Size + 3 ) >> 2; + + if ( ( Size < sizeof(char *) ) || + ( Index > 255 ) ) + { + free( Pointer ); + } + else + { + memset( Pointer, 0, Size ); + + *((char **)Pointer) = AutHeapHeadArray[ Index ]; + + AutHeapHeadArray[ Index ] = Pointer; + } + } + else + { + autallocdebug *AllocDebug; + + AllocDebug = (autallocdebug *)(Pointer - sizeof(autallocdebug)); + Pointer = (char *)AllocDebug; + + if ( AllocDebug->POINTER != AllocDebug ) + { + fprintf( stdout, "ERROR autfree %lx != %lx !!!!\n", AllocDebug->POINTER, AllocDebug ); + autexit( 1 ); + } + + if ( ( AllocDebug->HEAP ) && + ( Size == 0 ) ) + { + fprintf( stdout, "ERROR autfree heap and size = 0 !!!!\n" ); + autexit( 1 ); + } + + if ( ( ! AllocDebug->HEAP ) && + ( Size != 0 ) ) + { + fprintf( stdout, "ERROR autfree block and size != 0 !!!!\n" ); + autexit( 1 ); + } + + if ( ( AllocDebug->HEAP ) && + ( AllocDebug->SIZE != Size ) ) + { + fprintf( stdout, "ERROR autfree heap mode and size %ld != %ld !!!!\n", + AllocDebug->SIZE, Size ); + autexit( 1 ); + } + + memset( AllocDebug->POINTER, 0, AllocDebug->SIZE + sizeof( autallocdebug ) ); + + free( Pointer ); + } +} + +/*------------------------------------------------------------\ +| | +| Aut Free Debug | +| | +\------------------------------------------------------------*/ + +void freeautdebug( Debug ) + + autdebug_list *Debug; +{ + autfreeheap( (char *)Debug, sizeof( autdebug_list ) ); +} + +/*------------------------------------------------------------\ +| | +| Aut Free Hash Element | +| | +\------------------------------------------------------------*/ + +void freeauthelem( Element ) + + authelem *Element; +{ + autfreeblock( (char *)Element ); +} + +/*------------------------------------------------------------\ +| | +| Aut Free Hash Table | +| | +\------------------------------------------------------------*/ + +void freeauthtable( HashTable ) + + authtable *HashTable; +{ + autfreeblock( (char *)HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Aut Free Hash Element 2 | +| | +\------------------------------------------------------------*/ + +void freeauth2elem( Element ) + + auth2elem *Element; +{ + autfreeblock( (char *)Element ); +} + +/*------------------------------------------------------------\ +| | +| Aut Free Hash Table 2 | +| | +\------------------------------------------------------------*/ + +void freeauth2table( HashTable ) + + auth2table *HashTable; +{ + autfreeblock( (char *)HashTable ); +} diff --git a/alliance/src/aut/src/autfree.h b/alliance/src/aut/src/autfree.h new file mode 100644 index 00000000..81dfd9d5 --- /dev/null +++ b/alliance/src/aut/src/autfree.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Abl | +| | +| File : autfree.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_FREE_H +# define AUT_FREE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/autgraph.c b/alliance/src/aut/src/autgraph.c new file mode 100644 index 00000000..572fd634 --- /dev/null +++ b/alliance/src/aut/src/autgraph.c @@ -0,0 +1,622 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : AUT | +| | +| File : autgraph.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 03.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include +# include "aut.h" + +# include "auterror.h" +# include "autgraph.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Private variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Graph Create | +| | +\------------------------------------------------------------*/ + +autgraph *createautgraph() +{ + autgraph *Graph; + + Graph = (autgraph *)autallocheap( sizeof( autgraph ) ); + Graph->HASH_NODE = createauthtable( 100 ); + Graph->HASH_ARC = createauth2table( 100 ); + + return( Graph ); +} + +/*------------------------------------------------------------\ +| | +| Aut Graph Search Node | +| | +\------------------------------------------------------------*/ + +autnode_list *searchautgraphnode( Graph, Name ) + + autgraph *Graph; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Graph->HASH_NODE, Name ); + + if ( Element != (authelem *)0 ) + { + return( (autnode_list *)Element->VALUE ); + } + + return( (autnode_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Aut Graph Search Arc | +| | +\------------------------------------------------------------*/ + +autarc_list *searchautgrapharc( Graph, NodeFrom, NodeTo ) + + autgraph *Graph; + autnode_list *NodeFrom; + autnode_list *NodeTo; +{ + auth2elem *Element; + + Element = searchauth2elem( Graph->HASH_ARC, NodeFrom->NAME, NodeTo->NAME ); + + if ( Element != (auth2elem *)0 ) + { + return( (autarc_list *)Element->VALUE ); + } + + return( (autarc_list *)0 ); +} + + +/*------------------------------------------------------------\ +| | +| Aut Graph Add Node | +| | +\------------------------------------------------------------*/ + +autnode_list *addautgraphnode( Graph, Name ) + + autgraph *Graph; + char *Name; +{ + autnode_list *Node; + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Graph->HASH_NODE, Name ); + + if ( Element != (authelem *)0 ) + { + return( (autnode_list *)Element->VALUE ); + } + + Node = (autnode_list *)autallocheap( sizeof( autnode_list ) ); + Node->PREV = &Graph->NODE; + Node->NAME = Name; + + if ( Graph->NODE != (autnode_list *)0 ) + { + Node->NEXT = Graph->NODE; + Graph->NODE->PREV = &Node->NEXT; + } + + addauthelem( Graph->HASH_NODE, Name, (long)Node ); + + Graph->NODE = Node; + Graph->NUMBER_NODE++; + + return( Node ); +} + +/*------------------------------------------------------------\ +| | +| Aut Graph Add Arc | +| | +\------------------------------------------------------------*/ + +autarc_list *addautgrapharc( Graph, NodeFrom, NodeTo ) + + autgraph *Graph; + autnode_list *NodeFrom; + autnode_list *NodeTo; +{ + autarc_list *Arc; + chain_list *ScanArc; + + Arc = searchautgrapharc( Graph, NodeFrom, NodeTo ); + + if ( Arc != (autarc_list *)0 ) + { + return( Arc ); + } + + Arc = (autarc_list *)autallocheap( sizeof( autarc_list ) ); + Arc->NODE_FROM = NodeFrom; + Arc->NODE_TO = NodeTo; + Arc->PREV = &Graph->ARC; + + if ( Graph->ARC != (autarc_list *)0 ) + { + Arc->NEXT = Graph->ARC; + Graph->ARC->PREV = &Arc->NEXT; + } + + Graph->ARC = Arc; + Graph->NUMBER_ARC++; + + NodeFrom->ARC_FROM = addchain( NodeFrom->ARC_FROM, Arc ); + NodeTo->ARC_TO = addchain( NodeTo->ARC_TO , Arc ); + + addauth2elem( Graph->HASH_ARC, (char *)NodeFrom, (char *)NodeTo, (long)Arc ); + + return( Arc ); +} + +/*------------------------------------------------------------\ +| | +| Aut Graph Del Node | +| | +\------------------------------------------------------------*/ + +void delautgraphnode( Graph, Node ) + + autgraph *Graph; + autnode_list *Node; +{ + autarc_list *Arc; + autnode_list *ScanNode; + chain_list *ScanArc; + chain_list **PrevChain; + chain_list *ScanChain; + + if ( Node->NEXT != (autnode_list *)0 ) + { + Node->NEXT->PREV = Node->PREV; + } + + *Node->PREV = Node->NEXT; + + for ( ScanArc = Node->ARC_FROM; + ScanArc != (chain_list *)0; + ScanArc = ScanArc->NEXT ) + { + Arc = (autarc_list *)ScanArc->DATA; + ScanNode = Arc->NODE_TO; + + PrevChain = &ScanNode->ARC_TO; + + for ( ScanChain = ScanNode->ARC_TO; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if ( ScanChain->DATA == Arc ) break; + + PrevChain = &ScanChain->NEXT; + } + + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + + if ( Arc->NEXT != (autarc_list *)0 ) + { + Arc->NEXT->PREV = Arc->PREV; + } + + delauth2elem( Graph->HASH_ARC, Arc->NODE_FROM->NAME, Arc->NODE_TO->NAME ); + + autfreeheap( Arc, sizeof( autarc_list ) ); + Graph->NUMBER_ARC--; + } + + freechain( Node->ARC_FROM ); + + for ( ScanChain = Node->ARC_TO; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Arc = (autarc_list *)ScanChain->DATA; + ScanNode = Arc->NODE_FROM; + PrevChain = (chain_list **)0; + + for ( ScanChain = ScanNode->ARC_FROM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if ( ScanChain->DATA == Arc ) break; + + PrevChain = &ScanChain->NEXT; + } + + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + + if ( Arc->NEXT != (autarc_list *)0 ) + { + Arc->NEXT->PREV = Arc->PREV; + } + + delauth2elem( Graph->HASH_ARC, Arc->NODE_FROM->NAME, Arc->NODE_TO->NAME ); + + autfreeheap( Arc, sizeof( autarc_list ) ); + Graph->NUMBER_ARC--; + } + + freechain( Node->ARC_TO ); + + delauthelem( Graph->HASH_NODE, Node->NAME ); + + autfreeheap( Node, sizeof( autnode_list ) ); + Graph->NUMBER_NODE--; +} + +/*------------------------------------------------------------\ +| | +| Aut Graph Del Arc | +| | +\------------------------------------------------------------*/ + +void delautgrapharc( Graph, Arc ) + + autgraph *Graph; + autarc_list *Arc; +{ + chain_list **PrevChain; + chain_list *ScanChain; + autnode_list *Node; + + Node = Arc->NODE_FROM; + PrevChain = &Node->ARC_FROM; + + for ( ScanChain = Node->ARC_FROM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if ( ScanChain->DATA == Arc ) break; + PrevChain = &ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + + Node = Arc->NODE_TO; + PrevChain = &Node->ARC_TO; + + for ( ScanChain = Node->ARC_TO; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if ( ScanChain->DATA == Arc ) break; + PrevChain = &ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + + if ( Arc->NEXT != (autarc_list *)0 ) + { + Arc->NEXT->PREV = Arc->PREV; + } + + delauth2elem( Graph->HASH_ARC, Arc->NODE_FROM->NAME, Arc->NODE_TO->NAME ); + + *Arc->PREV = Arc->NEXT; + autfreeheap( Arc, sizeof( autarc_list ) ); + Graph->NUMBER_ARC--; +} + +/*------------------------------------------------------------\ +| | +| Aut Graph View | +| | +\------------------------------------------------------------*/ + +void viewautgraph( Graph, FuncViewNode, FuncViewArc ) + + autgraph *Graph; + void (*FuncViewNode)(); + void (*FuncViewArc)(); +{ + autnode_list *ScanNode; + chain_list *ScanChain; + autarc_list *ScanArc; + + for ( ScanNode = Graph->NODE; + ScanNode != (autnode_list *)0; + ScanNode = ScanNode->NEXT ) + { + if ( FuncViewNode ) + { + FuncViewNode( Graph, ScanNode ); + } + else + { + fprintf( stdout, "NODE: %s\n", ScanNode->NAME ); + } + + fprintf( stdout, "> ARC_FROM:\n" ); + + for ( ScanChain = ScanNode->ARC_FROM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (autarc_list *)ScanChain->DATA; + + if ( FuncViewArc ) + { + FuncViewArc( Graph, ScanArc ); + } + else + { + fprintf( stdout, "> TO %s\n", ScanArc->NODE_TO->NAME ); + } + } + + fprintf( stdout, "> ARC_TO:\n" ); + + for ( ScanChain = ScanNode->ARC_TO; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (autarc_list *)ScanChain->DATA; + + if ( FuncViewArc ) + { + FuncViewArc( Graph, ScanArc ); + } + else + { + fprintf( stdout, "> FROM %s\n", ScanArc->NODE_FROM->NAME ); + } + } + } +} + +/*------------------------------------------------------------\ +| | +| Aut Graph Destroy | +| | +\------------------------------------------------------------*/ + +void destroyautgraph( Graph ) + + autgraph *Graph; +{ + autnode_list *ScanNode; + autnode_list *DelNode; + autarc_list *ScanArc; + autarc_list *DelArc; + + ScanNode = Graph->NODE; + + while( ScanNode != (autnode_list *)0 ) + { + DelNode = ScanNode; + ScanNode = ScanNode->NEXT; + + freechain( DelNode->ARC_FROM ); + freechain( DelNode->ARC_TO ); + + autfreeheap( DelNode, sizeof( autnode_list ) ); + } + + ScanArc = Graph->ARC; + + while( ScanArc != (autarc_list *)0 ) + { + DelArc = ScanArc; + ScanArc = ScanArc->NEXT; + + autfreeheap( DelArc, sizeof( autarc_list ) ); + } + + destroyauthtable( Graph->HASH_NODE ); + destroyauth2table( Graph->HASH_ARC ); + + autfreeheap( Graph, sizeof( autgraph ) ); +} + +/*------------------------------------------------------------\ +| | +| Aut Graph Load Graph | +| | +\------------------------------------------------------------*/ + +autgraph *loadautgraph( FileName ) + + char *FileName; +{ + FILE *GraphFile; + autgraph *Graph; + char Buffer[ 512 ]; + char *Scan; + char *Name; + char *NameTo; + autnode_list *NodeFrom; + autnode_list *NodeTo; + autarc_list *Arc; + + GraphFile = mbkfopen( FileName, "gr", "r" ); + + if ( GraphFile == (FILE *)0 ) + { + auterror( AUT_OPEN_FILE_ERROR, FileName ); + } + + Graph = createautgraph(); + + while ( fgets( Buffer, 512, GraphFile ) != (char *)0 ) + { + Scan = strchr( Buffer, '\n' ); + if ( Scan != (char *)0 ) *Scan = '\0'; + Scan = Buffer; + + if ( ( Buffer[ 0 ] == 'n' ) || + ( Buffer[ 0 ] == 'a' ) ) + { + Scan = strchr( Scan, '\t' ); + if ( Scan == (char *)0 ) continue; + + Name = Scan + 1; + Scan = strchr( Name, '\t' ); + if ( Scan == (char *)0 ) continue; + *Scan = '\0'; + + if ( Buffer[ 0 ] == 'n' ) + { + NodeFrom = addautgraphnode( Graph, Name ); + NodeFrom->FLAGS = atol( Scan + 1 ); + } + else + { + NameTo = Scan + 1; + Scan = strchr( NameTo, '\t' ); + if ( Scan == (char *)0 ) continue; + *Scan = '\0'; + + NodeFrom = addautgraphnode( Graph, Name ); + NodeTo = addautgraphnode( Graph, NameTo ); + + Arc = addautgrapharc( Graph, NodeFrom, NodeTo ); + Arc->FLAGS = atol( Scan + 1 ); + } + } + } + + if ( fclose( GraphFile ) ) + { + auterror( AUT_CLOSE_FILE_ERROR, FileName ); + } + + return( Graph ); +} + +/*------------------------------------------------------------\ +| | +| Aut Graph Drive Graph | +| | +\------------------------------------------------------------*/ + +void driveautgraph( Graph, FileName ) + + autgraph *Graph; + char *FileName; +{ + FILE *GraphFile; + autarc_list *ScanArc; + autnode_list *ScanNode; + + GraphFile = mbkfopen( FileName, "gr", "w" ); + + if ( GraphFile == (FILE *)0 ) + { + auterror( AUT_OPEN_FILE_ERROR, FileName ); + } + + for ( ScanNode = Graph->NODE; + ScanNode != (autnode_list *)0; + ScanNode = ScanNode->NEXT ) + { + fprintf( GraphFile, "node\t%s\t%ld\n", + ScanNode->NAME, + ScanNode->FLAGS ); + } + + for ( ScanArc = Graph->ARC; + ScanArc != (autarc_list *)0; + ScanArc = ScanArc->NEXT ) + { + fprintf( GraphFile, "arc\t%s\t%s\t%ld\n", + ScanArc->NODE_FROM->NAME, + ScanArc->NODE_TO->NAME, + ScanArc->FLAGS ); + } + + if ( fclose( GraphFile ) ) + { + auterror( AUT_CLOSE_FILE_ERROR, FileName ); + } +} diff --git a/alliance/src/aut/src/autgraph.h b/alliance/src/aut/src/autgraph.h new file mode 100644 index 00000000..7ac5eab3 --- /dev/null +++ b/alliance/src/aut/src/autgraph.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : AUT | +| | +| File : autgraph.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 03.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_GRAPH_H +# define AUT_GRAPH_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/authash.c b/alliance/src/aut/src/authash.c new file mode 100644 index 00000000..d04bf6d1 --- /dev/null +++ b/alliance/src/aut/src/authash.c @@ -0,0 +1,594 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : authash.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include +# include "aut.h" + +# include "authash.h" +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + long AUT_HASH_PRIME_NUMBER[ AUT_MAX_PRIME_NUMBER ] = + { + 1, + 3, + 5, + 7, + 13, + 23, + 59, + 101, + 503, + 1009, + 2003, + 3001, + 4001, + 5003, + 6007, + 7001, + 8009, + 9001, + 10007, + 12007, + 14009, + 16001, + 18013, + 20011, + 25013, + 30011, + 35023, + 40009, + 50021, + 60013, + 80021, + 100003, + 150001, + 200003, + 250007, + 300007, + 400009, + 600011, + 800011, + 1000003, + 1500007, + 2000003, + 2642201, + 3328979, + 4194287, + 5284393, + 6657919, + 8388593, + 10568797, + 13315831, + 16777199, + 33554393, + 67108859, + 134217689, + 268435399, + 536870879, + 1073741789, + 2147483629 + }; + + long AUT_HASH_STRETCH_FACTOR = HASH_STRETCH_FACTOR; + long AUT_HASH_MAX_SCAN = HASH_MAX_SCAN; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Set Hash Size Function | +| | +\------------------------------------------------------------*/ + +void setauthfunc( HashTable, FuncSize, FuncKey, FuncIndex ) + + authtable *HashTable; + long (*FuncSize)(); + long (*FuncKey)(); + long (*FuncIndex)(); +{ + if ( FuncSize != 0 ) HashTable->FUNC_SIZE = FuncSize; + if ( FuncKey != 0 ) HashTable->FUNC_KEY = FuncKey; + if ( FuncIndex != 0 ) HashTable->FUNC_INDEX = FuncIndex; +} + +/*------------------------------------------------------------\ +| | +| Aut Get Hash Size | +| | +\------------------------------------------------------------*/ + +long getauthsize( Size ) + + long Size; +{ + int Index; + + for ( Index = 0; Index < AUT_MAX_PRIME_NUMBER; Index++ ) + { + if ( AUT_HASH_PRIME_NUMBER[ Index ] > Size ) + { + return( AUT_HASH_PRIME_NUMBER[ Index ] ); + } + } + + if ( ( Size & 1 ) == 0 ) + { + Size++; + } + + return( Size ); +} + +/*------------------------------------------------------------\ +| | +| Aut Get Hash Key | +| | +\------------------------------------------------------------*/ + +long getauthkey( Table, Key ) + + authtable *Table; + char *Key; +{ + return( ( (unsigned long)Key >> 2 ) % Table->TABLE_SIZE ); +} + +/*------------------------------------------------------------\ +| | +| Aut Get Hash Index | +| | +\------------------------------------------------------------*/ + +long getauthindex( Table, Key, Index ) + + authtable *Table; + char *Key; + long Index; +{ + Index = Index + 1; + + if ( Index >= Table->TABLE_SIZE ) Index = 0; + + return( Index ); +} + +/*------------------------------------------------------------\ +| | +| Aut Check Hash Key | +| | +\------------------------------------------------------------*/ + +int checkauthkey( Key, Severity ) + + char *Key; + int Severity; +{ + if ( ( Key == AUT_HASH_KEY_EMPTY ) || + ( Key == AUT_HASH_KEY_DELETED ) ) + { + if ( Severity ) + { + auterror( AUT_HASH_KEY_ERROR, Key ); + } + + return( 0 ); + } + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Aut Create Hash Table | +| | +\------------------------------------------------------------*/ + +authtable *createauthtable( Length ) + + long Length; +{ + authtable *HashTable; + authelem *Table; + + if ( Length < 0 ) + { + auterror( AUT_HASH_SIZE_ERROR, Length ); + } + + Length = getauthsize( Length ); + + HashTable = allocauthtable(); + Table = allocauthelem( Length ); + + HashTable->TABLE = Table; + HashTable->TABLE_SIZE = Length; + HashTable->FUNC_SIZE = getauthsize; + HashTable->FUNC_INDEX = getauthindex; + HashTable->FUNC_KEY = getauthkey; + + return( HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Aut Destroy Hash Table | +| | +\------------------------------------------------------------*/ + +void destroyauthtable( HashTable ) + + authtable *HashTable; +{ + freeauthelem( HashTable->TABLE ); + freeauthtable( HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Aut Reset Hash Table | +| | +\------------------------------------------------------------*/ + +void resetauthtable( HashTable ) + + authtable *HashTable; +{ + if ( HashTable->NUMBER_ELEM > 0 ) + { + memset( (void *)HashTable->TABLE, 0, + (size_t)HashTable->TABLE_SIZE * sizeof( authelem ) ); + } + + HashTable->NUMBER_ELEM = 0; + HashTable->NUMBER_ADD = 0; + HashTable->NUMBER_SCAN = 0; + HashTable->NUMBER_DEL = 0; + HashTable->NUMBER_STRETCH = 0; +} + +/*------------------------------------------------------------\ +| | +| Aut Stretch Hash Table | +| | +\------------------------------------------------------------*/ + +void stretchauthtable( HashTable ) + + authtable *HashTable; +{ + authelem *NewTable; + authelem *Table; + authelem *Element; + long NewLength; + long Length; + + Length = HashTable->TABLE_SIZE; + Table = HashTable->TABLE; + NewLength = (*HashTable->FUNC_SIZE)( Length * AUT_HASH_STRETCH_FACTOR / 100 ); + NewTable = allocauthelem( NewLength ); + + HashTable->TABLE = NewTable; + HashTable->TABLE_SIZE = NewLength; + HashTable->NUMBER_ELEM = 0; + HashTable->NUMBER_STRETCH += 1; + + while ( Length > 0 ) + { + Length = Length - 1; + Element = &Table[ Length ]; + + if ( ( Element->KEY != AUT_HASH_KEY_EMPTY ) && + ( Element->KEY != AUT_HASH_KEY_DELETED ) ) + { + addauthelem( HashTable, + Element->KEY, + Element->VALUE ); + } + } + + freeauthelem( Table ); +} + +/*------------------------------------------------------------\ +| | +| Aut Add Hash Element | +| | +\------------------------------------------------------------*/ + +authelem *addauthelem( HashTable, Key, Value ) + + authtable *HashTable; + char *Key; + long Value; +{ + authelem *Element; + long HashIndex; + long Deleted; + int NumberScan; + char Stop; + + check_authkey( Key ); + + HashIndex = (*HashTable->FUNC_KEY)( HashTable, Key ); + Deleted = -1; + NumberScan = 0; + Stop = 0; + + HashTable->NUMBER_ADD++; + + do + { + Element = &HashTable->TABLE[ HashIndex ]; + + if ( Element->KEY == AUT_HASH_KEY_DELETED ) + { + if ( Deleted == -1 ) Deleted = HashIndex; + } + else + if ( ( Element->KEY == AUT_HASH_KEY_EMPTY ) || + ( Element->KEY == Key ) ) + { + if ( Element->KEY == AUT_HASH_KEY_EMPTY ) + { + HashTable->NUMBER_ELEM++; + + if ( Deleted != -1 ) + { + Element = &HashTable->TABLE[ Deleted ]; + } + } + else + if ( Deleted != -1 ) + { + Element->KEY = AUT_HASH_KEY_DELETED; + Element = &HashTable->TABLE[ Deleted ]; + } + + Element->VALUE = Value; + Element->KEY = Key; + + Stop = 1; + } + + NumberScan += 1; + + if ( Stop == 0 ) + { + if ( NumberScan > AUT_HASH_MAX_SCAN ) + { + if ( Deleted != -1 ) + { + HashTable->TABLE[ Deleted ].KEY = AUT_HASH_KEY_EMPTY; + HashIndex = Deleted; + Deleted = -1; + } + else + { + stretchauthtable( HashTable ); + + HashIndex = (*HashTable->FUNC_KEY)( HashTable, Key ); + NumberScan = 0; + } + } + else + { + HashIndex = (*HashTable->FUNC_INDEX)( HashTable, Key, HashIndex ); + } + } + } + while ( Stop == 0 ); + + HashTable->NUMBER_SCAN += NumberScan + 1; + + return( Element ); +} + +/*------------------------------------------------------------\ +| | +| Aut Del Hash Element | +| | +\------------------------------------------------------------*/ + +int delauthelem( HashTable, Key ) + + authtable *HashTable; + char *Key; +{ + authelem *Element; + long HashIndex; + int NumberScan; + + check_authkey( Key ); + + HashIndex = (*HashTable->FUNC_KEY)( HashTable, Key ); + NumberScan = 0; + + HashTable->NUMBER_DEL++; + + do + { + Element = &HashTable->TABLE[ HashIndex ]; + + if ( Element->KEY == Key ) + { + HashTable->NUMBER_ELEM--; + + Element->KEY = AUT_HASH_KEY_DELETED; + + HashTable->NUMBER_SCAN += NumberScan + 1; + + return( 1 ); + } + + if ( Element->KEY == AUT_HASH_KEY_EMPTY ) + { + return( 0 ); + } + + NumberScan += 1; + HashIndex = (*HashTable->FUNC_INDEX)( HashTable, Key, HashIndex ); + } + while ( NumberScan <= AUT_HASH_MAX_SCAN ); + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| Aut Search Hash Element | +| | +\------------------------------------------------------------*/ + +authelem *searchauthelem( HashTable, Key ) + + authtable *HashTable; + char *Key; +{ + authelem *Element; + long HashIndex; + int NumberScan; + + check_authkey( Key ); + + HashIndex = (*HashTable->FUNC_KEY)( HashTable, Key ); + NumberScan = 0; + + do + { + Element = &HashTable->TABLE[ HashIndex ]; + + if ( Element->KEY == Key ) + { + return( Element ); + } + + if ( Element->KEY == AUT_HASH_KEY_EMPTY ) + { + return( (authelem *)0 ); + } + + NumberScan += 1; + HashIndex = (*HashTable->FUNC_INDEX)( HashTable, Key, HashIndex ); + } + while ( NumberScan <= AUT_HASH_MAX_SCAN ); + + return( (authelem *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Aut View Hash Element | +| | +\------------------------------------------------------------*/ + +void viewauthelem( Element ) + + authelem *Element; +{ + fprintf( stdout, "VALUE: %10ld KEY: %s\n", + Element->VALUE, Element->KEY ); +} + +/*------------------------------------------------------------\ +| | +| Aut View Hash Table | +| | +\------------------------------------------------------------*/ + +void viewauthtable( HashTable, FuncView ) + + authtable *HashTable; + void (*FuncView)(); +{ + authelem *Element; + long HashIndex; + + fprintf( stdout, "--> HashTable\n" ); + fprintf( stdout, " SIZE : %ld\n", HashTable->TABLE_SIZE ); + fprintf( stdout, " ELEMENT : %ld\n", HashTable->NUMBER_ELEM ); + fprintf( stdout, " STRETCH : %ld\n", HashTable->NUMBER_STRETCH ); + fprintf( stdout, " SCAN : %ld\n", HashTable->NUMBER_SCAN ); + fprintf( stdout, " ADD : %ld\n", HashTable->NUMBER_ADD ); + fprintf( stdout, " DEL : %ld\n", HashTable->NUMBER_DEL ); + + if ( FuncView ) + { + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + Element = &HashTable->TABLE[ HashIndex ]; + + if ( checkauthkey( Element->KEY, 0 ) ) + { + fprintf( stdout, " INDEX : %-4ld ", HashIndex ); + + (*FuncView)( Element ); + } + } + } + + fprintf( stdout, "<-- HashTable\n" ); +} diff --git a/alliance/src/aut/src/authash.h b/alliance/src/aut/src/authash.h new file mode 100644 index 00000000..29459ed8 --- /dev/null +++ b/alliance/src/aut/src/authash.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : authash.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_HASH_H +# define AUT_HASH_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define HASH_STRETCH_FACTOR 150 +# define HASH_MAX_SCAN 15 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define check_authkey( K ) \ + \ + do { if ( ( (K) == AUT_HASH_KEY_EMPTY ) || \ + ( (K) == AUT_HASH_KEY_DELETED ) ) \ + { \ + auterror( AUT_HASH_KEY_ERROR, (K) ); \ + \ + } } while (0) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/authash2.c b/alliance/src/aut/src/authash2.c new file mode 100644 index 00000000..0282432e --- /dev/null +++ b/alliance/src/aut/src/authash2.c @@ -0,0 +1,555 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : authash2.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include +# include "aut.h" + + +# include "authash2.h" +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + long AUT_HASH2_STRETCH_FACTOR = HASH2_STRETCH_FACTOR; + long AUT_HASH2_MAX_SCAN = HASH2_MAX_SCAN; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Set Hash Size Function | +| | +\------------------------------------------------------------*/ + +void setauth2func( HashTable, FuncSize, FuncKey, FuncIndex ) + + auth2table *HashTable; + long (*FuncSize)(); + long (*FuncKey)(); + long (*FuncIndex)(); +{ + if ( FuncSize != 0 ) HashTable->FUNC_SIZE = FuncSize; + if ( FuncKey != 0 ) HashTable->FUNC_KEY = FuncKey; + if ( FuncIndex != 0 ) HashTable->FUNC_INDEX = FuncIndex; +} + +/*------------------------------------------------------------\ +| | +| Aut Get Hash Size | +| | +\------------------------------------------------------------*/ + +long getauth2size( Size ) + + long Size; +{ + int Index; + + for ( Index = 0; Index < AUT_MAX_PRIME_NUMBER; Index++ ) + { + if ( AUT_HASH_PRIME_NUMBER[ Index ] > Size ) + { + return( AUT_HASH_PRIME_NUMBER[ Index ] ); + } + } + + if ( ( Size & 1 ) == 0 ) + { + Size++; + } + + return( Size ); +} + +/*------------------------------------------------------------\ +| | +| Aut Get Hash Key | +| | +\------------------------------------------------------------*/ + +long getauth2key( Table, Key1, Key2 ) + + auth2table *Table; + char *Key1; + char *Key2; +{ + return( ( ((unsigned long)Key1 >> 2 ) + + ((unsigned long)Key2 << 1 ) ) % Table->TABLE_SIZE ); +} + +/*------------------------------------------------------------\ +| | +| Aut Get Hash Index | +| | +\------------------------------------------------------------*/ + +long getauth2index( Table, Key1, Key2, Index ) + + auth2table *Table; + char *Key1; + char *Key2; + long Index; +{ + return( ( ((unsigned long)Index ) + + ((unsigned long)Index << 2 ) + + ((unsigned long)Key2 ) + + ((unsigned long)Key1 << 1 ) ) % Table->TABLE_SIZE ); +} + +/*------------------------------------------------------------\ +| | +| Aut Check Hash Key | +| | +\------------------------------------------------------------*/ + +int checkauth2key( Key1, Key2, Severity ) + + char *Key1; + char *Key2; + int Severity; +{ + if ( ( Key1 == AUT_HASH_KEY_EMPTY ) || + ( Key1 == AUT_HASH_KEY_DELETED ) ) + { + if ( Severity ) + { + auterror( AUT_HASH_KEY_ERROR, Key1 ); + } + + return( 0 ); + } + + if ( ( Key2 == AUT_HASH_KEY_EMPTY ) || + ( Key2 == AUT_HASH_KEY_DELETED ) ) + { + if ( Severity ) + { + auterror( AUT_HASH_KEY_ERROR, Key2 ); + } + + return( 0 ); + } + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Aut Create Hash Table | +| | +\------------------------------------------------------------*/ + +auth2table *createauth2table( Length ) + + long Length; +{ + auth2table *HashTable; + auth2elem *Table; + + if ( Length < 0 ) + { + auterror( AUT_HASH_SIZE_ERROR, Length ); + } + + Length = getauth2size( Length ); + + HashTable = allocauth2table(); + Table = allocauth2elem( Length ); + + HashTable->TABLE = Table; + HashTable->TABLE_SIZE = Length; + HashTable->FUNC_SIZE = getauth2size; + HashTable->FUNC_INDEX = getauth2index; + HashTable->FUNC_KEY = getauth2key; + + return( HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Aut Destroy Hash Table | +| | +\------------------------------------------------------------*/ + +void destroyauth2table( HashTable ) + + auth2table *HashTable; +{ + freeauth2elem( HashTable->TABLE ); + freeauth2table( HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Aut Reset Hash Table | +| | +\------------------------------------------------------------*/ + +void resetauth2table( HashTable ) + + auth2table *HashTable; +{ + if ( HashTable->NUMBER_ELEM > 0 ) + { + memset( (void *)HashTable->TABLE, 0, + (size_t)HashTable->TABLE_SIZE * sizeof( auth2elem ) ); + } + + HashTable->NUMBER_ELEM = 0; + HashTable->NUMBER_ADD = 0; + HashTable->NUMBER_SCAN = 0; + HashTable->NUMBER_DEL = 0; + HashTable->NUMBER_STRETCH = 0; +} + +/*------------------------------------------------------------\ +| | +| Aut Stretch Hash Table | +| | +\------------------------------------------------------------*/ + +void stretchauth2table( HashTable ) + + auth2table *HashTable; +{ + auth2elem *NewTable; + auth2elem *Table; + auth2elem *Element; + long NewLength; + long Length; + + Length = HashTable->TABLE_SIZE; + Table = HashTable->TABLE; + NewLength = (*HashTable->FUNC_SIZE)( Length * AUT_HASH2_STRETCH_FACTOR / 100 ); + NewTable = allocauth2elem( NewLength ); + + HashTable->TABLE = NewTable; + HashTable->TABLE_SIZE = NewLength; + HashTable->NUMBER_ELEM = 0; + HashTable->NUMBER_STRETCH += 1; + + while ( Length > 0 ) + { + Length = Length - 1; + Element = &Table[ Length ]; + + if ( ( Element->KEY1 != AUT_HASH_KEY_EMPTY ) && + ( Element->KEY1 != AUT_HASH_KEY_DELETED ) ) + { + addauth2elem( HashTable, + Element->KEY1, + Element->KEY2, + Element->VALUE ); + } + } + + freeauth2elem( Table ); +} + +/*------------------------------------------------------------\ +| | +| Aut Add Hash Element | +| | +\------------------------------------------------------------*/ + +auth2elem *addauth2elem( HashTable, Key1, Key2, Value ) + + auth2table *HashTable; + char *Key1; + char *Key2; + long Value; +{ + auth2elem *Element; + long HashIndex; + long Deleted; + int NumberScan; + char Stop; + + check_auth2key( Key1, Key2 ); + + HashIndex = (*HashTable->FUNC_KEY)( HashTable, Key1, Key2 ); + Deleted = -1; + NumberScan = 0; + Stop = 0; + + HashTable->NUMBER_ADD++; + + do + { + Element = &HashTable->TABLE[ HashIndex ]; + + if ( Element->KEY1 == AUT_HASH_KEY_DELETED ) + { + if ( Deleted == -1 ) Deleted = HashIndex; + } + else + if ( ( Element->KEY1 == AUT_HASH_KEY_EMPTY ) || + ( ( Element->KEY1 == Key1 ) && + ( Element->KEY2 == Key2 ) ) ) + { + if ( Element->KEY1 == AUT_HASH_KEY_EMPTY ) + { + HashTable->NUMBER_ELEM++; + + if ( Deleted != -1 ) + { + Element = &HashTable->TABLE[ Deleted ]; + } + } + else + if ( Deleted != -1 ) + { + Element->KEY1 = AUT_HASH_KEY_DELETED; + Element = &HashTable->TABLE[ Deleted ]; + } + + Element->VALUE = Value; + Element->KEY1 = Key1; + Element->KEY2 = Key2; + + Stop = 1; + } + + NumberScan += 1; + + if ( Stop == 0 ) + { + if ( NumberScan > AUT_HASH2_MAX_SCAN ) + { + if ( Deleted != -1 ) + { + HashTable->TABLE[ Deleted ].KEY1 = AUT_HASH_KEY_EMPTY; + HashIndex = Deleted; + Deleted = -1; + } + else + { + stretchauth2table( HashTable ); + + HashIndex = (*HashTable->FUNC_KEY)( HashTable, Key1, Key2 ); + NumberScan = 0; + } + } + else + { + HashIndex = (*HashTable->FUNC_INDEX)( HashTable, Key1, Key2, HashIndex ); + } + } + } + while ( Stop == 0 ); + + HashTable->NUMBER_SCAN += NumberScan + 1; + + return( Element ); +} + +/*------------------------------------------------------------\ +| | +| Aut Del Hash Element | +| | +\------------------------------------------------------------*/ + +int delauth2elem( HashTable, Key1, Key2 ) + + auth2table *HashTable; + char *Key1; + char *Key2; +{ + auth2elem *Element; + long HashIndex; + int NumberScan; + + check_auth2key( Key1, Key2 ); + + HashIndex = (*HashTable->FUNC_KEY)( HashTable, Key1, Key2 ); + NumberScan = 0; + + HashTable->NUMBER_DEL++; + + do + { + Element = &HashTable->TABLE[ HashIndex ]; + + if ( ( Element->KEY1 == Key1 ) && + ( Element->KEY2 == Key2 ) ) + { + HashTable->NUMBER_ELEM--; + + Element->KEY1 = AUT_HASH_KEY_DELETED; + + HashTable->NUMBER_SCAN += NumberScan + 1; + + return( 1 ); + } + + if ( Element->KEY1 == AUT_HASH_KEY_EMPTY ) + { + return( 0 ); + } + + NumberScan += 1; + HashIndex = (*HashTable->FUNC_INDEX)( HashTable, Key1, Key2, HashIndex ); + } + while ( NumberScan <= AUT_HASH2_MAX_SCAN ); + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| Aut Search Hash Element | +| | +\------------------------------------------------------------*/ + +auth2elem *searchauth2elem( HashTable, Key1, Key2 ) + + auth2table *HashTable; + char *Key1; + char *Key2; +{ + auth2elem *Element; + long HashIndex; + int NumberScan; + + check_auth2key( Key1, Key2 ); + + HashIndex = (*HashTable->FUNC_KEY)( HashTable, Key1, Key2 ); + NumberScan = 0; + + do + { + Element = &HashTable->TABLE[ HashIndex ]; + + if ( ( Element->KEY1 == Key1 ) && + ( Element->KEY2 == Key2 ) ) + { + return( Element ); + } + + if ( Element->KEY1 == AUT_HASH_KEY_EMPTY ) + { + return( (auth2elem *)0 ); + } + + NumberScan += 1; + HashIndex = (*HashTable->FUNC_INDEX)( HashTable, Key1, Key2, HashIndex ); + } + while ( NumberScan <= AUT_HASH2_MAX_SCAN ); + + return( (auth2elem *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Aut View Hash Element | +| | +\------------------------------------------------------------*/ + +void viewauth2elem( Element ) + + auth2elem *Element; +{ + fprintf( stdout, "VALUE: %10ld KEY1: %s KEY2: %s\n", + Element->VALUE, Element->KEY1, Element->KEY2 ); +} + +/*------------------------------------------------------------\ +| | +| Aut View Hash Table | +| | +\------------------------------------------------------------*/ + +void viewauth2table( HashTable, FuncView ) + + auth2table *HashTable; + void (*FuncView)(); +{ + auth2elem *Element; + long HashIndex; + + fprintf( stdout, "--> HashTable\n" ); + fprintf( stdout, " SIZE : %ld\n", HashTable->TABLE_SIZE ); + fprintf( stdout, " ELEMENT : %ld\n", HashTable->NUMBER_ELEM ); + fprintf( stdout, " STRETCH : %ld\n", HashTable->NUMBER_STRETCH ); + fprintf( stdout, " SCAN : %ld\n", HashTable->NUMBER_SCAN ); + fprintf( stdout, " ADD : %ld\n", HashTable->NUMBER_ADD ); + fprintf( stdout, " DEL : %ld\n", HashTable->NUMBER_DEL ); + + if ( FuncView ) + { + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + Element = &HashTable->TABLE[ HashIndex ]; + + if ( checkauth2key( Element->KEY1, Element->KEY2, 0 ) ) + { + fprintf( stdout, " INDEX : %-4ld ", HashIndex ); + + (*FuncView)( Element ); + } + } + } + + fprintf( stdout, "<-- HashTable\n" ); +} diff --git a/alliance/src/aut/src/authash2.h b/alliance/src/aut/src/authash2.h new file mode 100644 index 00000000..f7353d7c --- /dev/null +++ b/alliance/src/aut/src/authash2.h @@ -0,0 +1,95 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : authash2.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_HASH2_H +# define AUT_HASH2_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define HASH2_STRETCH_FACTOR 150 +# define HASH2_MAX_SCAN 15 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define check_auth2key( K1, K2 ) \ + \ + do { if ( ( (K1) == AUT_HASH_KEY_EMPTY ) || \ + ( (K1) == AUT_HASH_KEY_DELETED ) ) \ + { \ + auterror( AUT_HASH_KEY_ERROR, (K1) ); \ + } \ + \ + if ( ( (K2) == AUT_HASH_KEY_EMPTY ) || \ + ( (K2) == AUT_HASH_KEY_DELETED ) ) \ + { \ + auterror( AUT_HASH_KEY_ERROR, (K2) ); \ + \ + } } while (0) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/autname.c b/alliance/src/aut/src/autname.c new file mode 100644 index 00000000..a30b3d4a --- /dev/null +++ b/alliance/src/aut/src/autname.c @@ -0,0 +1,146 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autname.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include +# include "aut.h" + + +# include "autname.h" +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static chain_list *AutNameHashTable[ AUT_NAME_HASH_SIZE ]; + static char AutNameBuffer[ AUT_NAME_BUFFER_SIZE ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Name Alloc | +| | +\------------------------------------------------------------*/ + +char *autnamealloc( Name ) + + char *Name; +{ + static char *LastName1 = (char *)0; + static char *LastName2 = (char *)0; + + chain_list *ScanChain; + char *SourceName; + char *TargetName; + int HashKey; + + if ( Name != (char *)0 ) + { + if ( Name == LastName1 ) return( LastName1 ); + else + if ( Name == LastName2 ) return( LastName2 ); + + HashKey = 0; + TargetName = AutNameBuffer; + SourceName = Name; + + while ( *SourceName != '\0' ) + { + *TargetName = *SourceName; + + HashKey += ( HashKey ^ ( HashKey >> 1 ) ); + HashKey += AUT_NAME_HASH_MULT * (unsigned char)*TargetName; + + TargetName++; + SourceName++; + + while ( HashKey >= AUT_NAME_HASH_PRIME ) + { + HashKey -= AUT_NAME_HASH_PRIME; + } + } + + *TargetName = '\0'; + HashKey %= AUT_NAME_HASH_SIZE; + + for ( ScanChain = AutNameHashTable[ HashKey ]; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if (! strcmp( AutNameBuffer, (char *)ScanChain->DATA ) ) + { + Name = (char *)ScanChain->DATA; break; + } + } + + if ( ScanChain == (chain_list *)0 ) + { + Name = mbkstrdup( AutNameBuffer ); + AutNameHashTable[ HashKey ] = addchain( AutNameHashTable[ HashKey ], (void *)Name ); + } + + LastName1 = LastName2; + LastName2 = Name; + } + + return( Name ); +} diff --git a/alliance/src/aut/src/autname.h b/alliance/src/aut/src/autname.h new file mode 100644 index 00000000..4c104bd0 --- /dev/null +++ b/alliance/src/aut/src/autname.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autname.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_NAME_H +# define AUT_NAME_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define AUT_NAME_HASH_SIZE 10007 +# define AUT_NAME_HASH_MULT 314159 +# define AUT_NAME_HASH_PRIME 516595003 +# define AUT_NAME_BUFFER_SIZE 1024 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/autresize.c b/alliance/src/aut/src/autresize.c new file mode 100644 index 00000000..7f2aeddf --- /dev/null +++ b/alliance/src/aut/src/autresize.c @@ -0,0 +1,121 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autresize.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include + + +# include +# include "aut.h" + +# include "autresize.h" +# include "autenv.h" +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Resize Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Resize | +| | +\------------------------------------------------------------*/ + +char *autresize( Source, OldSize, NewSize ) + + char *Source; + unsigned int OldSize; + unsigned int NewSize; +{ + char *Target; + + if ( Source == (char *)0 ) + { + return( autalloc( NewSize, 0 ) ); + } + + if ( ! AUT_ALLOC_DEBUG ) + { + if ( ! ( Target = realloc( Source, NewSize ) ) ) + { + auterror( AUT_RESIZE_ERROR, (char *)0 ); + } + } + else + { + Target = autallocblock( NewSize ); + memcpy( Target, Source, ( NewSize > OldSize ) ? OldSize : NewSize ); + autfreeblock( Source ); + } + + if ( NewSize > OldSize ) + { + memset( Target + OldSize, 0, NewSize - OldSize ); + } + + return( Target ); +} diff --git a/alliance/src/aut/src/autresize.h b/alliance/src/aut/src/autresize.h new file mode 100644 index 00000000..eaa4b697 --- /dev/null +++ b/alliance/src/aut/src/autresize.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autresize.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_RESIZE_H +# define AUT_RESIZE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/autsort.c b/alliance/src/aut/src/autsort.c new file mode 100644 index 00000000..17917d82 --- /dev/null +++ b/alliance/src/aut/src/autsort.c @@ -0,0 +1,189 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autsort.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include +# include "aut.h" + +# include "autsort.h" +# include "auterror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Aut Sort Compare | +| | +\------------------------------------------------------------*/ + +long sortautcompare( ValueArray, Index1, Index2 ) + + long *ValueArray; + long Index1; + long Index2; +{ + return( ValueArray[ Index1 ] - ValueArray[ Index2 ] ); +} + +/*------------------------------------------------------------\ +| | +| Sort Aut Array | +| | +\------------------------------------------------------------*/ + +void sortautarray( ValueArray, IndexArray, ArraySize, FuncCompare ) + + void *ValueArray; + long *IndexArray; + long ArraySize; + long (*FuncCompare)(); +{ + long Node; + long NodeIndex; + long LastNode; + long Father; + long FatherIndex; + long LeftChild; + long LeftIndex; + long RightChild; + long RightIndex; + long Child; + long ChildIndex; + + if ( ! FuncCompare ) FuncCompare = sortautcompare; + + for ( LastNode = 0; LastNode < ArraySize; LastNode++ ) + { + IndexArray[ LastNode ] = LastNode; + + NodeIndex = LastNode; + Node = LastNode; + + do + { + Father = HEAP_FATHER( Node ); + + if ( Father != -1 ) + { + FatherIndex = IndexArray[ Father ]; + + if ( (*FuncCompare)( ValueArray, FatherIndex, NodeIndex ) > 0 ) + { + IndexArray[ Father ] = NodeIndex; + IndexArray[ Node ] = FatherIndex; + + Node = Father; + } + } + } + while ( Node == Father ); + } + + for ( LastNode = ArraySize - 1; LastNode >= 0; LastNode-- ) + { + Node = 0; + + NodeIndex = IndexArray[ LastNode ]; + IndexArray[ LastNode ] = IndexArray[ 0 ]; + IndexArray[ 0 ] = NodeIndex; + + do + { + LeftChild = HEAP_LEFT_CHILD( Node ); + RightChild = HEAP_RIGHT_CHILD( Node ); + + if ( LeftChild < LastNode ) + { + LeftIndex = IndexArray[ LeftChild ]; + RightIndex = IndexArray[ RightChild ]; + + if ( ( RightChild < LastNode ) && + ( (*FuncCompare)( ValueArray, + RightIndex, + LeftIndex ) < 0 ) ) + { + Child = RightChild; + ChildIndex = RightIndex; + } + else + { + Child = LeftChild; + ChildIndex = LeftIndex; + } + + if ( (*FuncCompare)( ValueArray, NodeIndex, ChildIndex ) > 0 ) + { + IndexArray[ Child ] = NodeIndex; + IndexArray[ Node ] = ChildIndex; + + Node = Child; + } + else + { + LeftChild = LastNode; + } + } + } + while ( LeftChild < LastNode ); + } +} diff --git a/alliance/src/aut/src/autsort.h b/alliance/src/aut/src/autsort.h new file mode 100644 index 00000000..b364e9e9 --- /dev/null +++ b/alliance/src/aut/src/autsort.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : autsort.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_SORT_H +# define AUT_SORT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define HEAP_FATHER( Node ) ( ( ( ( Node ) + 1 ) >> 1 ) - 1 ) +# define HEAP_LEFT_CHILD( Node ) ( ( ( ( Node ) + 1 ) << 1 ) - 1 ) +# define HEAP_RIGHT_CHILD( Node ) ( ( ( Node ) + 1 ) << 1 ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/aut/src/auttest.c b/alliance/src/aut/src/auttest.c new file mode 100644 index 00000000..fa7d5aa4 --- /dev/null +++ b/alliance/src/aut/src/auttest.c @@ -0,0 +1,537 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : auttest.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include +# include "aut.h" + +# include "auttest.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char TestBuffer[ AUT_TEST_BUFFER_SIZE ]; + static authtable *TestHashTable = (authtable *)0; + static auth2table *TestHashTable2 = (auth2table *)0; + static char TestExit = 0; + static char TestMode2 = 0; + static long TestIndex = 0; + + static command TestCommandDefine[ AUT_TEST_MAX_COMMAND ] = + { + { "addelem" , TestCommandAddElement }, + { "addelem2" , TestCommandAddElement2 }, + { "delelem" , TestCommandDelElement }, + { "delelem2" , TestCommandDelElement2 }, + { "exit" , TestCommandExit }, + { "help" , TestCommandHelp }, + { "list" , TestCommandHelp }, + { "quit" , TestCommandExit }, + { "reset" , TestCommandReset }, + { "reset2" , TestCommandReset2 }, + { "viewelem" , TestCommandViewElement }, + { "viewelem2" , TestCommandViewElement2 }, + { "viewhash" , TestCommandViewHash }, + { "viewhash2" , TestCommandViewHash2 } + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Test Command Compare | +| | +\------------------------------------------------------------*/ + +static int TestCommandCompare( FirstKey, SecondKey ) + + command *FirstKey; + command *SecondKey; +{ + return( strcmp( FirstKey->NAME, SecondKey->NAME ) ); +} + +/*------------------------------------------------------------\ +| | +| Test Get Command Value | +| | +\------------------------------------------------------------*/ + +static command *TestGetCommand( String ) + + char *String; +{ + command Entry; + + Entry.NAME = String; + + return( (command *)bsearch( (char *)(&Entry), + (char *)TestCommandDefine, + AUT_TEST_MAX_COMMAND, + sizeof( command ), + TestCommandCompare ) ); +} + +/*------------------------------------------------------------\ +| | +| Command Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Test Command Exit | +| | +\------------------------------------------------------------*/ + +static void TestCommandExit( String ) + + char *String; +{ + fprintf( stdout, "--> exit\n" ); + TestExit = 1; +} + +/*------------------------------------------------------------\ +| | +| Test Command Help | +| | +\------------------------------------------------------------*/ + +static void TestCommandHelp( String ) + + char *String; +{ + int Counter; + + fprintf( stdout, "--> help" ); + + for ( Counter = 0; Counter < AUT_TEST_MAX_COMMAND; Counter++ ) + { + if ( ( Counter & 0x3 ) == 0 ) + { + fprintf( stdout, "\n" ); + } + + fprintf( stdout, " %-8s", TestCommandDefine[ Counter ].NAME ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Add Element | +| | +\------------------------------------------------------------*/ + +static void TestCommandAddElement( String ) + + char *String; +{ + authelem *AutElement; + char *Scan; + + if ( TestMode2 ) return; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = namealloc( String ); + fprintf( stdout, "--> addelem %s\n", String ); + + AutElement = addauthelem( TestHashTable, String, TestIndex++ ); + viewauthelem( AutElement ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Add Element 2 | +| | +\------------------------------------------------------------*/ + +static void TestCommandAddElement2( String ) + + char *String; +{ + auth2elem *AutElement; + char *Scan; + + if ( ! TestMode2 ) return; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = namealloc( String ); + Scan = namealloc( Scan + 1 ); + + fprintf( stdout, "--> addelem %s %s\n", String, Scan ); + + AutElement = addauth2elem( TestHashTable2, String, Scan, TestIndex++ ); + viewauth2elem( AutElement ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View Element | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewElement( String ) + + char *String; +{ + authelem *AutElement; + char *Scan; + + if ( TestMode2 ) return; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = namealloc( String ); + fprintf( stdout, "--> viewelem %s\n", String ); + + AutElement = searchauthelem( TestHashTable, String ); + + if ( AutElement != (authelem *)0 ) + { + viewauthelem( AutElement ); + } + else + { + fprintf( stderr, "Element %s doesn't exist\n", String ); + } + } + else + { + viewauthtable( TestHashTable, viewauthelem ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View Element 2 | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewElement2( String ) + + char *String; +{ + auth2elem *AutElement; + char *Scan; + + if ( ! TestMode2 ) return; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = namealloc( String ); + Scan = namealloc( Scan + 1 ); + fprintf( stdout, "--> viewelem2 %s %s\n", String, Scan ); + + AutElement = searchauth2elem( TestHashTable2, String, Scan ); + + if ( AutElement != (auth2elem *)0 ) + { + viewauth2elem( AutElement ); + } + else + { + fprintf( stderr, "Element %s %s doesn't exist\n", String, Scan ); + } + } + else + { + viewauth2table( TestHashTable2, viewauth2elem ); + } +} + + +/*------------------------------------------------------------\ +| | +| Test Command Del Element | +| | +\------------------------------------------------------------*/ + +static void TestCommandDelElement( String ) + + char *String; +{ + char *Scan; + + if ( TestMode2 ) return; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = namealloc( String ); + if ( delauthelem( TestHashTable, String ) ) + { + fprintf( stdout, "--> delelem %s\n", String ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Del Element 2 | +| | +\------------------------------------------------------------*/ + +static void TestCommandDelElement2( String ) + + char *String; +{ + char *Scan; + + if ( ! TestMode2 ) return; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = namealloc( String ); + Scan = namealloc( Scan + 1 ); + if ( delauth2elem( TestHashTable2, String, Scan ) ) + { + fprintf( stdout, "--> delelem2 %s %s\n", String, Scan ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Reset | +| | +\------------------------------------------------------------*/ + +static void TestCommandReset( String ) + + char *String; +{ + if ( TestMode2 ) return; + + fprintf( stdout, "--> reset\n" ); + resetauthtable( TestHashTable ); +} + +/*------------------------------------------------------------\ +| | +| Test Command Reset 2 | +| | +\------------------------------------------------------------*/ + +static void TestCommandReset2( String ) + + char *String; +{ + if ( ! TestMode2 ) return; + + fprintf( stdout, "--> reset2\n" ); + resetauth2table( TestHashTable2 ); +} + +/*------------------------------------------------------------\ +| | +| Test Command View Hash | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewHash( String ) + + char *String; +{ + if ( TestMode2 ) return; + + fprintf( stdout, "--> viewhash\n" ); + viewauthtable( TestHashTable, 0 ); +} + +/*------------------------------------------------------------\ +| | +| Test Command View Hash 2 | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewHash2( String ) + + char *String; +{ + if ( ! TestMode2 ) return; + + fprintf( stdout, "--> viewhash2\n" ); + viewauth2table( TestHashTable2, 0 ); +} + + +/*------------------------------------------------------------\ +| | +| Main Loop | +| | +\------------------------------------------------------------*/ + +static int TestMainLoop() +{ + command *Command; + char *Scan; + + TestExit = 0; + TestIndex = 0; + + do + { + fprintf( stdout, "\ncommand > " ); + + if ( ! fgets( TestBuffer, AUT_TEST_BUFFER_SIZE, stdin ) ) + { + fprintf( stderr, "Interrupt by user\n" ); + + return( 0 ); + } + + Scan = strchr( TestBuffer, '\n' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + Scan = strchr( TestBuffer, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; Scan = Scan + 1; + } + + Command = TestGetCommand( TestBuffer ); + + if ( Command != (command *)0 ) + { + (*Command->FUNCTION)( Scan ); + } + else + { + fprintf( stderr, "syntax error\n" ); + } + } + while ( TestExit == 0 ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Test Aut Hash Table | +| | +\------------------------------------------------------------*/ + +int testauthtable( HashTable ) + + authtable *HashTable; +{ + TestHashTable = HashTable; + TestMode2 = 0; + + return( TestMainLoop() ); +} + +/*------------------------------------------------------------\ +| | +| Test Aut Hash Table 2 | +| | +\------------------------------------------------------------*/ + +int testauth2table( HashTable ) + + auth2table *HashTable; +{ + TestHashTable2 = HashTable; + TestMode2 = 1; + + return( TestMainLoop() ); +} diff --git a/alliance/src/aut/src/auttest.h b/alliance/src/aut/src/auttest.h new file mode 100644 index 00000000..fa66832a --- /dev/null +++ b/alliance/src/aut/src/auttest.h @@ -0,0 +1,104 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Aut | +| | +| File : auttest.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef AUT_TEST_H +# define AUT_TEST_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define AUT_TEST_MAX_COMMAND 14 +# define AUT_TEST_BUFFER_SIZE 512 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct command + { + char *NAME; + void (*FUNCTION)(); + + } command; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + static void TestCommandExit(); + static void TestCommandHelp(); + + static void TestCommandAddElement(); + static void TestCommandViewElement(); + static void TestCommandDelElement(); + + static void TestCommandAddElement2(); + static void TestCommandViewElement2(); + static void TestCommandDelElement2(); + + static void TestCommandViewHash(); + static void TestCommandViewHash2(); + + static void TestCommandReset(); + static void TestCommandReset2(); + +# endif diff --git a/alliance/src/aut/src/main.c b/alliance/src/aut/src/main.c new file mode 100644 index 00000000..b004b6c7 --- /dev/null +++ b/alliance/src/aut/src/main.c @@ -0,0 +1,121 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +# include +# include +# include +# include + +# include +# include "aut.h" + +/*------------------------------------------------------------\ +| | +| Aut Sort Compare | +| | +\------------------------------------------------------------*/ + +long SortCompare( ValueArray, Index1, Index2 ) + + long *ValueArray; + long Index1; + long Index2; +{ + return( ValueArray[ Index2 ] - ValueArray[ Index1 ] ); +} + +int main( argc, argv ) + + int argc; + char **argv; +{ + FILE *File; + long Value; + char *Buffer; + char *ScanName; + long *ValueArray; + long *IndexArray; + long SizeArray; + long Index; + + if ( argc < 2 ) return( 0 ); + + autenv(); + + if ( !strcmp( argv[1], "-sort" ) ) + { + File = fopen( argv[2], "r" ); + + if ( File != (FILE *)0 ) + { + Buffer = autallocblock( 1024 ); + Value = 0; + Index = -1; + + while ( fgets( Buffer, 1024, File ) != (char *)0 ) + { + Value = atoi( Buffer ); + + if ( Index == -1 ) + { + SizeArray = Value; + ValueArray = (long *)autallocblock( sizeof( long ) * SizeArray ); + IndexArray = (long *)autallocblock( sizeof( long ) * SizeArray ); + Index = 0; + } + else + { + ValueArray[ Index++ ] = Value; + } + } + + fclose( File ); + + sortautarray( ValueArray, IndexArray, SizeArray, 0 ); + + for ( Index = 0; Index < SizeArray; Index++ ) + { + fprintf( stdout, "%ld\n", ValueArray[ IndexArray[ Index ] ] ); + } + } + } + else + if ( !strcmp( argv[1], "-namealloc" ) ) + { + Buffer = autallocblock( 1024 ); + + while ( fgets( Buffer, 1024, stdin ) != (char *)0 ) + { + ScanName = strchr( Buffer, '\n' ); + if ( ScanName != (char *)0 ) *ScanName = '\0'; + + ScanName = autnamealloc( Buffer ); + fprintf( stdout, "%s %lx\n", ScanName, (long)ScanName ); + } + } + + return( 0 ); +} diff --git a/alliance/src/aut/src/testhash.c b/alliance/src/aut/src/testhash.c new file mode 100644 index 00000000..b8c93213 --- /dev/null +++ b/alliance/src/aut/src/testhash.c @@ -0,0 +1,45 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +# include + + +# include +# include "aut.h" + +int main( argc, argv ) + + int argc; + char **argv; +{ + authtable *HashTable; + + HashTable = createauthtable( 10 ); + + testauthtable( HashTable ); + + destroyauthtable( HashTable ); +}