On 8/7/06, felix winkelmann <[EMAIL PROTECTED]> wrote:
On 8/7/06, Daishi Kato <[EMAIL PROTECTED]> wrote:
>
> If the procedure ID is really re-used, the fallback procedure is never
> called, isn't it?

That's correct, unfortunately.

OK, I found another weird behavior.
Procedures of hash-tables are referenced in a dump file,
but when I run deserialize (w/ different chicken version),
the fallback is called more then once for the same ID.
I'm afraid there is a bug in backref handling with the procedure
returned by the fallback.


>
> If I could not find any solution to this, my final resort would be
> editting the binary dump file to change procedure IDs.

I think it would be better to write a custom version of
"deserialize", the last few lines look like this:

             (switch tag
              ...
               (procedure-tag
                (let ((id (fetch)))
                ;; >>>>>> do some custom processing here <<<<<<<<<<<
                  (cond ((##core#inline "set_procedure_ptr" x 
(##sys#make-c-string id))
                         (fetchslots x 1) )
                        (fallback
                         (let ((proc (fallback id)))
                           (vector-set! backrefs r proc)
                           proc) )
                        (else (error 'deserialize "unable to deserialize 
procedure - no
table entry found" id))) ) )
               (else (error 'deserialize "invalid tag" tag)) ) ) ) ) ) )
    (fetch) ) )

It shouldn't be to hard to add some hook there to do any custom
handling of specific IDs. But, again, it's slippy terrain you're moving
on.

I understand it's slippy, but I also think it's useful.
Isn't it possible to add a trap at "do some custom processing here"
that calls an optional procedure, just like the fallback procedure,
so that I don't need to modify the s11n code?
In this case, it is desired to pass not only a procedure ID but also
the lambda info that is shown when you run chicken-dump.

I hope this makes sense.
Daishi


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to