aboutsummaryrefslogtreecommitdiff
path: root/data/mud_with_grass.png
blob: 60ae4eec27d7c00f704375dac0019df01db2f521 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 10 00 00 00 10 08 02 00 00 00 90 91 68 .PNG........IHDR...............h
0020 36 00 00 03 00 50 4c 54 45 00 00 00 ff 00 00 00 ff 00 ff ff 00 00 00 ff ff 00 ff 00 ff ff ff ff 6....PLTE.......................
0040 ff db db db b6 b6 b6 92 92 92 6d 6d 6d 49 49 49 24 24 24 db 00 00 b6 00 00 92 00 00 6d 00 00 49 ..........mmmIII$$$.........m..I
0060 00 00 24 00 00 00 db 00 00 b6 00 00 92 00 00 6d 00 00 49 00 00 24 00 db db 00 b6 b6 00 92 92 00 ..$............m..I..$..........
0080 6d 6d 00 49 49 00 24 24 00 00 00 db 00 00 b6 00 00 92 00 00 6d 00 00 49 00 00 24 db 00 db b6 00 mm.II.$$............m..I..$.....
00a0 b6 92 00 92 6d 00 6d 49 00 49 24 00 24 00 db db 00 b6 b6 00 92 92 00 6d 6d 00 49 49 00 24 24 ff ....m.mI.I$.$..........mm.II.$$.
00c0 db db db b6 b6 b6 92 92 92 6d 6d 6d 49 49 49 24 24 ff b6 b6 db 92 92 b6 6d 6d 92 49 49 6d 24 24 .........mmmIII$$.......mm.IIm$$
00e0 ff 92 92 db 6d 6d b6 49 49 92 24 24 ff 6d 6d db 49 49 b6 24 24 ff 49 49 db 24 24 ff 24 24 db ff ....mm.II.$$.mm.II.$$.II.$$.$$..
0100 db b6 db b6 92 b6 92 6d 92 6d 49 6d 49 24 49 24 b6 ff b6 92 db 92 6d b6 6d 49 92 49 24 6d 24 92 .......m.mImI$I$......m.mI.I$m$.
0120 ff 92 6d db 6d 49 b6 49 24 92 24 6d ff 6d 49 db 49 24 b6 24 49 ff 49 24 db 24 24 ff 24 db db ff ..m.mI.I$.$m.mI.I$.$I.I$.$$.$...
0140 b6 b6 db 92 92 b6 6d 6d 92 49 49 6d 24 24 49 b6 b6 ff 92 92 db 6d 6d b6 49 49 92 24 24 6d 92 92 ......mm.IIm$$I......mm.II.$$m..
0160 ff 6d 6d db 49 49 b6 24 24 92 6d 6d ff 49 49 db 24 24 b6 49 49 ff 24 24 db 24 24 ff ff ff db db .mm.II.$$.mm.II.$$.II.$$.$$.....
0180 db b6 b6 b6 92 92 92 6d 6d 6d 49 49 49 24 ff ff b6 db db 92 b6 b6 6d 92 92 49 6d 6d 24 ff ff 92 .......mmmIII$........m..Imm$...
01a0 db db 6d b6 b6 49 92 92 24 ff ff 6d db db 49 b6 b6 24 ff ff 49 db db 24 ff ff 24 ff db ff db b6 ..m..I..$..m..I..$..I..$..$.....
01c0 db b6 92 b6 92 6d 92 6d 49 6d 49 24 49 ff b6 ff db 92 db b6 6d b6 92 49 92 6d 24 6d ff 92 ff db .....m.mImI$I.......m..I.m$m....
01e0 6d db b6 49 b6 92 24 92 ff 6d ff db 49 db b6 24 b6 ff 49 ff db 24 db ff 24 ff db ff ff b6 db db m..I..$..m..I..$..I..$..$.......
0200 92 b6 b6 6d 92 92 49 6d 6d 24 49 49 b6 ff ff 92 db db 6d b6 b6 49 92 92 24 6d 6d 92 ff ff 6d db ...m..Imm$II......m..I..$mm...m.
0220 db 49 b6 b6 24 92 92 6d ff ff 49 db db 24 b6 b6 49 ff ff 24 db db 24 ff ff ff db b6 db b6 92 b6 .I..$..m..I..$..I..$..$.........
0240 92 6d 92 6d 49 6d 49 24 49 24 00 ff b6 92 db 92 6d b6 6d 49 92 49 24 6d 24 00 ff b6 db db 92 b6 .m.mImI$I$......m.mI.I$m$.......
0260 b6 6d 92 92 49 6d 6d 24 49 49 00 24 ff 92 b6 db 6d 92 b6 49 6d 92 24 49 6d 00 24 db b6 ff b6 92 .m..Imm$II.$....m..Im.$Im.$.....
0280 db 92 6d b6 6d 49 92 49 24 6d 24 00 49 b6 92 ff 92 6d db 6d 49 b6 49 24 92 24 00 6d b6 db ff 92 ..m.mI.I$m$.I....m.mI.I$.$.m....
02a0 b6 db 6d 92 b6 49 6d 92 24 49 6d 00 24 49 92 b6 ff 6d 92 db 49 6d b6 24 49 92 00 24 6d b6 ff db ..m..Im.$Im.$I...m..Im.$I..$m...
02c0 92 db b6 6d b6 92 49 92 6d 24 6d 49 00 49 24 92 ff b6 6d db 92 49 b6 6d 24 92 49 00 6d 24 db ff ...m..I.m$mI.I$...m..I.m$.I.m$..
02e0 b6 b6 db 92 92 b6 6d 6d 92 49 49 6d 24 24 49 00 b6 ff 92 92 db 6d 6d b6 49 49 92 24 24 6d 00 ff ......mm.IIm$$I......mm.II.$$m..
0300 b6 00 db 92 00 b6 6d 00 92 49 00 ff 00 b6 db 00 92 b6 00 6d 92 00 49 00 b6 ff 00 92 db 00 6d b6 ......m..I.........m..I.......m.
0320 00 49 92 00 00 00 00 00 00 cf 2a 02 04 00 00 02 f7 49 44 41 54 28 cf 05 c1 cb 6f da 66 00 00 f0 .I........*......IDAT(....o.f...
0340 8f ef c3 c6 36 8e 79 bf 62 c2 23 50 58 12 52 05 da a2 66 eb e8 a6 35 95 da 1d 36 e5 98 1d ba 5d ....6.y.b.#PX.R...f...5...6....]
0360 26 ed 9f da 69 da a4 5d b7 43 a5 1d aa ae 6a bb b4 d9 42 08 21 e3 d1 40 12 70 78 da 06 6c b0 c1 &...i..].C....j...B.!..@.px..l..
0380 8f fe 7e 96 fd 9f 7c 6e af 8b f4 40 45 b7 48 dd 19 4d 50 37 83 e1 de d3 9d d6 e5 88 75 38 c6 3a ..~...|n...@E.H..MP7........u8.:
03a0 b8 b8 6c d2 b8 f5 ee 46 be de 3e 6d 55 7b 30 b4 e1 94 97 2a 20 89 9d 58 52 be 92 3e 7f 10 f2 d2 ..l....F..>mU{0....*...XR..>....
03c0 cc db c3 8a 9b 20 8b 87 97 9d 8b b1 24 cf 23 c9 d0 71 f3 cd 55 7b 60 c0 10 da ff 71 47 e0 fb 7c ............$.#..q..U{`....qG..|
03e0 1b 45 fc 81 f0 56 bc df bc e9 8a a3 50 2a f2 fc f7 b3 83 ef ef 4b cb ce d1 6b 91 a4 cc 9d fc 27 .E...V......P*.......K...k.....'
0400 36 bb 0b b3 42 b4 fb 65 dc 24 14 5d 1e af 38 e1 aa df 38 2e f6 83 d3 1c eb cc c4 d4 93 f2 6b c1 6...B..e.$.]..8...8...........k.
0420 96 76 27 d2 56 d3 42 08 7d a9 51 14 ae 5a 3d c4 28 4d 64 d2 ad 97 73 fb 14 7e f8 a5 7c 37 92 9e .v'.V.B.}.Q..Z=.(Md...s..~..|7..
0440 f3 ff fd fb fc 7d 57 c3 ff 07 a3 da 6f d2 bd 27 e1 ca 79 e7 61 61 fd e4 cf 46 b2 06 50 8c 4d 01 .....}W.....o..'..y.aa...F..P.M.
0460 c3 f9 cd fe 0f 83 2b de 95 ad 73 22 83 58 88 03 76 2d 91 58 74 17 61 37 f4 02 fa 8f 5f 6f e6 47 ......+...s".X..v-.Xt.a7...._o.G
0480 ca de a3 83 a2 52 42 cf be fd 4c 11 4b 23 cd 44 d3 c3 e2 05 d6 d6 e6 5a 6d 51 eb 4c 2a 55 4e 10 .....RB...L.K#.D.......ZmQ.L*UN.
04a0 d5 60 8a 1e 4c 64 4c 37 1e ee 3d e9 08 7f b3 41 1f da f4 04 24 a0 bf 78 5b df cb e5 5f 54 5b 49 .`..LdL7..=....A....$..x[..._T[I
04c0 8d b1 d9 90 88 a6 99 30 e5 73 02 53 8f 78 17 42 a8 90 b7 08 ef 47 3d e1 e5 ab 3a 5a c5 66 65 ee .......0.s.S.x.B.....G=...:Z.fe.
04e0 9a 65 3c 6f 4a 1f be 7e bc 2d 53 a2 3d 46 66 11 66 f7 2c 87 bc a3 7c d6 39 f8 2a d7 bd 7e e7 c4 .e<oJ..~.-S.=Ff.f.,...|.9.*..~..
0500 6e ab 8d 21 0a 68 a8 90 8d 01 c7 cc c5 78 25 53 38 3d 96 ed 5e 78 7e c4 f9 6d 2b 6d 09 52 99 d5 n..!.h.......x%S8=..^x~..m+m.R..
0520 02 61 fd b9 54 4a af 25 34 c2 36 82 e7 b7 3c 39 b4 15 f1 79 18 28 f6 a1 db 0a 69 87 48 1b 4a ca .a..TJ.%4.6...<9...y.(....i.H.J.
0540 1d a8 81 f6 64 a6 d9 b9 59 43 15 b7 3f f5 92 23 d8 1b 77 37 7d 9b 5c af 89 02 09 23 49 85 e3 eb ....d...YC..?..#..w7}.\....#I...
0560 18 ee 15 d6 60 34 ec 4e 1a 2d 25 9c 49 ca bc 96 2f e4 27 f5 3a 43 48 ec f6 ee 14 98 ad 36 37 e3 ....`4.N.-%.I.../.'.:CH......67.
0580 54 f4 dd 17 1b 27 9d c6 ab fa f0 01 0a 5b e2 b8 e8 5c 89 6d 05 26 7f 35 a3 a9 81 65 b0 a4 33 14 T....'.......[...\.m.&.5...e..3.
05a0 09 18 7d a9 6d d8 7d 95 b2 d4 a0 15 74 3f 41 36 2e 51 9a f5 eb 40 e9 4c 38 be aa 9f b6 ff 49 e5 ..}.m.}.....t?A6.Q...@.L8.....I.
05c0 ee 68 38 ae e3 4a af 01 c9 44 b6 52 6d 54 82 9a 22 76 63 ae 39 ba 97 64 84 66 6f f7 71 1c b8 b1 .h8..J...D.RmT.."vc.9..d.fo.q...
05e0 d0 e2 16 20 cf 30 1c fa cd 85 28 8e 6d 77 b2 0b fe a6 77 5d 35 fb 78 b3 a2 44 77 83 14 1f 43 b7 .....0....(.mw....w]5.x..Dw...C.
0600 73 51 36 e2 9b 2f 39 42 b5 bd 6b f1 b4 6e cc d0 8a b1 f4 44 d7 e3 c3 6b 1c c9 15 55 95 00 45 50 sQ6../9B..k..n.....D...k...U..EP
0620 98 0f f6 01 bd 18 7f 04 aa b9 79 04 b8 26 34 b8 00 00 00 00 49 45 4e 44 ae 42 60 82 ..........y..&4.....IEND.B`.
'n325' href='#n325'>325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666
/*
** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $
** Dynamic library loader for Lua
** See Copyright Notice in lua.h
**
** This module contains an implementation of loadlib for Unix systems
** that have dlfcn, an implementation for Darwin (Mac OS X), an
** implementation for Windows, and a stub for other systems.
*/


#include <stdlib.h>
#include <string.h>


#define loadlib_c
#define LUA_LIB

#include "lua.h"

#include "lauxlib.h"
#include "lualib.h"


/* prefix for open functions in C libraries */
#define LUA_POF		"luaopen_"

/* separator for open functions in C libraries */
#define LUA_OFSEP	"_"


#define LIBPREFIX	"LOADLIB: "

#define POF		LUA_POF
#define LIB_FAIL	"open"


/* error codes for ll_loadfunc */
#define ERRLIB		1
#define ERRFUNC		2

#define setprogdir(L)		((void)0)


static void ll_unloadlib (void *lib);
static void *ll_load (lua_State *L, const char *path);
static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym);



#if defined(LUA_DL_DLOPEN)
/*
** {========================================================================
** This is an implementation of loadlib based on the dlfcn interface.
** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD,
** NetBSD, AIX 4.2, HPUX 11, and  probably most other Unix flavors, at least
** as an emulation layer on top of native functions.
** =========================================================================
*/

#include <dlfcn.h>

static void ll_unloadlib (void *lib) {
  dlclose(lib);
}


static void *ll_load (lua_State *L, const char *path) {
  void *lib = dlopen(path, RTLD_NOW);
  if (lib == NULL) lua_pushstring(L, dlerror());
  return lib;
}


static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
  lua_CFunction f = (lua_CFunction)dlsym(lib, sym);
  if (f == NULL) lua_pushstring(L, dlerror());
  return f;
}

/* }====================================================== */



#elif defined(LUA_DL_DLL)
/*
** {======================================================================
** This is an implementation of loadlib for Windows using native functions.
** =======================================================================
*/

#include <windows.h>


#undef setprogdir

static void setprogdir (lua_State *L) {
  char buff[MAX_PATH + 1];
  char *lb;
  DWORD nsize = sizeof(buff)/sizeof(char);
  DWORD n = GetModuleFileNameA(NULL, buff, nsize);
  if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
    luaL_error(L, "unable to get ModuleFileName");
  else {
    *lb = '\0';
    luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff);
    lua_remove(L, -2);  /* remove original string */
  }
}


static void pusherror (lua_State *L) {
  int error = GetLastError();
  char buffer[128];
  if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
      NULL, error, 0, buffer, sizeof(buffer), NULL))
    lua_pushstring(L, buffer);
  else
    lua_pushfstring(L, "system error %d\n", error);
}

static void ll_unloadlib (void *lib) {
  FreeLibrary((HINSTANCE)lib);
}


static void *ll_load (lua_State *L, const char *path) {
  HINSTANCE lib = LoadLibraryA(path);
  if (lib == NULL) pusherror(L);
  return lib;
}


static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
  lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym);
  if (f == NULL) pusherror(L);
  return f;
}

/* }====================================================== */



#elif defined(LUA_DL_DYLD)
/*
** {======================================================================
** Native Mac OS X / Darwin Implementation
** =======================================================================
*/

#include <mach-o/dyld.h>


/* Mac appends a `_' before C function names */
#undef POF
#define POF	"_" LUA_POF


