Subversion Repositories HomeAutomation

Rev

Rev 1740 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1740 Rev 1741
Line 64... Line 64...
64
 
64
 
65
Value System::Export_Require(const v8::Arguments& args)
65
Value System::Export_Require(const v8::Arguments& args)
66
{
66
{
67
    v8::Locker lock;
67
    v8::Locker lock;
68
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
68
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
69
    v8::HandleScope handle_scope;
69
   
70
   
70
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
71
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
71
   
72
   
72
    if (args.Length() < 1)
73
    if (args.Length() < 1)
73
    {
74
    {
Line 75... Line 76...
75
        return v8::Boolean::New(false);
76
        return v8::Boolean::New(false);
76
    }
77
    }
77
   
78
   
78
    v8::String::AsciiValue str(args[0]);
79
    v8::String::AsciiValue str(args[0]);
79
   
80
   
80
    return v8::Boolean::New(Manager::Instance()->LoadScript(*str));
81
    return handle_scope.Close(v8::Boolean::New(Manager::Instance()->LoadScript(*str)));
81
}
82
}
82
 
83
 
83
Value System::Export_Execute(const v8::Arguments& args)
84
Value System::Export_Execute(const v8::Arguments& args)
84
{
85
{
85
    v8::Locker lock;
86
    v8::Locker lock;
86
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
87
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
88
    v8::HandleScope handle_scope;
87
   
89
   
88
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
90
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
89
   
91
   
90
    if (args.Length() < 1)
92
    if (args.Length() < 1)
91
    {
93
    {
Line 114... Line 116...
114
        }
116
        }
115
    }
117
    }
116
   
118
   
117
    pclose(pipe);
119
    pclose(pipe);
118
   
120
   
119
    return v8::String::New(output_buffer.data());
121
    return handle_scope.Close(v8::String::New(output_buffer.data()));
120
}
122
}
121
 
123
 
122
Value System::Export_ToHex(const v8::Arguments& args)
124
Value System::Export_ToHex(const v8::Arguments& args)
123
{
125
{
124
    v8::Locker lock;
126
    v8::Locker lock;
125
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
127
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
128
    v8::HandleScope handle_scope;
126
   
129
   
127
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
130
    //LOG.Debug(std::string(__FUNCTION__) + " called!");
128
   
131
   
129
    if (args.Length() < 1)
132
    if (args.Length() < 1)
130
    {
133
    {
131
        LOG.Error(std::string(__FUNCTION__) + ": To few arguments.");
134
        LOG.Error(std::string(__FUNCTION__) + ": To few arguments.");
132
        return v8::Boolean::New(false);
135
        return handle_scope.Close(v8::Boolean::New(false));
133
    }
136
    }
134
   
137
   
135
    return v8::String::New(common::ToHex(args[0]->Uint32Value()).data());
138
    return handle_scope.Close(v8::String::New(common::ToHex(args[0]->Uint32Value()).data()));
136
}
139
}
137
 
140
 
138
Value System::Export_Version(const v8::Arguments& args)
141
Value System::Export_Version(const v8::Arguments& args)
139
{
142
{
140
    v8::Locker lock;
143
    v8::Locker lock;
141
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
144
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
145
    v8::HandleScope handle_scope;
-
 
146
   
142
    return v8::String::New(VERSION);
147
    return handle_scope.Close(v8::String::New(VERSION));
143
}
148
}
144
 
149
 
145
Value System::Export_License(const v8::Arguments& args)
150
Value System::Export_License(const v8::Arguments& args)
146
{
151
{
147
    v8::Locker lock;
152
    v8::Locker lock;
148
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
153
    v8::Context::Scope context_scope(vm::Manager::Instance()->GetContext());
-
 
154
    v8::HandleScope handle_scope;
-
 
155
   
149
    return v8::String::New(LICENSE);
156
    return handle_scope.Close(v8::String::New(LICENSE));
150
}
157
}
151
 
158
 
152
}; // namespace plugin
159
}; // namespace plugin
153
}; // namespace vm
160
}; // namespace vm
154
}; // namespace atom
161
}; // namespace atom