annotate run/i/interpret_01_B.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents 5cc974ee1e2f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1418
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
1 // $HeadURL$
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
2 // $Date$
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
3 // $Author$
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
4
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
5 // @author@ Lionello Lunesu <lio@lunesu.remove.com>
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
6 // @date@ 2007-02-16
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
7 // @uri@ http://www.digitalmars.com/webnews/newsgroups.php?group=digitalmars.D&article_id=48917
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
8 // @desc@ Re: Compile time function execution...
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
9
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
10 module dstress.run.i.interpret_01_B;
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
11
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
12 template eval(A...) {
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
13 alias A eval;
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
14 }
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
15
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
16 char[] trimfirst(char[] s){
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
17 int x = 0;
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
18 foreach (char each; s) {
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
19 if (each != ' '){
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
20 return s[x .. $];
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
21 }
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
22 x++;
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
23 }
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
24 return s;
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
25 }
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
26
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
27 int main(){
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
28 char[] a = eval!(trimfirst(" test"))[0];
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
29 if(a != "test"){
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
30 assert(0);
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
31 }
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
32 return 0;
5cc974ee1e2f Re: Compile time function execution...
thomask
parents:
diff changeset
33 }