• cosmin

    Hello everyone!

    It's been a year this month since I started working on luapower again after 2 years of absence, and since I haven't posted anything on this forum in a while, I thought I'd take some time to go through the git logs and make a little report of what happened in the past 12 months. In a future message I will also lay out some future directions for this project. As usual, all the code is in Public Domain so you can use it without restrictions of any kind. Ok, story time!

    Work (re)started in October 2017. The thing I did first was to fix a longstanding issue that was taking in a lot of time for me which is building binaries and testing on all 6 platforms that luapower runs on (Win, Linux, OSX, 32 and 64bit). So I bought a minimac, plugged it into my LAN and along with my two Ubuntu VMs and Win7 desktop machine I created an automated CI that would build binaries, run tests and collect dependency info automatically on all platforms. This fully scripted environment is documented and can be reproduced by anyone (relevant github repos on github.com/luapower/: vps, luapower-ci, ci_linux, ci_windows, ci_osx, ci_linux_lxc).

    After that was in place I started working on some new libraries as well as finishing some old ones. I'll list them in roughly chronological order along with a little rationale/story for each one.

    • luapower.com/mustache (oct 2017) - full-spec mustache parser and renderer. This is beyond luapower's scope which is desktop apps, but I needed this for an outside project. I needed a mustache implementation that would match the official JS one perfectly in terms of output, which at the minimum means running all the official mustache tests, and although there are a few existing Lua implementations, none of them would pass all the mustache tests. I also tried to upgrade one existing implementation but I found the code too complex and gave up. The reason for seeking this level of compatibility is that I was making a single-page webapp in which templates would be rendered in Lua on the server on the first request, but subsequently rendered on the client side in JS so the output would have to look the same.

    • luapower.com/objc (oct 2017) - Objective-C bridge. Fixed it for OSX 10.10 when they broke Cocoa. This library is useless now on 10.13+ when they broke the bridgesupport files (as is any objc bridge for any language for that matter, python, ruby, LuaCocoa, you name it). I suppose it could be fixed, but I'm not sure OSX would be around long enough to see that :) I mostly wrote objc for luapower.com/nw in the first place, so lately I was thinking of wrapping those ObjC calls in a C layer and use that via ffi and ditch objc altogether. We'll see when I'll get back on porting for the Mac (I code everything for Windows first).

    • luapower.com/coro (nov 2017) - symmetric coroutines. This little lib implements the idea of symmetric coroutines, which I first read about in this paper http://www.inf.puc-rio.br/~roberto/docs/corosblp.pdf. The paper comes with a very short implementation which although very enlightening, is also limited. The problem with built-in Lua coroutines is that you can't do coroutine-based I/O inside other coroutines. Symmetric coroutines can solve that in principle, but the implementation in the paper does not allow mixing yield() and transfer() in the same code. This implementation fixes that so you can now make coroutine-based iterators and protocols around coroutine-scheduled I/O without problems.

    • luapower.com/rsync (nov 2017) - rsync algorithm in Lua. I reimplemented rsync in Lua mostly to see if it could compete with librsync, and because librsync does not have a 100% push-style API and thus cannot be used with coroutine-based I/O. There are benchmarks you can run. Overall the speed is good, but I'm still considering implementing the missing push-style API in librsync because librsync is still faster. The librsync binding is at github.com/luapower/librsync.

    • luapower.com/fs (dec 2017) - Portable filesystem API. I wanted to write this for a long time and get rid of lfs which after many years can't open files with accented letters on Windows. It also supports symlinks and hardlinks on all platforms as well as getting and setting all platform-specific file attributes and permissions. A memory mapping API is also in the works (but not a priority at the moment). luapower.com/path and a smaller lib (luapower.com/unixperms) for parsing unix perm strings are offshots (and depdencies) of this library.

    • luapower.com/path (dec 2017) - Path manipulation for Windows and UNIX paths in Lua. This misery took 2 weeks to get right and it's 500 LOC but it is necessary if you want to operate on arbitrary files and directories correctly and portably.

    • luapower.com/winapi.cairopanel, luapower.com/winapi.wglpanel -- moved those two out of winapi in order to have winapi clean of dependencies (they weren't hard dependencies anyway but now they're also no longer listed as dependencies on the website, which some people found confusing).

    • luapower.com/amoeba - forked the Lua implementation of github.com/starwing/amoeba, a Cassowary constraint solver. I found this to be a very clean and very fast implementation and planning to use it for an upcoming layouting system in luapower.com/ui.

    • luapower.com/bmp (feb 2016) - BMP file loading and saving.

    • luapower.com/easing (feb 2018) - separated the in/out/in-out/out-in modes from the actual easing formulas so that new formulas can be added without implementing all those modes redundantly (which are just different ways to use the formulas).

    • luapower.com/tweening (feb 2018) - Tweening module for vector-based animation. This is on par with GSAP without plugins in terms of timing model, animation model and runtime features. See the demos and docs for more info.

    • github.com/luapower/imgui (ian-apr 2018) - wasted a few months implementing an IMGUI. Gave up on it and started working on a classic object-oriented UI lib which I'll talk about later.

    • luapower.com/bitmap (mar 2018) - mainly bug fixes and API doc additions.

    • luapower.com/boxblur (mar 2018) - reimplemented boxblur in C/SSE2 based on the moving-averange algorithm. Supports both 8-bit grayscale and BGRA8 formats. I remember getting > 200 fps on a 1080p grayscale bitmap on my machine, but see for yourself, YMMV. Benchmarks included. I'm far from an expert in optimization so any tips on speeding this up further are very welcome.

    • luapower.com/rs232 (jun 2018) - RS232 lib leveraging fs.

    • (jul 2018) Deprecated a lot of libs and moved them all in a meta-repo at github.com/luapower/luapower-repos-dev/. These are libs that I no longer have an interest in or have better alternatives for. You can still clone them with mgit clone-all if you clone the above repo first (with mgit clone https://github.com/luapower/luapower-repos-dev).

    • luapower.com/bundle (sometime 2018) - fs drop-in replacement APIs bundle.fs_dir() for fs.dir() and bundle.fs_open() for fs.open(). Allows embedding directory listings and files in executables.

    What I'm working on now

    • luapower.com/tr (jul-sep 2018) - Unicode text shaping and rendering written in Lua. Supports subpixel positioning, emoticons, word wrapping, alignments, hit testing, clipping, cursors, selections, editing, control over OpenType features, moving, coloring and editing inside ligatures, OpenType-assisted auto-hinter. Other features are still missing (see the project page). I wrote this lib because AFAIK there's no free C lib that does this except Pango which depends on GObject and fontconfig and the implementation itself is orders of magnitude larger than what it could be in Lua, and also because I wanted to have the opportunity to add more hi-level features like embedding widgets in text for example. tr is based on many libs which have Lua bindings themselves and you can use independently:
    • luapower.com/ui (feb 2018 - present) - cross-platform UI library with styles, animations and (soon) layouts.
      • Uses luapower.com/nw for creating native windows and getting mouse and keyboard input as well as for other OS GUI-related APIs like copy/pasting, notification icons, native menus, etc. This layer can be replaced by libs like SDL if needed.
      • Uses luapower.com/cairo for drawing but all drawing code is isolated so it can be replaced with any 2D vector graphics lib.
      • The widgets themselves are custom drawn and customizable with cascading styles and animated with transitions which are also declared in css (even caret blinking is done in css).
      • Uses the luapower.com/boxblur for shadows.
      • Uses luapower.com/oo as OOP library.
      • Widgets are built upon a base layer object which implements all the drawing, positioning, clipping, layouting, hit testing, keyboard focusing functionality, similar to html layers.
      • Widgets:
        • Tablist: tabs can be moved around and between tablists. Docking is next.
        • Grid: the largest and most versatile widget for data-centric (business/operational) GUIs. Currently at only 2200 LOC is already editable and can smooth-scroll and select 1 million rows instantly, includes a vertical split pane, movable and resizable columns, stylable cells, etc. Next is tree-list, group-by row, data-binding, etc. The plan is to make this on par with the grids made by DevExpress (which I think can be achieved with a lot fewer LOC).
        • Editbox: single line, multi-line, password mask.
        • Dropdown menu with different picker widgets (grid, color picker).
        • Buttons (incl. radio, checkbox, multi-choice).
        • Slider.
        • Color picker with HSL/HSV squares etc.
        • Scrollbox with autohide scrollbars.

    That's it for now. I'm sure I'm forgetting some stuff, I'll try to add more as I remember. As always, comments, questions, feedback appreciated.

    Happy coding!

    posted in General Discussion read more
  • cosmin

    In fact lemme make a status report on the whole thing... comming up...

    posted in General Discussion read more
  • cosmin

    Hi! Sorry for the late reply. Looks like I just forgot to add it :) Pull now please.

    Please note that ui and tr libs are still in development (as you can see from the commits and from the "dev" tag on both repos).

    posted in General Discussion read more
  • cosmin

    Hello everyone!

    I just fixed a longstanding bug with objc that makes it work with OSX 10.10+. Details are here: https://github.com/luapower/objc/issues/4

    If you used objc with OSX 10.10+ before you might have noticed that your code doesn't work on OSX 10.9-. Likewise, your 10.9- code doesn't work on 10.10+. This change solves the compatibility but at the cost of disabling property access via dot notation, which breaks your 10.10+only code. To make it work again, you need to call objc.with_properties(true) after you load objc.

    posted in General Discussion read more
  • cosmin

    Oh, I almost forgot. I also published the dependency database in this meta-package: https://luapower.com/luapower_db and added a bit of documentation on the luapower-repos meta-package as well here: https://luapower.com/luapower-repos

    posted in General Discussion read more
  • cosmin

    Hello everyone!

    For those of you who are new to luapower or just need a quick reference on the structure of the source tree, you can now browse the whole tree online with annotations on every file and directory at this link: https://luapower.com/tree

    It's a new thing that I hacked over the past few days so there might be some bugs. If found, please shout them out. Thank you.

    Enjoy!

    posted in General Discussion read more
  • cosmin

    Ok, I'll make a short guide on the directory layout. Thanks for the tip. Until then, if you want the extended version of that guide check out https://luapower.com/get-involved

    posted in General Discussion read more
  • cosmin

    Hi. Thanks for the feedback. I think the site layout needs improving. For instance, there is a FAQ link at the top. Did you missed it? Also, luajit comes with precompiled binaries and build scripts (all packages do). You can download the package from the download link on luapower.com/luajit or from github.

    posted in General Discussion read more
  • cosmin

    Hi pupp!

    Luapower author here. Looks like you encountered a few issues with luapower since you started. Can you make a list of things that you found surprising or frustrating or took a while to grasp? I'd like to improve the documentation if I can, maybe make a getting-started guide. Thanks!

    posted in General Discussion read more
  • cosmin

    The window's WNDPROC is bound to MessageRouter.proc which calls the window's __handle_message() method which calls the WM_PAINT() method or the on_paint() method. If you're using CairoPanel, that descends from BitmapPanel which defines the on_paint() method. Hope this helps.

    posted in General Discussion read more
  • cosmin

    Can you tell us which one?

    posted in General Discussion read more
  • cosmin

    Hi Robert!

    Luapower hasn't seen much input this year but it will in the future. Not sure when exactly and what packages will be updated but I suspect it will be rewriting cplayer over nw and probably an IMGUI lib. I will also set up a build/test/CI server with multiple versions of Windows, Linux and OSX which will keep the binaries updated and will make the package metadata more accurate (right now I might have forgotten to update the package metadata for some packages on some platforms since I have to do that manually, and I rarely switch on my Mac these days).

    posted in General Discussion read more
  • cosmin

    Hi helmut,

    There's a xml module in luapower called expat, check it out.

    For 2D graphics check out cairo which is better than gd and the bindings are ffi-based, not C based and it also integrates well with libpng, freetype, winapi etc. bindings.

    If you need to use cmake then that's that (currently only libjpeg-turbo requires it because I was too lazy to make a build script for it) but an effort to make a simple shell script would be appreciated. In any case, even if you require cmake you should still make bash wrapper scripts with the correct cmake invocations so that it works out-of-the-box with the prescribed toolchain (that's a very important feature for me).

    posted in General Discussion read more
  • cosmin

    @robertmuench said:

    You have to place your own code in the luapower directory

    Done.

    posted in General Discussion read more
  • cosmin

    Oh I see, it comes as a size_t which is a uint64 on x64. Thanks for the find. Corrected in master.

    posted in General Discussion read more
  • cosmin

    Yap, cplayer needs reimplementing on top of nw. It's currently implemented on top of winapi.

    nw is in WIP indeed, but it's quite stable, give it a try. Missing functionality is organized here: https://github.com/luapower/nw/issues

    posted in General Discussion read more
  • cosmin

    Bundle doesn't handle paths. As the manual says "it assumes luapower's toolchain and directory layout".

    posted in General Discussion read more
  • cosmin

    Hi Robert,

    When would dsz not be a number such that it requires wrapping in tonumber() ?

    posted in General Discussion read more
  • cosmin

    Hi

    I for one am reading all the posts but I can't respond to debugging questions.

    posted in General Discussion read more
Internal error.

Oops! Looks like something went wrong!