#!/bin/sh
#
# aegis - project change supervisor.
# Copyright (C) 2008, 2012 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see .
#
TEST_SUBJECT="fmtgen, top level"
# load up standard prelude and test functions
. test_funcs
cat > fubar.def << 'fubar'
x = integer;
fubar
if test $? -ne 0 ; then no_result; fi
cat > ok << 'TheEnd'
//
// This file is generated by fmtgen.
//
#ifndef FUBAR_H
#define FUBAR_H
#ifndef fubar_DEF
#define fubar_DEF
#define fubar_x_mask ((unsigned long)1 << 0)
#include
struct fubar_ty
{
long reference_count;
unsigned long mask;
string_ty *errpos;
long x;
};
#endif // fubar_DEF
#include
extern meta_type fubar_type;
#include
void fubar_write(const output::pointer &fp, fubar_ty *value);
void fubar_write_xml(const output::pointer &fp, fubar_ty *value);
fubar_ty *fubar_copy(fubar_ty *);
fubar_ty *fubar_clone(fubar_ty *);
#include
#ifndef fubar_trace
#ifdef DEBUG
void fubar_trace_real(const char *name, const fubar_ty *value);
#define fubar_trace(x) ((void)(trace_pretest_ && (trace_where_, fubar_trace_real(trace_stringize(x), x), 0)))
#else
#define fubar_trace(x)
#endif
#endif
/**
* The fubar_write_file function is used to
* write fubar meta data to the named file.
*
* @param filename
* The name of the file to be written.
* @param value
* The value of the meta-data to be written.
* @param comp
* true (non-zero) if data should be compressed.
* @note
* If any errors are encountered, this
* function will not return. All errors
* will print a fatal error message, and
* exit with an exit status of 1.
*/
void fubar_write_file(string_ty *filename, fubar_ty *value, int comp);
#include
/**
* The fubar_write_file function is used to
* write fubar meta data to the named file.
*
* @param filnam
* The name of the file to be written.
* @param value
* The value of the meta-data to be written.
* @param comp
* true if data should be compressed.
* @note
* If any errors are encountered, this
* function will not return. All errors
* will print a fatal error message, and
* exit with an exit status of 1.
*/
void fubar_write_file(const nstring &filnam, fubar_ty *value, bool comp);
/**
* The fubar_read_file function is used to
* read fubar meta data from the named file.
*
* @param filename
* The name of the file to be read.
* @returns
* a pointer to a dynamically allocated
* value read from the file.
* @note
* If any errors are encountered, this
* function will not return. All errors
* (including syntax errors) will print a
* fatal error message, and exit with an
* exit status of 1.
*/
fubar_ty *fubar_read_file(string_ty *filename);
/**
* The fubar_read_file function is used to
* read fubar meta data from the named file.
*
* @param filename
* The name of the file to be read.
* @returns
* a pointer to a dynamically allocated
* value read from the file.
* @note
* If any errors are encountered, this
* function will not return. All errors
* (including syntax errors) will print a
* fatal error message, and exit with an
* exit status of 1.
*/
fubar_ty *fubar_read_file(const nstring &filename);
void fubar__rpt_init(void);
#endif // FUBAR_H
TheEnd
if test $? -ne 0 ; then no_result; fi
#
# test the functionality
#
activity="fmtgen-oi 149"
fmtgen -tw=2 fubar.def -oi fubar.h
if test $? -ne 0 ; then fail; fi
diff ok fubar.h
if test $? -ne 0 ; then fail; fi
#
# Only definite negatives are possible.
# The functionality exercised by this test appears to work,
# no other guarantees are made.
#
pass
// vim: set ts=8 sw=4 et :