BRL-CAD
report.c
Go to the documentation of this file.
1 /* R E P O R T . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-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 /** @file libged/report.c
21  *
22  * The report command.
23  *
24  */
25 
26 #include "common.h"
27 #include <stdlib.h>
28 
29 #include "ged.h"
30 #include "./ged_private.h"
31 
32 /*
33  * Returns the solid table & vector list as a string
34  *
35  * Usage:
36  * report [lvl]
37  *
38  */
39 int
40 ged_report(struct ged *gedp, int argc, const char *argv[])
41 {
42  int lvl = 0;
43  static const char *usage = "lvl";
44 
47  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
48 
49  /* initialize result */
50  bu_vls_trunc(gedp->ged_result_str, 0);
51 
52  /* must be wanting help */
53  if (argc == 1) {
54  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
55  return GED_HELP;
56  }
57 
58  if (argc != 2) {
59  bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
60  return GED_ERROR;
61  }
62 
63  lvl = atoi(argv[1]);
64 
65  if (lvl <= 3)
66  dl_print_schain(gedp->ged_gdp->gd_headDisplay, gedp->ged_wdbp->dbip, lvl, 0, gedp->ged_result_str);
67  else
69 
70  return GED_OK;
71 }
72 
73 
74 /*
75  * Local Variables:
76  * tab-width: 8
77  * mode: C
78  * indent-tabs-mode: t
79  * c-file-style: "stroustrup"
80  * End:
81  * ex: shiftwidth=4 tabstop=8
82  */
void usage(struct ged *gedp)
Definition: coil.c:315
#define GED_OK
Definition: ged.h:55
int ged_report(struct ged *gedp, int argc, const char *argv[])
Definition: report.c:40
Definition: ged.h:338
struct db_i * dbip
Definition: raytrace.h:1266
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.
struct bu_list * gd_headDisplay
head of display list
Definition: ged.h:307
#define GED_ERROR
Definition: ged.h:61
#define GED_CHECK_DATABASE_OPEN(_gedp, _flags)
Definition: ged.h:114
#define GED_CHECK_DRAWABLE(_gedp, _flags)
Definition: ged.h:129
struct bu_vls * ged_result_str
Definition: ged.h:357
struct ged_drawable * ged_gdp
Definition: ged.h:360
void dl_print_schain(struct bu_list *hdlp, struct db_i *dbip, int lvl, int vlcmds, struct bu_vls *vls)
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