Commit c3e9b64e7fde8499f8543503bdfeeeb65512dcd7

Authored by Jay Berkenbilt
1 parent 6e70d99b

QPDFJob increment: generate handler declarations

generate_auto_job
... ... @@ -93,8 +93,12 @@ class Main:
93 93 with open('job.yml', 'r') as f:
94 94 data = yaml.safe_load(f.read())
95 95 self.validate(data)
96   - self.generate_decl(data)
97   - self.generate_init(data)
  96 + with open(self.DESTS['decl'], 'w') as f:
  97 + print(BANNER, file=f)
  98 + self.generate_decl(data, f)
  99 + with open(self.DESTS['init'], 'w') as f:
  100 + print(BANNER, file=f)
  101 + self.generate_init(data, f)
98 102  
99 103 # Update hashes last to ensure that this will be rerun in the
100 104 # event of a failure.
... ... @@ -113,7 +117,7 @@ class Main:
113 117 self.check_keys('top', data, set(['choices', 'options']))
114 118 for o in data['options']:
115 119 self.check_keys('top', o, set(
116   - ['table', 'bare', 'positional',
  120 + ['table', 'prefix', 'bare', 'positional',
117 121 'optional_parameter', 'required_parameter',
118 122 'required_choices', 'from_table']))
119 123  
... ... @@ -123,28 +127,46 @@ class Main:
123 127 identifier = identifier.upper()
124 128 else:
125 129 identifier = identifier.lower()
126   - identifier = re.sub('_([a-z])', lambda x: x.group(1).upper(),
127   - identifier)
  130 + identifier = re.sub(r'(?:^|_)([a-z])',
  131 + lambda x: x.group(1).upper(),
  132 + identifier).replace('_', '')
128 133 return prefix + identifier
129 134  
130   - def generate_decl(self, data):
131   - with open(self.DESTS['decl'], 'w') as f:
132   - print(BANNER, file=f)
133   - for o in data['options']:
134   - table = o['table']
135   - if table in ('main', 'help'):
136   - continue
137   - i = self.to_identifier(table, 'O_', True)
138   - print(f'static constexpr char const* {i} = "{table}";', file=f)
139   -
140   - def generate_init(self, data):
141   - with open(self.DESTS['init'], 'w') as f:
142   - print(BANNER, file=f)
143   - for k, v in data['choices'].items():
144   - print(f'char const* {k}_choices[] = {{', file=f, end='')
145   - for i in v:
146   - print(f'"{i}", ', file=f, end='')
147   - print('0};', file=f)
  135 + def generate_decl(self, data, f):
  136 + for o in data['options']:
  137 + table = o['table']
  138 + if table in ('main', 'help'):
  139 + continue
  140 + i = self.to_identifier(table, 'O_', True)
  141 + print(f'static constexpr char const* {i} = "{table}";', file=f)
  142 + print('', file=f)
  143 + for o in data['options']:
  144 + table = o['table']
  145 + prefix = 'arg' + o.get('prefix', '')
  146 + if o.get('positional', False):
  147 + print(f'void {prefix}Positional(char*);', file=f)
  148 + for i in o.get('bare', []):
  149 + identifier = self.to_identifier(i, prefix, False)
  150 + print(f'void {identifier}();', file=f)
  151 + for i in o.get('optional_parameter', []):
  152 + identifier = self.to_identifier(i, prefix, False)
  153 + print(f'void {identifier}(char *);', file=f)
  154 + for i in o.get('required_parameter', {}):
  155 + identifier = self.to_identifier(i, prefix, False)
  156 + print(f'void {identifier}(char *);', file=f)
  157 + for i in o.get('required_choices', {}):
  158 + identifier = self.to_identifier(i, prefix, False)
  159 + print(f'void {identifier}(char *);', file=f)
  160 + if table not in ('main', 'help'):
  161 + identifier = self.to_identifier(table, 'argEnd', False)
  162 + print(f'void {identifier}();', file=f)
  163 +
  164 + def generate_init(self, data, f):
  165 + for k, v in data['choices'].items():
  166 + print(f'char const* {k}_choices[] = {{', file=f, end='')
  167 + for i in v:
  168 + print(f'"{i}", ', file=f, end='')
  169 + print('0};', file=f)
148 170  
149 171  
150 172 if __name__ == '__main__':
... ...
job.sums
1 1 # Generated by generate_auto_job
2   -generate_auto_job 82410a924077d975acc27240f7b167cd32e1c358b8b2ea40161e607ee2ac0599
3   -job.yml 8c66b75eb06be65dfa40058a52cbc0bc18627a3aade5b3d4e034543605c93298
4   -libqpdf/qpdf/auto_job_decl.hh b098ee02ec853f47850b6421cc72b08c608f303f74f01d0b3ce3df52cecd5ffa
  2 +generate_auto_job 52a5e6bc70375e1183fedd5865ae4eae2a10be8d80edede1c48f9946be5d2538
  3 +job.yml b4d230c46ca2b2e75b3b974e2d9ad21fb007eb5007d05cf249ae1e2cde81040c
  4 +libqpdf/qpdf/auto_job_decl.hh fca37543c1a2b7f675374e23b1ab34b30a7f5f2d843c53d4bc7e9a12bf4c3615
5 5 libqpdf/qpdf/auto_job_init.hh 0640167b8d550030c086851408b842e2a93c86577253d78f1b7d41d4ca695bd9
... ...
... ... @@ -143,18 +143,22 @@ options:
143 143 remove-unreferenced-resources: remove_unref
144 144 stream-data: stream_data
145 145 - table: pages
  146 + prefix: Pages
146 147 positional: true
147 148 required_parameter:
148   - - password: password
  149 + password: password
149 150 - table: encryption
  151 + prefix: Enc
150 152 positional: true
151 153 - table: 40-bit encryption
  154 + prefix: Enc40
152 155 required_choices:
153 156 extract: yn
154 157 annotate: yn
155 158 print: yn
156 159 modify: yn
157 160 - table: 128-bit encryption
  161 + prefix: Enc128
158 162 bare:
159 163 - cleartext-metadata
160 164 - force-V4
... ... @@ -169,6 +173,7 @@ options:
169 173 modify: modify128_choices
170 174 use-aes: yn
171 175 - table: 256-bit encryption
  176 + prefix: Enc256
172 177 from_table:
173 178 table: 128-bit encryption
174 179 options:
... ... @@ -185,6 +190,7 @@ options:
185 190 - force-R5
186 191 - allow-insecure
187 192 - table: underlay/overlay
  193 + prefix: UO
188 194 positional: true
189 195 required_parameter:
190 196 to: page-range
... ... @@ -192,6 +198,7 @@ options:
192 198 repeat: page-range
193 199 password: password
194 200 - table: attachment
  201 + prefix: Att
195 202 positional: true
196 203 bare:
197 204 - replace
... ... @@ -203,6 +210,7 @@ options:
203 210 mimetype: mime/type
204 211 description: description
205 212 - table: copy attachment
  213 + prefix: CopyAtt
206 214 positional: true
207 215 required_parameter:
208 216 prefix: prefix
... ...
libqpdf/QPDFJob_argv.cc
... ... @@ -25,134 +25,6 @@ namespace
25 25 private:
26 26 # include <qpdf/auto_job_decl.hh>
27 27  
28   - void argHelp();
29   - void argVersion();
30   - void argCopyright();
31   - void argJsonHelp();
32   - void argShowCrypto();
33   - void argPositional(char* arg);
34   - void argPassword(char* parameter);
35   - void argPasswordFile(char* parameter);
36   - void argEmpty();
37   - void argLinearize();
38   - void argEncrypt();
39   - void argDecrypt();
40   - void argPasswordIsHexKey();
41   - void argAllowInsecure();
42   - void argAllowWeakCrypto();
43   - void argPasswordMode(char* parameter);
44   - void argSuppressPasswordRecovery();
45   - void argCopyEncryption(char* parameter);
46   - void argEncryptionFilePassword(char* parameter);
47   - void argPages();
48   - void argPagesPassword(char* parameter);
49   - void argPagesPositional(char* parameter);
50   - void argEndPages();
51   - void argUnderlay();
52   - void argOverlay();
53   - void argRotate(char* parameter);
54   - void argCollate(char* parameter);
55   - void argFlattenRotation();
56   - void argListAttachments();
57   - void argShowAttachment(char* parameter);
58   - void argRemoveAttachment(char* parameter);
59   - void argAddAttachment();
60   - void argCopyAttachments();
61   - void argStreamData(char* parameter);
62   - void argCompressStreams(char* parameter);
63   - void argRecompressFlate();
64   - void argCompressionLevel(char* parameter);
65   - void argDecodeLevel(char* parameter);
66   - void argNormalizeContent(char* parameter);
67   - void argSuppressRecovery();
68   - void argObjectStreams(char* parameter);
69   - void argIgnoreXrefStreams();
70   - void argQdf();
71   - void argPreserveUnreferenced();
72   - void argPreserveUnreferencedResources();
73   - void argRemoveUnreferencedResources(char* parameter);
74   - void argKeepFilesOpen(char* parameter);
75   - void argKeepFilesOpenThreshold(char* parameter);
76   - void argNewlineBeforeEndstream();
77   - void argLinearizePass1(char* parameter);
78   - void argCoalesceContents();
79   - void argFlattenAnnotations(char* parameter);
80   - void argGenerateAppearances();
81   - void argMinVersion(char* parameter);
82   - void argForceVersion(char* parameter);
83   - void argSplitPages(char* parameter);
84   - void argVerbose();
85   - void argProgress();
86   - void argNoWarn();
87   - void argWarningExitZero();
88   - void argDeterministicId();
89   - void argStaticId();
90   - void argStaticAesIv();
91   - void argNoOriginalObjectIds();
92   - void argShowEncryption();
93   - void argShowEncryptionKey();
94   - void argCheckLinearization();
95   - void argShowLinearization();
96   - void argShowXref();
97   - void argShowObject(char* parameter);
98   - void argRawStreamData();
99   - void argFilteredStreamData();
100   - void argShowNpages();
101   - void argShowPages();
102   - void argWithImages();
103   - void argJson();
104   - void argJsonKey(char* parameter);
105   - void argJsonObject(char* parameter);
106   - void argCheck();
107   - void argOptimizeImages();
108   - void argExternalizeInlineImages();
109   - void argKeepInlineImages();
110   - void argRemovePageLabels();
111   - void argOiMinWidth(char* parameter);
112   - void argOiMinHeight(char* parameter);
113   - void argOiMinArea(char* parameter);
114   - void argIiMinBytes(char* parameter);
115   - void arg40Print(char* parameter);
116   - void arg40Modify(char* parameter);
117   - void arg40Extract(char* parameter);
118   - void arg40Annotate(char* parameter);
119   - void arg128Accessibility(char* parameter);
120   - void arg128Extract(char* parameter);
121   - void arg128Print(char* parameter);
122   - void arg128Modify(char* parameter);
123   - void arg128ClearTextMetadata();
124   - void arg128Assemble(char* parameter);
125   - void arg128Annotate(char* parameter);
126   - void arg128Form(char* parameter);
127   - void arg128ModOther(char* parameter);
128   - void arg128UseAes(char* parameter);
129   - void arg128ForceV4();
130   - void arg256ForceR5();
131   - void argEncryptPositional(char* arg);
132   - void argEndEncrypt();
133   - void argUOpositional(char* arg);
134   - void argUOto(char* parameter);
135   - void argUOfrom(char* parameter);
136   - void argUOrepeat(char* parameter);
137   - void argUOpassword(char* parameter);
138   - void argEndUnderOverlay();
139   - void argReplaceInput();
140   - void argIsEncrypted();
141   - void argRequiresPassword();
142   - void argAApositional(char* arg);
143   - void argAAKey(char* parameter);
144   - void argAAFilename(char* parameter);
145   - void argAACreationDate(char* parameter);
146   - void argAAModDate(char* parameter);
147   - void argAAMimeType(char* parameter);
148   - void argAADescription(char* parameter);
149   - void argAAReplace();
150   - void argEndAddAttachment();
151   - void argCApositional(char* arg);
152   - void argCAprefix(char* parameter);
153   - void argCApassword(char* parameter);
154   - void argEndCopyAttachments();
155   -
156 28 void usage(std::string const& message);
157 29 void initOptionTable();
158 30 void doFinalChecks();
... ... @@ -226,7 +98,7 @@ ArgParser::initOptionTable()
226 98 p(&ArgParser::argRemoveAttachment), "attachment-key");
227 99 this->ap.addBare("add-attachment", b(&ArgParser::argAddAttachment));
228 100 this->ap.addBare(
229   - "copy-attachments-from", b(&ArgParser::argCopyAttachments));
  101 + "copy-attachments-from", b(&ArgParser::argCopyAttachmentsFrom));
