interp_lua.c (3af64f03119a159ac15eb75b92d346705b490385) | interp_lua.c (ee74c236246cc2567b00578bbc760e38ee42fdfd) |
---|---|
1/*- 2 * Copyright (c) 2011 Wojciech A. Koszek <wkoszek@FreeBSD.org> 3 * Copyright (c) 2014 Pedro Souza <pedrosouza@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 46 unchanged lines hidden (view full) --- 55 printf("%s(%d): ", __func__, __LINE__); \ 56 printf(__VA_ARGS__); \ 57 printf("\n"); \ 58} while (0) 59#else 60#define LDBG(...) 61#endif 62 | 1/*- 2 * Copyright (c) 2011 Wojciech A. Koszek <wkoszek@FreeBSD.org> 3 * Copyright (c) 2014 Pedro Souza <pedrosouza@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 46 unchanged lines hidden (view full) --- 55 printf("%s(%d): ", __func__, __LINE__); \ 56 printf(__VA_ARGS__); \ 57 printf("\n"); \ 58} while (0) 59#else 60#define LDBG(...) 61#endif 62 |
63#define LOADER_LUA LUA_PATH "/loader.lua" 64 |
|
63INTERP_DEFINE("lua"); 64 65static void * 66interp_lua_realloc(void *ud __unused, void *ptr, size_t osize __unused, size_t nsize) 67{ 68 69 if (nsize == 0) { 70 free(ptr); --- 44 unchanged lines hidden (view full) --- 115 softc->luap = luap; 116 117 /* "require" functions from 'loadedlibs' and set results to global table */ 118 for (lib = loadedlibs; lib->func; lib++) { 119 luaL_requiref(luap, lib->name, lib->func, 1); 120 lua_pop(luap, 1); /* remove lib */ 121 } 122 | 65INTERP_DEFINE("lua"); 66 67static void * 68interp_lua_realloc(void *ud __unused, void *ptr, size_t osize __unused, size_t nsize) 69{ 70 71 if (nsize == 0) { 72 free(ptr); --- 44 unchanged lines hidden (view full) --- 117 softc->luap = luap; 118 119 /* "require" functions from 'loadedlibs' and set results to global table */ 120 for (lib = loadedlibs; lib->func; lib++) { 121 luaL_requiref(luap, lib->name, lib->func, 1); 122 lua_pop(luap, 1); /* remove lib */ 123 } 124 |
123 filename = "/boot/lua/loader.lua"; | 125 filename = LOADER_LUA; |
124 if (interp_include(filename) != 0) { 125 const char *errstr = lua_tostring(luap, -1); 126 errstr = errstr == NULL ? "unknown" : errstr; 127 printf("Startup error in %s:\nLUA ERROR: %s.\n", filename, errstr); 128 lua_pop(luap, 1); 129 } 130} 131 --- 65 unchanged lines hidden --- | 126 if (interp_include(filename) != 0) { 127 const char *errstr = lua_tostring(luap, -1); 128 errstr = errstr == NULL ? "unknown" : errstr; 129 printf("Startup error in %s:\nLUA ERROR: %s.\n", filename, errstr); 130 lua_pop(luap, 1); 131 } 132} 133 --- 65 unchanged lines hidden --- |