]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/c++-lib/c++/print.cpp
Security-28.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c++-lib / c++ / print.cpp
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 // file: .../c++-lib/src/print.C
20 //
21 // MS 92
22 // Copyright (C) 1992 Michael Sample and the University of British Columbia
23 //
24 // This library is free software; you can redistribute it and/or
25 // modify it provided that this copyright/license information is retained
26 // in original form.
27 //
28 // If you modify this file, you must clearly indicate your changes.
29 //
30 // This source code is distributed in the hope that it will be
31 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
32 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
33 //
34 // $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/c++-lib/c++/print.cpp,v 1.4 2001/06/28 22:49:58 mb Exp $
35 // $Log: print.cpp,v $
36 // Revision 1.4 2001/06/28 22:49:58 mb
37 // Saved 4 bytes of data when compiling with -DNDEBUG
38 //
39 // Revision 1.3 2001/06/27 23:57:50 dmitch
40 // Reimplement partial fix for Radar 2664258: Print() routines are now empty stubs in NDEBUG config.
41 //
42 // Revision 1.2 2001/06/27 23:09:15 dmitch
43 // Pusuant to Radar 2664258, avoid all cerr-based output in NDEBUG configuration.
44 //
45 // Revision 1.1.1.1 2001/05/18 23:14:06 mb
46 // Move from private repository to open source repository
47 //
48 // Revision 1.2 2001/05/05 00:59:17 rmurphy
49 // Adding darwin license headers
50 //
51 // Revision 1.1 2000/06/15 18:44:58 dmitch
52 // These snacc-generated source files are now checked in to allow cross-platform build.
53 //
54 // Revision 1.2 2000/06/08 20:05:36 dmitch
55 // Mods for X port. These files are actually machine generated and probably don't need to be in CVS....
56 //
57 // Revision 1.1.1.1 2000/03/09 01:00:06 rmurphy
58 // Base Fortissimo Tree
59 //
60 // Revision 1.1 1999/02/25 05:21:56 mb
61 // Added snacc c++ library
62 //
63 // Revision 1.5 1997/02/16 20:26:09 rj
64 // check-in of a few cosmetic changes
65 //
66 // Revision 1.4 1995/07/24 20:34:55 rj
67 // changed `_' to `-' in file names.
68 //
69 // Revision 1.3 1994/10/08 04:18:33 rj
70 // code for meta structures added (provides information about the generated code itself).
71 //
72 // code for Tcl interface added (makes use of the above mentioned meta code).
73 //
74 // virtual inline functions (the destructor, the Clone() function, BEnc(), BDec() and Print()) moved from inc/*.h to src/*.C because g++ turns every one of them into a static non-inline function in every file where the .h file gets included.
75 //
76 // made Print() const (and some other, mainly comparison functions).
77 //
78 // several `unsigned long int' turned into `size_t'.
79 //
80 // Revision 1.2 1994/08/28 10:01:22 rj
81 // comment leader fixed.
82 //
83 // Revision 1.1 1994/08/28 09:21:12 rj
84 // first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
85
86 #include "asn-incl.h"
87
88 #ifndef NDEBUG
89 // the generated operator << routines for aggregate types use these globals
90 unsigned short int indentG = 0;
91 unsigned short int stdIndentG = 4;
92 #endif
93
94 void
95 Indent (ostream &os, unsigned short int i)
96 {
97 #ifndef NDEBUG
98 while (i-->0)
99 os << ' ';
100 #endif
101 }
102
103 ostream &operator << (ostream &os, const AsnType &v)
104 {
105 #ifndef NDEBUG
106 v.Print (os);
107 #endif
108 return os;
109 }