Lines Matching refs: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, unsigned 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 << "struct " << typeName << " _RS_OBJECT_DECL" << attribute;
145 *file << "enum" << attribute << " ";
148 *file << name << " ";
150 *file << "{\n";
156 *file << " " << values[i];
158 *file << ",";
161 *file << " // " << valueComments[i];
163 *file << "\n";
165 *file << "}";
169 *file << "struct" << attribute << " ";
172 *file << name << " ";
174 *file << "{\n";
179 *file << " " << fields[i] << ";";
181 *file << " // " << fieldComments[i];
183 *file << "\n";
185 *file << "}";
189 *file << " " << typeName << ";\n";
191 writeVersionGuardEnd(file, info);
192 *file << "\n";
195 static void writeTypeComment(GeneratedFile* file, const Type& type) {
197 writeComment(file, name, type.getSummary(), type.getDescription(), type.deprecated(), true);
200 static void writeFunctionPermutation(GeneratedFile* file, const FunctionSpecification& spec,
203 writeVersionGuardStart(file, spec.getVersionInfo(), function->getFinalVersion());
208 *file << "static inline ";
210 *file << "extern ";
216 *file << ret->rsType;
218 *file << "void";
221 *file << makeAttributeTag(spec.getAttribute(), spec.isOverloadable() ? "overloadable" : "",
223 *file << "\n";
226 *file << " " << permutation.getName() << "(";
234 *file << ",";
247 *file << "\n" << string(offset, ' ');
250 *file << " ";
253 *file << s;
259 *file << "void";
261 *file << ")";
265 *file << " {\n";
268 *file << "\n";
270 *file << " " << inlineCodeLines[ct] << "\n";
273 *file << "}\n";
275 *file << ";\n";
278 writeVersionGuardEnd(file, spec.getVersionInfo());
279 *file << "\n";
282 static void writeFunctionComment(GeneratedFile* file, const Function& function) {
284 writeComment(file, function.getName(), function.getSummary(), function.getDescription(),
289 *file << " *\n";
290 *file << " * Parameters:\n";
293 *file << " * " << p->name << ": " << p->documentation << "\n";
301 *file << " *\n";
302 *file << " * Returns: " << returnDoc << "\n";
305 *file << " */\n";
308 static void writeFunctionSpecification(GeneratedFile* file, const FunctionSpecification& spec) {
311 writeFunctionPermutation(file, spec, *permutation);
318 // We generate one header file for each spec file.
319 GeneratedFile file;
320 if (!file.start(directory, headerFileName)) {
324 // Write the comments that start the file.
325 file.writeNotices();
326 writeComment(&file, headerFileName, specFile.getBriefDescription(),
328 file << "\n";
330 // Write the ifndef that prevents the file from being included twice.
332 file << "#ifndef " << guard << "\n";
333 file << "#define " << guard << "\n\n";
338 file << s << "\n";
340 file << "\n";
344 * encountered in the spec file.
351 writeConstantComment(&file, *constant);
353 writeConstantSpecification(&file, *spec);
360 writeTypeComment(&file, *type);
362 writeTypeSpecification(&file, *spec);
374 writeFunctionComment(&file, *function);
376 writeFunctionSpecification(&file, *spec);
379 file << "#endif // " << guard << "\n";
380 file.close();