89 | | <!--Fortran section --> |
90 | | <div class="bhoechie-tab-content"> |
91 | | <center> |
92 | | <h3>Fortran</h3> |
93 | | <pre class="language-fortran"> |
94 | | <code>Integer FUNCTION HELLOF(zoo_main_cfg,zoo_inputs,zoo_outputs) |
95 | | & RESULT (R) |
96 | | Integer R, ls, iLenStr |
97 | | CHARACTER*(1024) zoo_main_cfg(10,30),zoo_inputs(10,30), |
98 | | & zoo_outputs(10,30) |
99 | | CHARACTER*(1024) TMP |
100 | | |
101 | | write(0,*) 'Hello '//zoo_inputs(4,1)//' from the Fortran world !' |
102 | | |
103 | | ls = iLenStr(zoo_inputs(4,1)) |
104 | | TMP = zoo_inputs(4,1) |
105 | | zoo_outputs(1,1) = 'name'//CHAR(0) |
106 | | zoo_outputs(2,1) = 'result'//CHAR(0) |
107 | | zoo_outputs(3,1) = 'value'//CHAR(0) |
108 | | zoo_outputs(4,1) = 'Hello '//TMP(1:ls)// |
109 | | & ' from the Fortran world !'//CHAR(0) |
110 | | zoo_outputs(5,1) = 'datatype'//CHAR(0) |
111 | | zoo_outputs(6,1) = 'string'//CHAR(0) |
112 | | |
113 | | R = 3 |
114 | | Return |
115 | | END |
116 | | |
117 | | Integer Function iLenStr(cString) |
118 | | Character*(*) cString |
119 | | Integer iLen,i |
120 | | |
121 | | iLen = Len(cString) |
122 | | Do i=iLen,1,-1 |
123 | | If(ichar(cString(i:i)).NE.0) Goto 10 |
124 | | EndDo |
125 | | i = 1 |
126 | | 10 Continue |
127 | | iLenStr = i |
128 | | |
129 | | Return |
130 | | End Function iLenStr/code> |
131 | | </pre> |
132 | | </code> |
133 | | </center> |
134 | | </div> |
135 | | |
136 | | |
137 | | <!--Java section --> |
138 | | <div class="bhoechie-tab-content"> |
139 | | <center> |
140 | | <h3>Java</h3> |
141 | | <pre class="language-java"> |
142 | | <code>import java.lang.*; |
143 | | import java.util.*; |
144 | | public class HelloJava { |
145 | | public static int HelloWorldJava(HashMap conf,HashMap inputs, HashMap outputs) { |
146 | | HashMap tmp=(HashMap)(inputs.get("S")); |
147 | | String v=tmp.get("value").toString(); |
148 | | HashMap hm1 = (HashMap)(outputs.get("Result")); |
149 | | hm1.put("value",ZOO._("Hello "+v+" from JAVA World !!")); |
150 | | return ZOO.SERVICE_SUCCEEDED; |
151 | | } |
152 | | } |
153 | | </code> |
154 | | </pre> |
155 | | </center> |
156 | | </div> |
189 | | |
| 115 | <!--Ruby section --> |
| 116 | <div class="bhoechie-tab-content"> |
| 117 | <center> |
| 118 | <h3>Ruby</h3> |
| 119 | <pre class="language-ruby"> |
| 120 | <code>[def helloRuby(conf,inputs,outputs) |
| 121 | a=Zoo::Translate("Hello") |
| 122 | b=Zoo::Translate("from the ruby world !") |
| 123 | outputs["Result"]["value"]=Zoo::Translate("#{a} #{inputs["s"]["value"]} #{b}") |
| 124 | return Zoo::SERVICE_SUCCEEDED |
| 125 | end |
| 126 | lruby-static |
| 127 | RUBYLDFLAGS=-L/usr/local/ruby-2.1.0/lib -lruby-static |
| 128 | </code> |
| 129 | </pre> |
| 130 | </center> |
| 131 | </div> |