BRL-CAD
importFg4Section.c
Go to the documentation of this file.
1 /* I M P O R T F G 4 S E C T I O N . C
2  * BRL-CAD
3  *
4  * Copyright (c) 1994-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @addtogroup librt */
21 /** @{ */
22 /** @file libged/importFg4Section.c
23  *
24  * This file calls the functions in wdb_importFg4Section.c with the
25  * correct wdb, which is derived from the passed in gedp. It imports a
26  * Fastgen4 section from a string. This section can only contain
27  * GRIDs, CTRIs and CQUADs.
28  *
29  */
30 #include "common.h"
31 
32 #include "./ged_private.h"
33 
34 
35 extern int wdb_importFg4Section_cmd(void *data, int argc, const char *argv[]);
36 
37 int
38 ged_importFg4Section(struct ged *gedp, int argc, const char *argv[])
39 {
40  static const char *usage = "obj section";
41 
44  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
45 
46  /* initialize result */
47  bu_vls_trunc(gedp->ged_result_str, 0);
48 
49  /* must be wanting help */
50  if (argc == 1) {
51  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
52  return GED_HELP;
53  }
54 
55  if (argc != 3) {
56  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
57  return GED_ERROR;
58  }
59 
60  return wdb_importFg4Section_cmd(gedp->ged_wdbp, argc, argv);
61 }
62 /** @} */
63 
64 /*
65  * Local Variables:
66  * mode: C
67  * tab-width: 8
68  * indent-tabs-mode: t
69  * c-file-style: "stroustrup"
70  * End:
71  * ex: shiftwidth=4 tabstop=8
72  */
void usage(struct ged *gedp)
Definition: coil.c:315
Definition: ged.h:338
void bu_vls_trunc(struct bu_vls *vp, int len)
Definition: vls.c:198
#define GED_CHECK_ARGC_GT_0(_gedp, _argc, _flags)
Definition: ged.h:202
struct rt_wdb * ged_wdbp
Definition: ged.h:340
Header file for the BRL-CAD common definitions.
int ged_importFg4Section(struct ged *gedp, int argc, const char *argv[])
#define GED_ERROR
Definition: ged.h:61
COMPLEX data[64]
Definition: fftest.c:34
#define GED_CHECK_DATABASE_OPEN(_gedp, _flags)
Definition: ged.h:114
struct bu_vls * ged_result_str
Definition: ged.h:357
int wdb_importFg4Section_cmd(void *data, int argc, const char *argv[])
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
#define GED_HELP
Definition: ged.h:62
#define GED_CHECK_READ_ONLY(_gedp, _flags)
Definition: ged.h:181