static void pusherror (lua_State *L) {
  const char *err_str;
  const char *err_file;
  NSLinkEditErrors err;
  int err_num;
  NSLinkEditError(&err, &err_num, &err_file, &err_str);
  lua_pushstring(L, err_str);
}


static const char *errorfromcode (NSObjectFileImageReturnCode ret) {
  switch (ret) {
    case NSObjectFileImageInappropriateFile:
      return "file is not a bundle";
    case NSObjectFileImageArch:
      return "library is for wrong CPU type";
    case NSObjectFileImageFormat:
      return "bad format";
    case NSObjectFileImageAccess:
      return "cannot access file";
    case NSObjectFileImageFailure:
    default:
      return "unable to load library";
  }
}


static void ll_unloadlib (void *lib) {
  NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES);
}


static void *ll_load (lua_State *L, const char *path) {
  NSObjectFileImage img;
  NSObjectFileImageReturnCode ret;
  /* this would be a rare case, but prevents crashing if it happens */
  if(!_dyld_present()) {
    lua_pushliteral(L, "dyld not present");
    return NULL;
  }
  ret = NSCreateObjectFileImageFromFile(path, &img);
  if (ret == NSObjectFileImageSuccess) {
    NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE |
                       NSLINKMODULE_OPTION_RETURN_ON_ERROR);
    NSDestroyObjectFileImage(img);
    if (mod == NULL) pusherror(L);
    return mod;
  }
  lua_pushstring(L, errorfromcode(ret));
  return NULL;
}


