-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
better error reporting add progressbar to linker
- Loading branch information
1 parent
9400134
commit 9b1aba2
Showing
13 changed files
with
503 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
function idle_cb() | ||
local value = gauge.value | ||
value = value + 0.01; | ||
ldesk.msleep(10) | ||
if value > 1.0 then | ||
value = 0.0 | ||
ldesk.sleep(1) | ||
end | ||
gauge.value = value | ||
return iup.DEFAULT | ||
end | ||
|
||
function main(args) | ||
local value = 0 | ||
gauge = iup.progressbar {max = 100} | ||
label = iup.label { title = string.format("value = %f...", value) } | ||
dlg = iup.dialog{iup.vbox{gauge, label}; title = "IupGauge"} | ||
dlg.size = "QUARTERxEIGHTH" | ||
|
||
local value = 0.0 | ||
dlg:showxy(iup.CENTER, iup.CENTER) | ||
for i = 1, 1000, 1 do | ||
value = value + 1.0 | ||
if value > 100.0 then | ||
value = 0.0 | ||
ldesk.sleep(1) | ||
end | ||
gauge.value = value * 1.20 | ||
label.title = string.format("value = %f...", value) | ||
ldesk.msleep(50) | ||
iup.LoopStep() | ||
end | ||
dlg:hide() | ||
dlg:destroy() | ||
|
||
--[[ | ||
-- Registers idle callback | ||
iup.SetIdle(idle_cb) | ||
dlg:showxy(iup.CENTER, iup.CENTER) | ||
if (not iup.MainLoopLevel or iup.MainLoopLevel()==0) then | ||
iup.MainLoop() | ||
end | ||
]] | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef HTON_H_INCLUDED | ||
#define HTON_H_INCLUDED | ||
|
||
#if defined(BIG_ENDIAN) | ||
#define htons(A) (A) | ||
#define htonl(A) (A) | ||
#define ntohs(A) (A) | ||
#define ntohl(A) (A) | ||
#else | ||
#define htons(A) ((((uint16_t)(A) & 0xff00) >> 8) | \ | ||
(((uint16_t)(A) & 0x00ff) << 8)) | ||
#define htonl(A) ((((uint32_t)(A) & 0xff000000) >> 24) | \ | ||
(((uint32_t)(A) & 0x00ff0000) >> 8) | \ | ||
(((uint32_t)(A) & 0x0000ff00) << 8) | \ | ||
(((uint32_t)(A) & 0x000000ff) << 24)) | ||
#define ntohs htons | ||
#define ntohl htonl | ||
#endif | ||
|
||
#endif // HTON_H_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include <stdint.h> | ||
|
||
#include <iup.h> | ||
#include "hton.h" | ||
#include "libluadesk.h" | ||
|
||
#include <unistd.h> | ||
#define msleep(msec) (usleep((msec) * 1000)) | ||
|
||
int L_htons(lua_State *L) { | ||
uint16_t n = (uint16_t)luaL_checkint(L, 1); | ||
n = htons(n); | ||
lua_pushlstring(L, (const char*)&n, 2); | ||
return 1; | ||
} | ||
|
||
int L_htonl(lua_State *L) { | ||
uint32_t n = (uint32_t)luaL_checklong(L, 1); | ||
n = htonl(n); | ||
lua_pushlstring(L, (const char*)&n, 4); | ||
return 1; | ||
} | ||
|
||
int L_ntohs(lua_State *L) { | ||
uint16_t n = *(uint16_t*)luaL_checkstring(L, 1); | ||
n = htons(n); | ||
lua_pushnumber(L, n); | ||
return 1; | ||
} | ||
|
||
int L_ntohl(lua_State *L) { | ||
uint32_t n = *(uint32_t*)luaL_checkstring(L, 1); | ||
n = htonl(n); | ||
lua_pushnumber(L, n); | ||
return 1; | ||
} | ||
|
||
int L_msleep(lua_State *L) { | ||
uint32_t i; | ||
uint32_t n = (uint32_t)luaL_checklong(L, 1); | ||
for (i = 0; i < n; i++) { | ||
usleep(1000); | ||
if (IupLoopStep() == IUP_CLOSE) break; | ||
} | ||
return 0; | ||
} | ||
|
||
int L_sleep(lua_State *L) { | ||
uint32_t i; | ||
uint32_t n = (uint32_t)luaL_checklong(L, 1); | ||
for (i = 0; i < n * 100; i++) { | ||
usleep(1000); | ||
if (IupLoopStep() == IUP_CLOSE) break; | ||
} | ||
return 0; | ||
} | ||
|
||
const luaL_Reg R_ld_functions[] = { | ||
{"htons", L_htons}, | ||
{"htonl", L_htonl}, | ||
{"ntohs", L_htons}, | ||
{"ntohl", L_htonl}, | ||
{"msleep", L_msleep}, | ||
{"sleep", L_sleep}, | ||
{NULL, NULL} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef LIBLUADESK_H_INCLUDED | ||
#define LIBLUADESK_H_INCLUDED | ||
|
||
#include <lua.h> | ||
#include <lualib.h> | ||
#include <lauxlib.h> | ||
|
||
extern const luaL_Reg R_ld_functions[]; | ||
|
||
#endif // LIBLUADESK_H_INCLUDED |
Oops, something went wrong.