230 102 this->ap.addRequiredChoices("stream-data",
231 103 p(&ArgParser::argStreamData), stream_data_choices);
232 104 this->ap.addRequiredChoices("compress-streams",
... ... @@ -270,7 +142,7 @@ ArgParser::initOptionTable()
270 142 this->ap.addBare("verbose", b(&ArgParser::argVerbose));
271 143 this->ap.addBare("progress", b(&ArgParser::argProgress));
272 144 this->ap.addBare("no-warn", b(&ArgParser::argNoWarn));
273   - this->ap.addBare("warning-exit-0", b(&ArgParser::argWarningExitZero));
  145 + this->ap.addBare("warning-exit-0", b(&ArgParser::argWarningExit0));
274 146 this->ap.addBare("deterministic-id", b(&ArgParser::argDeterministicId));
275 147 this->ap.addBare("static-id", b(&ArgParser::argStaticId));
276 148 this->ap.addBare("static-aes-iv", b(&ArgParser::argStaticAesIv));
... ... @@ -321,73 +193,73 @@ ArgParser::initOptionTable()
321 193  
322 194 this->ap.selectMainOptionTable();
323 195 this->ap.addBare("encrypt", b(&ArgParser::argEncrypt));
324   - this->ap.registerOptionTable(O_ENCRYPTION, b(&ArgParser::argEndEncrypt));
325   - this->ap.addPositional(p(&ArgParser::argEncryptPositional));
326   - this->ap.registerOptionTable(O_40_BIT_ENCRYPTION, b(&ArgParser::argEndEncrypt));
327   - this->ap.addRequiredChoices("extract",p(&ArgParser::arg40Extract), yn_choices);
328   - this->ap.addRequiredChoices("annotate",p(&ArgParser::arg40Annotate), yn_choices);
329   - this->ap.addRequiredChoices("print",p(&ArgParser::arg40Print), yn_choices);
330   - this->ap.addRequiredChoices("modify",p(&ArgParser::arg40Modify), yn_choices);
331   - this->ap.registerOptionTable(O_128_BIT_ENCRYPTION, b(&ArgParser::argEndEncrypt));
332   - this->ap.registerOptionTable(O_256_BIT_ENCRYPTION, b(&ArgParser::argEndEncrypt));
  196 + this->ap.registerOptionTable(O_ENCRYPTION, b(&ArgParser::argEndEncryption));
  197 + this->ap.addPositional(p(&ArgParser::argEncPositional));
  198 + this->ap.registerOptionTable(O_40_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption));
  199 + this->ap.addRequiredChoices("extract",p(&ArgParser::argEnc40Extract), yn_choices);
  200 + this->ap.addRequiredChoices("annotate",p(&ArgParser::argEnc40Annotate), yn_choices);
  201 + this->ap.addRequiredChoices("print",p(&ArgParser::argEnc40Print), yn_choices);
  202 + this->ap.addRequiredChoices("modify",p(&ArgParser::argEnc40Modify), yn_choices);
  203 + this->ap.registerOptionTable(O_128_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption));
  204 + this->ap.registerOptionTable(O_256_BIT_ENCRYPTION, b(&ArgParser::argEndEncryption));
333 205 for (char const* k: {O_128_BIT_ENCRYPTION, O_256_BIT_ENCRYPTION})
334 206 {
335 207 this->ap.selectOptionTable(k);
336 208 this->ap.addRequiredChoices("accessibility",
337   - p(&ArgParser::arg128Accessibility), yn_choices);
338   - this->ap.addRequiredChoices("extract", p(&ArgParser::arg128Extract), yn_choices);
  209 + p(&ArgParser::argEnc128Accessibility), yn_choices);
  210 + this->ap.addRequiredChoices("extract", p(&ArgParser::argEnc128Extract), yn_choices);
339 211 this->ap.addRequiredChoices("print",
340   - p(&ArgParser::arg128Print), print128_choices);
341   - this->ap.addRequiredChoices("assemble",p(&ArgParser::arg128Assemble), yn_choices);
342   - this->ap.addRequiredChoices("annotate",p(&ArgParser::arg128Annotate), yn_choices);
343   - this->ap.addRequiredChoices("form",p(&ArgParser::arg128Form), yn_choices);
344   - this->ap.addRequiredChoices("modify-other",p(&ArgParser::arg128ModOther), yn_choices);
  212 + p(&ArgParser::argEnc128Print), print128_choices);
  213 + this->ap.addRequiredChoices("assemble",p(&ArgParser::argEnc128Assemble), yn_choices);
  214 + this->ap.addRequiredChoices("annotate",p(&ArgParser::argEnc128Annotate), yn_choices);
  215 + this->ap.addRequiredChoices("form",p(&ArgParser::argEnc128Form), yn_choices);
  216 + this->ap.addRequiredChoices("modify-other",p(&ArgParser::argEnc128ModifyOther), yn_choices);
345 217 this->ap.addRequiredChoices("modify",
346   - p(&ArgParser::arg128Modify), modify128_choices);
347   - this->ap.addBare("cleartext-metadata", b(&ArgParser::arg128ClearTextMetadata));
  218 + p(&ArgParser::argEnc128Modify), modify128_choices);
  219 + this->ap.addBare("cleartext-metadata", b(&ArgParser::argEnc128CleartextMetadata));
348 220 }
349 221  
350 222 this->ap.selectOptionTable(O_128_BIT_ENCRYPTION);
351   - this->ap.addRequiredChoices("use-aes",p(&ArgParser::arg128UseAes), yn_choices);
352   - this->ap.addBare("force-V4", b(&ArgParser::arg128ForceV4));
  223 + this->ap.addRequiredChoices("use-aes",p(&ArgParser::argEnc128UseAes), yn_choices);
  224 + this->ap.addBare("force-V4", b(&ArgParser::argEnc128ForceV4));
353 225  
354 226 this->ap.selectOptionTable(O_256_BIT_ENCRYPTION);
355   - this->ap.addBare("force-R5", b(&ArgParser::arg256ForceR5));
356   - this->ap.addBare("allow-insecure", b(&ArgParser::argAllowInsecure));
  227 + this->ap.addBare("force-R5", b(&ArgParser::argEnc256ForceR5));
  228 + this->ap.addBare("allow-insecure", b(&ArgParser::argEnc256AllowInsecure));
357 229  
358   - this->ap.registerOptionTable(O_UNDERLAY_OVERLAY, b(&ArgParser::argEndUnderOverlay));
359   - this->ap.addPositional(p(&ArgParser::argUOpositional));
  230 + this->ap.registerOptionTable(O_UNDERLAY_OVERLAY, b(&ArgParser::argEndUnderlayOverlay));
  231 + this->ap.addPositional(p(&ArgParser::argUOPositional));
360 232 this->ap.addRequiredParameter("to",
361   - p(&ArgParser::argUOto), "page-range");
  233 + p(&ArgParser::argUOTo), "page-range");
362 234 this->ap.addRequiredParameter("from",
363   - p(&ArgParser::argUOfrom), "page-range");
  235 + p(&ArgParser::argUOFrom), "page-range");
364 236 this->ap.addRequiredParameter("repeat",
365   - p(&ArgParser::argUOrepeat), "page-range");
  237 + p(&ArgParser::argUORepeat), "page-range");
366 238 this->ap.addRequiredParameter("password",
367   - p(&ArgParser::argUOpassword), "password");
  239 + p(&ArgParser::argUOPassword), "password");
368 240  
369   - this->ap.registerOptionTable(O_ATTACHMENT, b(&ArgParser::argEndAddAttachment));
370   - this->ap.addPositional(p(&ArgParser::argAApositional));
  241 + this->ap.registerOptionTable(O_ATTACHMENT, b(&ArgParser::argEndAttachment));
  242 + this->ap.addPositional(p(&ArgParser::argAttPositional));
371 243 this->ap.addRequiredParameter("key",
372   - p(&ArgParser::argAAKey), "attachment-key");
  244 + p(&ArgParser::argAttKey), "attachment-key");
373 245 this->ap.addRequiredParameter("filename",
374   - p(&ArgParser::argAAFilename), "filename");
  246 + p(&ArgParser::argAttFilename), "filename");
375 247 this->ap.addRequiredParameter("creationdate",
376   - p(&ArgParser::argAACreationDate), "creation-date");
  248 + p(&ArgParser::argAttCreationdate), "creation-date");
377 249 this->ap.addRequiredParameter("moddate",
378   - p(&ArgParser::argAAModDate), "modification-date");
  250 + p(&ArgParser::argAttModdate), "modification-date");
379 251 this->ap.addRequiredParameter("mimetype",
380   - p(&ArgParser::argAAMimeType), "mime/type");
  252 + p(&ArgParser::argAttMimetype), "mime/type");
381 253 this->ap.addRequiredParameter("description",
382   - p(&ArgParser::argAADescription), "description");
383   - this->ap.addBare("replace", b(&ArgParser::argAAReplace));
  254 + p(&ArgParser::argAttDescription), "description");
  255 + this->ap.addBare("replace", b(&ArgParser::argAttReplace));
384 256  
385   - this->ap.registerOptionTable(O_COPY_ATTACHMENT, b(&ArgParser::argEndCopyAttachments));
386   - this->ap.addPositional(p(&ArgParser::argCApositional));
  257 + this->ap.registerOptionTable(O_COPY_ATTACHMENT, b(&ArgParser::argEndCopyAttachment));
  258 + this->ap.addPositional(p(&ArgParser::argCopyAttPositional));
387 259 this->ap.addRequiredParameter("prefix",
388   - p(&ArgParser::argCAprefix), "prefix");
  260 + p(&ArgParser::argCopyAttPrefix), "prefix");
389 261 this->ap.addRequiredParameter("password",
390   - p(&ArgParser::argCApassword), "password");
  262 + p(&ArgParser::argCopyAttPassword), "password");
391 263 }
392 264  
393 265 void
... ... @@ -1067,7 +939,7 @@ ArgParser::argEncrypt()
1067 939 }
1068 940  
1069 941 void
1070   -ArgParser::argEncryptPositional(char* arg)
  942 +ArgParser::argEncPositional(char* arg)
1071 943 {
1072 944 this->accumulated_args.push_back(arg);
1073 945 size_t n_args = this->accumulated_args.size();
... ... @@ -1159,7 +1031,7 @@ ArgParser::argPasswordMode(char* parameter)
1159 1031 }
1160 1032  
1161 1033 void
1162   -ArgParser::argAllowInsecure()
  1034 +ArgParser::argEnc256AllowInsecure()
1163 1035 {
1164 1036 o.allow_insecure = true;
1165 1037 }
... ... @@ -1364,7 +1236,7 @@ ArgParser::argAddAttachment()
1364 1236 }
1365 1237  
1366 1238 void
1367   -ArgParser::argCopyAttachments()
  1239 +ArgParser::argCopyAttachmentsFrom()
1368 1240 {
1369 1241 o.attachments_to_copy.push_back(QPDFJob::CopyAttachmentFrom());
1370 1242 this->ap.selectOptionTable(O_COPY_ATTACHMENT);
... ... @@ -1616,7 +1488,7 @@ ArgParser::argNoWarn()
1616 1488 }
1617 1489  
1618 1490 void
1619   -ArgParser::argWarningExitZero()
  1491 +ArgParser::argWarningExit0()
1620 1492 {
1621 1493 o.warnings_exit_zero = true;
1622 1494 }
... ... @@ -1793,43 +1665,43 @@ ArgParser::argIiMinBytes(char* parameter)
1793 1665 }
1794 1666  
1795 1667 void
1796   -ArgParser::arg40Print(char* parameter)
  1668 +ArgParser::argEnc40Print(char* parameter)
1797 1669 {
1798 1670 o.r2_print = (strcmp(parameter, "y") == 0);
1799 1671 }
1800 1672  
1801 1673 void
1802   -ArgParser::arg40Modify(char* parameter)
  1674 +ArgParser::argEnc40Modify(char* parameter)
1803 1675 {
1804 1676 o.r2_modify = (strcmp(parameter, "y") == 0);
1805 1677 }
1806 1678  
1807 1679 void
1808   -ArgParser::arg40Extract(char* parameter)
  1680 +ArgParser::argEnc40Extract(char* parameter)
1809 1681 {
1810 1682 o.r2_extract = (strcmp(parameter, "y") == 0);
1811 1683 }
1812 1684  
1813 1685 void
1814   -ArgParser::arg40Annotate(char* parameter)
  1686 +ArgParser::argEnc40Annotate(char* parameter)
1815 1687 {
1816 1688 o.r2_annotate = (strcmp(parameter, "y") == 0);
1817 1689 }
1818 1690  
1819 1691 void
1820   -ArgParser::arg128Accessibility(char* parameter)
  1692 +ArgParser::argEnc128Accessibility(char* parameter)