static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
  NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym);
  if (nss == NULL) {
    lua_pushfstring(L, "symbol " LUA_QS " not found", sym);
    return NULL;
  }
  return (lua_CFunction)NSAddressOfSymbol(nss);
}

/* }====================================================== */



#else
/*
** {======================================================
** Fallback for other systems
** =======================================================
*/

#undef LIB_FAIL
#define LIB_FAIL	"absent"


#define DLMSG	"dynamic libraries not enabled; check your Lua installation"


static void ll_unloadlib (void *lib) {
  (void)lib;  /* to avoid warnings */
}


static void *ll_load (lua_State *L, const char *path) {
  (void)path;  /* to avoid warnings */
  lua_pushliteral(L, DLMSG);
  return NULL;
}


static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
  (void)lib; (void)sym;  /* to avoid warnings */
  lua_pushliteral(L, DLMSG);
  return NULL;
}

/* }====================================================== */
#endif



static void **ll_register (lua_State *L, const char *path) {
  void **plib;
  lua_pushfstring(L, "%s%s", LIBPREFIX, path);
  lua_gettable(L, LUA_REGISTRYINDEX);  /* check library in registry? */
  if (!lua_isnil(L, -1))  /* is there an entry? */
    plib = (void **)lua_touserdata(L, -1);
  else {  /* no entry yet; create one */
    lua_pop(L, 1);
    plib = (void **)lua_newuserdata(L, sizeof(const void *));
    *plib = NULL;
    luaL_getmetatable(L, "_LOADLIB");
    lua_setmetatable(L, -2);
    lua_pushfstring(L, "%s%s", LIBPREFIX, path);
    lua_pushvalue(L, -2);
    lua_settable(L, LUA_REGISTRYINDEX);
  }
  return plib;
}


