test-callback.c 102 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885
  1. /*
  2. * Copyright 1993 Bill Triggs <Bill.Triggs@inrialpes.fr>
  3. * Copyright 1995-2017 Bruno Haible <bruno@clisp.org>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* { dg-do run } */
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <ffi.h>
  23. #include "alignof.h"
  24. #include <stdarg.h>
  25. /* libffi testsuite local changes -------------------------------- */
  26. #ifdef DGTEST
  27. /* Redefine exit(1) as a test failure */
  28. #define exit(V) (void)((V) ? (abort(), 1) : exit(0))
  29. int count = 0;
  30. char rbuf1[2048];
  31. char rbuf2[2048];
  32. int _fprintf(FILE *stream, const char *format, ...)
  33. {
  34. va_list args;
  35. va_start(args, format);
  36. switch (count++)
  37. {
  38. case 0:
  39. case 1:
  40. vsprintf(&rbuf1[strlen(rbuf1)], format, args);
  41. break;
  42. case 2:
  43. printf("%s", rbuf1);
  44. vsprintf(rbuf2, format, args);
  45. break;
  46. case 3:
  47. vsprintf(&rbuf2[strlen(rbuf2)], format, args);
  48. printf("%s", rbuf2);
  49. if (strcmp (rbuf1, rbuf2)) abort();
  50. break;
  51. }
  52. va_end(args);
  53. return 0;
  54. }
  55. #define fprintf _fprintf
  56. #endif
  57. /* --------------------------------------------------------------- */
  58. #include "testcases.c"
  59. #ifndef ABI_NUM
  60. #define ABI_NUM FFI_DEFAULT_ABI
  61. #endif
  62. /* Definitions that ought to be part of libffi. */
  63. static ffi_type ffi_type_char;
  64. #define ffi_type_slonglong ffi_type_sint64
  65. #define ffi_type_ulonglong ffi_type_uint64
  66. /* libffi does not support arrays inside structs. */
  67. #define SKIP_EXTRA_STRUCTS
  68. #define FFI_PREP_CIF(cif,argtypes,rettype) \
  69. if (ffi_prep_cif(&(cif),ABI_NUM,sizeof(argtypes)/sizeof(argtypes[0]),&rettype,argtypes) != FFI_OK) abort()
  70. #define FFI_PREP_CIF_NOARGS(cif,rettype) \
  71. if (ffi_prep_cif(&(cif),ABI_NUM,0,&rettype,NULL) != FFI_OK) abort()
  72. #if defined(__sparc__) && defined(__sun) && defined(__SUNPRO_C) /* SUNWspro cc */
  73. /* SunPRO cc miscompiles the simulator function for X_BcdB: d.i[1] is
  74. * temporarily stored in %l2 and put onto the stack from %l2, but in between
  75. * the copy of X has used %l2 as a counter without saving and restoring its
  76. * value.
  77. */
  78. #define SKIP_X
  79. #endif
  80. #if defined(__mipsn32__) && !defined(__GNUC__)
  81. /* The X test crashes for an unknown reason. */
  82. #define SKIP_X
  83. #endif
  84. /* These functions simulate the behaviour of the functions defined in testcases.c. */
  85. /* void tests */
  86. void v_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  87. {
  88. if (data != (void*)&v_v) { fprintf(out,"wrong data for v_v\n"); exit(1); }
  89. fprintf(out,"void f(void):\n");
  90. fflush(out);
  91. }
  92. /* int tests */
  93. void i_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  94. {
  95. if (data != (void*)&i_v) { fprintf(out,"wrong data for i_v\n"); exit(1); }
  96. {int r=99;
  97. fprintf(out,"int f(void):");
  98. fflush(out);
  99. *(ffi_arg*)retp = r;
  100. }}
  101. void i_i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  102. {
  103. if (data != (void*)&i_i) { fprintf(out,"wrong data for i_i\n"); exit(1); }
  104. int a = *(int*)(*args++);
  105. int r=a+1;
  106. fprintf(out,"int f(int):(%d)",a);
  107. fflush(out);
  108. *(ffi_arg*)retp = r;
  109. }
  110. void i_i2_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  111. {
  112. if (data != (void*)&i_i2) { fprintf(out,"wrong data for i_i2\n"); exit(1); }
  113. {int a = *(int*)(*args++);
  114. int b = *(int*)(*args++);
  115. int r=a+b;
  116. fprintf(out,"int f(2*int):(%d,%d)",a,b);
  117. fflush(out);
  118. *(ffi_arg*)retp = r;
  119. }}
  120. void i_i4_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  121. {
  122. if (data != (void*)&i_i4) { fprintf(out,"wrong data for i_i4\n"); exit(1); }
  123. {int a = *(int*)(*args++);
  124. int b = *(int*)(*args++);
  125. int c = *(int*)(*args++);
  126. int d = *(int*)(*args++);
  127. int r=a+b+c+d;
  128. fprintf(out,"int f(4*int):(%d,%d,%d,%d)",a,b,c,d);
  129. fflush(out);
  130. *(ffi_arg*)retp = r;
  131. }}
  132. void i_i8_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  133. {
  134. if (data != (void*)&i_i8) { fprintf(out,"wrong data for i_i8\n"); exit(1); }
  135. {int a = *(int*)(*args++);
  136. int b = *(int*)(*args++);
  137. int c = *(int*)(*args++);
  138. int d = *(int*)(*args++);
  139. int e = *(int*)(*args++);
  140. int f = *(int*)(*args++);
  141. int g = *(int*)(*args++);
  142. int h = *(int*)(*args++);
  143. int r=a+b+c+d+e+f+g+h;
  144. fprintf(out,"int f(8*int):(%d,%d,%d,%d,%d,%d,%d,%d)",a,b,c,d,e,f,g,h);
  145. fflush(out);
  146. *(ffi_arg*)retp = r;
  147. }}
  148. void i_i16_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  149. {
  150. if (data != (void*)&i_i16) { fprintf(out,"wrong data for i_i16\n"); exit(1); }
  151. {int a = *(int*)(*args++);
  152. int b = *(int*)(*args++);
  153. int c = *(int*)(*args++);
  154. int d = *(int*)(*args++);
  155. int e = *(int*)(*args++);
  156. int f = *(int*)(*args++);
  157. int g = *(int*)(*args++);
  158. int h = *(int*)(*args++);
  159. int i = *(int*)(*args++);
  160. int j = *(int*)(*args++);
  161. int k = *(int*)(*args++);
  162. int l = *(int*)(*args++);
  163. int m = *(int*)(*args++);
  164. int n = *(int*)(*args++);
  165. int o = *(int*)(*args++);
  166. int p = *(int*)(*args++);
  167. int r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p;
  168. fprintf(out,"int f(16*int):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",
  169. a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
  170. fflush(out);
  171. *(ffi_arg*)retp = r;
  172. }}
  173. /* float tests */
  174. void f_f_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  175. {
  176. if (data != (void*)&f_f) { fprintf(out,"wrong data for f_f\n"); exit(1); }
  177. {float a = *(float*)(*args++);
  178. float r=a+1.0;
  179. fprintf(out,"float f(float):(%g)",a);
  180. fflush(out);
  181. *(float*)retp = r;
  182. }}
  183. void f_f2_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  184. {
  185. if (data != (void*)&f_f2) { fprintf(out,"wrong data for f_f2\n"); exit(1); }
  186. {float a = *(float*)(*args++);
  187. float b = *(float*)(*args++);
  188. float r=a+b;
  189. fprintf(out,"float f(2*float):(%g,%g)",a,b);
  190. fflush(out);
  191. *(float*)retp = r;
  192. }}
  193. void f_f4_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  194. {
  195. if (data != (void*)&f_f4) { fprintf(out,"wrong data for f_f4\n"); exit(1); }
  196. {float a = *(float*)(*args++);
  197. float b = *(float*)(*args++);
  198. float c = *(float*)(*args++);
  199. float d = *(float*)(*args++);
  200. float r=a+b+c+d;
  201. fprintf(out,"float f(4*float):(%g,%g,%g,%g)",a,b,c,d);
  202. fflush(out);
  203. *(float*)retp = r;
  204. }}
  205. void f_f8_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  206. {
  207. if (data != (void*)&f_f8) { fprintf(out,"wrong data for f_f8\n"); exit(1); }
  208. {float a = *(float*)(*args++);
  209. float b = *(float*)(*args++);
  210. float c = *(float*)(*args++);
  211. float d = *(float*)(*args++);
  212. float e = *(float*)(*args++);
  213. float f = *(float*)(*args++);
  214. float g = *(float*)(*args++);
  215. float h = *(float*)(*args++);
  216. float r=a+b+c+d+e+f+g+h;
  217. fprintf(out,"float f(8*float):(%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h);
  218. fflush(out);
  219. *(float*)retp = r;
  220. }}
  221. void f_f16_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  222. {
  223. if (data != (void*)&f_f16) { fprintf(out,"wrong data for f_f16\n"); exit(1); }
  224. {float a = *(float*)(*args++);
  225. float b = *(float*)(*args++);
  226. float c = *(float*)(*args++);
  227. float d = *(float*)(*args++);
  228. float e = *(float*)(*args++);
  229. float f = *(float*)(*args++);
  230. float g = *(float*)(*args++);
  231. float h = *(float*)(*args++);
  232. float i = *(float*)(*args++);
  233. float j = *(float*)(*args++);
  234. float k = *(float*)(*args++);
  235. float l = *(float*)(*args++);
  236. float m = *(float*)(*args++);
  237. float n = *(float*)(*args++);
  238. float o = *(float*)(*args++);
  239. float p = *(float*)(*args++);
  240. float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p;
  241. fprintf(out,"float f(16*float):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
  242. fflush(out);
  243. *(float*)retp = r;
  244. }}
  245. void f_f24_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  246. {
  247. if (data != (void*)&f_f24) { fprintf(out,"wrong data for f_f24\n"); exit(1); }
  248. {float a = *(float*)(*args++);
  249. float b = *(float*)(*args++);
  250. float c = *(float*)(*args++);
  251. float d = *(float*)(*args++);
  252. float e = *(float*)(*args++);
  253. float f = *(float*)(*args++);
  254. float g = *(float*)(*args++);
  255. float h = *(float*)(*args++);
  256. float i = *(float*)(*args++);
  257. float j = *(float*)(*args++);
  258. float k = *(float*)(*args++);
  259. float l = *(float*)(*args++);
  260. float m = *(float*)(*args++);
  261. float n = *(float*)(*args++);
  262. float o = *(float*)(*args++);
  263. float p = *(float*)(*args++);
  264. float q = *(float*)(*args++);
  265. float s = *(float*)(*args++);
  266. float t = *(float*)(*args++);
  267. float u = *(float*)(*args++);
  268. float v = *(float*)(*args++);
  269. float w = *(float*)(*args++);
  270. float x = *(float*)(*args++);
  271. float y = *(float*)(*args++);
  272. float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+v+w+x+y;
  273. fprintf(out,"float f(24*float):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y);
  274. fflush(out);
  275. *(float*)retp = r;
  276. }}
  277. /* double tests */
  278. void d_d_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  279. {
  280. if (data != (void*)&d_d) { fprintf(out,"wrong data for d_d\n"); exit(1); }
  281. {double a = *(double*)(*args++);
  282. double r=a+1.0;
  283. fprintf(out,"double f(double):(%g)",a);
  284. fflush(out);
  285. *(double*)retp = r;
  286. }}
  287. void d_d2_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  288. {
  289. if (data != (void*)&d_d2) { fprintf(out,"wrong data for d_d2\n"); exit(1); }
  290. {double a = *(double*)(*args++);
  291. double b = *(double*)(*args++);
  292. double r=a+b;
  293. fprintf(out,"double f(2*double):(%g,%g)",a,b);
  294. fflush(out);
  295. *(double*)retp = r;
  296. }}
  297. void d_d4_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  298. {
  299. if (data != (void*)&d_d4) { fprintf(out,"wrong data for d_d4\n"); exit(1); }
  300. {double a = *(double*)(*args++);
  301. double b = *(double*)(*args++);
  302. double c = *(double*)(*args++);
  303. double d = *(double*)(*args++);
  304. double r=a+b+c+d;
  305. fprintf(out,"double f(4*double):(%g,%g,%g,%g)",a,b,c,d);
  306. fflush(out);
  307. *(double*)retp = r;
  308. }}
  309. void d_d8_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  310. {
  311. if (data != (void*)&d_d8) { fprintf(out,"wrong data for d_d8\n"); exit(1); }
  312. {double a = *(double*)(*args++);
  313. double b = *(double*)(*args++);
  314. double c = *(double*)(*args++);
  315. double d = *(double*)(*args++);
  316. double e = *(double*)(*args++);
  317. double f = *(double*)(*args++);
  318. double g = *(double*)(*args++);
  319. double h = *(double*)(*args++);
  320. double r=a+b+c+d+e+f+g+h;
  321. fprintf(out,"double f(8*double):(%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h);
  322. fflush(out);
  323. *(double*)retp = r;
  324. }}
  325. void d_d16_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  326. {
  327. if (data != (void*)&d_d16) { fprintf(out,"wrong data for d_d16\n"); exit(1); }
  328. {double a = *(double*)(*args++);
  329. double b = *(double*)(*args++);
  330. double c = *(double*)(*args++);
  331. double d = *(double*)(*args++);
  332. double e = *(double*)(*args++);
  333. double f = *(double*)(*args++);
  334. double g = *(double*)(*args++);
  335. double h = *(double*)(*args++);
  336. double i = *(double*)(*args++);
  337. double j = *(double*)(*args++);
  338. double k = *(double*)(*args++);
  339. double l = *(double*)(*args++);
  340. double m = *(double*)(*args++);
  341. double n = *(double*)(*args++);
  342. double o = *(double*)(*args++);
  343. double p = *(double*)(*args++);
  344. double r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p;
  345. fprintf(out,"double f(16*double):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
  346. fflush(out);
  347. *(double*)retp = r;
  348. }}
  349. /* pointer tests */
  350. void vp_vpdpcpsp_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  351. {
  352. if (data != (void*)&vp_vpdpcpsp) { fprintf(out,"wrong data for vp_vpdpcpsp\n"); exit(1); }
  353. {void* a = *(void* *)(*args++);
  354. double* b = *(double* *)(*args++);
  355. char* c = *(char* *)(*args++);
  356. Int* d = *(Int* *)(*args++);
  357. void* ret = (char*)b + 1;
  358. fprintf(out,"void* f(void*,double*,char*,Int*):(0x%p,0x%p,0x%p,0x%p)",a,b,c,d);
  359. fflush(out);
  360. *(void* *)retp = ret;
  361. }}
  362. /* mixed number tests */
  363. void uc_ucsil_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  364. {
  365. if (data != (void*)&uc_ucsil) { fprintf(out,"wrong data for uc_ucsil\n"); exit(1); }
  366. {uchar a = *(unsigned char *)(*args++);
  367. ushort b = *(unsigned short *)(*args++);
  368. uint c = *(unsigned int *)(*args++);
  369. ulong d = *(unsigned long *)(*args++);
  370. uchar r = (uchar)-1;
  371. fprintf(out,"uchar f(uchar,ushort,uint,ulong):(%u,%u,%u,%lu)",a,b,c,d);
  372. fflush(out);
  373. *(ffi_arg *)retp = r;
  374. }}
  375. void d_iidd_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  376. {
  377. if (data != (void*)&d_iidd) { fprintf(out,"wrong data for d_iidd\n"); exit(1); }
  378. {int a = *(int*)(*args++);
  379. int b = *(int*)(*args++);
  380. double c = *(double*)(*args++);
  381. double d = *(double*)(*args++);
  382. double r=a+b+c+d;
  383. fprintf(out,"double f(int,int,double,double):(%d,%d,%g,%g)",a,b,c,d);
  384. fflush(out);
  385. *(double*)retp = r;
  386. }}
  387. void d_iiidi_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  388. {
  389. if (data != (void*)&d_iiidi) { fprintf(out,"wrong data for d_iiidi\n"); exit(1); }
  390. {int a = *(int*)(*args++);
  391. int b = *(int*)(*args++);
  392. int c = *(int*)(*args++);
  393. double d = *(double*)(*args++);
  394. int e = *(int*)(*args++);
  395. double r=a+b+c+d+e;
  396. fprintf(out,"double f(int,int,int,double,int):(%d,%d,%d,%g,%d)",a,b,c,d,e);
  397. fflush(out);
  398. *(double*)retp = r;
  399. }}
  400. void d_idid_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  401. {
  402. if (data != (void*)&d_idid) { fprintf(out,"wrong data for d_idid\n"); exit(1); }
  403. {int a = *(int*)(*args++);
  404. double b = *(double*)(*args++);
  405. int c = *(int*)(*args++);
  406. double d = *(double*)(*args++);
  407. double r=a+b+c+d;
  408. fprintf(out,"double f(int,double,int,double):(%d,%g,%d,%g)",a,b,c,d);
  409. fflush(out);
  410. *(double*)retp = r;
  411. }}
  412. void d_fdi_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  413. {
  414. if (data != (void*)&d_fdi) { fprintf(out,"wrong data for d_fdi\n"); exit(1); }
  415. {float a = *(float*)(*args++);
  416. double b = *(double*)(*args++);
  417. int c = *(int*)(*args++);
  418. double r=a+b+c;
  419. fprintf(out,"double f(float,double,int):(%g,%g,%d)",a,b,c);
  420. fflush(out);
  421. *(double*)retp = r;
  422. }}
  423. void us_cdcd_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  424. {
  425. if (data != (void*)&us_cdcd) { fprintf(out,"wrong data for us_cdcd\n"); exit(1); }
  426. {char a = *(char*)(*args++);
  427. double b = *(double*)(*args++);
  428. char c = *(char*)(*args++);
  429. double d = *(double*)(*args++);
  430. ushort r = (ushort)(a + b + c + d);
  431. fprintf(out,"ushort f(char,double,char,double):('%c',%g,'%c',%g)",a,b,c,d);
  432. fflush(out);
  433. *(ffi_arg *)retp = r;
  434. }}
  435. void ll_iiilli_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  436. {
  437. if (data != (void*)&ll_iiilli) { fprintf(out,"wrong data for ll_iiilli\n"); exit(1); }
  438. {int a = *(int*)(*args++);
  439. int b = *(int*)(*args++);
  440. int c = *(int*)(*args++);
  441. long long d = *(long long *)(*args++);
  442. int e = *(int*)(*args++);
  443. long long r = (long long)(int)a + (long long)(int)b + (long long)(int)c + d + (long long)e;
  444. fprintf(out,"long long f(int,int,int,long long,int):(%d,%d,%d,0x%lx%08lx,%d)",a,b,c,(long)(d>>32),(long)(d&0xffffffff),e);
  445. fflush(out);
  446. *(long long *)retp = r;
  447. }}
  448. void ll_flli_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  449. {
  450. if (data != (void*)&ll_flli) { fprintf(out,"wrong data for ll_flli\n"); exit(1); }
  451. {float a = *(float*)(*args++);
  452. long long b = *(long long *)(*args++);
  453. int c = *(int*)(*args++);
  454. long long r = (long long)(int)a + b + (long long)c;
  455. fprintf(out,"long long f(float,long long,int):(%g,0x%lx%08lx,0x%lx)",a,(long)(b>>32),(long)(b&0xffffffff),(long)c);
  456. fflush(out);
  457. *(long long *)retp = r;
  458. }}
  459. void f_fi_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  460. {
  461. if (data != (void*)&f_fi) { fprintf(out,"wrong data for f_fi\n"); exit(1); }
  462. {float a = *(float*)(*args++);
  463. int z = *(int*)(*args++);
  464. float r=a+z;
  465. fprintf(out,"float f(float,int):(%g,%d)",a,z);
  466. fflush(out);
  467. *(float*)retp = r;
  468. }}
  469. void f_f2i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  470. {
  471. if (data != (void*)&f_f2i) { fprintf(out,"wrong data for f_f2i\n"); exit(1); }
  472. {float a = *(float*)(*args++);
  473. float b = *(float*)(*args++);
  474. int z = *(int*)(*args++);
  475. float r=a+b+z;
  476. fprintf(out,"float f(2*float,int):(%g,%g,%d)",a,b,z);
  477. fflush(out);
  478. *(float*)retp = r;
  479. }}
  480. void f_f3i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  481. {
  482. if (data != (void*)&f_f3i) { fprintf(out,"wrong data for f_f3i\n"); exit(1); }
  483. {float a = *(float*)(*args++);
  484. float b = *(float*)(*args++);
  485. float c = *(float*)(*args++);
  486. int z = *(int*)(*args++);
  487. float r=a+b+c+z;
  488. fprintf(out,"float f(3*float,int):(%g,%g,%g,%d)",a,b,c,z);
  489. fflush(out);
  490. *(float*)retp = r;
  491. }}
  492. void f_f4i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  493. {
  494. if (data != (void*)&f_f4i) { fprintf(out,"wrong data for f_f4i\n"); exit(1); }
  495. {float a = *(float*)(*args++);
  496. float b = *(float*)(*args++);
  497. float c = *(float*)(*args++);
  498. float d = *(float*)(*args++);
  499. int z = *(int*)(*args++);
  500. float r=a+b+c+d+z;
  501. fprintf(out,"float f(4*float,int):(%g,%g,%g,%g,%d)",a,b,c,d,z);
  502. fflush(out);
  503. *(float*)retp = r;
  504. }}
  505. void f_f7i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  506. {
  507. if (data != (void*)&f_f7i) { fprintf(out,"wrong data for f_f7i\n"); exit(1); }
  508. {float a = *(float*)(*args++);
  509. float b = *(float*)(*args++);
  510. float c = *(float*)(*args++);
  511. float d = *(float*)(*args++);
  512. float e = *(float*)(*args++);
  513. float f = *(float*)(*args++);
  514. float g = *(float*)(*args++);
  515. int z = *(int*)(*args++);
  516. float r=a+b+c+d+e+f+g+z;
  517. fprintf(out,"float f(7*float,int):(%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,z);
  518. fflush(out);
  519. *(float*)retp = r;
  520. }}
  521. void f_f8i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  522. {
  523. if (data != (void*)&f_f8i) { fprintf(out,"wrong data for f_f8i\n"); exit(1); }
  524. {float a = *(float*)(*args++);
  525. float b = *(float*)(*args++);
  526. float c = *(float*)(*args++);
  527. float d = *(float*)(*args++);
  528. float e = *(float*)(*args++);
  529. float f = *(float*)(*args++);
  530. float g = *(float*)(*args++);
  531. float h = *(float*)(*args++);
  532. int z = *(int*)(*args++);
  533. float r=a+b+c+d+e+f+g+h+z;
  534. fprintf(out,"float f(8*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,z);
  535. fflush(out);
  536. *(float*)retp = r;
  537. }}
  538. void f_f12i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  539. {
  540. if (data != (void*)&f_f12i) { fprintf(out,"wrong data for f_f12i\n"); exit(1); }
  541. {float a = *(float*)(*args++);
  542. float b = *(float*)(*args++);
  543. float c = *(float*)(*args++);
  544. float d = *(float*)(*args++);
  545. float e = *(float*)(*args++);
  546. float f = *(float*)(*args++);
  547. float g = *(float*)(*args++);
  548. float h = *(float*)(*args++);
  549. float i = *(float*)(*args++);
  550. float j = *(float*)(*args++);
  551. float k = *(float*)(*args++);
  552. float l = *(float*)(*args++);
  553. int z = *(int*)(*args++);
  554. float r=a+b+c+d+e+f+g+h+i+j+k+l+z;
  555. fprintf(out,"float f(12*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,z);
  556. fflush(out);
  557. *(float*)retp = r;
  558. }}
  559. void f_f13i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  560. {
  561. if (data != (void*)&f_f13i) { fprintf(out,"wrong data for f_f13i\n"); exit(1); }
  562. {float a = *(float*)(*args++);
  563. float b = *(float*)(*args++);
  564. float c = *(float*)(*args++);
  565. float d = *(float*)(*args++);
  566. float e = *(float*)(*args++);
  567. float f = *(float*)(*args++);
  568. float g = *(float*)(*args++);
  569. float h = *(float*)(*args++);
  570. float i = *(float*)(*args++);
  571. float j = *(float*)(*args++);
  572. float k = *(float*)(*args++);
  573. float l = *(float*)(*args++);
  574. float m = *(float*)(*args++);
  575. int z = *(int*)(*args++);
  576. float r=a+b+c+d+e+f+g+h+i+j+k+l+m+z;
  577. fprintf(out,"float f(13*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,m,z);
  578. fflush(out);
  579. *(float*)retp = r;
  580. }}
  581. void d_di_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  582. {
  583. if (data != (void*)&d_di) { fprintf(out,"wrong data for d_di\n"); exit(1); }
  584. {double a = *(double*)(*args++);
  585. int z = *(int*)(*args++);
  586. double r=a+z;
  587. fprintf(out,"double f(double,int):(%g,%d)",a,z);
  588. fflush(out);
  589. *(double*)retp = r;
  590. }}
  591. void d_d2i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  592. {
  593. if (data != (void*)&d_d2i) { fprintf(out,"wrong data for d_d2i\n"); exit(1); }
  594. {double a = *(double*)(*args++);
  595. double b = *(double*)(*args++);
  596. int z = *(int*)(*args++);
  597. double r=a+b+z;
  598. fprintf(out,"double f(2*double,int):(%g,%g,%d)",a,b,z);
  599. fflush(out);
  600. *(double*)retp = r;
  601. }}
  602. void d_d3i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  603. {
  604. if (data != (void*)&d_d3i) { fprintf(out,"wrong data for d_d3i\n"); exit(1); }
  605. {double a = *(double*)(*args++);
  606. double b = *(double*)(*args++);
  607. double c = *(double*)(*args++);
  608. int z = *(int*)(*args++);
  609. double r=a+b+c+z;
  610. fprintf(out,"double f(3*double,int):(%g,%g,%g,%d)",a,b,c,z);
  611. fflush(out);
  612. *(double*)retp = r;
  613. }}
  614. void d_d4i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  615. {
  616. if (data != (void*)&d_d4i) { fprintf(out,"wrong data for d_d4i\n"); exit(1); }
  617. {double a = *(double*)(*args++);
  618. double b = *(double*)(*args++);
  619. double c = *(double*)(*args++);
  620. double d = *(double*)(*args++);
  621. int z = *(int*)(*args++);
  622. double r=a+b+c+d+z;
  623. fprintf(out,"double f(4*double,int):(%g,%g,%g,%g,%d)",a,b,c,d,z);
  624. fflush(out);
  625. *(double*)retp = r;
  626. }}
  627. void d_d7i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  628. {
  629. if (data != (void*)&d_d7i) { fprintf(out,"wrong data for d_d7i\n"); exit(1); }
  630. {double a = *(double*)(*args++);
  631. double b = *(double*)(*args++);
  632. double c = *(double*)(*args++);
  633. double d = *(double*)(*args++);
  634. double e = *(double*)(*args++);
  635. double f = *(double*)(*args++);
  636. double g = *(double*)(*args++);
  637. int z = *(int*)(*args++);
  638. double r=a+b+c+d+e+f+g+z;
  639. fprintf(out,"double f(7*double,int):(%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,z);
  640. fflush(out);
  641. *(double*)retp = r;
  642. }}
  643. void d_d8i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  644. {
  645. if (data != (void*)&d_d8i) { fprintf(out,"wrong data for d_d8i\n"); exit(1); }
  646. {double a = *(double*)(*args++);
  647. double b = *(double*)(*args++);
  648. double c = *(double*)(*args++);
  649. double d = *(double*)(*args++);
  650. double e = *(double*)(*args++);
  651. double f = *(double*)(*args++);
  652. double g = *(double*)(*args++);
  653. double h = *(double*)(*args++);
  654. int z = *(int*)(*args++);
  655. double r=a+b+c+d+e+f+g+h+z;
  656. fprintf(out,"double f(8*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,z);
  657. fflush(out);
  658. *(double*)retp = r;
  659. }}
  660. void d_d12i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  661. {
  662. if (data != (void*)&d_d12i) { fprintf(out,"wrong data for d_d12i\n"); exit(1); }
  663. {double a = *(double*)(*args++);
  664. double b = *(double*)(*args++);
  665. double c = *(double*)(*args++);
  666. double d = *(double*)(*args++);
  667. double e = *(double*)(*args++);
  668. double f = *(double*)(*args++);
  669. double g = *(double*)(*args++);
  670. double h = *(double*)(*args++);
  671. double i = *(double*)(*args++);
  672. double j = *(double*)(*args++);
  673. double k = *(double*)(*args++);
  674. double l = *(double*)(*args++);
  675. int z = *(int*)(*args++);
  676. double r=a+b+c+d+e+f+g+h+i+j+k+l+z;
  677. fprintf(out,"double f(12*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,z);
  678. fflush(out);
  679. *(double*)retp = r;
  680. }}
  681. void d_d13i_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  682. {
  683. if (data != (void*)&d_d13i) { fprintf(out,"wrong data for d_d13i\n"); exit(1); }
  684. {double a = *(double*)(*args++);
  685. double b = *(double*)(*args++);
  686. double c = *(double*)(*args++);
  687. double d = *(double*)(*args++);
  688. double e = *(double*)(*args++);
  689. double f = *(double*)(*args++);
  690. double g = *(double*)(*args++);
  691. double h = *(double*)(*args++);
  692. double i = *(double*)(*args++);
  693. double j = *(double*)(*args++);
  694. double k = *(double*)(*args++);
  695. double l = *(double*)(*args++);
  696. double m = *(double*)(*args++);
  697. int z = *(int*)(*args++);
  698. double r=a+b+c+d+e+f+g+h+i+j+k+l+m+z;
  699. fprintf(out,"double f(13*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,m,z);
  700. fflush(out);
  701. *(double*)retp = r;
  702. }}
  703. /* small structure return tests */
  704. void S1_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  705. {
  706. if (data != (void*)&S1_v) { fprintf(out,"wrong data for S1_v\n"); exit(1); }
  707. {Size1 r = Size1_1;
  708. fprintf(out,"Size1 f(void):");
  709. fflush(out);
  710. *(Size1*)retp = r;
  711. }}
  712. void S2_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  713. {
  714. if (data != (void*)&S2_v) { fprintf(out,"wrong data for S2_v\n"); exit(1); }
  715. {Size2 r = Size2_1;
  716. fprintf(out,"Size2 f(void):");
  717. fflush(out);
  718. *(Size2*)retp = r;
  719. }}
  720. void S3_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  721. {
  722. if (data != (void*)&S3_v) { fprintf(out,"wrong data for S3_v\n"); exit(1); }
  723. {Size3 r = Size3_1;
  724. fprintf(out,"Size3 f(void):");
  725. fflush(out);
  726. *(Size3*)retp = r;
  727. }}
  728. void S4_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  729. {
  730. if (data != (void*)&S4_v) { fprintf(out,"wrong data for S4_v\n"); exit(1); }
  731. {Size4 r = Size4_1;
  732. fprintf(out,"Size4 f(void):");
  733. fflush(out);
  734. *(Size4*)retp = r;
  735. }}
  736. void S7_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  737. {
  738. if (data != (void*)&S7_v) { fprintf(out,"wrong data for S7_v\n"); exit(1); }
  739. {Size7 r = Size7_1;
  740. fprintf(out,"Size7 f(void):");
  741. fflush(out);
  742. *(Size7*)retp = r;
  743. }}
  744. void S8_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  745. {
  746. if (data != (void*)&S8_v) { fprintf(out,"wrong data for S8_v\n"); exit(1); }
  747. {Size8 r = Size8_1;
  748. fprintf(out,"Size8 f(void):");
  749. fflush(out);
  750. *(Size8*)retp = r;
  751. }}
  752. void S12_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  753. {
  754. if (data != (void*)&S12_v) { fprintf(out,"wrong data for S12_v\n"); exit(1); }
  755. {Size12 r = Size12_1;
  756. fprintf(out,"Size12 f(void):");
  757. fflush(out);
  758. *(Size12*)retp = r;
  759. }}
  760. void S15_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  761. {
  762. if (data != (void*)&S15_v) { fprintf(out,"wrong data for S15_v\n"); exit(1); }
  763. {Size15 r = Size15_1;
  764. fprintf(out,"Size15 f(void):");
  765. fflush(out);
  766. *(Size15*)retp = r;
  767. }}
  768. void S16_v_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  769. {
  770. if (data != (void*)&S16_v) { fprintf(out,"wrong data for S16_v\n"); exit(1); }
  771. {Size16 r = Size16_1;
  772. fprintf(out,"Size16 f(void):");
  773. fflush(out);
  774. *(Size16*)retp = r;
  775. }}
  776. /* structure tests */
  777. void I_III_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  778. {
  779. if (data != (void*)&I_III) { fprintf(out,"wrong data for I_III\n"); exit(1); }
  780. {Int a = *(Int*)(*args++);
  781. Int b = *(Int*)(*args++);
  782. Int c = *(Int*)(*args++);
  783. Int r;
  784. r.x = a.x + b.x + c.x;
  785. fprintf(out,"Int f(Int,Int,Int):({%d},{%d},{%d})",a.x,b.x,c.x);
  786. fflush(out);
  787. *(Int*)retp = r;
  788. }}
  789. void C_CdC_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  790. {
  791. if (data != (void*)&C_CdC) { fprintf(out,"wrong data for C_CdC\n"); exit(1); }
  792. {Char a = *(Char*)(*args++);
  793. double b = *(double*)(*args++);
  794. Char c = *(Char*)(*args++);
  795. Char r;
  796. r.x = (a.x + c.x)/2;
  797. fprintf(out,"Char f(Char,double,Char):({'%c'},%g,{'%c'})",a.x,b,c.x);
  798. fflush(out);
  799. *(Char*)retp = r;
  800. }}
  801. void F_Ffd_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  802. {
  803. if (data != (void*)&F_Ffd) { fprintf(out,"wrong data for F_Ffd\n"); exit(1); }
  804. {Float a = *(Float*)(*args++);
  805. float b = *(float*)(*args++);
  806. double c = *(double*)(*args++);
  807. Float r;
  808. r.x = a.x + b + c;
  809. fprintf(out,"Float f(Float,float,double):({%g},%g,%g)",a.x,b,c);
  810. fflush(out);
  811. *(Float*)retp = r;
  812. }}
  813. void D_fDd_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  814. {
  815. if (data != (void*)&D_fDd) { fprintf(out,"wrong data for D_fDd\n"); exit(1); }
  816. {float a = *(float*)(*args++);
  817. Double b = *(Double*)(*args++);
  818. double c = *(double*)(*args++);
  819. Double r;
  820. r.x = a + b.x + c;
  821. fprintf(out,"Double f(float,Double,double):(%g,{%g},%g)",a,b.x,c);
  822. fflush(out);
  823. *(Double*)retp = r;
  824. }}
  825. void D_Dfd_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  826. {
  827. if (data != (void*)&D_Dfd) { fprintf(out,"wrong data for D_Dfd\n"); exit(1); }
  828. {Double a = *(Double*)(*args++);
  829. float b = *(float*)(*args++);
  830. double c = *(double*)(*args++);
  831. Double r;
  832. r.x = a.x + b + c;
  833. fprintf(out,"Double f(Double,float,double):({%g},%g,%g)",a.x,b,c);
  834. fflush(out);
  835. *(Double*)retp = r;
  836. }}
  837. void J_JiJ_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  838. {
  839. if (data != (void*)&J_JiJ) { fprintf(out,"wrong data for J_JiJ\n"); exit(1); }
  840. {J a = *(J*)(*args++);
  841. int b= *(int*)(*args++);
  842. J c = *(J*)(*args++);
  843. J r;
  844. r.l1 = a.l1+c.l1; r.l2 = a.l2+b+c.l2;
  845. fprintf(out,"J f(J,int,J):({%ld,%ld},%d,{%ld,%ld})",a.l1,a.l2,b,c.l1,c.l2);
  846. fflush(out);
  847. *(J*)retp = r;
  848. }}
  849. #ifndef SKIP_EXTRA_STRUCTS
  850. void T_TcT_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  851. {
  852. if (data != (void*)&T_TcT) { fprintf(out,"wrong data for T_TcT\n"); exit(1); }
  853. {T a = *(T*)(*args++);
  854. char b = *(char*)(*args++);
  855. T c = *(T*)(*args++);
  856. T r;
  857. r.c[0]='b'; r.c[1]=c.c[1]; r.c[2]=c.c[2];
  858. fprintf(out,"T f(T,char,T):({\"%c%c%c\"},'%c',{\"%c%c%c\"})",a.c[0],a.c[1],a.c[2],b,c.c[0],c.c[1],c.c[2]);
  859. fflush(out);
  860. *(T*)retp = r;
  861. }}
  862. void X_BcdB_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  863. {
  864. if (data != (void*)&X_BcdB) { fprintf(out,"wrong data for X_BcdB\n"); exit(1); }
  865. {B a = *(B*)(*args++);
  866. char b = *(char*)(*args++);
  867. double c = *(double*)(*args++);
  868. B d = *(B*)(*args++);
  869. static X xr={"return val",'R'};
  870. X r;
  871. r = xr;
  872. r.c1 = b;
  873. fprintf(out,"X f(B,char,double,B):({%g,{%d,%d,%d}},'%c',%g,{%g,{%d,%d,%d}})",
  874. a.d,a.i[0],a.i[1],a.i[2],b,c,d.d,d.i[0],d.i[1],d.i[2]);
  875. fflush(out);
  876. *(X*)retp = r;
  877. }}
  878. #endif
  879. /* gpargs boundary tests */
  880. void l_l0K_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  881. {
  882. if (data != (void*)&l_l0K) { fprintf(out,"wrong data for l_l0K\n"); exit(1); }
  883. {K b = *(K*)(*args++);
  884. long c = *(long*)(*args++);
  885. long r = b.l1 + b.l2 + b.l3 + b.l4 + c;
  886. fprintf(out,"long f(K,long):(%ld,%ld,%ld,%ld,%ld)",b.l1,b.l2,b.l3,b.l4,c);
  887. fflush(out);
  888. *(ffi_arg*)retp = r;
  889. }}
  890. void l_l1K_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  891. {
  892. if (data != (void*)&l_l1K) { fprintf(out,"wrong data for l_l1K\n"); exit(1); }
  893. {long a1 = *(long*)(*args++);
  894. K b = *(K*)(*args++);
  895. long c = *(long*)(*args++);
  896. long r = a1 + b.l1 + b.l2 + b.l3 + b.l4 + c;
  897. fprintf(out,"long f(long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld)",a1,b.l1,b.l2,b.l3,b.l4,c);
  898. fflush(out);
  899. *(ffi_arg*)retp = r;
  900. }}
  901. void l_l2K_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  902. {
  903. if (data != (void*)&l_l2K) { fprintf(out,"wrong data for l_l2K\n"); exit(1); }
  904. {long a1 = *(long*)(*args++);
  905. long a2 = *(long*)(*args++);
  906. K b = *(K*)(*args++);
  907. long c = *(long*)(*args++);
  908. long r = a1 + a2 + b.l1 + b.l2 + b.l3 + b.l4 + c;
  909. fprintf(out,"long f(2*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,b.l1,b.l2,b.l3,b.l4,c);
  910. fflush(out);
  911. *(ffi_arg*)retp = r;
  912. }}
  913. void l_l3K_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  914. {
  915. if (data != (void*)&l_l3K) { fprintf(out,"wrong data for l_l3K\n"); exit(1); }
  916. {long a1 = *(long*)(*args++);
  917. long a2 = *(long*)(*args++);
  918. long a3 = *(long*)(*args++);
  919. K b = *(K*)(*args++);
  920. long c = *(long*)(*args++);
  921. long r = a1 + a2 + a3 + b.l1 + b.l2 + b.l3 + b.l4 + c;
  922. fprintf(out,"long f(3*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,b.l1,b.l2,b.l3,b.l4,c);
  923. fflush(out);
  924. *(ffi_arg*)retp = r;
  925. }}
  926. void l_l4K_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  927. {
  928. if (data != (void*)&l_l4K) { fprintf(out,"wrong data for l_l4K\n"); exit(1); }
  929. {long a1 = *(long*)(*args++);
  930. long a2 = *(long*)(*args++);
  931. long a3 = *(long*)(*args++);
  932. long a4 = *(long*)(*args++);
  933. K b = *(K*)(*args++);
  934. long c = *(long*)(*args++);
  935. long r = a1 + a2 + a3 + a4 + b.l1 + b.l2 + b.l3 + b.l4 + c;
  936. fprintf(out,"long f(4*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,b.l1,b.l2,b.l3,b.l4,c);
  937. fflush(out);
  938. *(ffi_arg*)retp = r;
  939. }}
  940. void l_l5K_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  941. {
  942. if (data != (void*)&l_l5K) { fprintf(out,"wrong data for l_l5K\n"); exit(1); }
  943. {long a1 = *(long*)(*args++);
  944. long a2 = *(long*)(*args++);
  945. long a3 = *(long*)(*args++);
  946. long a4 = *(long*)(*args++);
  947. long a5 = *(long*)(*args++);
  948. K b = *(K*)(*args++);
  949. long c = *(long*)(*args++);
  950. long r = a1 + a2 + a3 + a4 + a5 + b.l1 + b.l2 + b.l3 + b.l4 + c;
  951. fprintf(out,"long f(5*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,b.l1,b.l2,b.l3,b.l4,c);
  952. fflush(out);
  953. *(ffi_arg*)retp = r;
  954. }}
  955. void l_l6K_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  956. {
  957. if (data != (void*)&l_l6K) { fprintf(out,"wrong data for l_l6K\n"); exit(1); }
  958. {long a1 = *(long*)(*args++);
  959. long a2 = *(long*)(*args++);
  960. long a3 = *(long*)(*args++);
  961. long a4 = *(long*)(*args++);
  962. long a5 = *(long*)(*args++);
  963. long a6 = *(long*)(*args++);
  964. K b = *(K*)(*args++);
  965. long c = *(long*)(*args++);
  966. long r = a1 + a2 + a3 + a4 + a5 + a6 + b.l1 + b.l2 + b.l3 + b.l4 + c;
  967. fprintf(out,"long f(6*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,b.l1,b.l2,b.l3,b.l4,c);
  968. fflush(out);
  969. *(ffi_arg*)retp = r;
  970. }}
  971. void f_f17l3L_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  972. {
  973. if (data != (void*)&f_f17l3L) { fprintf(out,"wrong data for f_f17l3L\n"); exit(1); }
  974. {float a = *(float*)(*args++);
  975. float b = *(float*)(*args++);
  976. float c = *(float*)(*args++);
  977. float d = *(float*)(*args++);
  978. float e = *(float*)(*args++);
  979. float f = *(float*)(*args++);
  980. float g = *(float*)(*args++);
  981. float h = *(float*)(*args++);
  982. float i = *(float*)(*args++);
  983. float j = *(float*)(*args++);
  984. float k = *(float*)(*args++);
  985. float l = *(float*)(*args++);
  986. float m = *(float*)(*args++);
  987. float n = *(float*)(*args++);
  988. float o = *(float*)(*args++);
  989. float p = *(float*)(*args++);
  990. float q = *(float*)(*args++);
  991. long s = *(long*)(*args++);
  992. long t = *(long*)(*args++);
  993. long u = *(long*)(*args++);
  994. L z = *(L*)(*args++);
  995. float r = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+z.l1+z.l2+z.l3+z.l4+z.l5+z.l6;
  996. fprintf(out,"float f(17*float,3*int,L):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,z.l1,z.l2,z.l3,z.l4,z.l5,z.l6);
  997. fflush(out);
  998. *(float*)retp = r;
  999. }}
  1000. void d_d17l3L_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1001. {
  1002. if (data != (void*)&d_d17l3L) { fprintf(out,"wrong data for d_d17l3L\n"); exit(1); }
  1003. {double a = *(double*)(*args++);
  1004. double b = *(double*)(*args++);
  1005. double c = *(double*)(*args++);
  1006. double d = *(double*)(*args++);
  1007. double e = *(double*)(*args++);
  1008. double f = *(double*)(*args++);
  1009. double g = *(double*)(*args++);
  1010. double h = *(double*)(*args++);
  1011. double i = *(double*)(*args++);
  1012. double j = *(double*)(*args++);
  1013. double k = *(double*)(*args++);
  1014. double l = *(double*)(*args++);
  1015. double m = *(double*)(*args++);
  1016. double n = *(double*)(*args++);
  1017. double o = *(double*)(*args++);
  1018. double p = *(double*)(*args++);
  1019. double q = *(double*)(*args++);
  1020. long s = *(long*)(*args++);
  1021. long t = *(long*)(*args++);
  1022. long u = *(long*)(*args++);
  1023. L z = *(L*)(*args++);
  1024. double r = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+z.l1+z.l2+z.l3+z.l4+z.l5+z.l6;
  1025. fprintf(out,"double f(17*double,3*int,L):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,z.l1,z.l2,z.l3,z.l4,z.l5,z.l6);
  1026. fflush(out);
  1027. *(double*)retp = r;
  1028. }}
  1029. void ll_l2ll_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1030. {
  1031. if (data != (void*)&ll_l2ll) { fprintf(out,"wrong data for ll_l2ll\n"); exit(1); }
  1032. {long a1 = *(long*)(*args++);
  1033. long a2 = *(long*)(*args++);
  1034. long long b = *(long long *)(*args++);
  1035. long c = *(long*)(*args++);
  1036. long long r = (long long) (a1 + a2) + b + c;
  1037. fprintf(out,"long long f(2*long,long long,long):(%ld,%ld,0x%lx%08lx,%ld)",a1,a2,(long)(b>>32),(long)(b&0xffffffff),c);
  1038. fflush(out);
  1039. *(long long *)retp = r;
  1040. }}
  1041. void ll_l3ll_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1042. {
  1043. if (data != (void*)&ll_l3ll) { fprintf(out,"wrong data for ll_l3ll\n"); exit(1); }
  1044. {long a1 = *(long*)(*args++);
  1045. long a2 = *(long*)(*args++);
  1046. long a3 = *(long*)(*args++);
  1047. long long b = *(long long *)(*args++);
  1048. long c = *(long*)(*args++);
  1049. long long r = (long long) (a1 + a2 + a3) + b + c;
  1050. fprintf(out,"long long f(3*long,long long,long):(%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,(long)(b>>32),(long)(b&0xffffffff),c);
  1051. fflush(out);
  1052. *(long long *)retp = r;
  1053. }}
  1054. void ll_l4ll_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1055. {
  1056. if (data != (void*)&ll_l4ll) { fprintf(out,"wrong data for ll_l4ll\n"); exit(1); }
  1057. {long a1 = *(long*)(*args++);
  1058. long a2 = *(long*)(*args++);
  1059. long a3 = *(long*)(*args++);
  1060. long a4 = *(long*)(*args++);
  1061. long long b = *(long long *)(*args++);
  1062. long c = *(long*)(*args++);
  1063. long long r = (long long) (a1 + a2 + a3 + a4) + b + c;
  1064. fprintf(out,"long long f(4*long,long long,long):(%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,(long)(b>>32),(long)(b&0xffffffff),c);
  1065. fflush(out);
  1066. *(long long *)retp = r;
  1067. }}
  1068. void ll_l5ll_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1069. {
  1070. if (data != (void*)&ll_l5ll) { fprintf(out,"wrong data for ll_l5ll\n"); exit(1); }
  1071. {long a1 = *(long*)(*args++);
  1072. long a2 = *(long*)(*args++);
  1073. long a3 = *(long*)(*args++);
  1074. long a4 = *(long*)(*args++);
  1075. long a5 = *(long*)(*args++);
  1076. long long b = *(long long *)(*args++);
  1077. long c = *(long*)(*args++);
  1078. long long r = (long long) (a1 + a2 + a3 + a4 + a5) + b + c;
  1079. fprintf(out,"long long f(5*long,long long,long):(%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,(long)(b>>32),(long)(b&0xffffffff),c);
  1080. fflush(out);
  1081. *(long long *)retp = r;
  1082. }}
  1083. void ll_l6ll_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1084. {
  1085. if (data != (void*)&ll_l6ll) { fprintf(out,"wrong data for ll_l6ll\n"); exit(1); }
  1086. {long a1 = *(long*)(*args++);
  1087. long a2 = *(long*)(*args++);
  1088. long a3 = *(long*)(*args++);
  1089. long a4 = *(long*)(*args++);
  1090. long a5 = *(long*)(*args++);
  1091. long a6 = *(long*)(*args++);
  1092. long long b = *(long long *)(*args++);
  1093. long c = *(long*)(*args++);
  1094. long long r = (long long) (a1 + a2 + a3 + a4 + a5 + a6) + b + c;
  1095. fprintf(out,"long long f(6*long,long long,long):(%ld,%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,a6,(long)(b>>32),(long)(b&0xffffffff),c);
  1096. fflush(out);
  1097. *(long long *)retp = r;
  1098. }}
  1099. void ll_l7ll_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1100. {
  1101. if (data != (void*)&ll_l7ll) { fprintf(out,"wrong data for ll_l7ll\n"); exit(1); }
  1102. {long a1 = *(long*)(*args++);
  1103. long a2 = *(long*)(*args++);
  1104. long a3 = *(long*)(*args++);
  1105. long a4 = *(long*)(*args++);
  1106. long a5 = *(long*)(*args++);
  1107. long a6 = *(long*)(*args++);
  1108. long a7 = *(long*)(*args++);
  1109. long long b = *(long long *)(*args++);
  1110. long c = *(long*)(*args++);
  1111. long long r = (long long) (a1 + a2 + a3 + a4 + a5 + a6 + a7) + b + c;
  1112. fprintf(out,"long long f(7*long,long long,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,a6,a7,(long)(b>>32),(long)(b&0xffffffff),c);
  1113. fflush(out);
  1114. *(long long *)retp = r;
  1115. }}
  1116. void d_l2d_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1117. {
  1118. if (data != (void*)&d_l2d) { fprintf(out,"wrong data for d_l2d\n"); exit(1); }
  1119. {long a1 = *(long*)(*args++);
  1120. long a2 = *(long*)(*args++);
  1121. double b = *(double*)(*args++);
  1122. long c = *(long*)(*args++);
  1123. double r = (double) (a1 + a2) + b + c;
  1124. fprintf(out,"double f(2*long,double,long):(%ld,%ld,%g,%ld)",a1,a2,b,c);
  1125. fflush(out);
  1126. *(double*)retp = r;
  1127. }}
  1128. void d_l3d_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1129. {
  1130. if (data != (void*)&d_l3d) { fprintf(out,"wrong data for d_l3d\n"); exit(1); }
  1131. {long a1 = *(long*)(*args++);
  1132. long a2 = *(long*)(*args++);
  1133. long a3 = *(long*)(*args++);
  1134. double b = *(double*)(*args++);
  1135. long c = *(long*)(*args++);
  1136. double r = (double) (a1 + a2 + a3) + b + c;
  1137. fprintf(out,"double f(3*long,double,long):(%ld,%ld,%ld,%g,%ld)",a1,a2,a3,b,c);
  1138. fflush(out);
  1139. *(double*)retp = r;
  1140. }}
  1141. void d_l4d_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1142. {
  1143. if (data != (void*)&d_l4d) { fprintf(out,"wrong data for d_l4d\n"); exit(1); }
  1144. {long a1 = *(long*)(*args++);
  1145. long a2 = *(long*)(*args++);
  1146. long a3 = *(long*)(*args++);
  1147. long a4 = *(long*)(*args++);
  1148. double b = *(double*)(*args++);
  1149. long c = *(long*)(*args++);
  1150. double r = (double) (a1 + a2 + a3 + a4) + b + c;
  1151. fprintf(out,"double f(4*long,double,long):(%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,b,c);
  1152. fflush(out);
  1153. *(double*)retp = r;
  1154. }}
  1155. void d_l5d_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1156. {
  1157. if (data != (void*)&d_l5d) { fprintf(out,"wrong data for d_l5d\n"); exit(1); }
  1158. {long a1 = *(long*)(*args++);
  1159. long a2 = *(long*)(*args++);
  1160. long a3 = *(long*)(*args++);
  1161. long a4 = *(long*)(*args++);
  1162. long a5 = *(long*)(*args++);
  1163. double b = *(double*)(*args++);
  1164. long c = *(long*)(*args++);
  1165. double r = (double) (a1 + a2 + a3 + a4 + a5) + b + c;
  1166. fprintf(out,"double f(5*long,double,long):(%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,b,c);
  1167. fflush(out);
  1168. *(double*)retp = r;
  1169. }}
  1170. void d_l6d_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1171. {
  1172. if (data != (void*)&d_l6d) { fprintf(out,"wrong data for d_l6d\n"); exit(1); }
  1173. {long a1 = *(long*)(*args++);
  1174. long a2 = *(long*)(*args++);
  1175. long a3 = *(long*)(*args++);
  1176. long a4 = *(long*)(*args++);
  1177. long a5 = *(long*)(*args++);
  1178. long a6 = *(long*)(*args++);
  1179. double b = *(double*)(*args++);
  1180. long c = *(long*)(*args++);
  1181. double r = (double) (a1 + a2 + a3 + a4 + a5 + a6) + b + c;
  1182. fprintf(out,"double f(6*long,double,long):(%ld,%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,a6,b,c);
  1183. fflush(out);
  1184. *(double*)retp = r;
  1185. }}
  1186. void d_l7d_simulator (ffi_cif* cif, void* retp, /*const*/ void* /*const*/ *args, void* data)
  1187. {
  1188. if (data != (void*)&d_l7d) { fprintf(out,"wrong data for d_l7d\n"); exit(1); }
  1189. {long a1 = *(long*)(*args++);
  1190. long a2 = *(long*)(*args++);
  1191. long a3 = *(long*)(*args++);
  1192. long a4 = *(long*)(*args++);
  1193. long a5 = *(long*)(*args++);
  1194. long a6 = *(long*)(*args++);
  1195. long a7 = *(long*)(*args++);
  1196. double b = *(double*)(*args++);
  1197. long c = *(long*)(*args++);
  1198. double r = (double) (a1 + a2 + a3 + a4 + a5 + a6 + a7) + b + c;
  1199. fprintf(out,"double f(7*long,double,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,a6,a7,b,c);
  1200. fflush(out);
  1201. *(double*)retp = r;
  1202. }}
  1203. /*
  1204. * The way we run these tests - first call the function directly, then
  1205. * through vacall() - there is the danger that arguments or results seem
  1206. * to be passed correctly, but what we are seeing are in fact the vestiges
  1207. * (traces) or the previous call. This may seriously fake the test.
  1208. * Avoid this by clearing the registers between the first and the second call.
  1209. */
  1210. long clear_traces_i (long a, long b, long c, long d, long e, long f, long g, long h,
  1211. long i, long j, long k, long l, long m, long n, long o, long p)
  1212. { return 0; }
  1213. float clear_traces_f (float a, float b, float c, float d, float e, float f, float g,
  1214. float h, float i, float j, float k, float l, float m, float n,
  1215. float o, float p)
  1216. { return 0.0; }
  1217. double clear_traces_d (double a, double b, double c, double d, double e, double f, double g,
  1218. double h, double i, double j, double k, double l, double m, double n,
  1219. double o, double p)
  1220. { return 0.0; }
  1221. J clear_traces_J (void)
  1222. { J j; j.l1 = j.l2 = 0; return j; }
  1223. void clear_traces (void)
  1224. { clear_traces_i(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
  1225. clear_traces_f(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0);
  1226. clear_traces_d(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0);
  1227. clear_traces_J();
  1228. }
  1229. int main (void)
  1230. {
  1231. void* callback_code;
  1232. void* callback_writable;
  1233. #define ALLOC_CALLBACK() \
  1234. callback_writable = ffi_closure_alloc(sizeof(ffi_closure),&callback_code); \
  1235. if (!callback_writable) abort()
  1236. #define PREP_CALLBACK(cif,simulator,data) \
  1237. if (ffi_prep_closure_loc(callback_writable,&(cif),simulator,data,callback_code) != FFI_OK) abort()
  1238. #define FREE_CALLBACK() \
  1239. ffi_closure_free(callback_writable)
  1240. ffi_type_char = (char)(-1) < 0 ? ffi_type_schar : ffi_type_uchar;
  1241. out = stdout;
  1242. #if (!defined(DGTEST)) || DGTEST == 1
  1243. /* void tests */
  1244. v_v();
  1245. clear_traces();
  1246. ALLOC_CALLBACK();
  1247. {
  1248. ffi_cif cif;
  1249. FFI_PREP_CIF_NOARGS(cif,ffi_type_void);
  1250. PREP_CALLBACK(cif,v_v_simulator,(void*)&v_v);
  1251. ((void (ABI_ATTR *) (void)) callback_code) ();
  1252. }
  1253. FREE_CALLBACK();
  1254. #endif
  1255. /* int tests */
  1256. { int ir;
  1257. #if (!defined(DGTEST)) || DGTEST == 2
  1258. ir = i_v();
  1259. fprintf(out,"->%d\n",ir);
  1260. fflush(out);
  1261. ir = 0; clear_traces();
  1262. ALLOC_CALLBACK();
  1263. {
  1264. ffi_cif cif;
  1265. FFI_PREP_CIF_NOARGS(cif,ffi_type_sint);
  1266. PREP_CALLBACK(cif,i_v_simulator,(void*)&i_v);
  1267. ir = ((int (ABI_ATTR *) (void)) callback_code) ();
  1268. }
  1269. FREE_CALLBACK();
  1270. fprintf(out,"->%d\n",ir);
  1271. fflush(out);
  1272. #endif
  1273. #if (!defined(DGTEST)) || DGTEST == 3
  1274. ir = i_i(i1);
  1275. fprintf(out,"->%d\n",ir);
  1276. fflush(out);
  1277. ir = 0; clear_traces();
  1278. ALLOC_CALLBACK();
  1279. {
  1280. ffi_type* argtypes[] = { &ffi_type_sint };
  1281. ffi_cif cif;
  1282. FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
  1283. PREP_CALLBACK(cif,i_i_simulator,(void*)&i_i);
  1284. ir = ((int (ABI_ATTR *) (int)) callback_code) (i1);
  1285. }
  1286. FREE_CALLBACK();
  1287. fprintf(out,"->%d\n",ir);
  1288. fflush(out);
  1289. #endif
  1290. #if (!defined(DGTEST)) || DGTEST == 4
  1291. ir = i_i2(i1,i2);
  1292. fprintf(out,"->%d\n",ir);
  1293. fflush(out);
  1294. ir = 0; clear_traces();
  1295. ALLOC_CALLBACK();
  1296. {
  1297. ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint };
  1298. ffi_cif cif;
  1299. FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
  1300. PREP_CALLBACK(cif,i_i2_simulator,(void*)&i_i2);
  1301. ir = ((int (ABI_ATTR *) (int,int)) callback_code) (i1,i2);
  1302. }
  1303. FREE_CALLBACK();
  1304. fprintf(out,"->%d\n",ir);
  1305. fflush(out);
  1306. #endif
  1307. #if (!defined(DGTEST)) || DGTEST == 5
  1308. ir = i_i4(i1,i2,i3,i4);
  1309. fprintf(out,"->%d\n",ir);
  1310. fflush(out);
  1311. ir = 0; clear_traces();
  1312. ALLOC_CALLBACK();
  1313. {
  1314. ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint };
  1315. ffi_cif cif;
  1316. FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
  1317. PREP_CALLBACK(cif,i_i4_simulator,(void*)&i_i4);
  1318. ir = ((int (ABI_ATTR *) (int,int,int,int)) callback_code) (i1,i2,i3,i4);
  1319. }
  1320. FREE_CALLBACK();
  1321. fprintf(out,"->%d\n",ir);
  1322. fflush(out);
  1323. #endif
  1324. #if (!defined(DGTEST)) || DGTEST == 6
  1325. ir = i_i8(i1,i2,i3,i4,i5,i6,i7,i8);
  1326. fprintf(out,"->%d\n",ir);
  1327. fflush(out);
  1328. ir = 0; clear_traces();
  1329. ALLOC_CALLBACK();
  1330. {
  1331. ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint };
  1332. ffi_cif cif;
  1333. FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
  1334. PREP_CALLBACK(cif,i_i8_simulator,(void*)&i_i8);
  1335. ir = ((int (ABI_ATTR *) (int,int,int,int,int,int,int,int)) callback_code) (i1,i2,i3,i4,i5,i6,i7,i8);
  1336. }
  1337. FREE_CALLBACK();
  1338. fprintf(out,"->%d\n",ir);
  1339. fflush(out);
  1340. #endif
  1341. #if (!defined(DGTEST)) || DGTEST == 7
  1342. ir = i_i16(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16);
  1343. fprintf(out,"->%d\n",ir);
  1344. fflush(out);
  1345. ir = 0; clear_traces();
  1346. ALLOC_CALLBACK();
  1347. {
  1348. ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint };
  1349. ffi_cif cif;
  1350. FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
  1351. PREP_CALLBACK(cif,i_i16_simulator,(void*)&i_i16);
  1352. ir = ((int (ABI_ATTR *) (int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int)) callback_code) (i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16);
  1353. }
  1354. FREE_CALLBACK();
  1355. fprintf(out,"->%d\n",ir);
  1356. fflush(out);
  1357. #endif
  1358. }
  1359. /* float tests */
  1360. { float fr;
  1361. #if (!defined(DGTEST)) || DGTEST == 8
  1362. fr = f_f(f1);
  1363. fprintf(out,"->%g\n",fr);
  1364. fflush(out);
  1365. fr = 0.0; clear_traces();
  1366. ALLOC_CALLBACK();
  1367. {
  1368. ffi_type* argtypes[] = { &ffi_type_float };
  1369. ffi_cif cif;
  1370. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1371. PREP_CALLBACK(cif,f_f_simulator,(void*)&f_f);
  1372. fr = ((float (ABI_ATTR *) (float)) callback_code) (f1);
  1373. }
  1374. FREE_CALLBACK();
  1375. fprintf(out,"->%g\n",fr);
  1376. fflush(out);
  1377. #endif
  1378. #if (!defined(DGTEST)) || DGTEST == 9
  1379. fr = f_f2(f1,f2);
  1380. fprintf(out,"->%g\n",fr);
  1381. fflush(out);
  1382. fr = 0.0; clear_traces();
  1383. ALLOC_CALLBACK();
  1384. {
  1385. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float };
  1386. ffi_cif cif;
  1387. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1388. PREP_CALLBACK(cif,f_f2_simulator,(void*)&f_f2);
  1389. fr = ((float (ABI_ATTR *) (float,float)) callback_code) (f1,f2);
  1390. }
  1391. FREE_CALLBACK();
  1392. fprintf(out,"->%g\n",fr);
  1393. fflush(out);
  1394. #endif
  1395. #if (!defined(DGTEST)) || DGTEST == 10
  1396. fr = f_f4(f1,f2,f3,f4);
  1397. fprintf(out,"->%g\n",fr);
  1398. fflush(out);
  1399. fr = 0.0; clear_traces();
  1400. ALLOC_CALLBACK();
  1401. {
  1402. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float };
  1403. ffi_cif cif;
  1404. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1405. PREP_CALLBACK(cif,f_f4_simulator,(void*)&f_f4);
  1406. fr = ((float (ABI_ATTR *) (float,float,float,float)) callback_code) (f1,f2,f3,f4);
  1407. }
  1408. FREE_CALLBACK();
  1409. fprintf(out,"->%g\n",fr);
  1410. fflush(out);
  1411. #endif
  1412. #if (!defined(DGTEST)) || DGTEST == 11
  1413. fr = f_f8(f1,f2,f3,f4,f5,f6,f7,f8);
  1414. fprintf(out,"->%g\n",fr);
  1415. fflush(out);
  1416. fr = 0.0; clear_traces();
  1417. ALLOC_CALLBACK();
  1418. {
  1419. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float };
  1420. ffi_cif cif;
  1421. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1422. PREP_CALLBACK(cif,f_f8_simulator,(void*)&f_f8);
  1423. fr = ((float (ABI_ATTR *) (float,float,float,float,float,float,float,float)) callback_code) (f1,f2,f3,f4,f5,f6,f7,f8);
  1424. }
  1425. FREE_CALLBACK();
  1426. fprintf(out,"->%g\n",fr);
  1427. fflush(out);
  1428. #endif
  1429. #if (!defined(DGTEST)) || DGTEST == 12
  1430. fr = f_f16(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16);
  1431. fprintf(out,"->%g\n",fr);
  1432. fflush(out);
  1433. fr = 0.0; clear_traces();
  1434. ALLOC_CALLBACK();
  1435. {
  1436. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float };
  1437. ffi_cif cif;
  1438. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1439. PREP_CALLBACK(cif,f_f16_simulator,(void*)&f_f16);
  1440. fr = ((float (ABI_ATTR *) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float)) callback_code) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16);
  1441. }
  1442. FREE_CALLBACK();
  1443. fprintf(out,"->%g\n",fr);
  1444. fflush(out);
  1445. #endif
  1446. #if (!defined(DGTEST)) || DGTEST == 13
  1447. fr = f_f24(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24);
  1448. fprintf(out,"->%g\n",fr);
  1449. fflush(out);
  1450. fr = 0.0; clear_traces();
  1451. ALLOC_CALLBACK();
  1452. {
  1453. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float };
  1454. ffi_cif cif;
  1455. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1456. PREP_CALLBACK(cif,f_f24_simulator,(void*)&f_f24);
  1457. fr = ((float (ABI_ATTR *) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float)) callback_code) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24);
  1458. }
  1459. FREE_CALLBACK();
  1460. fprintf(out,"->%g\n",fr);
  1461. fflush(out);
  1462. #endif
  1463. }
  1464. /* double tests */
  1465. { double dr;
  1466. #if (!defined(DGTEST)) || DGTEST == 14
  1467. dr = d_d(d1);
  1468. fprintf(out,"->%g\n",dr);
  1469. fflush(out);
  1470. dr = 0.0; clear_traces();
  1471. ALLOC_CALLBACK();
  1472. {
  1473. ffi_type* argtypes[] = { &ffi_type_double };
  1474. ffi_cif cif;
  1475. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1476. PREP_CALLBACK(cif,d_d_simulator,(void*)&d_d);
  1477. dr = ((double (ABI_ATTR *) (double)) callback_code) (d1);
  1478. }
  1479. FREE_CALLBACK();
  1480. fprintf(out,"->%g\n",dr);
  1481. fflush(out);
  1482. #endif
  1483. #if (!defined(DGTEST)) || DGTEST == 15
  1484. dr = d_d2(d1,d2);
  1485. fprintf(out,"->%g\n",dr);
  1486. fflush(out);
  1487. dr = 0.0; clear_traces();
  1488. ALLOC_CALLBACK();
  1489. {
  1490. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double };
  1491. ffi_cif cif;
  1492. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1493. PREP_CALLBACK(cif,d_d2_simulator,(void*)&d_d2);
  1494. dr = ((double (ABI_ATTR *) (double,double)) callback_code) (d1,d2);
  1495. }
  1496. FREE_CALLBACK();
  1497. fprintf(out,"->%g\n",dr);
  1498. fflush(out);
  1499. #endif
  1500. #if (!defined(DGTEST)) || DGTEST == 16
  1501. dr = d_d4(d1,d2,d3,d4);
  1502. fprintf(out,"->%g\n",dr);
  1503. fflush(out);
  1504. dr = 0.0; clear_traces();
  1505. ALLOC_CALLBACK();
  1506. {
  1507. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double };
  1508. ffi_cif cif;
  1509. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1510. PREP_CALLBACK(cif,d_d4_simulator,(void*)&d_d4);
  1511. dr = ((double (ABI_ATTR *) (double,double,double,double)) callback_code) (d1,d2,d3,d4);
  1512. }
  1513. FREE_CALLBACK();
  1514. fprintf(out,"->%g\n",dr);
  1515. fflush(out);
  1516. #endif
  1517. #if (!defined(DGTEST)) || DGTEST == 17
  1518. dr = d_d8(d1,d2,d3,d4,d5,d6,d7,d8);
  1519. fprintf(out,"->%g\n",dr);
  1520. fflush(out);
  1521. dr = 0.0; clear_traces();
  1522. ALLOC_CALLBACK();
  1523. {
  1524. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double };
  1525. ffi_cif cif;
  1526. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1527. PREP_CALLBACK(cif,d_d8_simulator,(void*)&d_d8);
  1528. dr = ((double (ABI_ATTR *) (double,double,double,double,double,double,double,double)) callback_code) (d1,d2,d3,d4,d5,d6,d7,d8);
  1529. }
  1530. FREE_CALLBACK();
  1531. fprintf(out,"->%g\n",dr);
  1532. fflush(out);
  1533. #endif
  1534. #if (!defined(DGTEST)) || DGTEST == 18
  1535. dr = d_d16(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16);
  1536. fprintf(out,"->%g\n",dr);
  1537. fflush(out);
  1538. dr = 0.0; clear_traces();
  1539. ALLOC_CALLBACK();
  1540. {
  1541. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double };
  1542. ffi_cif cif;
  1543. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1544. PREP_CALLBACK(cif,d_d16_simulator,(void*)&d_d16);
  1545. dr = ((double (ABI_ATTR *) (double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double)) callback_code) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16);
  1546. }
  1547. FREE_CALLBACK();
  1548. fprintf(out,"->%g\n",dr);
  1549. fflush(out);
  1550. #endif
  1551. }
  1552. /* pointer tests */
  1553. { void* vpr;
  1554. #if (!defined(DGTEST)) || DGTEST == 19
  1555. vpr = vp_vpdpcpsp(&uc1,&d2,str3,&I4);
  1556. fprintf(out,"->0x%p\n",vpr);
  1557. fflush(out);
  1558. vpr = 0; clear_traces();
  1559. ALLOC_CALLBACK();
  1560. {
  1561. ffi_type* argtypes[] = { &ffi_type_pointer, &ffi_type_pointer, &ffi_type_pointer, &ffi_type_pointer };
  1562. ffi_cif cif;
  1563. FFI_PREP_CIF(cif,argtypes,ffi_type_pointer);
  1564. PREP_CALLBACK(cif,vp_vpdpcpsp_simulator,(void*)&vp_vpdpcpsp);
  1565. vpr = ((void* (ABI_ATTR *) (void*,double*,char*,Int*)) callback_code) (&uc1,&d2,str3,&I4);
  1566. }
  1567. FREE_CALLBACK();
  1568. fprintf(out,"->0x%p\n",vpr);
  1569. fflush(out);
  1570. #endif
  1571. }
  1572. /* mixed number tests */
  1573. { uchar ucr;
  1574. ushort usr;
  1575. float fr;
  1576. double dr;
  1577. long long llr;
  1578. #if (!defined(DGTEST)) || DGTEST == 20
  1579. ucr = uc_ucsil(uc1,us2,ui3,ul4);
  1580. fprintf(out,"->%u\n",ucr);
  1581. fflush(out);
  1582. ucr = 0; clear_traces();
  1583. ALLOC_CALLBACK();
  1584. {
  1585. ffi_type* argtypes[] = { &ffi_type_uchar, &ffi_type_ushort, &ffi_type_uint, &ffi_type_ulong };
  1586. ffi_cif cif;
  1587. FFI_PREP_CIF(cif,argtypes,ffi_type_uchar);
  1588. PREP_CALLBACK(cif,uc_ucsil_simulator,(void*)&uc_ucsil);
  1589. ucr = ((uchar (ABI_ATTR *) (uchar,ushort,uint,ulong)) callback_code) (uc1,us2,ui3,ul4);
  1590. }
  1591. FREE_CALLBACK();
  1592. fprintf(out,"->%u\n",ucr);
  1593. fflush(out);
  1594. #endif
  1595. #if (!defined(DGTEST)) || DGTEST == 21
  1596. dr = d_iidd(i1,i2,d3,d4);
  1597. fprintf(out,"->%g\n",dr);
  1598. fflush(out);
  1599. dr = 0.0; clear_traces();
  1600. ALLOC_CALLBACK();
  1601. {
  1602. ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_double, &ffi_type_double };
  1603. ffi_cif cif;
  1604. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1605. PREP_CALLBACK(cif,d_iidd_simulator,(void*)&d_iidd);
  1606. dr = ((double (ABI_ATTR *) (int,int,double,double)) callback_code) (i1,i2,d3,d4);
  1607. }
  1608. FREE_CALLBACK();
  1609. fprintf(out,"->%g\n",dr);
  1610. fflush(out);
  1611. #endif
  1612. #if (!defined(DGTEST)) || DGTEST == 22
  1613. dr = d_iiidi(i1,i2,i3,d4,i5);
  1614. fprintf(out,"->%g\n",dr);
  1615. fflush(out);
  1616. dr = 0.0; clear_traces();
  1617. ALLOC_CALLBACK();
  1618. {
  1619. ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_double, &ffi_type_sint };
  1620. ffi_cif cif;
  1621. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1622. PREP_CALLBACK(cif,d_iiidi_simulator,(void*)&d_iiidi);
  1623. dr = ((double (ABI_ATTR *) (int,int,int,double,int)) callback_code) (i1,i2,i3,d4,i5);
  1624. }
  1625. FREE_CALLBACK();
  1626. fprintf(out,"->%g\n",dr);
  1627. fflush(out);
  1628. #endif
  1629. #if (!defined(DGTEST)) || DGTEST == 23
  1630. dr = d_idid(i1,d2,i3,d4);
  1631. fprintf(out,"->%g\n",dr);
  1632. fflush(out);
  1633. dr = 0.0; clear_traces();
  1634. ALLOC_CALLBACK();
  1635. {
  1636. ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_double, &ffi_type_sint, &ffi_type_double };
  1637. ffi_cif cif;
  1638. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1639. PREP_CALLBACK(cif,d_idid_simulator,(void*)&d_idid);
  1640. dr = ((double (ABI_ATTR *) (int,double,int,double)) callback_code) (i1,d2,i3,d4);
  1641. }
  1642. FREE_CALLBACK();
  1643. fprintf(out,"->%g\n",dr);
  1644. fflush(out);
  1645. #endif
  1646. #if (!defined(DGTEST)) || DGTEST == 24
  1647. dr = d_fdi(f1,d2,i3);
  1648. fprintf(out,"->%g\n",dr);
  1649. fflush(out);
  1650. dr = 0.0; clear_traces();
  1651. ALLOC_CALLBACK();
  1652. {
  1653. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_double, &ffi_type_sint };
  1654. ffi_cif cif;
  1655. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1656. PREP_CALLBACK(cif,d_fdi_simulator,(void*)&d_fdi);
  1657. dr = ((double (ABI_ATTR *) (float,double,int)) callback_code) (f1,d2,i3);
  1658. }
  1659. FREE_CALLBACK();
  1660. fprintf(out,"->%g\n",dr);
  1661. fflush(out);
  1662. #endif
  1663. #if (!defined(DGTEST)) || DGTEST == 25
  1664. usr = us_cdcd(c1,d2,c3,d4);
  1665. fprintf(out,"->%u\n",usr);
  1666. fflush(out);
  1667. usr = 0; clear_traces();
  1668. ALLOC_CALLBACK();
  1669. {
  1670. ffi_type* argtypes[] = { &ffi_type_char, &ffi_type_double, &ffi_type_char, &ffi_type_double };
  1671. ffi_cif cif;
  1672. FFI_PREP_CIF(cif,argtypes,ffi_type_ushort);
  1673. PREP_CALLBACK(cif,us_cdcd_simulator,(void*)&us_cdcd);
  1674. usr = ((ushort (ABI_ATTR *) (char,double,char,double)) callback_code) (c1,d2,c3,d4);
  1675. }
  1676. FREE_CALLBACK();
  1677. fprintf(out,"->%u\n",usr);
  1678. fflush(out);
  1679. #endif
  1680. #if (!defined(DGTEST)) || DGTEST == 26
  1681. llr = ll_iiilli(i1,i2,i3,ll1,i13);
  1682. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  1683. fflush(out);
  1684. llr = 0; clear_traces();
  1685. ALLOC_CALLBACK();
  1686. {
  1687. ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_slonglong, &ffi_type_sint };
  1688. ffi_cif cif;
  1689. FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
  1690. PREP_CALLBACK(cif,ll_iiilli_simulator,(void*)&ll_iiilli);
  1691. llr = ((long long (ABI_ATTR *) (int,int,int,long long,int)) callback_code) (i1,i2,i3,ll1,i13);
  1692. }
  1693. FREE_CALLBACK();
  1694. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  1695. fflush(out);
  1696. #endif
  1697. #if (!defined(DGTEST)) || DGTEST == 27
  1698. llr = ll_flli(f13,ll1,i13);
  1699. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  1700. fflush(out);
  1701. llr = 0; clear_traces();
  1702. ALLOC_CALLBACK();
  1703. {
  1704. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_slonglong, &ffi_type_sint };
  1705. ffi_cif cif;
  1706. FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
  1707. PREP_CALLBACK(cif,ll_flli_simulator,(void*)&ll_flli);
  1708. llr = ((long long (ABI_ATTR *) (float,long long,int)) callback_code) (f13,ll1,i13);
  1709. }
  1710. FREE_CALLBACK();
  1711. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  1712. fflush(out);
  1713. #endif
  1714. #if (!defined(DGTEST)) || DGTEST == 28
  1715. fr = f_fi(f1,i9);
  1716. fprintf(out,"->%g\n",fr);
  1717. fflush(out);
  1718. fr = 0.0; clear_traces();
  1719. ALLOC_CALLBACK();
  1720. {
  1721. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_sint };
  1722. ffi_cif cif;
  1723. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1724. PREP_CALLBACK(cif,f_fi_simulator,(void*)&f_fi);
  1725. fr = ((float (ABI_ATTR *) (float,int)) callback_code) (f1,i9);
  1726. }
  1727. FREE_CALLBACK();
  1728. fprintf(out,"->%g\n",fr);
  1729. fflush(out);
  1730. #endif
  1731. #if (!defined(DGTEST)) || DGTEST == 29
  1732. fr = f_f2i(f1,f2,i9);
  1733. fprintf(out,"->%g\n",fr);
  1734. fflush(out);
  1735. fr = 0.0; clear_traces();
  1736. ALLOC_CALLBACK();
  1737. {
  1738. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_sint };
  1739. ffi_cif cif;
  1740. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1741. PREP_CALLBACK(cif,f_f2i_simulator,(void*)&f_f2i);
  1742. fr = ((float (ABI_ATTR *) (float,float,int)) callback_code) (f1,f2,i9);
  1743. }
  1744. FREE_CALLBACK();
  1745. fprintf(out,"->%g\n",fr);
  1746. fflush(out);
  1747. #endif
  1748. #if (!defined(DGTEST)) || DGTEST == 30
  1749. fr = f_f3i(f1,f2,f3,i9);
  1750. fprintf(out,"->%g\n",fr);
  1751. fflush(out);
  1752. fr = 0.0; clear_traces();
  1753. ALLOC_CALLBACK();
  1754. {
  1755. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
  1756. ffi_cif cif;
  1757. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1758. PREP_CALLBACK(cif,f_f3i_simulator,(void*)&f_f3i);
  1759. fr = ((float (ABI_ATTR *) (float,float,float,int)) callback_code) (f1,f2,f3,i9);
  1760. }
  1761. FREE_CALLBACK();
  1762. fprintf(out,"->%g\n",fr);
  1763. fflush(out);
  1764. #endif
  1765. #if (!defined(DGTEST)) || DGTEST == 31
  1766. fr = f_f4i(f1,f2,f3,f4,i9);
  1767. fprintf(out,"->%g\n",fr);
  1768. fflush(out);
  1769. fr = 0.0; clear_traces();
  1770. ALLOC_CALLBACK();
  1771. {
  1772. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
  1773. ffi_cif cif;
  1774. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1775. PREP_CALLBACK(cif,f_f4i_simulator,(void*)&f_f4i);
  1776. fr = ((float (ABI_ATTR *) (float,float,float,float,int)) callback_code) (f1,f2,f3,f4,i9);
  1777. }
  1778. FREE_CALLBACK();
  1779. fprintf(out,"->%g\n",fr);
  1780. fflush(out);
  1781. #endif
  1782. #if (!defined(DGTEST)) || DGTEST == 32
  1783. fr = f_f7i(f1,f2,f3,f4,f5,f6,f7,i9);
  1784. fprintf(out,"->%g\n",fr);
  1785. fflush(out);
  1786. fr = 0.0; clear_traces();
  1787. ALLOC_CALLBACK();
  1788. {
  1789. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
  1790. ffi_cif cif;
  1791. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1792. PREP_CALLBACK(cif,f_f7i_simulator,(void*)&f_f7i);
  1793. fr = ((float (ABI_ATTR *) (float,float,float,float,float,float,float,int)) callback_code) (f1,f2,f3,f4,f5,f6,f7,i9);
  1794. }
  1795. FREE_CALLBACK();
  1796. fprintf(out,"->%g\n",fr);
  1797. fflush(out);
  1798. #endif
  1799. #if (!defined(DGTEST)) || DGTEST == 33
  1800. fr = f_f8i(f1,f2,f3,f4,f5,f6,f7,f8,i9);
  1801. fprintf(out,"->%g\n",fr);
  1802. fflush(out);
  1803. fr = 0.0; clear_traces();
  1804. ALLOC_CALLBACK();
  1805. {
  1806. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
  1807. ffi_cif cif;
  1808. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1809. PREP_CALLBACK(cif,f_f8i_simulator,(void*)&f_f8i);
  1810. fr = ((float (ABI_ATTR *) (float,float,float,float,float,float,float,float,int)) callback_code) (f1,f2,f3,f4,f5,f6,f7,f8,i9);
  1811. }
  1812. FREE_CALLBACK();
  1813. fprintf(out,"->%g\n",fr);
  1814. fflush(out);
  1815. #endif
  1816. #if (!defined(DGTEST)) || DGTEST == 34
  1817. fr = f_f13i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,i9);
  1818. fprintf(out,"->%g\n",fr);
  1819. fflush(out);
  1820. fr = 0.0; clear_traces();
  1821. ALLOC_CALLBACK();
  1822. {
  1823. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
  1824. ffi_cif cif;
  1825. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  1826. PREP_CALLBACK(cif,f_f13i_simulator,(void*)&f_f13i);
  1827. fr = ((float (ABI_ATTR *) (float,float,float,float,float,float,float,float,float,float,float,float,float,int)) callback_code) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,i9);
  1828. }
  1829. FREE_CALLBACK();
  1830. fprintf(out,"->%g\n",fr);
  1831. fflush(out);
  1832. #endif
  1833. #if (!defined(DGTEST)) || DGTEST == 35
  1834. dr = d_di(d1,i9);
  1835. fprintf(out,"->%g\n",dr);
  1836. fflush(out);
  1837. dr = 0.0; clear_traces();
  1838. ALLOC_CALLBACK();
  1839. {
  1840. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_sint };
  1841. ffi_cif cif;
  1842. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1843. PREP_CALLBACK(cif,d_di_simulator,(void*)&d_di);
  1844. dr = ((double (ABI_ATTR *) (double,int)) callback_code) (d1,i9);
  1845. }
  1846. FREE_CALLBACK();
  1847. fprintf(out,"->%g\n",dr);
  1848. fflush(out);
  1849. #endif
  1850. #if (!defined(DGTEST)) || DGTEST == 36
  1851. dr = d_d2i(d1,d2,i9);
  1852. fprintf(out,"->%g\n",dr);
  1853. fflush(out);
  1854. dr = 0.0; clear_traces();
  1855. ALLOC_CALLBACK();
  1856. {
  1857. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_sint };
  1858. ffi_cif cif;
  1859. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1860. PREP_CALLBACK(cif,d_d2i_simulator,(void*)&d_d2i);
  1861. dr = ((double (ABI_ATTR *) (double,double,int)) callback_code) (d1,d2,i9);
  1862. }
  1863. FREE_CALLBACK();
  1864. fprintf(out,"->%g\n",dr);
  1865. fflush(out);
  1866. #endif
  1867. #if (!defined(DGTEST)) || DGTEST == 37
  1868. dr = d_d3i(d1,d2,d3,i9);
  1869. fprintf(out,"->%g\n",dr);
  1870. fflush(out);
  1871. dr = 0.0; clear_traces();
  1872. ALLOC_CALLBACK();
  1873. {
  1874. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
  1875. ffi_cif cif;
  1876. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1877. PREP_CALLBACK(cif,d_d3i_simulator,(void*)&d_d3i);
  1878. dr = ((double (ABI_ATTR *) (double,double,double,int)) callback_code) (d1,d2,d3,i9);
  1879. }
  1880. FREE_CALLBACK();
  1881. fprintf(out,"->%g\n",dr);
  1882. fflush(out);
  1883. #endif
  1884. #if (!defined(DGTEST)) || DGTEST == 38
  1885. dr = d_d4i(d1,d2,d3,d4,i9);
  1886. fprintf(out,"->%g\n",dr);
  1887. fflush(out);
  1888. dr = 0.0; clear_traces();
  1889. ALLOC_CALLBACK();
  1890. {
  1891. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
  1892. ffi_cif cif;
  1893. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1894. PREP_CALLBACK(cif,d_d4i_simulator,(void*)&d_d4i);
  1895. dr = ((double (ABI_ATTR *) (double,double,double,double,int)) callback_code) (d1,d2,d3,d4,i9);
  1896. }
  1897. FREE_CALLBACK();
  1898. fprintf(out,"->%g\n",dr);
  1899. fflush(out);
  1900. #endif
  1901. #if (!defined(DGTEST)) || DGTEST == 39
  1902. dr = d_d7i(d1,d2,d3,d4,d5,d6,d7,i9);
  1903. fprintf(out,"->%g\n",dr);
  1904. fflush(out);
  1905. dr = 0.0; clear_traces();
  1906. ALLOC_CALLBACK();
  1907. {
  1908. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
  1909. ffi_cif cif;
  1910. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1911. PREP_CALLBACK(cif,d_d7i_simulator,(void*)&d_d7i);
  1912. dr = ((double (ABI_ATTR *) (double,double,double,double,double,double,double,int)) callback_code) (d1,d2,d3,d4,d5,d6,d7,i9);
  1913. }
  1914. FREE_CALLBACK();
  1915. fprintf(out,"->%g\n",dr);
  1916. fflush(out);
  1917. #endif
  1918. #if (!defined(DGTEST)) || DGTEST == 40
  1919. dr = d_d8i(d1,d2,d3,d4,d5,d6,d7,d8,i9);
  1920. fprintf(out,"->%g\n",dr);
  1921. fflush(out);
  1922. dr = 0.0; clear_traces();
  1923. ALLOC_CALLBACK();
  1924. {
  1925. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
  1926. ffi_cif cif;
  1927. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1928. PREP_CALLBACK(cif,d_d8i_simulator,(void*)&d_d8i);
  1929. dr = ((double (ABI_ATTR *) (double,double,double,double,double,double,double,double,int)) callback_code) (d1,d2,d3,d4,d5,d6,d7,d8,i9);
  1930. }
  1931. FREE_CALLBACK();
  1932. fprintf(out,"->%g\n",dr);
  1933. fflush(out);
  1934. #endif
  1935. #if (!defined(DGTEST)) || DGTEST == 41
  1936. dr = d_d12i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,i9);
  1937. fprintf(out,"->%g\n",dr);
  1938. fflush(out);
  1939. dr = 0.0; clear_traces();
  1940. ALLOC_CALLBACK();
  1941. {
  1942. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
  1943. ffi_cif cif;
  1944. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1945. PREP_CALLBACK(cif,d_d12i_simulator,(void*)&d_d12i);
  1946. dr = ((double (ABI_ATTR *) (double,double,double,double,double,double,double,double,double,double,double,double,int)) callback_code) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,i9);
  1947. }
  1948. FREE_CALLBACK();
  1949. fprintf(out,"->%g\n",dr);
  1950. fflush(out);
  1951. #endif
  1952. #if (!defined(DGTEST)) || DGTEST == 42
  1953. dr = d_d13i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,i9);
  1954. fprintf(out,"->%g\n",dr);
  1955. fflush(out);
  1956. dr = 0.0; clear_traces();
  1957. ALLOC_CALLBACK();
  1958. {
  1959. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
  1960. ffi_cif cif;
  1961. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  1962. PREP_CALLBACK(cif,d_d13i_simulator,(void*)&d_d13i);
  1963. dr = ((double (ABI_ATTR *) (double,double,double,double,double,double,double,double,double,double,double,double,double,int)) callback_code) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,i9);
  1964. }
  1965. FREE_CALLBACK();
  1966. fprintf(out,"->%g\n",dr);
  1967. fflush(out);
  1968. #endif
  1969. }
  1970. /* small structure return tests */
  1971. #if (!defined(DGTEST)) || DGTEST == 43
  1972. {
  1973. Size1 r = S1_v();
  1974. fprintf(out,"->{%c}\n",r.x1);
  1975. fflush(out);
  1976. memset(&r,0,sizeof(r)); clear_traces();
  1977. ALLOC_CALLBACK();
  1978. {
  1979. ffi_type* ffi_type_Size1_elements[] = { &ffi_type_char, NULL };
  1980. ffi_type ffi_type_Size1;
  1981. ffi_type_Size1.type = FFI_TYPE_STRUCT;
  1982. ffi_type_Size1.size = sizeof(Size1);
  1983. ffi_type_Size1.alignment = alignof_slot(Size1);
  1984. ffi_type_Size1.elements = ffi_type_Size1_elements;
  1985. ffi_cif cif;
  1986. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size1);
  1987. PREP_CALLBACK(cif,S1_v_simulator,(void*)&S1_v);
  1988. r = ((Size1 (ABI_ATTR *) (void)) callback_code) ();
  1989. }
  1990. FREE_CALLBACK();
  1991. fprintf(out,"->{%c}\n",r.x1);
  1992. fflush(out);
  1993. }
  1994. #endif
  1995. #if (!defined(DGTEST)) || DGTEST == 44
  1996. {
  1997. Size2 r = S2_v();
  1998. fprintf(out,"->{%c%c}\n",r.x1,r.x2);
  1999. fflush(out);
  2000. memset(&r,0,sizeof(r)); clear_traces();
  2001. ALLOC_CALLBACK();
  2002. {
  2003. ffi_type* ffi_type_Size2_elements[] = { &ffi_type_char, &ffi_type_char, NULL };
  2004. ffi_type ffi_type_Size2;
  2005. ffi_type_Size2.type = FFI_TYPE_STRUCT;
  2006. ffi_type_Size2.size = sizeof(Size2);
  2007. ffi_type_Size2.alignment = alignof_slot(Size2);
  2008. ffi_type_Size2.elements = ffi_type_Size2_elements;
  2009. ffi_cif cif;
  2010. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size2);
  2011. PREP_CALLBACK(cif,S2_v_simulator,(void*)&S2_v);
  2012. r = ((Size2 (ABI_ATTR *) (void)) callback_code) ();
  2013. }
  2014. FREE_CALLBACK();
  2015. fprintf(out,"->{%c%c}\n",r.x1,r.x2);
  2016. fflush(out);
  2017. }
  2018. #endif
  2019. #if (!defined(DGTEST)) || DGTEST == 45
  2020. {
  2021. Size3 r = S3_v();
  2022. fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3);
  2023. fflush(out);
  2024. memset(&r,0,sizeof(r)); clear_traces();
  2025. ALLOC_CALLBACK();
  2026. {
  2027. ffi_type* ffi_type_Size3_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
  2028. ffi_type ffi_type_Size3;
  2029. ffi_type_Size3.type = FFI_TYPE_STRUCT;
  2030. ffi_type_Size3.size = sizeof(Size3);
  2031. ffi_type_Size3.alignment = alignof_slot(Size3);
  2032. ffi_type_Size3.elements = ffi_type_Size3_elements;
  2033. ffi_cif cif;
  2034. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size3);
  2035. PREP_CALLBACK(cif,S3_v_simulator,(void*)&S3_v);
  2036. r = ((Size3 (ABI_ATTR *) (void)) callback_code) ();
  2037. }
  2038. FREE_CALLBACK();
  2039. fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3);
  2040. fflush(out);
  2041. }
  2042. #endif
  2043. #if (!defined(DGTEST)) || DGTEST == 46
  2044. {
  2045. Size4 r = S4_v();
  2046. fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4);
  2047. fflush(out);
  2048. memset(&r,0,sizeof(r)); clear_traces();
  2049. ALLOC_CALLBACK();
  2050. {
  2051. ffi_type* ffi_type_Size4_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
  2052. ffi_type ffi_type_Size4;
  2053. ffi_type_Size4.type = FFI_TYPE_STRUCT;
  2054. ffi_type_Size4.size = sizeof(Size4);
  2055. ffi_type_Size4.alignment = alignof_slot(Size4);
  2056. ffi_type_Size4.elements = ffi_type_Size4_elements;
  2057. ffi_cif cif;
  2058. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size4);
  2059. PREP_CALLBACK(cif,S4_v_simulator,(void*)&S4_v);
  2060. r = ((Size4 (ABI_ATTR *) (void)) callback_code) ();
  2061. }
  2062. FREE_CALLBACK();
  2063. fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4);
  2064. fflush(out);
  2065. }
  2066. #endif
  2067. #if (!defined(DGTEST)) || DGTEST == 47
  2068. {
  2069. Size7 r = S7_v();
  2070. fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7);
  2071. fflush(out);
  2072. memset(&r,0,sizeof(r)); clear_traces();
  2073. ALLOC_CALLBACK();
  2074. {
  2075. ffi_type* ffi_type_Size7_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
  2076. ffi_type ffi_type_Size7;
  2077. ffi_type_Size7.type = FFI_TYPE_STRUCT;
  2078. ffi_type_Size7.size = sizeof(Size7);
  2079. ffi_type_Size7.alignment = alignof_slot(Size7);
  2080. ffi_type_Size7.elements = ffi_type_Size7_elements;
  2081. ffi_cif cif;
  2082. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size7);
  2083. PREP_CALLBACK(cif,S7_v_simulator,(void*)&S7_v);
  2084. r = ((Size7 (ABI_ATTR *) (void)) callback_code) ();
  2085. }
  2086. FREE_CALLBACK();
  2087. fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7);
  2088. fflush(out);
  2089. }
  2090. #endif
  2091. #if (!defined(DGTEST)) || DGTEST == 48
  2092. {
  2093. Size8 r = S8_v();
  2094. fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8);
  2095. fflush(out);
  2096. memset(&r,0,sizeof(r)); clear_traces();
  2097. ALLOC_CALLBACK();
  2098. {
  2099. ffi_type* ffi_type_Size8_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
  2100. ffi_type ffi_type_Size8;
  2101. ffi_type_Size8.type = FFI_TYPE_STRUCT;
  2102. ffi_type_Size8.size = sizeof(Size8);
  2103. ffi_type_Size8.alignment = alignof_slot(Size8);
  2104. ffi_type_Size8.elements = ffi_type_Size8_elements;
  2105. ffi_cif cif;
  2106. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size8);
  2107. PREP_CALLBACK(cif,S8_v_simulator,(void*)&S8_v);
  2108. r = ((Size8 (ABI_ATTR *) (void)) callback_code) ();
  2109. }
  2110. FREE_CALLBACK();
  2111. fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8);
  2112. fflush(out);
  2113. }
  2114. #endif
  2115. #if (!defined(DGTEST)) || DGTEST == 49
  2116. {
  2117. Size12 r = S12_v();
  2118. fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12);
  2119. fflush(out);
  2120. memset(&r,0,sizeof(r)); clear_traces();
  2121. ALLOC_CALLBACK();
  2122. {
  2123. ffi_type* ffi_type_Size12_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
  2124. ffi_type ffi_type_Size12;
  2125. ffi_type_Size12.type = FFI_TYPE_STRUCT;
  2126. ffi_type_Size12.size = sizeof(Size12);
  2127. ffi_type_Size12.alignment = alignof_slot(Size12);
  2128. ffi_type_Size12.elements = ffi_type_Size12_elements;
  2129. ffi_cif cif;
  2130. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size12);
  2131. PREP_CALLBACK(cif,S12_v_simulator,(void*)&S12_v);
  2132. r = ((Size12 (ABI_ATTR *) (void)) callback_code) ();
  2133. }
  2134. FREE_CALLBACK();
  2135. fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12);
  2136. fflush(out);
  2137. }
  2138. #endif
  2139. #if (!defined(DGTEST)) || DGTEST == 50
  2140. {
  2141. Size15 r = S15_v();
  2142. fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15);
  2143. fflush(out);
  2144. memset(&r,0,sizeof(r)); clear_traces();
  2145. ALLOC_CALLBACK();
  2146. {
  2147. ffi_type* ffi_type_Size15_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
  2148. ffi_type ffi_type_Size15;
  2149. ffi_type_Size15.type = FFI_TYPE_STRUCT;
  2150. ffi_type_Size15.size = sizeof(Size15);
  2151. ffi_type_Size15.alignment = alignof_slot(Size15);
  2152. ffi_type_Size15.elements = ffi_type_Size15_elements;
  2153. ffi_cif cif;
  2154. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size15);
  2155. PREP_CALLBACK(cif,S15_v_simulator,(void*)&S15_v);
  2156. r = ((Size15 (ABI_ATTR *) (void)) callback_code) ();
  2157. }
  2158. FREE_CALLBACK();
  2159. fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15);
  2160. fflush(out);
  2161. }
  2162. #endif
  2163. #if (!defined(DGTEST)) || DGTEST == 51
  2164. {
  2165. Size16 r = S16_v();
  2166. fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16);
  2167. fflush(out);
  2168. memset(&r,0,sizeof(r)); clear_traces();
  2169. ALLOC_CALLBACK();
  2170. {
  2171. ffi_type* ffi_type_Size16_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
  2172. ffi_type ffi_type_Size16;
  2173. ffi_type_Size16.type = FFI_TYPE_STRUCT;
  2174. ffi_type_Size16.size = sizeof(Size16);
  2175. ffi_type_Size16.alignment = alignof_slot(Size16);
  2176. ffi_type_Size16.elements = ffi_type_Size16_elements;
  2177. ffi_cif cif;
  2178. FFI_PREP_CIF_NOARGS(cif,ffi_type_Size16);
  2179. PREP_CALLBACK(cif,S16_v_simulator,(void*)&S16_v);
  2180. r = ((Size16 (ABI_ATTR *) (void)) callback_code) ();
  2181. }
  2182. FREE_CALLBACK();
  2183. fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16);
  2184. fflush(out);
  2185. }
  2186. #endif
  2187. /* structure tests */
  2188. { Int Ir;
  2189. Char Cr;
  2190. Float Fr;
  2191. Double Dr;
  2192. J Jr;
  2193. #ifndef SKIP_EXTRA_STRUCTS
  2194. T Tr;
  2195. X Xr;
  2196. #endif
  2197. #if (!defined(DGTEST)) || DGTEST == 52
  2198. Ir = I_III(I1,I2,I3);
  2199. fprintf(out,"->{%d}\n",Ir.x);
  2200. fflush(out);
  2201. Ir.x = 0; clear_traces();
  2202. ALLOC_CALLBACK();
  2203. {
  2204. ffi_type* ffi_type_Int_elements[] = { &ffi_type_sint, NULL };
  2205. ffi_type ffi_type_Int;
  2206. ffi_type_Int.type = FFI_TYPE_STRUCT;
  2207. ffi_type_Int.size = sizeof(Int);
  2208. ffi_type_Int.alignment = alignof_slot(Int);
  2209. ffi_type_Int.elements = ffi_type_Int_elements;
  2210. ffi_type* argtypes[] = { &ffi_type_Int, &ffi_type_Int, &ffi_type_Int };
  2211. ffi_cif cif;
  2212. FFI_PREP_CIF(cif,argtypes,ffi_type_Int);
  2213. PREP_CALLBACK(cif,I_III_simulator,(void*)&I_III);
  2214. Ir = ((Int (ABI_ATTR *) (Int,Int,Int)) callback_code) (I1,I2,I3);
  2215. }
  2216. FREE_CALLBACK();
  2217. fprintf(out,"->{%d}\n",Ir.x);
  2218. fflush(out);
  2219. #endif
  2220. #if (!defined(DGTEST)) || DGTEST == 53
  2221. Cr = C_CdC(C1,d2,C3);
  2222. fprintf(out,"->{'%c'}\n",Cr.x);
  2223. fflush(out);
  2224. Cr.x = '\0'; clear_traces();
  2225. ALLOC_CALLBACK();
  2226. {
  2227. ffi_type* ffi_type_Char_elements[] = { &ffi_type_char, NULL };
  2228. ffi_type ffi_type_Char;
  2229. ffi_type_Char.type = FFI_TYPE_STRUCT;
  2230. ffi_type_Char.size = sizeof(Char);
  2231. ffi_type_Char.alignment = alignof_slot(Char);
  2232. ffi_type_Char.elements = ffi_type_Char_elements;
  2233. ffi_type* argtypes[] = { &ffi_type_Char, &ffi_type_double, &ffi_type_Char };
  2234. ffi_cif cif;
  2235. FFI_PREP_CIF(cif,argtypes,ffi_type_Char);
  2236. PREP_CALLBACK(cif,C_CdC_simulator,(void*)&C_CdC);
  2237. Cr = ((Char (ABI_ATTR *) (Char,double,Char)) callback_code) (C1,d2,C3);
  2238. }
  2239. FREE_CALLBACK();
  2240. fprintf(out,"->{'%c'}\n",Cr.x);
  2241. fflush(out);
  2242. #endif
  2243. #if (!defined(DGTEST)) || DGTEST == 54
  2244. Fr = F_Ffd(F1,f2,d3);
  2245. fprintf(out,"->{%g}\n",Fr.x);
  2246. fflush(out);
  2247. Fr.x = 0.0; clear_traces();
  2248. ALLOC_CALLBACK();
  2249. {
  2250. ffi_type* ffi_type_Float_elements[] = { &ffi_type_float, NULL };
  2251. ffi_type ffi_type_Float;
  2252. ffi_type_Float.type = FFI_TYPE_STRUCT;
  2253. ffi_type_Float.size = sizeof(Float);
  2254. ffi_type_Float.alignment = alignof_slot(Float);
  2255. ffi_type_Float.elements = ffi_type_Float_elements;
  2256. ffi_type* argtypes[] = { &ffi_type_Float, &ffi_type_float, &ffi_type_double };
  2257. ffi_cif cif;
  2258. FFI_PREP_CIF(cif,argtypes,ffi_type_Float);
  2259. PREP_CALLBACK(cif,F_Ffd_simulator,(void*)&F_Ffd);
  2260. Fr = ((Float (ABI_ATTR *) (Float,float,double)) callback_code) (F1,f2,d3);
  2261. }
  2262. FREE_CALLBACK();
  2263. fprintf(out,"->{%g}\n",Fr.x);
  2264. fflush(out);
  2265. #endif
  2266. #if (!defined(DGTEST)) || DGTEST == 55
  2267. Dr = D_fDd(f1,D2,d3);
  2268. fprintf(out,"->{%g}\n",Dr.x);
  2269. fflush(out);
  2270. Dr.x = 0.0; clear_traces();
  2271. ALLOC_CALLBACK();
  2272. {
  2273. ffi_type* ffi_type_Double_elements[] = { &ffi_type_double, NULL };
  2274. ffi_type ffi_type_Double;
  2275. ffi_type_Double.type = FFI_TYPE_STRUCT;
  2276. ffi_type_Double.size = sizeof(Double);
  2277. ffi_type_Double.alignment = alignof_slot(Double);
  2278. ffi_type_Double.elements = ffi_type_Double_elements;
  2279. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_Double, &ffi_type_double };
  2280. ffi_cif cif;
  2281. FFI_PREP_CIF(cif,argtypes,ffi_type_Double);
  2282. PREP_CALLBACK(cif,D_fDd_simulator,(void*)&D_fDd);
  2283. Dr = ((Double (ABI_ATTR *) (float,Double,double)) callback_code) (f1,D2,d3);
  2284. }
  2285. FREE_CALLBACK();
  2286. fprintf(out,"->{%g}\n",Dr.x);
  2287. fflush(out);
  2288. #endif
  2289. #if (!defined(DGTEST)) || DGTEST == 56
  2290. Dr = D_Dfd(D1,f2,d3);
  2291. fprintf(out,"->{%g}\n",Dr.x);
  2292. fflush(out);
  2293. Dr.x = 0.0; clear_traces();
  2294. ALLOC_CALLBACK();
  2295. {
  2296. ffi_type* ffi_type_Double_elements[] = { &ffi_type_double, NULL };
  2297. ffi_type ffi_type_Double;
  2298. ffi_type_Double.type = FFI_TYPE_STRUCT;
  2299. ffi_type_Double.size = sizeof(Double);
  2300. ffi_type_Double.alignment = alignof_slot(Double);
  2301. ffi_type_Double.elements = ffi_type_Double_elements;
  2302. ffi_type* argtypes[] = { &ffi_type_Double, &ffi_type_float, &ffi_type_double };
  2303. ffi_cif cif;
  2304. FFI_PREP_CIF(cif,argtypes,ffi_type_Double);
  2305. PREP_CALLBACK(cif,D_Dfd_simulator,(void*)&D_Dfd);
  2306. Dr = ((Double (ABI_ATTR *) (Double,float,double)) callback_code) (D1,f2,d3);
  2307. }
  2308. FREE_CALLBACK();
  2309. fprintf(out,"->{%g}\n",Dr.x);
  2310. fflush(out);
  2311. #endif
  2312. #if (!defined(DGTEST)) || DGTEST == 57
  2313. Jr = J_JiJ(J1,i2,J2);
  2314. fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2);
  2315. fflush(out);
  2316. Jr.l1 = Jr.l2 = 0; clear_traces();
  2317. ALLOC_CALLBACK();
  2318. {
  2319. ffi_type* ffi_type_J_elements[] = { &ffi_type_slong, &ffi_type_slong, NULL };
  2320. ffi_type ffi_type_J;
  2321. ffi_type_J.type = FFI_TYPE_STRUCT;
  2322. ffi_type_J.size = sizeof(J);
  2323. ffi_type_J.alignment = alignof_slot(J);
  2324. ffi_type_J.elements = ffi_type_J_elements;
  2325. ffi_type* argtypes[] = { &ffi_type_J, &ffi_type_sint, &ffi_type_J };
  2326. ffi_cif cif;
  2327. FFI_PREP_CIF(cif,argtypes,ffi_type_J);
  2328. PREP_CALLBACK(cif,J_JiJ_simulator,(void*)&J_JiJ);
  2329. Jr = ((J (ABI_ATTR *) (J,int,J)) callback_code) (J1,i2,J2);
  2330. }
  2331. FREE_CALLBACK();
  2332. fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2);
  2333. fflush(out);
  2334. #endif
  2335. #ifndef SKIP_EXTRA_STRUCTS
  2336. #if (!defined(DGTEST)) || DGTEST == 58
  2337. Tr = T_TcT(T1,' ',T2);
  2338. fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]);
  2339. fflush(out);
  2340. Tr.c[0] = Tr.c[1] = Tr.c[2] = 0; clear_traces();
  2341. ALLOC_CALLBACK();
  2342. {
  2343. ffi_type* ffi_type_T_elements[] = { ??, NULL };
  2344. ffi_type ffi_type_T;
  2345. ffi_type_T.type = FFI_TYPE_STRUCT;
  2346. ffi_type_T.size = sizeof(T);
  2347. ffi_type_T.alignment = alignof_slot(T);
  2348. ffi_type_T.elements = ffi_type_T_elements;
  2349. ffi_type* argtypes[] = { &ffi_type_T, &ffi_type_char, &ffi_type_T };
  2350. ffi_cif cif;
  2351. FFI_PREP_CIF(cif,argtypes,ffi_type_T);
  2352. PREP_CALLBACK(cif,T_TcT_simulator,(void*)&T_TcT);
  2353. Tr = ((T (ABI_ATTR *) (T,char,T)) callback_code) (T1,' ',T2);
  2354. }
  2355. FREE_CALLBACK();
  2356. fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]);
  2357. fflush(out);
  2358. #endif
  2359. #ifndef SKIP_X
  2360. #if (!defined(DGTEST)) || DGTEST == 59
  2361. Xr = X_BcdB(B1,c2,d3,B2);
  2362. fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1);
  2363. fflush(out);
  2364. Xr.c[0]=Xr.c1='\0'; clear_traces();
  2365. ALLOC_CALLBACK();
  2366. {
  2367. ffi_type* ffi_type_X_elements[] = { ??, NULL };
  2368. ffi_type ffi_type_X;
  2369. ffi_type_X.type = FFI_TYPE_STRUCT;
  2370. ffi_type_X.size = sizeof(X);
  2371. ffi_type_X.alignment = alignof_slot(X);
  2372. ffi_type_X.elements = ffi_type_X_elements;
  2373. ffi_type* argtypes[] = { &ffi_type_X, &ffi_type_char, &ffi_type_double, &ffi_type_X };
  2374. ffi_cif cif;
  2375. FFI_PREP_CIF(cif,argtypes,ffi_type_X);
  2376. PREP_CALLBACK(cif,X_BcdB_simulator,(void*)&X_BcdB);
  2377. Xr = ((X (ABI_ATTR *) (B,char,double,B)) callback_code) (B1,c2,d3,B2);
  2378. }
  2379. FREE_CALLBACK();
  2380. fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1);
  2381. fflush(out);
  2382. #endif
  2383. #endif
  2384. #endif
  2385. }
  2386. /* gpargs boundary tests */
  2387. {
  2388. ffi_type* ffi_type_K_elements[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, NULL };
  2389. ffi_type ffi_type_K;
  2390. ffi_type* ffi_type_L_elements[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, NULL };
  2391. ffi_type ffi_type_L;
  2392. long lr;
  2393. long long llr;
  2394. float fr;
  2395. double dr;
  2396. ffi_type_K.type = FFI_TYPE_STRUCT;
  2397. ffi_type_K.size = sizeof(K);
  2398. ffi_type_K.alignment = alignof_slot(K);
  2399. ffi_type_K.elements = ffi_type_K_elements;
  2400. ffi_type_L.type = FFI_TYPE_STRUCT;
  2401. ffi_type_L.size = sizeof(L);
  2402. ffi_type_L.alignment = alignof_slot(L);
  2403. ffi_type_L.elements = ffi_type_L_elements;
  2404. #if (!defined(DGTEST)) || DGTEST == 60
  2405. lr = l_l0K(K1,l9);
  2406. fprintf(out,"->%ld\n",lr);
  2407. fflush(out);
  2408. lr = 0; clear_traces();
  2409. ALLOC_CALLBACK();
  2410. {
  2411. ffi_type* argtypes[] = { &ffi_type_K, &ffi_type_slong };
  2412. ffi_cif cif;
  2413. FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
  2414. PREP_CALLBACK(cif,l_l0K_simulator,(void*)l_l0K);
  2415. lr = ((long (ABI_ATTR *) (K,long)) callback_code) (K1,l9);
  2416. }
  2417. FREE_CALLBACK();
  2418. fprintf(out,"->%ld\n",lr);
  2419. fflush(out);
  2420. #endif
  2421. #if (!defined(DGTEST)) || DGTEST == 61
  2422. lr = l_l1K(l1,K1,l9);
  2423. fprintf(out,"->%ld\n",lr);
  2424. fflush(out);
  2425. lr = 0; clear_traces();
  2426. ALLOC_CALLBACK();
  2427. {
  2428. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
  2429. ffi_cif cif;
  2430. FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
  2431. PREP_CALLBACK(cif,l_l1K_simulator,(void*)l_l1K);
  2432. lr = ((long (ABI_ATTR *) (long,K,long)) callback_code) (l1,K1,l9);
  2433. }
  2434. FREE_CALLBACK();
  2435. fprintf(out,"->%ld\n",lr);
  2436. fflush(out);
  2437. #endif
  2438. #if (!defined(DGTEST)) || DGTEST == 62
  2439. lr = l_l2K(l1,l2,K1,l9);
  2440. fprintf(out,"->%ld\n",lr);
  2441. fflush(out);
  2442. lr = 0; clear_traces();
  2443. ALLOC_CALLBACK();
  2444. {
  2445. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
  2446. ffi_cif cif;
  2447. FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
  2448. PREP_CALLBACK(cif,l_l2K_simulator,(void*)l_l2K);
  2449. lr = ((long (ABI_ATTR *) (long,long,K,long)) callback_code) (l1,l2,K1,l9);
  2450. }
  2451. FREE_CALLBACK();
  2452. fprintf(out,"->%ld\n",lr);
  2453. fflush(out);
  2454. #endif
  2455. #if (!defined(DGTEST)) || DGTEST == 63
  2456. lr = l_l3K(l1,l2,l3,K1,l9);
  2457. fprintf(out,"->%ld\n",lr);
  2458. fflush(out);
  2459. lr = 0; clear_traces();
  2460. ALLOC_CALLBACK();
  2461. {
  2462. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
  2463. ffi_cif cif;
  2464. FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
  2465. PREP_CALLBACK(cif,l_l3K_simulator,(void*)l_l3K);
  2466. lr = ((long (ABI_ATTR *) (long,long,long,K,long)) callback_code) (l1,l2,l3,K1,l9);
  2467. }
  2468. FREE_CALLBACK();
  2469. fprintf(out,"->%ld\n",lr);
  2470. fflush(out);
  2471. #endif
  2472. #if (!defined(DGTEST)) || DGTEST == 64
  2473. lr = l_l4K(l1,l2,l3,l4,K1,l9);
  2474. fprintf(out,"->%ld\n",lr);
  2475. fflush(out);
  2476. lr = 0; clear_traces();
  2477. ALLOC_CALLBACK();
  2478. {
  2479. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
  2480. ffi_cif cif;
  2481. FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
  2482. PREP_CALLBACK(cif,l_l4K_simulator,(void*)l_l4K);
  2483. lr = ((long (ABI_ATTR *) (long,long,long,long,K,long)) callback_code) (l1,l2,l3,l4,K1,l9);
  2484. }
  2485. FREE_CALLBACK();
  2486. fprintf(out,"->%ld\n",lr);
  2487. fflush(out);
  2488. #endif
  2489. #if (!defined(DGTEST)) || DGTEST == 65
  2490. lr = l_l5K(l1,l2,l3,l4,l5,K1,l9);
  2491. fprintf(out,"->%ld\n",lr);
  2492. fflush(out);
  2493. lr = 0; clear_traces();
  2494. ALLOC_CALLBACK();
  2495. {
  2496. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
  2497. ffi_cif cif;
  2498. FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
  2499. PREP_CALLBACK(cif,l_l5K_simulator,(void*)l_l5K);
  2500. lr = ((long (ABI_ATTR *) (long,long,long,long,long,K,long)) callback_code) (l1,l2,l3,l4,l5,K1,l9);
  2501. }
  2502. FREE_CALLBACK();
  2503. fprintf(out,"->%ld\n",lr);
  2504. fflush(out);
  2505. #endif
  2506. #if (!defined(DGTEST)) || DGTEST == 66
  2507. lr = l_l6K(l1,l2,l3,l4,l5,l6,K1,l9);
  2508. fprintf(out,"->%ld\n",lr);
  2509. fflush(out);
  2510. lr = 0; clear_traces();
  2511. ALLOC_CALLBACK();
  2512. {
  2513. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
  2514. ffi_cif cif;
  2515. FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
  2516. PREP_CALLBACK(cif,l_l6K_simulator,(void*)l_l6K);
  2517. lr = ((long (ABI_ATTR *) (long,long,long,long,long,long,K,long)) callback_code) (l1,l2,l3,l4,l5,l6,K1,l9);
  2518. }
  2519. FREE_CALLBACK();
  2520. fprintf(out,"->%ld\n",lr);
  2521. fflush(out);
  2522. #endif
  2523. #if (!defined(DGTEST)) || DGTEST == 67
  2524. fr = f_f17l3L(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,l6,l7,l8,L1);
  2525. fprintf(out,"->%g\n",fr);
  2526. fflush(out);
  2527. fr = 0.0; clear_traces();
  2528. ALLOC_CALLBACK();
  2529. {
  2530. ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_L };
  2531. ffi_cif cif;
  2532. FFI_PREP_CIF(cif,argtypes,ffi_type_float);
  2533. PREP_CALLBACK(cif,f_f17l3L_simulator,(void*)&f_f17l3L);
  2534. fr = ((float (ABI_ATTR *) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,long,long,long,L)) callback_code) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,l6,l7,l8,L1);
  2535. }
  2536. FREE_CALLBACK();
  2537. fprintf(out,"->%g\n",fr);
  2538. fflush(out);
  2539. #endif
  2540. #if (!defined(DGTEST)) || DGTEST == 68
  2541. dr = d_d17l3L(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,l6,l7,l8,L1);
  2542. fprintf(out,"->%g\n",dr);
  2543. fflush(out);
  2544. dr = 0.0; clear_traces();
  2545. ALLOC_CALLBACK();
  2546. {
  2547. ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_L };
  2548. ffi_cif cif;
  2549. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  2550. PREP_CALLBACK(cif,d_d17l3L_simulator,(void*)&d_d17l3L);
  2551. dr = ((double (ABI_ATTR *) (double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,long,long,long,L)) callback_code) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,l6,l7,l8,L1);
  2552. }
  2553. FREE_CALLBACK();
  2554. fprintf(out,"->%g\n",dr);
  2555. fflush(out);
  2556. #endif
  2557. #if (!defined(DGTEST)) || DGTEST == 69
  2558. llr = ll_l2ll(l1,l2,ll1,l9);
  2559. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2560. fflush(out);
  2561. llr = 0; clear_traces();
  2562. ALLOC_CALLBACK();
  2563. {
  2564. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
  2565. ffi_cif cif;
  2566. FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
  2567. PREP_CALLBACK(cif,ll_l2ll_simulator,(void*)ll_l2ll);
  2568. llr = ((long long (ABI_ATTR *) (long,long,long long,long)) callback_code) (l1,l2,ll1,l9);
  2569. }
  2570. FREE_CALLBACK();
  2571. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2572. fflush(out);
  2573. #endif
  2574. #if (!defined(DGTEST)) || DGTEST == 70
  2575. llr = ll_l3ll(l1,l2,l3,ll1,l9);
  2576. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2577. fflush(out);
  2578. llr = 0; clear_traces();
  2579. ALLOC_CALLBACK();
  2580. {
  2581. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
  2582. ffi_cif cif;
  2583. FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
  2584. PREP_CALLBACK(cif,ll_l3ll_simulator,(void*)ll_l3ll);
  2585. llr = ((long long (ABI_ATTR *) (long,long,long,long long,long)) callback_code) (l1,l2,l3,ll1,l9);
  2586. }
  2587. FREE_CALLBACK();
  2588. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2589. fflush(out);
  2590. #endif
  2591. #if (!defined(DGTEST)) || DGTEST == 71
  2592. llr = ll_l4ll(l1,l2,l3,l4,ll1,l9);
  2593. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2594. fflush(out);
  2595. llr = 0; clear_traces();
  2596. ALLOC_CALLBACK();
  2597. {
  2598. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
  2599. ffi_cif cif;
  2600. FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
  2601. PREP_CALLBACK(cif,ll_l4ll_simulator,(void*)ll_l4ll);
  2602. llr = ((long long (ABI_ATTR *) (long,long,long,long,long long,long)) callback_code) (l1,l2,l3,l4,ll1,l9);
  2603. }
  2604. FREE_CALLBACK();
  2605. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2606. fflush(out);
  2607. #endif
  2608. #if (!defined(DGTEST)) || DGTEST == 72
  2609. llr = ll_l5ll(l1,l2,l3,l4,l5,ll1,l9);
  2610. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2611. fflush(out);
  2612. llr = 0; clear_traces();
  2613. ALLOC_CALLBACK();
  2614. {
  2615. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
  2616. ffi_cif cif;
  2617. FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
  2618. PREP_CALLBACK(cif,ll_l5ll_simulator,(void*)ll_l5ll);
  2619. llr = ((long long (ABI_ATTR *) (long,long,long,long,long,long long,long)) callback_code) (l1,l2,l3,l4,l5,ll1,l9);
  2620. }
  2621. FREE_CALLBACK();
  2622. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2623. fflush(out);
  2624. #endif
  2625. #if (!defined(DGTEST)) || DGTEST == 73
  2626. llr = ll_l6ll(l1,l2,l3,l4,l5,l6,ll1,l9);
  2627. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2628. fflush(out);
  2629. llr = 0; clear_traces();
  2630. ALLOC_CALLBACK();
  2631. {
  2632. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
  2633. ffi_cif cif;
  2634. FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
  2635. PREP_CALLBACK(cif,ll_l6ll_simulator,(void*)ll_l6ll);
  2636. llr = ((long long (ABI_ATTR *) (long,long,long,long,long,long,long long,long)) callback_code) (l1,l2,l3,l4,l5,l6,ll1,l9);
  2637. }
  2638. FREE_CALLBACK();
  2639. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2640. fflush(out);
  2641. #endif
  2642. #if (!defined(DGTEST)) || DGTEST == 74
  2643. llr = ll_l7ll(l1,l2,l3,l4,l5,l6,l7,ll1,l9);
  2644. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2645. fflush(out);
  2646. llr = 0; clear_traces();
  2647. ALLOC_CALLBACK();
  2648. {
  2649. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
  2650. ffi_cif cif;
  2651. FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
  2652. PREP_CALLBACK(cif,ll_l7ll_simulator,(void*)ll_l7ll);
  2653. llr = ((long long (ABI_ATTR *) (long,long,long,long,long,long,long,long long,long)) callback_code) (l1,l2,l3,l4,l5,l6,l7,ll1,l9);
  2654. }
  2655. FREE_CALLBACK();
  2656. fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
  2657. fflush(out);
  2658. #endif
  2659. #if (!defined(DGTEST)) || DGTEST == 75
  2660. dr = d_l2d(l1,l2,ll1,l9);
  2661. fprintf(out,"->%g\n",dr);
  2662. fflush(out);
  2663. dr = 0.0; clear_traces();
  2664. ALLOC_CALLBACK();
  2665. {
  2666. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
  2667. ffi_cif cif;
  2668. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  2669. PREP_CALLBACK(cif,d_l2d_simulator,(void*)d_l2d);
  2670. dr = ((double (ABI_ATTR *) (long,long,double,long)) callback_code) (l1,l2,ll1,l9);
  2671. }
  2672. FREE_CALLBACK();
  2673. fprintf(out,"->%g\n",dr);
  2674. fflush(out);
  2675. #endif
  2676. #if (!defined(DGTEST)) || DGTEST == 76
  2677. dr = d_l3d(l1,l2,l3,ll1,l9);
  2678. fprintf(out,"->%g\n",dr);
  2679. fflush(out);
  2680. dr = 0.0; clear_traces();
  2681. ALLOC_CALLBACK();
  2682. {
  2683. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
  2684. ffi_cif cif;
  2685. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  2686. PREP_CALLBACK(cif,d_l3d_simulator,(void*)d_l3d);
  2687. dr = ((double (ABI_ATTR *) (long,long,long,double,long)) callback_code) (l1,l2,l3,ll1,l9);
  2688. }
  2689. FREE_CALLBACK();
  2690. fprintf(out,"->%g\n",dr);
  2691. fflush(out);
  2692. #endif
  2693. #if (!defined(DGTEST)) || DGTEST == 77
  2694. dr = d_l4d(l1,l2,l3,l4,ll1,l9);
  2695. fprintf(out,"->%g\n",dr);
  2696. fflush(out);
  2697. dr = 0.0; clear_traces();
  2698. ALLOC_CALLBACK();
  2699. {
  2700. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
  2701. ffi_cif cif;
  2702. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  2703. PREP_CALLBACK(cif,d_l4d_simulator,(void*)d_l4d);
  2704. dr = ((double (ABI_ATTR *) (long,long,long,long,double,long)) callback_code) (l1,l2,l3,l4,ll1,l9);
  2705. }
  2706. FREE_CALLBACK();
  2707. fprintf(out,"->%g\n",dr);
  2708. fflush(out);
  2709. #endif
  2710. #if (!defined(DGTEST)) || DGTEST == 78
  2711. dr = d_l5d(l1,l2,l3,l4,l5,ll1,l9);
  2712. fprintf(out,"->%g\n",dr);
  2713. fflush(out);
  2714. dr = 0.0; clear_traces();
  2715. ALLOC_CALLBACK();
  2716. {
  2717. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
  2718. ffi_cif cif;
  2719. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  2720. PREP_CALLBACK(cif,d_l5d_simulator,(void*)d_l5d);
  2721. dr = ((double (ABI_ATTR *) (long,long,long,long,long,double,long)) callback_code) (l1,l2,l3,l4,l5,ll1,l9);
  2722. }
  2723. FREE_CALLBACK();
  2724. fprintf(out,"->%g\n",dr);
  2725. fflush(out);
  2726. #endif
  2727. #if (!defined(DGTEST)) || DGTEST == 79
  2728. dr = d_l6d(l1,l2,l3,l4,l5,l6,ll1,l9);
  2729. fprintf(out,"->%g\n",dr);
  2730. fflush(out);
  2731. dr = 0.0; clear_traces();
  2732. ALLOC_CALLBACK();
  2733. {
  2734. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
  2735. ffi_cif cif;
  2736. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  2737. PREP_CALLBACK(cif,d_l6d_simulator,(void*)d_l6d);
  2738. dr = ((double (ABI_ATTR *) (long,long,long,long,long,long,double,long)) callback_code) (l1,l2,l3,l4,l5,l6,ll1,l9);
  2739. }
  2740. FREE_CALLBACK();
  2741. fprintf(out,"->%g\n",dr);
  2742. fflush(out);
  2743. #endif
  2744. #if (!defined(DGTEST)) || DGTEST == 80
  2745. dr = d_l7d(l1,l2,l3,l4,l5,l6,l7,ll1,l9);
  2746. fprintf(out,"->%g\n",dr);
  2747. fflush(out);
  2748. dr = 0.0; clear_traces();
  2749. ALLOC_CALLBACK();
  2750. {
  2751. ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
  2752. ffi_cif cif;
  2753. FFI_PREP_CIF(cif,argtypes,ffi_type_double);
  2754. PREP_CALLBACK(cif,d_l7d_simulator,(void*)d_l7d);
  2755. dr = ((double (ABI_ATTR *) (long,long,long,long,long,long,long,double,long)) callback_code) (l1,l2,l3,l4,l5,l6,l7,ll1,l9);
  2756. }
  2757. FREE_CALLBACK();
  2758. fprintf(out,"->%g\n",dr);
  2759. fflush(out);
  2760. #endif
  2761. }
  2762. exit(0);
  2763. }