| 1 | /*************************************************************************** | 
|---|
| 2 | * blitz/prettyprint.h      Format object for pretty-printing of | 
|---|
| 3 | *                          array expressions | 
|---|
| 4 | * | 
|---|
| 5 | * $Id: prettyprint.h,v 1.1.1.1 1999-04-09 17:59:02 ansari Exp $ | 
|---|
| 6 | * | 
|---|
| 7 | * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca> | 
|---|
| 8 | * | 
|---|
| 9 | * This program is free software; you can redistribute it and/or | 
|---|
| 10 | * modify it under the terms of the GNU General Public License | 
|---|
| 11 | * as published by the Free Software Foundation; either version 2 | 
|---|
| 12 | * of the License, or (at your option) any later version. | 
|---|
| 13 | * | 
|---|
| 14 | * This program is distributed in the hope that it will be useful, | 
|---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 17 | * GNU General Public License for more details. | 
|---|
| 18 | * | 
|---|
| 19 | * Suggestions:          blitz-suggest@cybervision.com | 
|---|
| 20 | * Bugs:                 blitz-bugs@cybervision.com | 
|---|
| 21 | * | 
|---|
| 22 | * For more information, please see the Blitz++ Home Page: | 
|---|
| 23 | *    http://seurat.uwaterloo.ca/blitz/ | 
|---|
| 24 | * | 
|---|
| 25 | *************************************************************************** | 
|---|
| 26 | * $Log: not supported by cvs2svn $ | 
|---|
| 27 | * Revision 1.2  1998/03/14 00:04:47  tveldhui | 
|---|
| 28 | * 0.2-alpha-05 | 
|---|
| 29 | * | 
|---|
| 30 | */ | 
|---|
| 31 |  | 
|---|
| 32 | #ifndef BZ_PRETTYPRINT_H | 
|---|
| 33 | #define BZ_PRETTYPRINT_H | 
|---|
| 34 |  | 
|---|
| 35 | BZ_NAMESPACE(blitz) | 
|---|
| 36 |  | 
|---|
| 37 | class prettyPrintFormat { | 
|---|
| 38 |  | 
|---|
| 39 | public: | 
|---|
| 40 | prettyPrintFormat(_bz_bool terse = _bz_false) | 
|---|
| 41 | : tersePrintingSelected_(terse) | 
|---|
| 42 | { | 
|---|
| 43 | arrayOperandCounter_ = 0; | 
|---|
| 44 | scalarOperandCounter_ = 0; | 
|---|
| 45 | dumpArrayShapes_ = _bz_false; | 
|---|
| 46 | } | 
|---|
| 47 |  | 
|---|
| 48 | void setDumpArrayShapesMode() | 
|---|
| 49 | { | 
|---|
| 50 | dumpArrayShapes_ = _bz_true; | 
|---|
| 51 | } | 
|---|
| 52 |  | 
|---|
| 53 | char nextArrayOperandSymbol() | 
|---|
| 54 | { | 
|---|
| 55 | return 'A' + ((arrayOperandCounter_++) % 26); | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|
| 58 | char nextScalarOperandSymbol() | 
|---|
| 59 | { | 
|---|
| 60 | return 's' + ((scalarOperandCounter_++) % 26); | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 | _bz_bool tersePrintingSelected() const | 
|---|
| 64 | { | 
|---|
| 65 | return tersePrintingSelected_; | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | _bz_bool dumpArrayShapesMode() const | 
|---|
| 69 | { | 
|---|
| 70 | return dumpArrayShapes_; | 
|---|
| 71 | } | 
|---|
| 72 |  | 
|---|
| 73 | private: | 
|---|
| 74 | _bz_bool tersePrintingSelected_; | 
|---|
| 75 | _bz_bool dumpArrayShapes_; | 
|---|
| 76 | int arrayOperandCounter_; | 
|---|
| 77 | int scalarOperandCounter_; | 
|---|
| 78 | }; | 
|---|
| 79 |  | 
|---|
| 80 | BZ_NAMESPACE_END | 
|---|
| 81 |  | 
|---|
| 82 | #endif // BZ_PRETTYPRINT_H | 
|---|