/*
** __gc tag method: calls library's `ll_unloadlib' function with the lib
** handle
*/
static int gctm (lua_State *L) {
  void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB");
  if (*lib) ll_unloadlib(*lib);
  *lib = NULL;  /* mark library as closed */
  return 0;
}


static int ll_loadfunc (lua_State *L, const char *path, const char *sym) {
  void **reg = ll_register(L, path);
  if (*reg == NULL) *reg = ll_load(L, path);
  if (*reg == NULL)
    return ERRLIB;  /* unable to load library */
  else {
    lua_CFunction f = ll_sym(L, *reg, sym);
    if (f == NULL)
      return ERRFUNC;  /* unable to find function */
    lua_pushcfunction(L, f);
    return 0;  /* return function */
  }
}


static int ll_loadlib (lua_State *L) {
  const char *path = luaL_checkstring(L, 1);
  const char *init = luaL_checkstring(L, 2);
  int stat = ll_loadfunc(L, path, init);
  if (stat == 0)  /* no errors? */
    return 1;  /* return the loaded function */
  else {  /* error; error message is on stack top */
    lua_pushnil(L);
    lua_insert(L, -2);
    lua_pushstring(L, (stat == ERRLIB) ?  LIB_FAIL : "init");
    return 3;  /* return nil, error message, and where */
  }
}



/*
** {======================================================