code-generation

Can I get an XML AST dump of C/C++ code with clang without using the compiler?

社会主义新天地 提交于 2019-12-17 22:46:48
问题 I managed to compile successfully clang for windows with cmake and visual studio 10. I would like to get an XML file as AST representation of the source code. There is one option that provides the result with clang with gcc under linux (ubuntu) but doesn't work on the windows box: clang -cc1 -ast-print-xml source.c However, this is invoking the compilation stage (which I would like to avoid). Digging in the source code didn't help me so far as I am quite new to clang. I could manage to

Maven example of annotation preprocessing and generation of classes in same compile process?

≯℡__Kan透↙ 提交于 2019-12-17 22:36:17
问题 Does anyone have a clean example of a maven project preprocessing class annotations at compile time with subsequent generation of classes to be compiled in the same compilation process? Does anyone have a step-by-step procedure to implement such a project? 回答1: After navigating a lot in existing documentation on the net, I came up with the following: What needs to be clarified: In order to process annotations on a given project P, you first need an annotation processor compiled in a separate

java partial classes

懵懂的女人 提交于 2019-12-17 20:19:50
问题 Small preamble. I was good java developer on 1.4 jdk. After it I have switched to another platforms, but here I come with problem so question is strongly about jdk 1.6 (or higher :) ). I have 3 coupled class, the nature of coupling concerned with native methods. Bellow is example of this 3 class public interface A { public void method(); } final class AOperations { static native method(. . .); } public class AImpl implements A { @Override public void method(){ AOperations.method( . . . ); } }

javascript dom, how to handle “special properties” as versus attributes?

点点圈 提交于 2019-12-17 18:40:01
问题 issue is whether to use property or attribute. have not found this documented, so have run some tests (chromium 12): property <=> attribute accept, alt, formMethod, formTarget, id, name, placeholder, type, maxlength, size form: method, name, target, action, enctype can set either property or attribute will reflect to property or attribute exception 1: if form property will first look for element of that name (!) exception 2: action property rewrites itself using value, passes set value to

How do I execute ruby template files (ERB) without a web server from command line?

萝らか妹 提交于 2019-12-17 17:52:06
问题 I need ERB (Ruby's templating system) for templating of non-HTML files. (Instead, I want to use it for source files such as .java, .cs, ...) How do I "execute" Ruby templates from command line? 回答1: You should have everything you need in your ruby/bin directory. On my (WinXP, Ruby 1.8.6) system, I have ruby/bin/erb.bat erb.bat [switches] [inputfile] -x print ruby script -n print ruby script with line number -v enable verbose mode -d set $DEBUG to true -r [library] load a library -K [kcode]

How do I execute ruby template files (ERB) without a web server from command line?

我的梦境 提交于 2019-12-17 17:51:08
问题 I need ERB (Ruby's templating system) for templating of non-HTML files. (Instead, I want to use it for source files such as .java, .cs, ...) How do I "execute" Ruby templates from command line? 回答1: You should have everything you need in your ruby/bin directory. On my (WinXP, Ruby 1.8.6) system, I have ruby/bin/erb.bat erb.bat [switches] [inputfile] -x print ruby script -n print ruby script with line number -v enable verbose mode -d set $DEBUG to true -r [library] load a library -K [kcode]

Why do PHP Array Examples Leave a Trailing Comma?

本小妞迷上赌 提交于 2019-12-17 15:59:17
问题 I have seen examples like the following: $data = array( 'username' => $user->getUsername(), 'userpass' => $user->getPassword(), 'email' => $user->getEmail(), ); However, in practice I have always not left the trailing comma. Am I doing something wrong, or is this just 'another' way of doing it? If I was using a framework would not having the trailing comma affect code generation negatively? I have seen the use of trailing commas in array declarations in other languages (Java, C++) as well, so

How to hide files generated by custom tool in Visual Studio

偶尔善良 提交于 2019-12-17 15:26:41
问题 I would like the files generated by my custom tool to be hidden, but I cannot find any documentation on how this is done. An example of what I'm looking for is WPF code behind files. These files are not displayed in the Visual Studio project view, yet are compiled with the project and are available in IntelliSense. WPF code behind files (Window1.g.i.cs, for example), are generated by a custom tool. 回答1: The solution is to create a Target that adds your files to the Compile ItemGroup rather

How can I generate database tables from C# classes?

大憨熊 提交于 2019-12-17 10:13:10
问题 Does anyone know a way to auto-generate database tables for a given class? I'm not looking for an entire persistence layer - I already have a data access solution I'm using, but I suddenly have to store a lot of information from a large number of classes and I really don't want to have to create all these tables by hand. For example, given the following class: class Foo { private string property1; public string Property1 { get { return property1; } set { property1 = value; } } private int

Generating Delegate Types dynamically in C#

陌路散爱 提交于 2019-12-17 09:52:39
问题 We have a requirement where we need to generate delegate types on the fly. We need to generate delegates given the input parameters and the output. Both input and output would be simple types. eg, we need to generate int Del(int, int, int, string) and int Del2(int, int, string, int) Any pointers on how to get started on this would be very helpful. We need to parse formulate which are represented as xml. For example, we represent (a + b) as <ADD> <param type="decimal">A</parameter> <param type