1 /***********************************************************************/
2 /* Open Visualization Data Explorer                                    */
3 /* (C) Copyright IBM Corp. 1989,1999                                   */
4 /* ALL RIGHTS RESERVED                                                 */
5 /* This code licensed under the                                        */
6 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
7 /***********************************************************************/
8 /*
9  * $Header: /src/master/dx/src/exec/dxmods/print.c,v 1.3 1999/05/10 15:45:29 gda Exp $
10  */
11 
12 #include <dxconfig.h>
13 
14 
15 #include <ctype.h>
16 #include <dx/dx.h>
17 
18 
19 
20 char defopts[] = "o";
21 
22 
23 /* 0 = input
24  * 1 = flags: r=recurse, o=object only, d=data, x=expanded, #=number of levels
25  * 2 = component namelist - restrict field printing to just these ones
26  */
27 int
m_Print(Object * in,Object * out)28 m_Print(Object *in, Object *out)
29 {
30     int i = 0, nstrings = 0;
31     char *cp, **comps = NULL;
32     char *opt = defopts;
33 
34 
35     if(!in[0]) {
36 	DXMessage("Null Object.");
37 	return OK;
38     }
39 
40     if(in[1] && !DXExtractString(in[1], &opt))
41 	DXErrorReturn(ERROR_BAD_PARAMETER, "bad options string");
42 
43     if(in[2]) {
44 	nstrings = 0;
45 	while(DXExtractNthString(in[2], nstrings, &cp))
46 	    nstrings++;
47 
48 	if(nstrings == 0)
49 	    DXErrorReturn(ERROR_BAD_PARAMETER, "bad component name(s)");
50 
51 	if((comps = (char **)DXAllocate(sizeof(char *) * (nstrings+1))) == NULL)
52 	    return ERROR;
53 
54 	for(i=0; i<nstrings; i++)
55 	    DXExtractNthString(in[2], i, &comps[i]);
56 
57 	comps[i] = NULL;
58     }
59 
60 
61     DXPrintV(in[0], opt, comps);
62     DXFree((Pointer)comps);
63 
64     return (DXGetError()==ERROR_NONE ? OK : ERROR);
65 }
66 
67