MCPcopy Create free account
hub / github.com/catboost/catboost / main

Function main

tools/rescompressor/main.cpp:91–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91int main(int argc, char** argv) {
92 int ind = 0;
93 if (argc < 4) {
94 Cerr << "usage: " << argv[ind] << "asm_output --prefix? [-? origin_resource ro_resource]+" << Endl;
95 return 1;
96 }
97
98 TVector<TStringBuf> replacements;
99
100 ind++;
101
102 if (TStringBuf(argv[ind]) == "--compress-only") {
103 ind++;
104 while (ind + 1 < argc) {
105 TUnbufferedFileInput inp(argv[ind]);
106 TString data = inp.ReadAll();
107 TString compressed = Compress(TStringBuf(data.data(), data.size()));
108 TFixedBufferFileOutput out(argv[ind+1]);
109 out << compressed;
110 ind += 2;
111 }
112 return 0;
113 }
114
115 TFixedBufferFileOutput asmout(argv[ind]);
116 ind++;
117 TString prefix;
118 if (TStringBuf(argv[ind]) == "--prefix") {
119 prefix = "_";
120 ind++;
121 }
122 else {
123 prefix = "";
124 }
125
126 while (TStringBuf(argv[ind]).StartsWith("--replace=")) {
127 replacements.push_back(TStringBuf(argv[ind]).SubStr(TStringBuf("--replace=").size()));
128 ind++;
129 }
130
131 TAsmWriter aw(asmout, prefix);
132 bool raw;
133 bool error = false;
134 while (ind < argc) {
135 TString compressed;
136 if ("-"sv == argv[ind]) {
137 ind++;
138 if (ind >= argc) {
139 error = true;
140 break;
141 }
142 compressed = CompressPath(replacements, TStringBuf(argv[ind]));
143 raw = true;
144 }
145 else {
146 TUnbufferedFileInput inp(argv[ind]);
147 TString data = inp.ReadAll();
148 compressed = Compress(TStringBuf(data.data(), data.size()));

Callers

nothing calls this directly

Calls 9

CompressPathFunction · 0.85
ReadAllMethod · 0.80
CompressFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45
StartsWithMethod · 0.45
push_backMethod · 0.45
SubStrMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected