Home | History | Annotate | Download | only in api

Lines Matching full:file

5  * you may not use this file except in compliance with the License.
26 // Convert a file name into a string that can be used to guard the include file with #ifdef...
45 static void writeVersionGuardStart(GeneratedFile* file, VersionInfo info, int finalVersion) {
47 *file << "#ifndef __LP64__\n";
49 *file << "#ifdef __LP64__\n";
64 *file << "#if !defined(RS_VERSION) || " << checkMaxVersion.str() << "\n";
67 *file << "#if (defined(RS_VERSION) && (RS_VERSION >= " << info.minVersion << ")";
69 *file << " && " << checkMaxVersion.str();
71 *file << ")\n";
75 static void writeVersionGuardEnd(GeneratedFile* file, VersionInfo info) {
77 *file << "#endif\n";
80 *file << "#endif\n";
84 static void writeComment(GeneratedFile* file, const string& name, const string& briefComment,
90 *file << "/*\n";
92 *file << " * " << name << ": " << briefComment << "\n";
93 *file << " *\n";
96 *file << " * DEPRECATED. Do not use.\n";
97 *file << " *\n";
103 *file << " * " << s << "\n";
105 *file << " *\n";
109 *file << " */\n";
113 static void writeConstantComment(GeneratedFile* file, const Constant& constant) {
115 writeComment(file, name, constant.getSummary(), constant.getDescription(),
119 static void writeConstantSpecification(GeneratedFile* file, const ConstantSpecification& spec) {
122 writeVersionGuardStart(file, info, constant->getFinalVersion());
123 *file << "#define " << constant->getName() << " " << spec.getValue() << "\n\n";
124 writeVersionGuardEnd(file, info);
127 static void writeTypeSpecification(GeneratedFile* file, const TypeSpecification& spec) {
131 writeVersionGuardStart(file, info, type->getFinalVersion());
136 *file << "typedef ";
139 *file << spec.getSimpleType() << attribute;
142 *file << "enum" << attribute << " ";
145 *file << name << " ";
147 *file << "{\n";
153 *file << " " << values[i];
155 *file << ",";
158 *file << " // " << valueComments[i];
160 *file << "\n";
162 *file << "}";
166 *file << "struct" << attribute << " ";
169 *file << name << " ";
171 *file << "{\n";
176 *file << " " << fields[i] << ";";
178 *file << " // " << fieldComments[i];
180 *file << "\n";
182 *file << "}";
186 *file << " " << typeName << ";\n";
188 writeVersionGuardEnd(file, info);
189 *file << "\n";
192 static void writeTypeComment(GeneratedFile* file, const Type& type) {
194 writeComment(file, name, type.getSummary(), type.getDescription(), type.deprecated(), true);
197 static void writeFunctionPermutation(GeneratedFile* file, const FunctionSpecification& spec,
200 writeVersionGuardStart(file, spec.getVersionInfo(), function->getFinalVersion());
205 *file << "static inline ";
207 *file << "extern ";
213 *file << ret->rsType;
215 *file << "void";
218 *file << makeAttributeTag(spec.getAttribute(), "overloadable",
220 *file << "\n";
223 *file << " " << permutation.getName() << "(";
231 *file << ",";
244 *file << "\n" << string(offset, ' ');
247 *file << " ";
250 *file << s;
256 *file << "void";
258 *file << ")";
262 *file << " {\n";
265 *file << "\n";
267 *file << " " << inlineCodeLines[ct] << "\n";
270 *file << "}\n";
272 *file << ";\n";
275 writeVersionGuardEnd(file, spec.getVersionInfo());
276 *file << "\n";
279 static void writeFunctionComment(GeneratedFile* file, const Function& function) {
281 writeComment(file, function.getName(), function.getSummary(), function.getDescription(),
286 *file << " *\n";
287 *file << " * Parameters:\n";
290 *file << " * " << p->name << ": " << p->documentation << "\n";
298 *file << " *\n";
299 *file << " * Returns: " << returnDoc << "\n";
302 *file << " */\n";
305 static void writeFunctionSpecification(GeneratedFile* file, const FunctionSpecification& spec) {
308 writeFunctionPermutation(file, spec, *permutation);
315 // We generate one header file for each spec file.
316 GeneratedFile file;
317 if (!file.start(directory, headerFileName)) {
321 // Write the comments that start the file.
322 file.writeNotices();
323 writeComment(&file, headerFileName, specFile.getBriefDescription(),
325 file << "\n";
327 // Write the ifndef that prevents the file from being included twice.
329 file << "#ifndef " << guard << "\n";
330 file << "#define " << guard << "\n\n";
335 file << s << "\n";
337 file << "\n";
341 * encountered in the spec file.
348 writeConstantComment(&file, *constant);
350 writeConstantSpecification(&file, *spec);
357 writeTypeComment(&file, *type);
359 writeTypeSpecification(&file, *spec);
367 writeFunctionComment(&file, *function);
369 writeFunctionSpecification(&file, *spec);
372 file << "#endif // " << guard << "\n";
373 file.close();