From 78eb5dcdb59b374af6146bc9b4ad8230c2d933e8 Mon Sep 17 00:00:00 2001 From: Ludovic Jacomme Date: Tue, 26 Mar 2002 12:50:48 +0000 Subject: [PATCH] Hi --- alliance/src/k2f/Makefile.am | 1 + alliance/src/k2f/man1/Makefile.am | 2 + alliance/src/k2f/man1/k2f.1 | 28 ++++++ alliance/src/k2f/src/Makefile.am | 11 ++ alliance/src/k2f/src/k2f_error.c | 128 ++++++++++++++++++++++++ alliance/src/k2f/src/k2f_error.h | 92 +++++++++++++++++ alliance/src/k2f/src/k2f_main.c | 161 ++++++++++++++++++++++++++++++ alliance/src/k2f/src/k2f_main.h | 70 +++++++++++++ 8 files changed, 493 insertions(+) create mode 100644 alliance/src/k2f/Makefile.am create mode 100644 alliance/src/k2f/man1/Makefile.am create mode 100644 alliance/src/k2f/man1/k2f.1 create mode 100644 alliance/src/k2f/src/Makefile.am create mode 100644 alliance/src/k2f/src/k2f_error.c create mode 100644 alliance/src/k2f/src/k2f_error.h create mode 100644 alliance/src/k2f/src/k2f_main.c create mode 100644 alliance/src/k2f/src/k2f_main.h diff --git a/alliance/src/k2f/Makefile.am b/alliance/src/k2f/Makefile.am new file mode 100644 index 00000000..5fcaa0d3 --- /dev/null +++ b/alliance/src/k2f/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src man1 diff --git a/alliance/src/k2f/man1/Makefile.am b/alliance/src/k2f/man1/Makefile.am new file mode 100644 index 00000000..9ea93da8 --- /dev/null +++ b/alliance/src/k2f/man1/Makefile.am @@ -0,0 +1,2 @@ +man_MANS = k2f.1 +EXTRA_DIST = $(man_MANS) diff --git a/alliance/src/k2f/man1/k2f.1 b/alliance/src/k2f/man1/k2f.1 new file mode 100644 index 00000000..d33aca60 --- /dev/null +++ b/alliance/src/k2f/man1/k2f.1 @@ -0,0 +1,28 @@ +.TH PAT2DWL 1 "October 1, 1997" "ASIM/LIP6" "CAO\-VLSI Reference Manual" +.SH NAME +.PP +\fIk2f\fP, FSM translator ALLIANCE format from/to Berkeley format + +.so man1/alc_origin.1 +.SH SYNOPSIS +.PP +\fBk2f\fP +.I In_format +.I Out_format +.I Input_name +[ +.I Output_name +] + +.SH DESCRIPTION +.PP +\fBk2f\fP is a FSM translator from ALLIANCE format (\fI".fsm"\fP) +to Berkeley format (\fI".kiss2"\fP). + +.SH SEE ALSO +.PP +fsm(5) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/k2f/src/Makefile.am b/alliance/src/k2f/src/Makefile.am new file mode 100644 index 00000000..8c204abf --- /dev/null +++ b/alliance/src/k2f/src/Makefile.am @@ -0,0 +1,11 @@ +## Process this file with automake to produce Makefile.in + +bin_PROGRAMS = k2f + +k2f_LDADD = @LIBS@ \ + -lFtl -lFks -lFvh -lFsm \ + -lBdd -lAbl -lAut -lMut + + +k2f_SOURCES = \ +k2f_error.c k2f_error.h k2f_main.c k2f_main.h diff --git a/alliance/src/k2f/src/k2f_error.c b/alliance/src/k2f/src/k2f_error.c new file mode 100644 index 00000000..397c3761 --- /dev/null +++ b/alliance/src/k2f/src/k2f_error.c @@ -0,0 +1,128 @@ +/*------------------------------------------------------------\ +| | +| 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 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 : K2F | +| | +| File : k2f_error.c | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include MUT_H +# include AUT_H +# include "k2f_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Private variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| K2fDisplayError | +| | +\------------------------------------------------------------*/ + +void K2fDisplayError( File, Line, Error, Text ) + + char *File; + int Line; + int Error; + char *Text; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%d ", Name, Line ); + + switch( Error ) + { + default : fprintf( stderr, "Internal error number %d\n", Error ); + } + + autexit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| K2fDisplayWarning | +| | +\------------------------------------------------------------*/ + +void K2fDisplayWarning( File, Line, Warning, Text ) + + char *File; + int Line; + int Warning; + char *Text; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%d ", Name, Line ); + + switch ( Warning ) + { + default : fprintf( stderr, "Internal warning number %d\n", Warning ); + } +} diff --git a/alliance/src/k2f/src/k2f_error.h b/alliance/src/k2f/src/k2f_error.h new file mode 100644 index 00000000..da947b85 --- /dev/null +++ b/alliance/src/k2f/src/k2f_error.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 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 : K2F | +| | +| File : k2f_error.h | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef K2F_ERROR_H +# define K2F_ERROR_H + +/*------------------------------------------------------------\ +| | +| Errors | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Warnings | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define K2fError( ERROR, TEXT ) \ + \ + K2fDisplayError( __FILE__, __LINE__, (ERROR), (TEXT) ) + +# define K2fWarning( WARNING, TEXT ) \ + \ + K2fDisplayWarning( __FILE__, __LINE__, (WARNING), (TEXT) ) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void K2fDisplayError(); + extern void K2fDisplayWarning(); + +# endif diff --git a/alliance/src/k2f/src/k2f_main.c b/alliance/src/k2f/src/k2f_main.c new file mode 100644 index 00000000..f0e1d29d --- /dev/null +++ b/alliance/src/k2f/src/k2f_main.c @@ -0,0 +1,161 @@ +/*------------------------------------------------------------\ +| | +| 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 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 : K2F | +| | +| File : k2f_main.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H +# include FSM_H +# include FTL_H + +# include +# include +# include +# include "k2f_error.h" +# include "k2f_main.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + fsmfig_list *K2fFsmFigure = (fsmfig_list *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| K2f Usage | +| | +\------------------------------------------------------------*/ + +void K2fUsage() +{ + fprintf( stderr, "\t\tk2f In_format Out_format Input_name [Output_name]\n\n" ); + fprintf( stdout, "\n" ); + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Main | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + char *InputFileName; + char *OutputFileName; + char *InputFormat; + char *OutputFormat; + int Number; + + alliancebanner_with_authors( "K2F", K2F_VERSION, + "Translator Kiss <-> FSM Format", "1996", ALLIANCE_VERSION, + "Ludovic Jacomme" ); + + mbkenv(); + autenv(); + ablenv(); + bddenv(); + fsmenv(); + + if ( argc < 4 ) K2fUsage(); + + InputFileName = (char *)0; + OutputFileName = (char *)0; + InputFormat = (char *)0; + OutputFormat = (char *)0; + + for ( Number = 1; Number < argc; Number++ ) + { + if ( InputFormat == (char *)0 ) InputFormat = argv[ Number ]; + else + if ( OutputFormat == (char *)0 ) OutputFormat = argv[ Number ]; + else + if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ]; + else + if ( OutputFileName == (char *)0 ) OutputFileName = argv[ Number ]; + else + K2fUsage(); + } + + if ( ( InputFileName == (char *)0 ) || + ( InputFormat == (char *)0 ) || + ( OutputFormat == (char *)0 ) ) K2fUsage(); + + if ( OutputFileName == (char *)0 ) OutputFileName = InputFileName; + + FSM_IN = namealloc( InputFormat ); + FSM_OUT = namealloc( OutputFormat ); + + fprintf( stdout, "\n\n\t--> Translate figure %s\n", InputFileName ); + + K2fFsmFigure = getfsmfig( InputFileName ); + + K2fFsmFigure->NAME = namealloc( OutputFileName ); + savefsmfig( K2fFsmFigure ); + + fprintf( stdout, "\t<-- done\n\n" ); + + return( 0 ); +} diff --git a/alliance/src/k2f/src/k2f_main.h b/alliance/src/k2f/src/k2f_main.h new file mode 100644 index 00000000..97f66176 --- /dev/null +++ b/alliance/src/k2f/src/k2f_main.h @@ -0,0 +1,70 @@ +/*------------------------------------------------------------\ +| | +| 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 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 : K2F | +| | +| File : k2f_main.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef K2F_MAIN_H +# define K2F_MAIN_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif