OK. I managed to get my first addon converted (and it passes basic tests). 
Unfortunately it is not public so I cannot give it as example

I did it with some silly macros that let me support both the old and new 
APIs:

#ifdef NEWAPI
#define BUFFER Local<Value>
#define BUFFERCONV(ARG) (ARG)
#define RETURNTYPE    void
#define RETURN args.GetReturnValue().Set
#define ARGUMENTS v8::FunctionCallbackInfo<Value>
#else
#define BUFFER Buffer*
#define BUFFERCONV(ARG) Local<Value>::New((ARG)->handle_)
#define RETURNTYPE    Handle<Value>
#define RETURN return scope.Close
#define ARGUMENTS Arguments
#endif

Note: this assumes that the scope and args variables are named scope and 
args. 

I also had to convert a Persistent<Function> to a handle. I did it with:

Local<Function> fn = Local<Function>::New(Isolate::GetCurrent(), 
persistent_fn) 

If this can help others...

Bruno

On Saturday, July 13, 2013 9:26:14 PM UTC+2, Bruno Jouhier wrote:
>
> The main things I'm having trouble with are Persistent<T> (an example 
> would be helpful) and Buffer (the class is gone, there is just a namespace).
>
> On Saturday, July 13, 2013 9:20:29 PM UTC+2, Bruno Jouhier wrote:
>>
>> The API has changed a lot because of the V8 changes. I'm trying to dig 
>> through the header files and the node diff (
>> https://github.com/bnoordhuis/node/commit/eb3a6c909dbd5086e7bc28013b61acbfcbefdc8d)
>>  
>> but I'm a bit lost. 
>>
>> Does anyone have some kind of cheat sheet that gives the most common 
>> rewriting patterns? Or just an addon that has been upgraded: the git diff 
>> could be a starting point for others.
>>
>> Bruno
>>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to