emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic loading progress


From: Aurélien Aptel
Subject: Re: Dynamic loading progress
Date: Fri, 17 Oct 2014 01:09:54 +0200

On Tue, Oct 14, 2014 at 8:11 PM, Stefan Monnier
<address@hidden> wrote:
>> - should we provide a destructor mechanism in the GC?
>
> You mean "finalizers"?  Sounds fine, yes.  The GC code already has code
> that does similar things to handle various kinds of "weak" pointers.

I will look into it, thanks.

>> - should we add a new generic lisp type for opaque pointers?
>
> Fine by me, yes.

Ok. I think this new type needs an unique module identifier field in
order to differentiate one module type from another (per-module type
predicates).
This field can be a random int, it can be computed from the module
struct directly, a short fixed size string (eg the module name +
version), the opaque type size, or a mix of all of these... (I'm
thinking out loud)

>> - how should modules be packaged?
>
> As GNU ELPA packages, of course.

Several headers are needed in order to build a module, and they have
to be the one your current Emacs was built with (eg config.h). I think
this means Emacs should copy those in the system include dir when
installing. Can we generate a config.h from a built emacs binary? Also
the whole thing has to be portable (build commands, paths, ...). Well
it's going to be a nightmare to get right.

In the mean time I wrote a basic YAML parsing module [1] using
libyaml. You can read yaml from a file, a buffer or a string. I've
tried to use direct access to lisp types (string, buffer) when reading
yaml streams to prevent too much copying/type conversion overhead. I
haven't done much error checking yet so it's not very robust but it
works:

(require 'yaml)
(yaml-parse-string "---
invoice: 34843
date   : 2001-01-23
bill-to: &id001
    given  : Chris
    family : Dumars
    address:
        lines: |
            458 Walkman Dr.
            Suite #292
        city    : Royal Oak
        state   : MI
        postal  : 48046
ship-to: *id001
")
=> (#s(hash-table
       data
       ("invoice" "34843"
    "date" "2001-01-23"
    "bill-to" #s(hash-table
             data
             ("given" "Chris"
              "family" "Dumars"
              "address" #s(hash-table
                   data
                   ("lines" "458 Walkman Dr.\nSuite #292\n"
                    "city" "Royal Oak"
                    "state" "MI"
                    "postal" "48046"))))
    "ship-to" #s(hash-table
             data
             ("given" "Chris"
              "family" "Dumars"
              "address" #s(hash-table
                   data
                   ("lines" "458 Walkman Dr.\nSuite #292\n"
                    "city" "Royal Oak"
                    "state" "MI"
                    "postal" "48046")))))))

(I have edited the output to make it more readable)

1: 
https://github.com/aaptel/emacs-dynamic-module/blob/master/modules/yaml/yaml.c



reply via email to

[Prev in Thread] Current Thread [Next in Thread]