ruby/interpreter/RubyInterpreter.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #ifndef RUBYINTERPRETER_HPP | ||
| 7 | #define RUBYINTERPRETER_HPP | ||
| 8 | |||
| 9 | #include "RubyEval.hpp" | ||
| 10 | #include <vector> | ||
| 11 | #include <string> | ||
| 12 | #include <map> | ||
| 13 | #include <typeinfo> | ||
| 14 | #include <sstream> | ||
| 15 | |||
| 16 | // SWIGRubyRuntime.hxx includes ruby.h which includes ruby/win32.h, which has some brain damaged notions of | ||
| 17 | // what standard errno values should be. | ||
| 18 | #ifdef _MSC_VER | ||
| 19 | # ifdef EWOULDBLOCK | ||
| 20 | # pragma push_macro("EWOULDBLOCK") | ||
| 21 | # undef EWOULDBLOCK | ||
| 22 | # define EWOULDBLOCK_macro_found | ||
| 23 | # endif | ||
| 24 | |||
| 25 | # ifdef EINPROGRESS | ||
| 26 | # pragma push_macro("EINPROGRESS") | ||
| 27 | # undef EINPROGRESS | ||
| 28 | # define EINPROGRESS_macro_found | ||
| 29 | # endif | ||
| 30 | |||
| 31 | # ifdef EALREADY | ||
| 32 | # pragma push_macro("EALREADY") | ||
| 33 | # undef EALREADY | ||
| 34 | # define EALREADY_macro_found | ||
| 35 | # endif | ||
| 36 | |||
| 37 | # ifdef ENOTSOCK | ||
| 38 | # pragma push_macro("ENOTSOCK") | ||
| 39 | # undef ENOTSOCK | ||
| 40 | # define ENOTSOCK_macro_found | ||
| 41 | # endif | ||
| 42 | |||
| 43 | # ifdef EDESTADDRREQ | ||
| 44 | # pragma push_macro("EDESTADDRREQ") | ||
| 45 | # undef EDESTADDRREQ | ||
| 46 | # define EDESTADDRREQ_macro_found | ||
| 47 | # endif | ||
| 48 | |||
| 49 | # ifdef EMSGSIZE | ||
| 50 | # pragma push_macro("EMSGSIZE") | ||
| 51 | # undef EMSGSIZE | ||
| 52 | # define EMSGSIZE_macro_found | ||
| 53 | # endif | ||
| 54 | |||
| 55 | # ifdef EPROTOTYPE | ||
| 56 | # pragma push_macro("EPROTOTYPE") | ||
| 57 | # undef EPROTOTYPE | ||
| 58 | # define EPROTOTYPE_macro_found | ||
| 59 | # endif | ||
| 60 | |||
| 61 | # ifdef ENOPROTOOPT | ||
| 62 | # pragma push_macro("ENOPROTOOPT") | ||
| 63 | # undef ENOPROTOOPT | ||
| 64 | # define ENOPROTOOPT_macro_found | ||
| 65 | # endif | ||
| 66 | |||
| 67 | # ifdef EPROTONOSUPPORT | ||
| 68 | # pragma push_macro("EPROTONOSUPPORT") | ||
| 69 | # undef EPROTONOSUPPORT | ||
| 70 | # define EPROTONOSUPPORT_macro_found | ||
| 71 | # endif | ||
| 72 | |||
| 73 | # ifdef EOPNOTSUPP | ||
| 74 | # pragma push_macro("EOPNOTSUPP") | ||
| 75 | # undef EOPNOTSUPP | ||
| 76 | # define EOPNOTSUPP_macro_found | ||
| 77 | # endif | ||
| 78 | |||
| 79 | # ifdef EAFNOSUPPORT | ||
| 80 | # pragma push_macro("EAFNOSUPPORT") | ||
| 81 | # undef EAFNOSUPPORT | ||
| 82 | # define EAFNOSUPPORT_macro_found | ||
| 83 | # endif | ||
| 84 | |||
| 85 | # ifdef EADDRINUSE | ||
| 86 | # pragma push_macro("EADDRINUSE") | ||
| 87 | # undef EADDRINUSE | ||
| 88 | # define EADDRINUSE_macro_found | ||
| 89 | # endif | ||
| 90 | |||
| 91 | # ifdef EADDRNOTAVAIL | ||
| 92 | # pragma push_macro("EADDRNOTAVAIL") | ||
| 93 | # undef EADDRNOTAVAIL | ||
| 94 | # define EADDRNOTAVAIL_macro_found | ||
| 95 | # endif | ||
| 96 | |||
| 97 | # ifdef ENETDOWN | ||
| 98 | # pragma push_macro("ENETDOWN") | ||
| 99 | # undef ENETDOWN | ||
| 100 | # define ENETDOWN_macro_found | ||
| 101 | # endif | ||
| 102 | |||
| 103 | # ifdef ENETUNREACH | ||
| 104 | # pragma push_macro("ENETUNREACH") | ||
| 105 | # undef ENETUNREACH | ||
| 106 | # define ENETUNREACH_macro_found | ||
| 107 | # endif | ||
| 108 | |||
| 109 | # ifdef ENETRESET | ||
| 110 | # pragma push_macro("ENETRESET") | ||
| 111 | # undef ENETRESET | ||
| 112 | # define ENETRESET_macro_found | ||
| 113 | # endif | ||
| 114 | |||
| 115 | # ifdef ECONNABORTED | ||
| 116 | # pragma push_macro("ECONNABORTED") | ||
| 117 | # undef ECONNABORTED | ||
| 118 | # define ECONNABORTED_macro_found | ||
| 119 | # endif | ||
| 120 | |||
| 121 | # ifdef ECONNRESET | ||
| 122 | # pragma push_macro("ECONNRESET") | ||
| 123 | # undef ECONNRESET | ||
| 124 | # define ECONNRESET_macro_found | ||
| 125 | # endif | ||
| 126 | |||
| 127 | # ifdef ENOBUFS | ||
| 128 | # pragma push_macro("ENOBUFS") | ||
| 129 | # undef ENOBUFS | ||
| 130 | # define ENOBUFS_macro_found | ||
| 131 | # endif | ||
| 132 | |||
| 133 | # ifdef EISCONN | ||
| 134 | # pragma push_macro("EISCONN") | ||
| 135 | # undef EISCONN | ||
| 136 | # define EISCONN_macro_found | ||
| 137 | # endif | ||
| 138 | |||
| 139 | # ifdef ENOTCONN | ||
| 140 | # pragma push_macro("ENOTCONN") | ||
| 141 | # undef ENOTCONN | ||
| 142 | # define ENOTCONN_macro_found | ||
| 143 | # endif | ||
| 144 | |||
| 145 | # ifdef ETIMEDOUT | ||
| 146 | # pragma push_macro("ETIMEDOUT") | ||
| 147 | # undef ETIMEDOUT | ||
| 148 | # define ETIMEDOUT_macro_found | ||
| 149 | # endif | ||
| 150 | |||
| 151 | # ifdef ECONNREFUSED | ||
| 152 | # pragma push_macro("ECONNREFUSED") | ||
| 153 | # undef ECONNREFUSED | ||
| 154 | # define ECONNREFUSED_macro_found | ||
| 155 | # endif | ||
| 156 | |||
| 157 | # ifdef ELOOP | ||
| 158 | # pragma push_macro("ELOOP") | ||
| 159 | # undef ELOOP | ||
| 160 | # define ELOOP_macro_found | ||
| 161 | # endif | ||
| 162 | |||
| 163 | # ifdef EHOSTUNREACH | ||
| 164 | # pragma push_macro("EHOSTUNREACH") | ||
| 165 | # undef EHOSTUNREACH | ||
| 166 | # define EHOSTUNREACH_macro_found | ||
| 167 | # endif | ||
| 168 | |||
| 169 | # ifdef try | ||
| 170 | # pragma push_macro("try") | ||
| 171 | # undef try | ||
| 172 | # define try_macro_found | ||
| 173 | # endif | ||
| 174 | |||
| 175 | # ifdef except | ||
| 176 | # pragma push_macro("except") | ||
| 177 | # undef except | ||
| 178 | # define except_macro_found | ||
| 179 | # endif | ||
| 180 | |||
| 181 | # ifdef finally | ||
| 182 | # pragma push_macro("finally") | ||
| 183 | # undef finally | ||
| 184 | # define finally_macro_found | ||
| 185 | # endif | ||
| 186 | |||
| 187 | # ifdef leave | ||
| 188 | # pragma push_macro("leave") | ||
| 189 | # undef leave | ||
| 190 | # define leave_macro_found | ||
| 191 | # endif | ||
| 192 | |||
| 193 | # ifdef OpenFile | ||
| 194 | # pragma push_macro("OpenFile") | ||
| 195 | # undef OpenFile | ||
| 196 | # define OpenFile_macro_found | ||
| 197 | # endif | ||
| 198 | |||
| 199 | # ifdef CharNext | ||
| 200 | # pragma push_macro("CharNext") | ||
| 201 | # undef CharNext | ||
| 202 | # define CharNext_macro_found | ||
| 203 | # endif | ||
| 204 | |||
| 205 | # ifdef rb_w32_iswinnt | ||
| 206 | # pragma push_macro("rb_w32_iswinnt") | ||
| 207 | # undef rb_w | ||
| 208 | # define rb_w_macro_found32_iswinnt | ||
| 209 | # endif | ||
| 210 | |||
| 211 | # ifdef rb_w32_iswin95 | ||
| 212 | # pragma push_macro("rb_w32_iswin95") | ||
| 213 | # undef rb_w | ||
| 214 | # define rb_w_macro_found32_iswin95 | ||
| 215 | # endif | ||
| 216 | |||
| 217 | # ifdef getc | ||
| 218 | # pragma push_macro("getc") | ||
| 219 | # undef getc | ||
| 220 | # define getc_macro_found | ||
| 221 | # endif | ||
| 222 | |||
| 223 | # ifdef putc | ||
| 224 | # pragma push_macro("putc") | ||
| 225 | # undef putc | ||
| 226 | # define putc_macro_found | ||
| 227 | # endif | ||
| 228 | |||
| 229 | # ifdef fgetc | ||
| 230 | # pragma push_macro("fgetc") | ||
| 231 | # undef fgetc | ||
| 232 | # define fgetc_macro_found | ||
| 233 | # endif | ||
| 234 | |||
| 235 | # ifdef fputc | ||
| 236 | # pragma push_macro("fputc") | ||
| 237 | # undef fputc | ||
| 238 | # define fputc_macro_found | ||
| 239 | # endif | ||
| 240 | |||
| 241 | # ifdef getchar | ||
| 242 | # pragma push_macro("getchar") | ||
| 243 | # undef getchar | ||
| 244 | # define getchar_macro_found | ||
| 245 | # endif | ||
| 246 | |||
| 247 | # ifdef putchar | ||
| 248 | # pragma push_macro("putchar") | ||
| 249 | # undef putchar | ||
| 250 | # define putchar_macro_found | ||
| 251 | # endif | ||
| 252 | |||
| 253 | # ifdef fgetchar | ||
| 254 | # pragma push_macro("fgetchar") | ||
| 255 | # undef fgetchar | ||
| 256 | # define fgetchar_macro_found | ||
| 257 | # endif | ||
| 258 | |||
| 259 | # ifdef fputchar | ||
| 260 | # pragma push_macro("fputchar") | ||
| 261 | # undef fputchar | ||
| 262 | # define fputchar_macro_found | ||
| 263 | # endif | ||
| 264 | |||
| 265 | # ifdef utime | ||
| 266 | # pragma push_macro("utime") | ||
| 267 | # undef utime | ||
| 268 | # define utime_macro_found | ||
| 269 | # endif | ||
| 270 | |||
| 271 | # ifdef strcasecmp | ||
| 272 | # pragma push_macro("strcasecmp") | ||
| 273 | # undef strcasecmp | ||
| 274 | # define strcasecmp_macro_found | ||
| 275 | # endif | ||
| 276 | |||
| 277 | # ifdef strncasecmp | ||
| 278 | # pragma push_macro("strncasecmp") | ||
| 279 | # undef strncasecmp | ||
| 280 | # define strncasecmp_macro_found | ||
| 281 | # endif | ||
| 282 | |||
| 283 | # ifdef close | ||
| 284 | # pragma push_macro("close") | ||
| 285 | # undef close | ||
| 286 | # define close_macro_found | ||
| 287 | # endif | ||
| 288 | |||
| 289 | # ifdef fclose | ||
| 290 | # pragma push_macro("fclose") | ||
| 291 | # undef fclose | ||
| 292 | # define fclose_macro_found | ||
| 293 | # endif | ||
| 294 | |||
| 295 | # ifdef read | ||
| 296 | # pragma push_macro("read") | ||
| 297 | # undef read | ||
| 298 | # define read_macro_found | ||
| 299 | # endif | ||
| 300 | |||
| 301 | # ifdef write | ||
| 302 | # pragma push_macro("write") | ||
| 303 | # undef write | ||
| 304 | # define write_macro_found | ||
| 305 | # endif | ||
| 306 | |||
| 307 | # ifdef getpid | ||
| 308 | # pragma push_macro("getpid") | ||
| 309 | # undef getpid | ||
| 310 | # define getpid_macro_found | ||
| 311 | # endif | ||
| 312 | |||
| 313 | # ifdef sleep | ||
| 314 | # pragma push_macro("sleep") | ||
| 315 | # undef sleep | ||
| 316 | # define sleep_macro_found | ||
| 317 | # endif | ||
| 318 | |||
| 319 | # ifdef creat | ||
| 320 | # pragma push_macro("creat") | ||
| 321 | # undef creat | ||
| 322 | # define creat_macro_found | ||
| 323 | # endif | ||
| 324 | |||
| 325 | # ifdef eof | ||
| 326 | # pragma push_macro("eof") | ||
| 327 | # undef eof | ||
| 328 | # define eof_macro_found | ||
| 329 | # endif | ||
| 330 | |||
| 331 | # ifdef filelength | ||
| 332 | # pragma push_macro("filelength") | ||
| 333 | # undef filelength | ||
| 334 | # define filelength_macro_found | ||
| 335 | # endif | ||
| 336 | |||
| 337 | # ifdef mktemp | ||
| 338 | # pragma push_macro("mktemp") | ||
| 339 | # undef mktemp | ||
| 340 | # define mktemp_macro_found | ||
| 341 | # endif | ||
| 342 | |||
| 343 | # ifdef tell | ||
| 344 | # pragma push_macro("tell") | ||
| 345 | # undef tell | ||
| 346 | # define tell_macro_found | ||
| 347 | # endif | ||
| 348 | |||
| 349 | # ifdef unlink | ||
| 350 | # pragma push_macro("unlink") | ||
| 351 | # undef unlink | ||
| 352 | # define unlink_macro_found | ||
| 353 | # endif | ||
| 354 | |||
| 355 | # ifdef _open | ||
| 356 | # pragma push_macro("_open") | ||
| 357 | # undef _open | ||
| 358 | # define _open_macro_found | ||
| 359 | # endif | ||
| 360 | |||
| 361 | # ifdef sopen | ||
| 362 | # pragma push_macro("sopen") | ||
| 363 | # undef sopen | ||
| 364 | # define sopen_macro_found | ||
| 365 | # endif | ||
| 366 | |||
| 367 | # ifdef fopen | ||
| 368 | # pragma push_macro("fopen") | ||
| 369 | # undef fopen | ||
| 370 | # define fopen_macro_found | ||
| 371 | # endif | ||
| 372 | |||
| 373 | # ifdef fdopen | ||
| 374 | # pragma push_macro("fdopen") | ||
| 375 | # undef fdopen | ||
| 376 | # define fdopen_macro_found | ||
| 377 | # endif | ||
| 378 | |||
| 379 | # ifdef fsopen | ||
| 380 | # pragma push_macro("fsopen") | ||
| 381 | # undef fsopen | ||
| 382 | # define fsopen_macro_found | ||
| 383 | # endif | ||
| 384 | |||
| 385 | # ifdef fsync | ||
| 386 | # pragma push_macro("fsync") | ||
| 387 | # undef fsync | ||
| 388 | # define fsync_macro_found | ||
| 389 | # endif | ||
| 390 | |||
| 391 | # ifdef stat | ||
| 392 | # pragma push_macro("stat") | ||
| 393 | # undef stat | ||
| 394 | # define stat_macro_found | ||
| 395 | # endif | ||
| 396 | |||
| 397 | # ifdef execv | ||
| 398 | # pragma push_macro("execv") | ||
| 399 | # undef execv | ||
| 400 | # define execv_macro_found | ||
| 401 | # endif | ||
| 402 | |||
| 403 | # ifdef isatty | ||
| 404 | # pragma push_macro("isatty") | ||
| 405 | # undef isatty | ||
| 406 | # define isatty_macro_found | ||
| 407 | # endif | ||
| 408 | |||
| 409 | # ifdef mkdir | ||
| 410 | # pragma push_macro("mkdir") | ||
| 411 | # undef mkdir | ||
| 412 | # define mkdir_macro_found | ||
| 413 | # endif | ||
| 414 | |||
| 415 | # ifdef rmdir | ||
| 416 | # pragma push_macro("rmdir") | ||
| 417 | # undef rmdir | ||
| 418 | # define rmdir_macro_found | ||
| 419 | # endif | ||
| 420 | |||
| 421 | # ifdef isascii | ||
| 422 | # pragma push_macro("isascii") | ||
| 423 | # undef isascii | ||
| 424 | # define isascii_macro_found | ||
| 425 | # endif | ||
| 426 | |||
| 427 | # ifdef vsnprintf | ||
| 428 | # pragma push_macro("vsnprintf") | ||
| 429 | # undef vsnprintf | ||
| 430 | # define vsnprintf_macro_found | ||
| 431 | # endif | ||
| 432 | |||
| 433 | # ifdef snprintf | ||
| 434 | # pragma push_macro("snprintf") | ||
| 435 | # undef snprintf | ||
| 436 | # define snprintf_macro_found | ||
| 437 | # endif | ||
| 438 | |||
| 439 | # ifdef isnan | ||
| 440 | # pragma push_macro("isnan") | ||
| 441 | # undef isnan | ||
| 442 | # define isnan_macro_found | ||
| 443 | # endif | ||
| 444 | |||
| 445 | # ifdef isinf | ||
| 446 | # pragma push_macro("isinf") | ||
| 447 | # undef isinf | ||
| 448 | # define isinf_macro_found | ||
| 449 | # endif | ||
| 450 | |||
| 451 | # ifdef finite | ||
| 452 | # pragma push_macro("finite") | ||
| 453 | # undef finite | ||
| 454 | # define finite_macro_found | ||
| 455 | # endif | ||
| 456 | |||
| 457 | # ifdef copysign | ||
| 458 | # pragma push_macro("copysign") | ||
| 459 | # undef copysign | ||
| 460 | # define copysign_macro_found | ||
| 461 | # endif | ||
| 462 | |||
| 463 | # ifdef scalb | ||
| 464 | # pragma push_macro("scalb") | ||
| 465 | # undef scalb | ||
| 466 | # define scalb_macro_found | ||
| 467 | # endif | ||
| 468 | |||
| 469 | # ifdef accept | ||
| 470 | # pragma push_macro("accept") | ||
| 471 | # undef accept | ||
| 472 | # define accept_macro_found | ||
| 473 | # endif | ||
| 474 | |||
| 475 | # ifdef bind | ||
| 476 | # pragma push_macro("bind") | ||
| 477 | # undef bind | ||
| 478 | # define bind_macro_found | ||
| 479 | # endif | ||
| 480 | |||
| 481 | # ifdef connect | ||
| 482 | # pragma push_macro("connect") | ||
| 483 | # undef connect | ||
| 484 | # define connect_macro_found | ||
| 485 | # endif | ||
| 486 | |||
| 487 | # ifdef FD_SET | ||
| 488 | # pragma push_macro("FD_SET") | ||
| 489 | # undef FD_SET | ||
| 490 | # define FD_SET_macro_found | ||
| 491 | # endif | ||
| 492 | |||
| 493 | # ifdef FD_CLR | ||
| 494 | # pragma push_macro("FD_CLR") | ||
| 495 | # undef FD_CLR | ||
| 496 | # define FD_CLR_macro_found | ||
| 497 | # endif | ||
| 498 | |||
| 499 | # ifdef FD_ISSET | ||
| 500 | # pragma push_macro("FD_ISSET") | ||
| 501 | # undef FD_ISSET | ||
| 502 | # define FD_ISSET_macro_found | ||
| 503 | # endif | ||
| 504 | |||
| 505 | # ifdef select | ||
| 506 | # pragma push_macro("select") | ||
| 507 | # undef select | ||
| 508 | # define select_macro_found | ||
| 509 | # endif | ||
| 510 | |||
| 511 | # ifdef getpeername | ||
| 512 | # pragma push_macro("getpeername") | ||
| 513 | # undef getpeername | ||
| 514 | # define getpeername_macro_found | ||
| 515 | # endif | ||
| 516 | |||
| 517 | # ifdef getsockname | ||
| 518 | # pragma push_macro("getsockname") | ||
| 519 | # undef getsockname | ||
| 520 | # define getsockname_macro_found | ||
| 521 | # endif | ||
| 522 | |||
| 523 | # ifdef getsockopt | ||
| 524 | # pragma push_macro("getsockopt") | ||
| 525 | # undef getsockopt | ||
| 526 | # define getsockopt_macro_found | ||
| 527 | # endif | ||
| 528 | |||
| 529 | # ifdef ioctlsocket | ||
| 530 | # pragma push_macro("ioctlsocket") | ||
| 531 | # undef ioctlsocket | ||
| 532 | # define ioctlsocket_macro_found | ||
| 533 | # endif | ||
| 534 | |||
| 535 | # ifdef listen | ||
| 536 | # pragma push_macro("listen") | ||
| 537 | # undef listen | ||
| 538 | # define listen_macro_found | ||
| 539 | # endif | ||
| 540 | |||
| 541 | # ifdef recv | ||
| 542 | # pragma push_macro("recv") | ||
| 543 | # undef recv | ||
| 544 | # define recv_macro_found | ||
| 545 | # endif | ||
| 546 | |||
| 547 | # ifdef recvfrom | ||
| 548 | # pragma push_macro("recvfrom") | ||
| 549 | # undef recvfrom | ||
| 550 | # define recvfrom_macro_found | ||
| 551 | # endif | ||
| 552 | |||
| 553 | # ifdef send | ||
| 554 | # pragma push_macro("send") | ||
| 555 | # undef send | ||
| 556 | # define send_macro_found | ||
| 557 | # endif | ||
| 558 | |||
| 559 | # ifdef sendto | ||
| 560 | # pragma push_macro("sendto") | ||
| 561 | # undef sendto | ||
| 562 | # define sendto_macro_found | ||
| 563 | # endif | ||
| 564 | |||
| 565 | # ifdef setsockopt | ||
| 566 | # pragma push_macro("setsockopt") | ||
| 567 | # undef setsockopt | ||
| 568 | # define setsockopt_macro_found | ||
| 569 | # endif | ||
| 570 | |||
| 571 | # ifdef shutdown | ||
| 572 | # pragma push_macro("shutdown") | ||
| 573 | # undef shutdown | ||
| 574 | # define shutdown_macro_found | ||
| 575 | # endif | ||
| 576 | |||
| 577 | # ifdef socket | ||
| 578 | # pragma push_macro("socket") | ||
| 579 | # undef socket | ||
| 580 | # define socket_macro_found | ||
| 581 | # endif | ||
| 582 | |||
| 583 | # ifdef gethostbyaddr | ||
| 584 | # pragma push_macro("gethostbyaddr") | ||
| 585 | # undef gethostbyaddr | ||
| 586 | # define gethostbyaddr_macro_found | ||
| 587 | # endif | ||
| 588 | |||
| 589 | # ifdef gethostbyname | ||
| 590 | # pragma push_macro("gethostbyname") | ||
| 591 | # undef gethostbyname | ||
| 592 | # define gethostbyname_macro_found | ||
| 593 | # endif | ||
| 594 | |||
| 595 | # ifdef gethostname | ||
| 596 | # pragma push_macro("gethostname") | ||
| 597 | # undef gethostname | ||
| 598 | # define gethostname_macro_found | ||
| 599 | # endif | ||
| 600 | |||
| 601 | # ifdef getprotobyname | ||
| 602 | # pragma push_macro("getprotobyname") | ||
| 603 | # undef getprotobyname | ||
| 604 | # define getprotobyname_macro_found | ||
| 605 | # endif | ||
| 606 | |||
| 607 | # ifdef getprotobynumber | ||
| 608 | # pragma push_macro("getprotobynumber") | ||
| 609 | # undef getprotobynumber | ||
| 610 | # define getprotobynumber_macro_found | ||
| 611 | # endif | ||
| 612 | |||
| 613 | # ifdef getservbyname | ||
| 614 | # pragma push_macro("getservbyname") | ||
| 615 | # undef getservbyname | ||
| 616 | # define getservbyname_macro_found | ||
| 617 | # endif | ||
| 618 | |||
| 619 | # ifdef getservbyport | ||
| 620 | # pragma push_macro("getservbyport") | ||
| 621 | # undef getservbyport | ||
| 622 | # define getservbyport_macro_found | ||
| 623 | # endif | ||
| 624 | |||
| 625 | # ifdef get_osfhandle | ||
| 626 | # define OLD_get_osfhandle get_osfhandle | ||
| 627 | # undef get_osfhandle | ||
| 628 | # define get_osfhandle_macro_found | ||
| 629 | # endif | ||
| 630 | |||
| 631 | # ifdef getcwd | ||
| 632 | # pragma push_macro("getcwd") | ||
| 633 | # undef getcwd | ||
| 634 | # define getcwd_macro_found | ||
| 635 | # endif | ||
| 636 | |||
| 637 | # ifdef getenv | ||
| 638 | # pragma push_macro("getenv") | ||
| 639 | # undef getenv | ||
| 640 | # define getenv_macro_found | ||
| 641 | # endif | ||
| 642 | |||
| 643 | # ifdef rename | ||
| 644 | # pragma push_macro("rename") | ||
| 645 | # undef rename | ||
| 646 | # define rename_macro_found | ||
| 647 | # endif | ||
| 648 | |||
| 649 | # ifdef times | ||
| 650 | # pragma push_macro("times") | ||
| 651 | # undef times | ||
| 652 | # define times_macro_found | ||
| 653 | # endif | ||
| 654 | |||
| 655 | # ifdef Sleep | ||
| 656 | # pragma push_macro("Sleep") | ||
| 657 | # undef Sleep | ||
| 658 | # define Sleep_macro_found | ||
| 659 | # endif | ||
| 660 | #endif | ||
| 661 | |||
| 662 | #include <ruby.h> | ||
| 663 | #include <ruby/encoding.h> | ||
| 664 | #include <SWIGRubyRuntime.hxx> | ||
| 665 | |||
| 666 | // RubyInterpreter predates RubyEngine. It is possible that the two things should be merged into one. | ||
| 667 | class RubyInterpreter | ||
| 668 | { | ||
| 669 | private: | ||
| 670 | static void addIncludePath(std::vector<std::string>& includePaths, const std::string& includePath) { | ||
| 671 | includePaths.push_back("-I"); | ||
| 672 | includePaths.push_back(includePath); | ||
| 673 | } | ||
| 674 | |||
| 675 | public: | ||
| 676 | 245 | explicit RubyInterpreter(const std::vector<std::string>& t_includePaths) { | |
| 677 | // register some default types that we want to pass in / out of the ruby system | ||
| 678 |
2/2✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
|
490 | registerType<int>("int"); |
| 679 |
2/2✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
|
490 | registerType<long>("long"); |
| 680 |
2/2✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
|
490 | registerType<size_t>("size_t"); |
| 681 |
2/2✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
|
490 | registerType<double>("double"); |
| 682 |
2/2✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
|
490 | registerType<std::string>("std::string"); |
| 683 |
2/2✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
|
245 | registerType<float>("float"); |
| 684 | 245 | } | |
| 685 | |||
| 686 | 234 | ~RubyInterpreter() = default; | |
| 687 | |||
| 688 | /// Register a type along with its vector versions so that it can be used | ||
| 689 | /// from within the Ruby wrapper. These are necessary because there's no way to divine | ||
| 690 | /// the unmangled type name. | ||
| 691 | template <typename Type> | ||
| 692 | 1470 | void registerType(const std::string& t_name) { | |
| 693 |
18/18void RubyInterpreter::registerType<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 2 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<float>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 2 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 2 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 2 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 2 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 2 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
|
2940 | m_types[typeid(Type).name()] = t_name; |
| 694 |
18/18void RubyInterpreter::registerType<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<float>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
void RubyInterpreter::registerType<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 5 taken 245 times.
✓ Branch 8 taken 245 times.
|
4410 | m_types[typeid(Type*).name()] = t_name + " *"; |
| 695 |
24/24void RubyInterpreter::registerType<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<float>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
|
4410 | m_types[typeid(std::vector<Type>).name()] = "std::vector<" + t_name + ">"; |
| 696 |
24/24void RubyInterpreter::registerType<double>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<float>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<int>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
void RubyInterpreter::registerType<unsigned long>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&):
✓ Branch 1 taken 245 times.
✓ Branch 4 taken 245 times.
✓ Branch 8 taken 245 times.
✓ Branch 11 taken 245 times.
|
4410 | m_types[typeid(std::vector<Type>*).name()] = "std::vector<" + t_name + "> *"; |
| 697 | 1470 | } | |
| 698 | |||
| 699 | // evaluate a ruby statement with no return value. If a ruby exception is raised | ||
| 700 | // the description is translated into a C++ exception, which is thrown as an openstudio::RubyException. | ||
| 701 | // TODO: should this be static? | ||
| 702 | // cppcheck-suppress functionStatic | ||
| 703 | 245 | void evalString(const std::string& t_str) { | |
| 704 | 245 | openstudio::evalString(t_str); | |
| 705 | 245 | } | |
| 706 | |||
| 707 | /// Execute a function by name with 0 parameters and no return value | ||
| 708 | template <typename ReturnType> | ||
| 709 | void exec(const std::string& t_functionName) { | ||
| 710 | std::vector<VALUE> params; | ||
| 711 | |||
| 712 | makeProtectedCall(t_functionName, params); | ||
| 713 | } | ||
| 714 | |||
| 715 | /// Execute a function by name with 1 parameter and no return value | ||
| 716 | template <typename ReturnType, typename Param1> | ||
| 717 | void exec(const std::string& t_functionName, Param1 t_param1) { | ||
| 718 | std::vector<VALUE> params; | ||
| 719 | params.push_back(newPointerObj(&t_param1)); | ||
| 720 | |||
| 721 | makeProtectedCall(t_functionName, params); | ||
| 722 | } | ||
| 723 | |||
| 724 | /// Execute a function by name with 2 parameters and no return value | ||
| 725 | template <typename ReturnType, typename Param1, typename Param2> | ||
| 726 | ReturnType exec(const std::string& t_functionName, Param1 t_param1, Param2 t_param2) { | ||
| 727 | std::vector<VALUE> params; | ||
| 728 | params.push_back(newPointerObj(&t_param1)); | ||
| 729 | params.push_back(newPointerObj(&t_param2)); | ||
| 730 | |||
| 731 | makeProtectedCall(t_functionName, params); | ||
| 732 | } | ||
| 733 | |||
| 734 | /// Execute a function by name with 3 parameters and no return value | ||
| 735 | template <typename ReturnType, typename Param1, typename Param2, typename Param3> | ||
| 736 | ReturnType exec(const std::string& t_functionName, Param1 t_param1, Param2 t_param2, Param3 t_param3) { | ||
| 737 | std::vector<VALUE> params; | ||
| 738 | params.push_back(newPointerObj(&t_param1)); | ||
| 739 | params.push_back(newPointerObj(&t_param2)); | ||
| 740 | params.push_back(newPointerObj(&t_param3)); | ||
| 741 | |||
| 742 | makeProtectedCall(t_functionName, params); | ||
| 743 | } | ||
| 744 | |||
| 745 | /// Execute a function by name with 0 parameters and a return value | ||
| 746 | template <typename ReturnType> | ||
| 747 | ReturnType execWithReturn(const std::string& t_functionName) { | ||
| 748 | std::vector<VALUE> params; | ||
| 749 | |||
| 750 | VALUE retval = makeProtectedCall(t_functionName, params); | ||
| 751 | return asType<ReturnType>(retval); | ||
| 752 | } | ||
| 753 | |||
| 754 | /// Execute a function by name with 1 parameter and a return value | ||
| 755 | template <typename ReturnType, typename Param1> | ||
| 756 | ReturnType execWithReturn(const std::string& t_functionName, Param1 t_param1) { | ||
| 757 | std::vector<VALUE> params; | ||
| 758 | params.push_back(newPointerObj(&t_param1)); | ||
| 759 | |||
| 760 | VALUE retval = makeProtectedCall(t_functionName, params); | ||
| 761 | return asType<ReturnType>(retval); | ||
| 762 | } | ||
| 763 | |||
| 764 | /// Execute a function by name with 2 parameters and a return value | ||
| 765 | template <typename ReturnType, typename Param1, typename Param2> | ||
| 766 | ReturnType execWithReturn(const std::string& t_functionName, Param1 t_param1, Param2 t_param2) { | ||
| 767 | std::vector<VALUE> params; | ||
| 768 | params.push_back(newPointerObj(&t_param1)); | ||
| 769 | params.push_back(newPointerObj(&t_param2)); | ||
| 770 | |||
| 771 | VALUE retval = makeProtectedCall(t_functionName, params); | ||
| 772 | return asType<ReturnType>(retval); | ||
| 773 | } | ||
| 774 | |||
| 775 | /// Execute a function by name with 3 parameters and a return value | ||
| 776 | template <typename ReturnType, typename Param1, typename Param2, typename Param3> | ||
| 777 | ReturnType execWithReturn(const std::string& t_functionName, Param1 t_param1, Param2 t_param2, Param3 t_param3) { | ||
| 778 | std::vector<VALUE> params; | ||
| 779 | params.push_back(newPointerObj(&t_param1)); | ||
| 780 | params.push_back(newPointerObj(&t_param2)); | ||
| 781 | params.push_back(newPointerObj(&t_param3)); | ||
| 782 | |||
| 783 | VALUE retval = makeProtectedCall(t_functionName, params); | ||
| 784 | return asType<ReturnType>(retval); | ||
| 785 | } | ||
| 786 | |||
| 787 | /// Add a named global object to the ruby runtime | ||
| 788 | template <typename ObjectType> | ||
| 789 | void addObject(const std::string& t_objectName, ObjectType* t_obj) { | ||
| 790 | VALUE r_obj = SWIG_NewPointerObj(t_obj, getTypeInfo<ObjectType*>(), 0); | ||
| 791 | rb_define_variable(t_objectName.c_str(), &r_obj); | ||
| 792 | } | ||
| 793 | |||
| 794 | private: | ||
| 795 | RubyInterpreter& operator=(const RubyInterpreter&) = delete; | ||
| 796 | RubyInterpreter(const RubyInterpreter&) = delete; | ||
| 797 | |||
| 798 | std::map<std::string, std::string> m_types; | ||
| 799 | |||
| 800 | // Returns the swig_type_info for the templated type if it's been registered previously | ||
| 801 | // with registerType | ||
| 802 | template <typename Type> | ||
| 803 | swig_type_info* getTypeInfo() const { | ||
| 804 | auto itr = m_types.find(typeid(Type).name()); | ||
| 805 | |||
| 806 | if (itr == m_types.end()) { | ||
| 807 | throw std::runtime_error(std::string("Type has not been registered: ") + typeid(Type).name()); | ||
| 808 | } | ||
| 809 | |||
| 810 | std::string t_typeName = itr->second; | ||
| 811 | |||
| 812 | swig_type_info* sti = SWIG_TypeQuery(t_typeName.c_str()); | ||
| 813 | |||
| 814 | if (sti == nullptr) { | ||
| 815 | throw std::runtime_error("Unable to lookup type info for type: " + t_typeName); | ||
| 816 | } | ||
| 817 | |||
| 818 | return sti; | ||
| 819 | } | ||
| 820 | |||
| 821 | VALUE makeProtectedCall(const std::string& t_functionName, std::vector<VALUE>& t_params) { | ||
| 822 | // we go through all of this because we cannot rb_protect a call to | ||
| 823 | // rb_funcall. At least not in any way I can find. | ||
| 824 | std::stringstream params; | ||
| 825 | |||
| 826 | for (size_t i = 0; i < t_params.size(); ++i) { | ||
| 827 | std::stringstream ss; | ||
| 828 | ss << "$embedded_ruby_param_" << i; | ||
| 829 | |||
| 830 | rb_define_variable(ss.str().c_str(), &t_params[i]); | ||
| 831 | |||
| 832 | params << ss.str(); | ||
| 833 | if (i < t_params.size() - 1) { | ||
| 834 | params << ", "; | ||
| 835 | } | ||
| 836 | } | ||
| 837 | |||
| 838 | std::string funcall = "$embedded_ruby_return = " + t_functionName + "(" + params.str() + ")"; | ||
| 839 | evalString(funcall); | ||
| 840 | |||
| 841 | VALUE retval = rb_gv_get("$embedded_ruby_return"); | ||
| 842 | return retval; | ||
| 843 | } | ||
| 844 | |||
| 845 | template <typename Param> | ||
| 846 | VALUE newPointerObj(Param t_param) { | ||
| 847 | swig_type_info* ti = getTypeInfo<Param>(); | ||
| 848 | return SWIG_NewPointerObj(t_param, ti, 0); | ||
| 849 | } | ||
| 850 | |||
| 851 | VALUE newPointerObj(double* d) { | ||
| 852 | return rb_float_new(*d); | ||
| 853 | } | ||
| 854 | |||
| 855 | VALUE newPointerObj(float* d) { | ||
| 856 | return rb_float_new(*d); | ||
| 857 | } | ||
| 858 | |||
| 859 | VALUE newPointerObj(int* d) { | ||
| 860 | return rb_to_int(rb_float_new(*d)); | ||
| 861 | } | ||
| 862 | |||
| 863 | VALUE newPointerObj(long* d) { | ||
| 864 | return rb_to_int(rb_float_new(*d)); | ||
| 865 | } | ||
| 866 | |||
| 867 | VALUE newPointerObj(std::string* s) { | ||
| 868 | return rb_str_new2(s->c_str()); | ||
| 869 | } | ||
| 870 | |||
| 871 | template <typename Type> | ||
| 872 | Type asType(VALUE v) { | ||
| 873 | Type* ptr = nullptr; | ||
| 874 | |||
| 875 | int res = SWIG_ConvertPtr(v, reinterpret_cast<void**>(&ptr), getTypeInfo<Type*>(), 0); | ||
| 876 | if (SWIG_IsOK(res)) { | ||
| 877 | if (!ptr) { | ||
| 878 | throw std::runtime_error(std::string("Result is null, trying to get type: ") + typeid(Type).name()); | ||
| 879 | } | ||
| 880 | |||
| 881 | if (SWIG_IsNewObj(res)) { | ||
| 882 | Type obj = *ptr; | ||
| 883 | delete ptr; | ||
| 884 | return obj; | ||
| 885 | } else { | ||
| 886 | return *ptr; | ||
| 887 | } | ||
| 888 | } else { | ||
| 889 | throw std::runtime_error(std::string("Unable to convert object to type: ") + typeid(Type).name()); | ||
| 890 | } | ||
| 891 | } | ||
| 892 | }; | ||
| 893 | |||
| 894 | #ifdef _MSC_VER | ||
| 895 | |||
| 896 | # ifdef EWOULDBLOCK_macro_found | ||
| 897 | # pragma pop_macro("EWOULDBLOCK") | ||
| 898 | # undef EWOULDBLOCK_macro_found | ||
| 899 | # endif | ||
| 900 | |||
| 901 | # ifdef EINPROGRESS_macro_found | ||
| 902 | # pragma pop_macro("EINPROGRESS") | ||
| 903 | # undef EINPROGRESS_macro_found | ||
| 904 | # endif | ||
| 905 | |||
| 906 | # ifdef EALREADY_macro_found | ||
| 907 | # pragma pop_macro("EALREADY") | ||
| 908 | # undef EALREADY_macro_found | ||
| 909 | # endif | ||
| 910 | |||
| 911 | # ifdef ENOTSOCK_macro_found | ||
| 912 | # pragma pop_macro("ENOTSOCK") | ||
| 913 | # undef ENOTSOCK_macro_found | ||
| 914 | # endif | ||
| 915 | |||
| 916 | # ifdef EDESTADDRREQ_macro_found | ||
| 917 | # pragma pop_macro("EDESTADDRREQ") | ||
| 918 | # undef EDESTADDRREQ_macro_found | ||
| 919 | # endif | ||
| 920 | |||
| 921 | # ifdef EMSGSIZE_macro_found | ||
| 922 | # pragma pop_macro("EMSGSIZE") | ||
| 923 | # undef EMSGSIZE_macro_found | ||
| 924 | # endif | ||
| 925 | |||
| 926 | # ifdef EPROTOTYPE_macro_found | ||
| 927 | # pragma pop_macro("EPROTOTYPE") | ||
| 928 | # undef EPROTOTYPE_macro_found | ||
| 929 | # endif | ||
| 930 | |||
| 931 | # ifdef ENOPROTOOPT_macro_found | ||
| 932 | # pragma pop_macro("ENOPROTOOPT") | ||
| 933 | # undef ENOPROTOOPT_macro_found | ||
| 934 | # endif | ||
| 935 | |||
| 936 | # ifdef EPROTONOSUPPORT_macro_found | ||
| 937 | # pragma pop_macro("EPROTONOSUPPORT") | ||
| 938 | # undef EPROTONOSUPPORT_macro_found | ||
| 939 | # endif | ||
| 940 | |||
| 941 | # ifdef EOPNOTSUPP_macro_found | ||
| 942 | # pragma pop_macro("EOPNOTSUPP") | ||
| 943 | # undef EOPNOTSUPP_macro_found | ||
| 944 | # endif | ||
| 945 | |||
| 946 | # ifdef EAFNOSUPPORT_macro_found | ||
| 947 | # pragma pop_macro("EAFNOSUPPORT") | ||
| 948 | # undef EAFNOSUPPORT_macro_found | ||
| 949 | # endif | ||
| 950 | |||
| 951 | # ifdef EADDRINUSE_macro_found | ||
| 952 | # pragma pop_macro("EADDRINUSE") | ||
| 953 | # undef EADDRINUSE_macro_found | ||
| 954 | # endif | ||
| 955 | |||
| 956 | # ifdef EADDRNOTAVAIL_macro_found | ||
| 957 | # pragma pop_macro("EADDRNOTAVAIL") | ||
| 958 | # undef EADDRNOTAVAIL_macro_found | ||
| 959 | # endif | ||
| 960 | |||
| 961 | # ifdef ENETDOWN_macro_found | ||
| 962 | # pragma pop_macro("ENETDOWN") | ||
| 963 | # undef ENETDOWN_macro_found | ||
| 964 | # endif | ||
| 965 | |||
| 966 | # ifdef ENETUNREACH_macro_found | ||
| 967 | # pragma pop_macro("ENETUNREACH") | ||
| 968 | # undef ENETUNREACH_macro_found | ||
| 969 | # endif | ||
| 970 | |||
| 971 | # ifdef ENETRESET_macro_found | ||
| 972 | # pragma pop_macro("ENETRESET") | ||
| 973 | # undef ENETRESET_macro_found | ||
| 974 | # endif | ||
| 975 | |||
| 976 | # ifdef ECONNABORTED_macro_found | ||
| 977 | # pragma pop_macro("ECONNABORTED") | ||
| 978 | # undef ECONNABORTED_macro_found | ||
| 979 | # endif | ||
| 980 | |||
| 981 | # ifdef ECONNRESET_macro_found | ||
| 982 | # pragma pop_macro("ECONNRESET") | ||
| 983 | # undef ECONNRESET_macro_found | ||
| 984 | # endif | ||
| 985 | |||
| 986 | # ifdef ENOBUFS_macro_found | ||
| 987 | # pragma pop_macro("ENOBUFS") | ||
| 988 | # undef ENOBUFS_macro_found | ||
| 989 | # endif | ||
| 990 | |||
| 991 | # ifdef EISCONN_macro_found | ||
| 992 | # pragma pop_macro("EISCONN") | ||
| 993 | # undef EISCONN_macro_found | ||
| 994 | # endif | ||
| 995 | |||
| 996 | # ifdef ENOTCONN_macro_found | ||
| 997 | # pragma pop_macro("ENOTCONN") | ||
| 998 | # undef ENOTCONN_macro_found | ||
| 999 | # endif | ||
| 1000 | |||
| 1001 | # ifdef ETIMEDOUT_macro_found | ||
| 1002 | # pragma pop_macro("ETIMEDOUT") | ||
| 1003 | # undef ETIMEDOUT_macro_found | ||
| 1004 | # endif | ||
| 1005 | |||
| 1006 | # ifdef ECONNREFUSED_macro_found | ||
| 1007 | # pragma pop_macro("ECONNREFUSED") | ||
| 1008 | # undef ECONNREFUSED_macro_found | ||
| 1009 | # endif | ||
| 1010 | |||
| 1011 | # ifdef ELOOP_macro_found | ||
| 1012 | # pragma pop_macro("ELOOP") | ||
| 1013 | # undef ELOOP_macro_found | ||
| 1014 | # endif | ||
| 1015 | |||
| 1016 | # ifdef EHOSTUNREACH_macro_found | ||
| 1017 | # pragma pop_macro("EHOSTUNREACH") | ||
| 1018 | # undef EHOSTUNREACH_macro_found | ||
| 1019 | # endif | ||
| 1020 | |||
| 1021 | # ifdef try_macro_found | ||
| 1022 | # pragma pop_macro("try") | ||
| 1023 | # undef try_macro_found | ||
| 1024 | # endif | ||
| 1025 | |||
| 1026 | # ifdef except_macro_found | ||
| 1027 | # pragma pop_macro("except") | ||
| 1028 | # undef except_macro_found | ||
| 1029 | # endif | ||
| 1030 | |||
| 1031 | # ifdef finally_macro_found | ||
| 1032 | # pragma pop_macro("finally") | ||
| 1033 | # undef finally_macro_found | ||
| 1034 | # endif | ||
| 1035 | |||
| 1036 | # ifdef leave_macro_found | ||
| 1037 | # pragma pop_macro("leave") | ||
| 1038 | # undef leave_macro_found | ||
| 1039 | # endif | ||
| 1040 | |||
| 1041 | # ifdef OpenFile_macro_found | ||
| 1042 | # pragma pop_macro("OpenFile") | ||
| 1043 | # undef OpenFile_macro_found | ||
| 1044 | # endif | ||
| 1045 | |||
| 1046 | # ifdef CharNext_macro_found | ||
| 1047 | # pragma pop_macro("CharNext") | ||
| 1048 | # undef CharNext_macro_found | ||
| 1049 | # endif | ||
| 1050 | |||
| 1051 | # ifdef rb_w_macro_found32_iswinnt | ||
| 1052 | # pragma pop_macro("rb_w32_iswinnt") | ||
| 1053 | # undef rb_w_macro_found32_iswinnt | ||
| 1054 | # endif | ||
| 1055 | |||
| 1056 | # ifdef rb_w_macro_found32_iswin95 | ||
| 1057 | # pragma pop_macro("rb_w32_iswin95") | ||
| 1058 | # undef rb_w_macro_found32_iswin95 | ||
| 1059 | # endif | ||
| 1060 | |||
| 1061 | # ifdef getc_macro_found | ||
| 1062 | # pragma pop_macro("getc") | ||
| 1063 | # undef getc_macro_found | ||
| 1064 | # endif | ||
| 1065 | |||
| 1066 | # ifdef putc_macro_found | ||
| 1067 | # pragma pop_macro("putc") | ||
| 1068 | # undef putc_macro_found | ||
| 1069 | # endif | ||
| 1070 | |||
| 1071 | # ifdef fgetc_macro_found | ||
| 1072 | # pragma pop_macro("fgetc") | ||
| 1073 | # undef fgetc_macro_found | ||
| 1074 | # endif | ||
| 1075 | |||
| 1076 | # ifdef fputc_macro_found | ||
| 1077 | # pragma pop_macro("fputc") | ||
| 1078 | # undef fputc_macro_found | ||
| 1079 | # endif | ||
| 1080 | |||
| 1081 | # ifdef getchar_macro_found | ||
| 1082 | # pragma pop_macro("getchar") | ||
| 1083 | # undef getchar_macro_found | ||
| 1084 | # endif | ||
| 1085 | |||
| 1086 | # ifdef putchar_macro_found | ||
| 1087 | # pragma pop_macro("putchar") | ||
| 1088 | # undef putchar_macro_found | ||
| 1089 | # endif | ||
| 1090 | |||
| 1091 | # ifdef fgetchar_macro_found | ||
| 1092 | # pragma pop_macro("fgetchar") | ||
| 1093 | # undef fgetchar_macro_found | ||
| 1094 | # endif | ||
| 1095 | |||
| 1096 | # ifdef fputchar_macro_found | ||
| 1097 | # pragma pop_macro("fputchar") | ||
| 1098 | # undef fputchar_macro_found | ||
| 1099 | # endif | ||
| 1100 | |||
| 1101 | # ifdef utime_macro_found | ||
| 1102 | # pragma pop_macro("utime") | ||
| 1103 | # undef utime_macro_found | ||
| 1104 | # endif | ||
| 1105 | |||
| 1106 | # ifdef strcasecmp_macro_found | ||
| 1107 | # pragma pop_macro("strcasecmp") | ||
| 1108 | # undef strcasecmp_macro_found | ||
| 1109 | # endif | ||
| 1110 | |||
| 1111 | # ifdef strncasecmp_macro_found | ||
| 1112 | # pragma pop_macro("strncasecmp") | ||
| 1113 | # undef strncasecmp_macro_found | ||
| 1114 | # endif | ||
| 1115 | |||
| 1116 | # ifdef close_macro_found | ||
| 1117 | # pragma pop_macro("close") | ||
| 1118 | # undef close_macro_found | ||
| 1119 | # endif | ||
| 1120 | |||
| 1121 | # ifdef fclose_macro_found | ||
| 1122 | # pragma pop_macro("fclose") | ||
| 1123 | # undef fclose_macro_found | ||
| 1124 | # endif | ||
| 1125 | |||
| 1126 | # ifdef read_macro_found | ||
| 1127 | # pragma pop_macro("read") | ||
| 1128 | # undef read_macro_found | ||
| 1129 | # endif | ||
| 1130 | |||
| 1131 | # ifdef write_macro_found | ||
| 1132 | # pragma pop_macro("write") | ||
| 1133 | # undef write_macro_found | ||
| 1134 | # endif | ||
| 1135 | |||
| 1136 | # ifdef getpid_macro_found | ||
| 1137 | # pragma pop_macro("getpid") | ||
| 1138 | # undef getpid_macro_found | ||
| 1139 | # endif | ||
| 1140 | |||
| 1141 | # ifdef sleep_macro_found | ||
| 1142 | # pragma pop_macro("sleep") | ||
| 1143 | # undef sleep | ||
| 1144 | # undef sleep_macro_found | ||
| 1145 | # endif | ||
| 1146 | |||
| 1147 | # ifdef creat_macro_found | ||
| 1148 | # pragma pop_macro("creat") | ||
| 1149 | # undef creat_macro_found | ||
| 1150 | # endif | ||
| 1151 | |||
| 1152 | # ifdef eof_macro_found | ||
| 1153 | # pragma pop_macro("eof") | ||
| 1154 | # undef eof_macro_found | ||
| 1155 | # endif | ||
| 1156 | |||
| 1157 | # ifdef filelength_macro_found | ||
| 1158 | # pragma pop_macro("filelength") | ||
| 1159 | # undef filelength_macro_found | ||
| 1160 | # endif | ||
| 1161 | |||
| 1162 | # ifdef mktemp_macro_found | ||
| 1163 | # pragma pop_macro("mktemp") | ||
| 1164 | # undef mktemp_macro_found | ||
| 1165 | # endif | ||
| 1166 | |||
| 1167 | # ifdef tell_macro_found | ||
| 1168 | # pragma pop_macro("tell") | ||
| 1169 | # undef tell_macro_found | ||
| 1170 | # endif | ||
| 1171 | |||
| 1172 | # ifdef unlink_macro_found | ||
| 1173 | # pragma pop_macro("unlink") | ||
| 1174 | # undef unlink_macro_found | ||
| 1175 | # endif | ||
| 1176 | |||
| 1177 | # ifdef _open_macro_found | ||
| 1178 | # pragma pop_macro("_open") | ||
| 1179 | # undef _open_macro_found | ||
| 1180 | # endif | ||
| 1181 | |||
| 1182 | # ifdef sopen_macro_found | ||
| 1183 | # pragma pop_macro("sopen") | ||
| 1184 | # undef sopen_macro_found | ||
| 1185 | # endif | ||
| 1186 | |||
| 1187 | # ifdef fopen_macro_found | ||
| 1188 | # pragma pop_macro("fopen") | ||
| 1189 | # undef fopen_macro_found | ||
| 1190 | # endif | ||
| 1191 | |||
| 1192 | # ifdef fdopen_macro_found | ||
| 1193 | # pragma pop_macro("fdopen") | ||
| 1194 | # undef fdopen_macro_found | ||
| 1195 | # endif | ||
| 1196 | |||
| 1197 | # ifdef fsopen_macro_found | ||
| 1198 | # pragma pop_macro("fsopen") | ||
| 1199 | # undef fsopen_macro_found | ||
| 1200 | # endif | ||
| 1201 | |||
| 1202 | # ifdef fsync_macro_found | ||
| 1203 | # pragma pop_macro("fsync") | ||
| 1204 | # undef fsync_macro_found | ||
| 1205 | # endif | ||
| 1206 | |||
| 1207 | # ifdef stat_macro_found | ||
| 1208 | # pragma pop_macro("stat") | ||
| 1209 | # undef stat_macro_found | ||
| 1210 | # endif | ||
| 1211 | |||
| 1212 | # ifdef execv_macro_found | ||
| 1213 | # pragma pop_macro("execv") | ||
| 1214 | # undef execv_macro_found | ||
| 1215 | # endif | ||
| 1216 | |||
| 1217 | # ifdef isatty_macro_found | ||
| 1218 | # pragma pop_macro("isatty") | ||
| 1219 | # undef isatty_macro_found | ||
| 1220 | # endif | ||
| 1221 | |||
| 1222 | # ifdef mkdir_macro_found | ||
| 1223 | # pragma pop_macro("mkdir") | ||
| 1224 | # undef mkdir_macro_found | ||
| 1225 | # endif | ||
| 1226 | |||
| 1227 | # ifdef rmdir_macro_found | ||
| 1228 | # pragma pop_macro("rmdir") | ||
| 1229 | # undef rmdir_macro_found | ||
| 1230 | # endif | ||
| 1231 | |||
| 1232 | # ifdef isascii_macro_found | ||
| 1233 | # pragma pop_macro("isascii") | ||
| 1234 | # undef isascii_macro_found | ||
| 1235 | # endif | ||
| 1236 | |||
| 1237 | # ifdef vsnprintf_macro_found | ||
| 1238 | # pragma pop_macro("vsnprintf") | ||
| 1239 | # undef vsnprintf_macro_found | ||
| 1240 | # endif | ||
| 1241 | |||
| 1242 | # ifdef snprintf_macro_found | ||
| 1243 | # pragma pop_macro("snprintf") | ||
| 1244 | # undef snprintf_macro_found | ||
| 1245 | # endif | ||
| 1246 | |||
| 1247 | # ifdef isnan_macro_found | ||
| 1248 | # pragma pop_macro("isnan") | ||
| 1249 | # undef isnan_macro_found | ||
| 1250 | # endif | ||
| 1251 | |||
| 1252 | # ifdef isinf_macro_found | ||
| 1253 | # pragma pop_macro("isinf") | ||
| 1254 | # undef isinf_macro_found | ||
| 1255 | # endif | ||
| 1256 | |||
| 1257 | # ifdef finite_macro_found | ||
| 1258 | # pragma pop_macro("finite") | ||
| 1259 | # undef finite_macro_found | ||
| 1260 | # endif | ||
| 1261 | |||
| 1262 | # ifdef copysign_macro_found | ||
| 1263 | # pragma pop_macro("copysign") | ||
| 1264 | # undef copysign_macro_found | ||
| 1265 | # endif | ||
| 1266 | |||
| 1267 | # ifdef scalb_macro_found | ||
| 1268 | # pragma pop_macro("scalb") | ||
| 1269 | # undef scalb_macro_found | ||
| 1270 | # endif | ||
| 1271 | |||
| 1272 | # ifdef accept_macro_found | ||
| 1273 | # pragma pop_macro("accept") | ||
| 1274 | # undef accept_macro_found | ||
| 1275 | # endif | ||
| 1276 | |||
| 1277 | # ifdef bind_macro_found | ||
| 1278 | # pragma pop_macro("bind") | ||
| 1279 | # undef bind_macro_found | ||
| 1280 | # endif | ||
| 1281 | |||
| 1282 | # ifdef connect_macro_found | ||
| 1283 | # pragma pop_macro("connect") | ||
| 1284 | # undef connect_macro_found | ||
| 1285 | # endif | ||
| 1286 | |||
| 1287 | # ifdef FD_SET_macro_found | ||
| 1288 | # pragma pop_macro("FD_SET") | ||
| 1289 | # undef FD_SET_macro_found | ||
| 1290 | # endif | ||
| 1291 | |||
| 1292 | # ifdef FD_CLR_macro_found | ||
| 1293 | # pragma pop_macro("FD_CLR") | ||
| 1294 | # undef FD_CLR_macro_found | ||
| 1295 | # endif | ||
| 1296 | |||
| 1297 | # ifdef FD_ISSET_macro_found | ||
| 1298 | # pragma pop_macro("FD_ISSET") | ||
| 1299 | # undef FD_ISSET_macro_found | ||
| 1300 | # endif | ||
| 1301 | |||
| 1302 | # ifdef select_macro_found | ||
| 1303 | # pragma pop_macro("select") | ||
| 1304 | # undef select_macro_found | ||
| 1305 | # endif | ||
| 1306 | |||
| 1307 | # ifdef getpeername_macro_found | ||
| 1308 | # pragma pop_macro("getpeername") | ||
| 1309 | # undef getpeername_macro_found | ||
| 1310 | # endif | ||
| 1311 | |||
| 1312 | # ifdef getsockname_macro_found | ||
| 1313 | # pragma pop_macro("getsockname") | ||
| 1314 | # undef getsockname_macro_found | ||
| 1315 | # endif | ||
| 1316 | |||
| 1317 | # ifdef getsockopt_macro_found | ||
| 1318 | # pragma pop_macro("getsockopt") | ||
| 1319 | # undef getsockopt_macro_found | ||
| 1320 | # endif | ||
| 1321 | |||
| 1322 | # ifdef ioctlsocket_macro_found | ||
| 1323 | # pragma pop_macro("ioctlsocket") | ||
| 1324 | # undef ioctlsocket_macro_found | ||
| 1325 | # endif | ||
| 1326 | |||
| 1327 | # ifdef listen_macro_found | ||
| 1328 | # pragma pop_macro("listen") | ||
| 1329 | # undef listen_macro_found | ||
| 1330 | # endif | ||
| 1331 | |||
| 1332 | # ifdef recv_macro_found | ||
| 1333 | # pragma pop_macro("recv") | ||
| 1334 | # undef recv_macro_found | ||
| 1335 | # endif | ||
| 1336 | |||
| 1337 | # ifdef recvfrom_macro_found | ||
| 1338 | # pragma pop_macro("recvfrom") | ||
| 1339 | # undef recvfrom_macro_found | ||
| 1340 | # endif | ||
| 1341 | |||
| 1342 | # ifdef send_macro_found | ||
| 1343 | # pragma pop_macro("send") | ||
| 1344 | # undef send_macro_found | ||
| 1345 | # endif | ||
| 1346 | |||
| 1347 | # ifdef sendto_macro_found | ||
| 1348 | # pragma pop_macro("sendto") | ||
| 1349 | # undef sendto_macro_found | ||
| 1350 | # endif | ||
| 1351 | |||
| 1352 | # ifdef setsockopt_macro_found | ||
| 1353 | # pragma pop_macro("setsockopt") | ||
| 1354 | # undef setsockopt_macro_found | ||
| 1355 | # endif | ||
| 1356 | |||
| 1357 | # ifdef shutdown_macro_found | ||
| 1358 | # pragma pop_macro("shutdown") | ||
| 1359 | # undef shutdown_macro_found | ||
| 1360 | # endif | ||
| 1361 | |||
| 1362 | # ifdef socket_macro_found | ||
| 1363 | # pragma pop_macro("socket") | ||
| 1364 | # undef socket_macro_found | ||
| 1365 | # endif | ||
| 1366 | |||
| 1367 | # ifdef gethostbyaddr_macro_found | ||
| 1368 | # pragma pop_macro("gethostbyaddr") | ||
| 1369 | # undef gethostbyaddr_macro_found | ||
| 1370 | # endif | ||
| 1371 | |||
| 1372 | # ifdef gethostbyname_macro_found | ||
| 1373 | # pragma pop_macro("gethostbyname") | ||
| 1374 | # undef gethostbyname_macro_found | ||
| 1375 | # endif | ||
| 1376 | |||
| 1377 | # ifdef gethostname_macro_found | ||
| 1378 | # pragma pop_macro("gethostname") | ||
| 1379 | # undef gethostname_macro_found | ||
| 1380 | # endif | ||
| 1381 | |||
| 1382 | # ifdef getprotobyname_macro_found | ||
| 1383 | # pragma pop_macro("getprotobyname") | ||
| 1384 | # undef getprotobyname_macro_found | ||
| 1385 | # endif | ||
| 1386 | |||
| 1387 | # ifdef getprotobynumber_macro_found | ||
| 1388 | # pragma pop_macro("getprotobynumber") | ||
| 1389 | # undef getprotobynumber_macro_found | ||
| 1390 | # endif | ||
| 1391 | |||
| 1392 | # ifdef getservbyname_macro_found | ||
| 1393 | # pragma pop_macro("getservbyname") | ||
| 1394 | # undef getservbyname_macro_found | ||
| 1395 | # endif | ||
| 1396 | |||
| 1397 | # ifdef getservbyport_macro_found | ||
| 1398 | # pragma pop_macro("getservbyport") | ||
| 1399 | # undef getservbyport_macro_found | ||
| 1400 | # endif | ||
| 1401 | |||
| 1402 | # ifdef get_osfhandle_macro_found | ||
| 1403 | # pragma pop_macro("get_osfhandle") | ||
| 1404 | # undef get_osfhandle_macro_found | ||
| 1405 | # endif | ||
| 1406 | |||
| 1407 | # ifdef getcwd_macro_found | ||
| 1408 | # pragma pop_macro("getcwd") | ||
| 1409 | # undef getcwd_macro_found | ||
| 1410 | # endif | ||
| 1411 | |||
| 1412 | # ifdef getenv_macro_found | ||
| 1413 | # pragma pop_macro("getenv") | ||
| 1414 | # undef getenv_macro_found | ||
| 1415 | # endif | ||
| 1416 | |||
| 1417 | # ifdef rename_macro_found | ||
| 1418 | # pragma pop_macro("rename") | ||
| 1419 | # undef rename_macro_found | ||
| 1420 | # endif | ||
| 1421 | |||
| 1422 | # ifdef times_macro_found | ||
| 1423 | # pragma pop_macro("times") | ||
| 1424 | # undef times_macro_found | ||
| 1425 | # endif | ||
| 1426 | |||
| 1427 | # ifdef Sleep_macro_found | ||
| 1428 | # pragma pop_macro("Sleep") | ||
| 1429 | # undef Sleep_macro_found | ||
| 1430 | # endif | ||
| 1431 | #endif | ||
| 1432 | |||
| 1433 | #endif // RUBYINTERPRETER_HPP | ||
| 1434 |