#! /bin/sh # -*- Mode: Shell-script -*- # snarf.test --- test the extraction of scm-type definitions # # Time-stamp: "2007-07-04 11:31:15 bkorb" # Author: Bruce Korb # Last Modified: $Date: 2007/07/04 20:51:14 $ # by: bkorb ## ## This file is part of AutoGen. ## AutoGen copyright (c) 1992-2007 by Bruce Korb - all rights reserved ## ## AutoGen 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 3 of the License, or ## (at your option) any later version. ## ## AutoGen is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ## See the GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License along ## with this program. If not, see . ## # Copyright: 1999-2007 by Bruce Korb # $Id: snarf.test,v 4.16 2007/07/04 20:51:14 bkorb Exp $ # ---------------------------------------------------------------------- . ./defs # # # # # # # # # # SOURCE FILE # # # # # # # # # echo creating ${testname}.c cat > ${testname}.c <<_EOF_ #include "${testname}.h" #include "${testname}.ini" /*=gfunc test_to_example_x * * exparg: in, test input arg desc, optional, list * =*/ SCM test_scm_test_to_example_x( SCM in ) { return in; } /*=symbol mumble_check * * init_val: SCM_BOOL_T =*/ /*=symbol bumble_it * * const_val: 100L * global: =*/ /*=syntax guile_syntax_ele * * type: scm_makacro * cfn: scm_m_undefine =*/ _EOF_ # # # # # # # # # # PROCESS SOURCE FILE # # # # # # # # # cat > ${testname}.cfg <<- _EOF_ subblock exparg=arg_name,arg_desc,arg_optional,arg_list template snarf srcfile assign group=test assign init=Chosen_init base-name ${testname} agarg -L$srcdir/.. _EOF_ echo "getdefs load=${testname}.cfg ${testname}.c" ${GDexe} load=${testname}.cfg autogen=${AGexe} ${testname}.c || \ failure getdefs load=${testname}.cfg autogen=${AGexe} ${testname}.c sed '/DO NOT EDIT THIS FILE/,/and the template file/d' \ ${testname}.ini > ${testname}.ini.tst sed '/DO NOT EDIT THIS FILE/,/and the template file/d' \ ${testname}.h > ${testname}.h.tst # # # # # # # # # # EXPECTED INI FILE # # # # # # # # # echo creating ${testname}.ini.OK cat > ${testname}.ini.OK <<'_EOF_' /* -*- buffer-read-only: t -*- vi: set ro: * * * copyright 1992-2007 Bruce Korb * * AutoGen 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 3 of the License, or * (at your option) any later version. * * AutoGen is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . * * Guile Initializations - Test Global Variables */ #include "snarf.h" extern SCM test_scm_sym_bumble_it = SCM_BOOL_F; static SCM test_scm_sym_mumble_check = SCM_BOOL_F; #ifndef __P # if defined (__GNUC__) || (defined (__STDC__) && __STDC__) # define __P(args) args # else # define __P(args) () # endif /* GCC. */ #endif /* Not __P. */ typedef SCM (*gh_callback_t)__P((void)); void Chosen_init( void ); #define NEW_PROC( _As, _Ar, _Ao, _Ax, _An ) \ gh_new_procedure( (char*)(_As), (gh_callback_t)(void*)ag_scm_ ## _An, \ _Ar, _Ao, _Ax ) /* * test Initialization procedure. */ void Chosen_init( void ) { static char const g_nm[55] = "test->example!\0" "guile-syntax-ele\0" "bumble-it\0" "mumble-check\0"; NEW_PROC(g_nm + 0, 0, 0, 1, test_to_example_x); scm_make_synt(g_nm+15, scm_makacro, scm_m_undefine); test_scm_sym_bumble_it = scm_permanent_object(SCM_CAR (scm_intern0 (g_nm+32))); test_scm_sym_mumble_check = scm_permanent_object(SCM_CAR (scm_intern0 (g_nm+42))); } #undef NEW_PROC _EOF_ cmp ${testname}.ini.* || \ failure "`diff ${testname}.ini.*`" # # # # # # # # # # EXPECTED HEADER FILE # # # # # # # echo creating ${testname}.h.OK cat > ${testname}.h.OK <<_EOF_ /* -*- buffer-read-only: t -*- vi: set ro: * * * copyright 1992-2007 Bruce Korb * * AutoGen 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 3 of the License, or * (at your option) any later version. * * AutoGen is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . * * Guile Implementation Routines - for the test group */ #ifndef GUILE_PROCS_SNARF_H_GUARD #define GUILE_PROCS_SNARF_H_GUARD 1 #include typedef enum { GH_TYPE_UNDEFINED = 0, GH_TYPE_BOOLEAN, GH_TYPE_SYMBOL, GH_TYPE_CHAR, GH_TYPE_VECTOR, GH_TYPE_PAIR, GH_TYPE_NUMBER, GH_TYPE_STRING, GH_TYPE_PROCEDURE, GH_TYPE_LIST, GH_TYPE_INEXACT, GH_TYPE_EXACT } teGuileType; extern SCM test_scm_test_to_example_x( SCM ); extern SCM test_scm_sym_bumble_it; #endif /* GUILE_PROCS_SNARF_H_GUARD */ _EOF_ cmp ${testname}.h.* || \ failure "`diff ${testname}.h.*`" cleanup ## Local Variables: ## Mode: shell-script ## indent-tabs-mode: nil ## sh-indentation: 2 ## End: # end of snarf.test