minix 3 and lua, berkeley db, and sqlite

Upload: mikhail-miguel

Post on 06-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Minix 3 and Lua, Berkeley Db, And Sqlite

    1/3

    Minix 3 and Lua, Berkeley DB, and SQLite

    Source: http://newsgroups.derkeiler.com/Archive/Comp/comp.os.minix/200511/msg00242.html

    From: jfathman@xxxxxxx

    Date: 12 Nov 2005 18:36:18 0800

    I spent my Saturday experimenting with building open source utility

    software under Minix 3. I had mixed results.

    Berkeley DB from www.sleepycat.com is a larger product than I remember.

    It won't compile because it expects a GNU gcc compatible tool chain on

    a Unix target. SQLite from www.sqlite.org won't build for the same

    reason.

    I had good success building Lua 5.0.2. I made minor mods to change

    'gcc' to 'cc', etc. in a 'config' file, as recommended in the INSTALL

    file. It built successfully, and some of the Lua test scripts worked.

    The 'sieve.lua' test script failed after several iterations. I used

    Minix 'chmem' to increase the stack/heap. With each increase,

    'sieve.lua' progressed further, until finally it ran to successful

    completion after the last stack/heap increase:

    # chmem +1000 lua

    lua: Stack+malloc area changed from 131072 to 132072 bytes.

    # chmem +100000 lua

    lua: Stack+malloc area changed from 132072 to 232072 bytes.

    # chmem +100000 lua

    lua: Stack+malloc area changed from 232072 to 332072 bytes.

    VIM 6.3 for Minix 3 recognizes '.lua' script files, so Lua keyword

    syntax highlighting works without doing anything special. The Lua

    source is attractive. For example, 'sieve.lua' is:

    the sieve of of Eratosthenes programmed with coroutines

    typical usage: lua e N=1000 sieve.lua | column

    generate all the numbers from 2 to n

    function gen (n)

    return coroutine.wrap(function ()

    for i=2,n do coroutine.yield(i) end

    end)

    end

    filter the numbers generated by `g', removing multiples of `p'

    Minix 3 and Lua, Berkeley DB, and SQLite

    Minix 3 and Lua, Berkeley DB, and SQLite 1

    http://newsgroups.derkeiler.com/Archive/Comp/comp.os.minix/2005-11/msg00242.htmlmailto:[email protected]://newsgroups.derkeiler.com/Archive/Comp/comp.os.minix/2005-11/msg00242.html
  • 8/3/2019 Minix 3 and Lua, Berkeley Db, And Sqlite

    2/3

    function filter (p, g)

    return coroutine.wrap(function ()

    while 1 do

    local n = g()

    if n == nil then return end

    if math.mod(n, p) ~= 0 then coroutine.yield(n) end

    endend)

    end

    N=N or 1000 from command line

    x = gen(N) generate primes up to N

    while 1 do

    local n = x() pick a number until done

    if n == nil then break end

    print(n) must be a prime number

    x = filter(n, x) now remove its multiples

    end

    Lua seems like a pretty good fit for Minix 3 where an embedded

    application will benefit from integration with a scripting language,

    and Python is perhaps a little heavy. I credit Lua for distributing

    basic ANSI C code and simple make files that do not require GNU tool

    chain compatibility. From www.lua.org:

    > Lua is a language engine that you can embed into your application.

    > This means that, besides syntax and semantics, Lua has an API

    > that allows the application to exchange data with Lua programs

    > and also to extend Lua with C functions. In this sense, Lua can

    > be regarded as a language framework for building domainspecific> languages.

    > Lua is implemented as a small library of C functions, written in

    > ANSI C, and compiles unmodified in all known platforms. The

    > implementation goals are simplicity, efficiency, portability, and

    > low embedding cost. The result is a fast language engine with

    > small footprint, making it ideal in embedded systems too.

    I enjoyed my Saturday with Minix 3 and Lua. I like what I have seen so

    far of the ACK compiler and the ash shell, but I am a little concerned

    that the lack of the GNU toolchain and the bash shell is going to makeit challenging to port popular (and perhaps necessary) packages to

    Minix 3.

    Thanks.

    Jim

    .

    Minix 3 and Lua, Berkeley DB, and SQLite

    Minix 3 and Lua, Berkeley DB, and SQLite 2

  • 8/3/2019 Minix 3 and Lua, Berkeley Db, And Sqlite

    3/3

    FollowUps:

    Re: Minix 3 and Lua, Berkeley DB, and SQLite

    From: drh

    Re: Minix 3 and Lua, Berkeley DB, and SQLite

    From: Segin

    Prev by Date: Re: IP configuration

    Next by Date: Re: Minix 3 and Lua, Berkeley DB, and SQLite

    Previous by thread: Re:consider unicode support on minix gcc

    Next by thread: Re: Minix 3 and Lua, Berkeley DB, and SQLite

    Index(es):

    Date

    Thread

    Minix 3 and Lua, Berkeley DB, and SQLite

    Minix 3 and Lua, Berkeley DB, and SQLite 3

    http://msg00241.html/http://msg00243.html/http://msg00260.html/http://msg00243.html/http://msg00239.html/http://msg00243.html/http://msg00241.html/http://msg00243.html/http://msg00260.html/