1821 1693 {
1822 1694 o.r3_accessibility = (strcmp(parameter, "y") == 0);
1823 1695 }
1824 1696  
1825 1697 void
1826   -ArgParser::arg128Extract(char* parameter)
  1698 +ArgParser::argEnc128Extract(char* parameter)
1827 1699 {
1828 1700 o.r3_extract = (strcmp(parameter, "y") == 0);
1829 1701 }
1830 1702  
1831 1703 void
1832   -ArgParser::arg128Print(char* parameter)
  1704 +ArgParser::argEnc128Print(char* parameter)
1833 1705 {
1834 1706 if (strcmp(parameter, "full") == 0)
1835 1707 {
... ... @@ -1850,7 +1722,7 @@ ArgParser::arg128Print(char* parameter)
1850 1722 }
1851 1723  
1852 1724 void
1853   -ArgParser::arg128Modify(char* parameter)
  1725 +ArgParser::argEnc128Modify(char* parameter)
1854 1726 {
1855 1727 if (strcmp(parameter, "all") == 0)
1856 1728 {
... ... @@ -1894,55 +1766,55 @@ ArgParser::arg128Modify(char* parameter)
1894 1766 }
1895 1767  
1896 1768 void
1897   -ArgParser::arg128ClearTextMetadata()
  1769 +ArgParser::argEnc128CleartextMetadata()
1898 1770 {
1899 1771 o.cleartext_metadata = true;
1900 1772 }
1901 1773  
1902 1774 void
1903   -ArgParser::arg128Assemble(char* parameter)
  1775 +ArgParser::argEnc128Assemble(char* parameter)
1904 1776 {
1905 1777 o.r3_assemble = (strcmp(parameter, "y") == 0);
1906 1778 }
1907 1779  
1908 1780 void
1909   -ArgParser::arg128Annotate(char* parameter)
  1781 +ArgParser::argEnc128Annotate(char* parameter)
1910 1782 {
1911 1783 o.r3_annotate_and_form = (strcmp(parameter, "y") == 0);
1912 1784 }
1913 1785  
1914 1786 void
1915   -ArgParser::arg128Form(char* parameter)
  1787 +ArgParser::argEnc128Form(char* parameter)
1916 1788 {
1917 1789 o.r3_form_filling = (strcmp(parameter, "y") == 0);
1918 1790 }
1919 1791  
1920 1792 void
1921   -ArgParser::arg128ModOther(char* parameter)
  1793 +ArgParser::argEnc128ModifyOther(char* parameter)
1922 1794 {
1923 1795 o.r3_modify_other = (strcmp(parameter, "y") == 0);
1924 1796 }
1925 1797  
1926 1798 void
1927   -ArgParser::arg128UseAes(char* parameter)
  1799 +ArgParser::argEnc128UseAes(char* parameter)
1928 1800 {
1929 1801 o.use_aes = (strcmp(parameter, "y") == 0);
1930 1802 }
1931 1803  
1932 1804 void
1933   -ArgParser::arg128ForceV4()
  1805 +ArgParser::argEnc128ForceV4()
1934 1806 {
1935 1807 o.force_V4 = true;
1936 1808 }
1937 1809  
1938 1810 void
1939   -ArgParser::arg256ForceR5()
  1811 +ArgParser::argEnc256ForceR5()
1940 1812 {
1941 1813 o.force_R5 = true;
1942 1814 }
1943 1815  
1944 1816 void
1945   -ArgParser::argEndEncrypt()
  1817 +ArgParser::argEndEncryption()
1946 1818 {
1947 1819 o.encrypt = true;
1948 1820 o.decrypt = false;
... ... @@ -1950,7 +1822,7 @@ ArgParser::argEndEncrypt()
1950 1822 }
1951 1823  
1952 1824 void
1953   -ArgParser::argUOpositional(char* arg)
  1825 +ArgParser::argUOPositional(char* arg)
1954 1826 {
1955 1827 if (o.under_overlay->filename)
1956 1828 {
... ... @@ -1963,14 +1835,14 @@ ArgParser::argUOpositional(char* arg)
1963 1835 }
1964 1836  
1965 1837 void
1966   -ArgParser::argUOto(char* parameter)
  1838 +ArgParser::argUOTo(char* parameter)
1967 1839 {
1968 1840 parseNumrange(parameter, 0);
1969 1841 o.under_overlay->to_nr = parameter;
1970 1842 }
1971 1843  
1972 1844 void
1973   -ArgParser::argUOfrom(char* parameter)
  1845 +ArgParser::argUOFrom(char* parameter)
1974 1846 {
1975 1847 if (strlen(parameter))
1976 1848 {
... ... @@ -1980,7 +1852,7 @@ ArgParser::argUOfrom(char* parameter)
1980 1852 }
1981 1853  
1982 1854 void
1983   -ArgParser::argUOrepeat(char* parameter)
  1855 +ArgParser::argUORepeat(char* parameter)
1984 1856 {
1985 1857 if (strlen(parameter))
1986 1858 {
... ... @@ -1990,13 +1862,13 @@ ArgParser::argUOrepeat(char* parameter)
1990 1862 }
1991 1863  
1992 1864 void
1993   -ArgParser::argUOpassword(char* parameter)
  1865 +ArgParser::argUOPassword(char* parameter)
1994 1866 {
1995 1867 o.under_overlay->password = parameter;
1996 1868 }
1997 1869  
1998 1870 void
1999   -ArgParser::argEndUnderOverlay()
  1871 +ArgParser::argEndUnderlayOverlay()
2000 1872 {
2001 1873 if (0 == o.under_overlay->filename)
2002 1874 {
... ... @@ -2026,25 +1898,25 @@ ArgParser::argRequiresPassword()
2026 1898 }
2027 1899  
2028 1900 void
2029   -ArgParser::argAApositional(char* arg)
  1901 +ArgParser::argAttPositional(char* arg)
2030 1902 {
2031 1903 o.attachments_to_add.back().path = arg;
2032 1904 }
2033 1905  
2034 1906 void
2035   -ArgParser::argAAKey(char* parameter)
  1907 +ArgParser::argAttKey(char* parameter)
2036 1908 {
2037 1909 o.attachments_to_add.back().key = parameter;
2038 1910 }
2039 1911  
2040 1912 void
2041   -ArgParser::argAAFilename(char* parameter)
  1913 +ArgParser::argAttFilename(char* parameter)
2042 1914 {
2043 1915 o.attachments_to_add.back().filename = parameter;
2044 1916 }
2045 1917  
2046 1918 void
2047   -ArgParser::argAACreationDate(char* parameter)
  1919 +ArgParser::argAttCreationdate(char* parameter)
2048 1920 {
2049 1921 if (! QUtil::pdf_time_to_qpdf_time(parameter))
2050 1922 {
... ... @@ -2054,7 +1926,7 @@ ArgParser::argAACreationDate(char* parameter)
2054 1926 }
2055 1927  
2056 1928 void
2057   -ArgParser::argAAModDate(char* parameter)
  1929 +ArgParser::argAttModdate(char* parameter)
2058 1930 {
2059 1931 if (! QUtil::pdf_time_to_qpdf_time(parameter))
2060 1932 {
... ... @@ -2064,7 +1936,7 @@ ArgParser::argAAModDate(char* parameter)
2064 1936 }
2065 1937  
2066 1938 void
2067   -ArgParser::argAAMimeType(char* parameter)
  1939 +ArgParser::argAttMimetype(char* parameter)
2068 1940 {
2069 1941 if (strchr(parameter, '/') == nullptr)
2070 1942 {
... ... @@ -2074,19 +1946,19 @@ ArgParser::argAAMimeType(char* parameter)
2074 1946 }
2075 1947  
2076 1948 void
2077   -ArgParser::argAADescription(char* parameter)
  1949 +ArgParser::argAttDescription(char* parameter)
2078 1950 {
2079 1951 o.attachments_to_add.back().description = parameter;
2080 1952 }
2081 1953  
2082 1954 void
2083   -ArgParser::argAAReplace()
  1955 +ArgParser::argAttReplace()
2084 1956 {
2085 1957 o.attachments_to_add.back().replace = true;
2086 1958 }
2087 1959  
2088 1960 void
2089   -ArgParser::argEndAddAttachment()
  1961 +ArgParser::argEndAttachment()
2090 1962 {
2091 1963 static std::string now = QUtil::qpdf_time_to_pdf_time(
2092 1964 QUtil::get_current_qpdf_time());
... ... @@ -2119,25 +1991,25 @@ ArgParser::argEndAddAttachment()
2119 1991 }
2120 1992  
2121 1993 void
2122   -ArgParser::argCApositional(char* arg)
  1994 +ArgParser::argCopyAttPositional(char* arg)
2123 1995 {
2124 1996 o.attachments_to_copy.back().path = arg;
2125 1997 }
2126 1998  
2127 1999 void
2128   -ArgParser::argCAprefix(char* parameter)
  2000 +ArgParser::argCopyAttPrefix(char* parameter)
2129 2001 {
2130 2002 o.attachments_to_copy.back().prefix = parameter;
2131 2003 }
2132 2004  
2133 2005 void
2134   -ArgParser::argCApassword(char* parameter)
  2006 +ArgParser::argCopyAttPassword(char* parameter)
2135 2007 {
2136 2008 o.attachments_to_copy.back().password = parameter;
2137 2009 }
2138 2010  
2139 2011 void
2140   -ArgParser::argEndCopyAttachments()
  2012 +ArgParser::argEndCopyAttachment()
2141 2013 {
2142 2014 if (o.attachments_to_copy.back().path.empty())
2143 2015 {
... ...
libqpdf/qpdf/auto_job_decl.hh
... ... @@ -11,3 +11,134 @@ static constexpr char const* O_256_BIT_ENCRYPTION = &quot;256-bit encryption&quot;;
11 11 static constexpr char const* O_UNDERLAY_OVERLAY = "underlay/overlay";
12 12 static constexpr char const* O_ATTACHMENT = "attachment";
13 13 static constexpr char const* O_COPY_ATTACHMENT = "copy attachment";
  14 +
  15 +void argHelp();
  16 +void argVersion();
  17 +void argCopyright();
  18 +void argJsonHelp();
  19 +void argShowCrypto();
  20 +void argPositional(char*);
  21 +void argAddAttachment();
  22 +void argAllowWeakCrypto();
  23 +void argCheck();
  24 +void argCheckLinearization();
  25 +void argCoalesceContents();
  26 +void argCopyAttachmentsFrom();
  27 +void argDecrypt();
  28 +void argDeterministicId();
  29 +void argEmpty();
  30 +void argEncrypt();
  31 +void argExternalizeInlineImages();
  32 +void argFilteredStreamData();
  33 +void argFlattenRotation();
  34 +void argGenerateAppearances();
  35 +void argIgnoreXrefStreams();
  36 +void argIsEncrypted();
  37 +void argJson();
  38 +void argKeepInlineImages();
  39 +void argLinearize();
  40 +void argListAttachments();
  41 +void argNewlineBeforeEndstream();
  42 +void argNoOriginalObjectIds();
  43 +void argNoWarn();
  44 +void argOptimizeImages();
  45 +void argOverlay();
  46 +void argPages();
  47 +void argPasswordIsHexKey();
  48 +void argPreserveUnreferenced();
  49 +void argPreserveUnreferencedResources();
  50 +void argProgress();
  51 +void argQdf();
  52 +void argRawStreamData();
  53 +void argRecompressFlate();
  54 +void argRemovePageLabels();
  55 +void argReplaceInput();
  56 +void argRequiresPassword();
  57 +void argShowEncryption();
  58 +void argShowEncryptionKey();
  59 +void argShowLinearization();
  60 +void argShowNpages();
  61 +void argShowPages();
  62 +void argShowXref();
  63 +void argStaticAesIv();
  64 +void argStaticId();
  65 +void argSuppressPasswordRecovery();
  66 +void argSuppressRecovery();
  67 +void argUnderlay();
  68 +void argVerbose();
  69 +void argWarningExit0();
  70 +void argWithImages();
  71 +void argCollate(char *);
  72 +void argSplitPages(char *);
  73 +void argCompressionLevel(char *);
  74 +void argCopyEncryption(char *);
  75 +void argEncryptionFilePassword(char *);
  76 +void argForceVersion(char *);
  77 +void argIiMinBytes(char *);
  78 +void argJsonObject(char *);
  79 +void argKeepFilesOpenThreshold(char *);
  80 +void argLinearizePass1(char *);
  81 +void argMinVersion(char *);
  82 +void argOiMinArea(char *);
  83 +void argOiMinHeight(char *);
  84 +void argOiMinWidth(char *);
  85 +void argPassword(char *);
  86 +void argPasswordFile(char *);
  87 +void argRemoveAttachment(char *);
  88 +void argRotate(char *);
  89 +void argShowAttachment(char *);
  90 +void argShowObject(char *);
  91 +void argCompressStreams(char *);
  92 +void argDecodeLevel(char *);
  93 +void argFlattenAnnotations(char *);
  94 +void argJsonKey(char *);
  95 +void argKeepFilesOpen(char *);
  96 +void argNormalizeContent(char *);
  97 +void argObjectStreams(char *);
  98 +void argPasswordMode(char *);
  99 +void argRemoveUnreferencedResources(char *);
  100 +void argStreamData(char *);
  101 +void argPagesPositional(char*);
  102 +void argPagesPassword(char *);
  103 +void argEndPages();
  104 +void argEncPositional(char*);
  105 +void argEndEncryption();
  106 +void argEnc40Extract(char *);
  107 +void argEnc40Annotate(char *);
  108 +void argEnc40Print(char *);
  109 +void argEnc40Modify(char *);
  110 +void argEnd40BitEncryption();
  111 +void argEnc128CleartextMetadata();
  112 +void argEnc128ForceV4();
  113 +void argEnc128Accessibility(char *);
  114 +void argEnc128Extract(char *);
  115 +void argEnc128Print(char *);
  116 +void argEnc128Assemble(char *);
  117 +void argEnc128Annotate(char *);
  118 +void argEnc128Form(char *);
  119 +void argEnc128ModifyOther(char *);
  120 +void argEnc128Modify(char *);
  121 +void argEnc128UseAes(char *);
  122 +void argEnd128BitEncryption();
  123 +void argEnc256ForceR5();
  124 +void argEnc256AllowInsecure();
  125 +void argEnd256BitEncryption();
  126 +void argUOPositional(char*);
  127 +void argUOTo(char *);
  128 +void argUOFrom(char *);
  129 +void argUORepeat(char *);
  130 +void argUOPassword(char *);
  131 +void argEndUnderlayOverlay();
  132 +void argAttPositional(char*);
  133 +void argAttReplace();
  134 +void argAttKey(char *);
  135 +void argAttFilename(char *);
  136 +void argAttCreationdate(char *);
  137 +void argAttModdate(char *);
  138 +void argAttMimetype(char *);
  139 +void argAttDescription(char *);
  140 +void argEndAttachment();
  141 +void argCopyAttPositional(char*);
  142 +void argCopyAttPrefix(char *);
  143 +void argCopyAttPassword(char *);
  144 +void argEndCopyAttachment();
... ...