xref: /onnv-gate/usr/src/cmd/man/src/util/nsgmls.src/lib/InputSource.cxx (revision 0:68f95e015346)
1 // Copyright (c) 1994 James Clark
2 // See the file COPYING for copying permission.
3 #pragma ident	"%Z%%M%	%I%	%E% SMI"
4 
5 #ifdef __GNUG__
6 #pragma implementation
7 #endif
8 #include "splib.h"
9 #include "InputSource.h"
10 #include "MarkupScan.h"
11 
12 #ifdef SP_NAMESPACE
13 namespace SP_NAMESPACE {
14 #endif
15 
InputSource(InputSourceOrigin * origin,const Char * start,const Char * end)16 InputSource::InputSource(InputSourceOrigin *origin, const Char *start,
17 			 const Char *end)
18 : origin_(origin), start_(start), end_(end), cur_(start), accessError_(0),
19   startLocation_(origin, 0), multicode_(0), scanSuppress_(0)
20 {
21 }
22 
reset(const Char * start,const Char * end)23 void InputSource::reset(const Char *start,
24 			const Char *end)
25 {
26   origin_ = origin_->copy();
27   start_ = start;
28   end_ = end;
29   cur_ = start_;
30   startLocation_ = Location(origin_.pointer(), 0);
31   multicode_ = 0;
32   scanSuppress_ = 0;
33   markupScanTable_.clear();
34 }
35 
~InputSource()36 InputSource::~InputSource()
37 {
38 }
39 
advanceStartMulticode(const Char * to)40 void InputSource::advanceStartMulticode(const Char *to)
41 {
42   while (start_ < to) {
43     switch (markupScanTable_[*start_]) {
44     case MarkupScan::normal:
45       break;
46     case MarkupScan::in:
47       scanSuppress_ = 0;
48       break;
49     case MarkupScan::out:
50       if (!scanSuppress()) {
51 	scanSuppress_ = 1;
52 	scanSuppressSingle_ = 0;
53       }
54       break;
55     case MarkupScan::suppress:
56       // what's the effect of MSSCHAR followed by MSSCHAR
57       if (!scanSuppress()) {
58 	scanSuppress_ = 1;
59 	scanSuppressSingle_ = 1;
60 	scanSuppressIndex_ = startLocation_.index() + 1;
61       }
62       break;
63     }
64     start_++;
65     startLocation_ += 1;
66   }
67 }
68 
willNotRewind()69 void InputSource::willNotRewind()
70 {
71 }
72 
setDocCharset(const CharsetInfo &,const CharsetInfo &)73 void InputSource::setDocCharset(const CharsetInfo &,
74 				const CharsetInfo &)
75 {
76 }
77 
willNotSetDocCharset()78 void InputSource::willNotSetDocCharset()
79 {
80 }
81 
82 #ifdef SP_NAMESPACE
83 }
84 #endif
85