PageRenderTime 92ms CodeModel.GetById 35ms app.highlight 52ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jsdbgapi.h

http://github.com/zpao/v8monkey
C Header | 593 lines | 280 code | 136 blank | 177 comment | 4 complexity | 54dedb7b2e174e577bf4d74a4ee05440 MD5 | raw file
  1/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2 * vim: set ts=8 sw=4 et tw=99:
  3 *
  4 * ***** BEGIN LICENSE BLOCK *****
  5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  6 *
  7 * The contents of this file are subject to the Mozilla Public License Version
  8 * 1.1 (the "License"); you may not use this file except in compliance with
  9 * the License. You may obtain a copy of the License at
 10 * http://www.mozilla.org/MPL/
 11 *
 12 * Software distributed under the License is distributed on an "AS IS" basis,
 13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 14 * for the specific language governing rights and limitations under the
 15 * License.
 16 *
 17 * The Original Code is Mozilla Communicator client code, released
 18 * March 31, 1998.
 19 *
 20 * The Initial Developer of the Original Code is
 21 * Netscape Communications Corporation.
 22 * Portions created by the Initial Developer are Copyright (C) 1998
 23 * the Initial Developer. All Rights Reserved.
 24 *
 25 * Contributor(s):
 26 *   Nick Fitzgerald <nfitzgerald@mozilla.com>
 27 *
 28 * Alternatively, the contents of this file may be used under the terms of
 29 * either of the GNU General Public License Version 2 or later (the "GPL"),
 30 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 31 * in which case the provisions of the GPL or the LGPL are applicable instead
 32 * of those above. If you wish to allow use of your version of this file only
 33 * under the terms of either the GPL or the LGPL, and not to allow others to
 34 * use your version of this file under the terms of the MPL, indicate your
 35 * decision by deleting the provisions above and replace them with the notice
 36 * and other provisions required by the GPL or the LGPL. If you do not delete
 37 * the provisions above, a recipient may use your version of this file under
 38 * the terms of any one of the MPL, the GPL or the LGPL.
 39 *
 40 * ***** END LICENSE BLOCK ***** */
 41
 42#ifndef jsdbgapi_h___
 43#define jsdbgapi_h___
 44/*
 45 * JS debugger API.
 46 */
 47#include "jsapi.h"
 48#include "jsprvtd.h"
 49
 50JS_BEGIN_EXTERN_C
 51
 52extern JS_PUBLIC_API(JSCrossCompartmentCall *)
 53JS_EnterCrossCompartmentCallScript(JSContext *cx, JSScript *target);
 54
 55extern JS_PUBLIC_API(JSCrossCompartmentCall *)
 56JS_EnterCrossCompartmentCallStackFrame(JSContext *cx, JSStackFrame *target);
 57
 58#ifdef __cplusplus
 59JS_END_EXTERN_C
 60
 61namespace JS {
 62
 63class JS_PUBLIC_API(AutoEnterScriptCompartment)
 64{
 65  protected:
 66    JSCrossCompartmentCall *call;
 67
 68  public:
 69    AutoEnterScriptCompartment() : call(NULL) {}
 70
 71    bool enter(JSContext *cx, JSScript *target);
 72
 73    bool entered() const { return call != NULL; }
 74
 75    ~AutoEnterScriptCompartment() {
 76        if (call && call != reinterpret_cast<JSCrossCompartmentCall*>(1))
 77            JS_LeaveCrossCompartmentCall(call);
 78    }
 79};
 80
 81class JS_PUBLIC_API(AutoEnterFrameCompartment) : public AutoEnterScriptCompartment
 82{
 83  public:
 84    bool enter(JSContext *cx, JSStackFrame *target);
 85};
 86
 87} /* namespace JS */
 88
 89#ifdef DEBUG
 90JS_FRIEND_API(void) js_DumpValue(const js::Value &val);
 91JS_FRIEND_API(void) js_DumpId(jsid id);
 92JS_FRIEND_API(void) js_DumpStackFrame(JSContext *cx, js::StackFrame *start = NULL);
 93#endif
 94
 95JS_BEGIN_EXTERN_C
 96#endif
 97
 98extern JS_PUBLIC_API(JSString *)
 99JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, uintN indent);
100
101/*
102 * Currently, we only support runtime-wide debugging. In the future, we should
103 * be able to support compartment-wide debugging.
104 */
105extern JS_PUBLIC_API(void)
106JS_SetRuntimeDebugMode(JSRuntime *rt, JSBool debug);
107
108/*
109 * Debug mode is a compartment-wide mode that enables a debugger to attach
110 * to and interact with running methodjit-ed frames. In particular, it causes
111 * every function to be compiled as if an eval was present (so eval-in-frame)
112 * can work, and it ensures that functions can be re-JITed for other debug
113 * features. In general, it is not safe to interact with frames that were live
114 * before debug mode was enabled. For this reason, it is also not safe to
115 * enable debug mode while frames are live.
116 */
117
118/* Get current state of debugging mode. */
119extern JS_PUBLIC_API(JSBool)
120JS_GetDebugMode(JSContext *cx);
121
122/*
123 * Turn on/off debugging mode for a single compartment. This should only be
124 * used when no code from this compartment is running or on the stack in any
125 * thread.
126 */
127JS_FRIEND_API(JSBool)
128JS_SetDebugModeForCompartment(JSContext *cx, JSCompartment *comp, JSBool debug);
129
130/*
131 * Turn on/off debugging mode for a context's compartment.
132 */
133JS_FRIEND_API(JSBool)
134JS_SetDebugMode(JSContext *cx, JSBool debug);
135
136/* Turn on single step mode. */
137extern JS_PUBLIC_API(JSBool)
138JS_SetSingleStepMode(JSContext *cx, JSScript *script, JSBool singleStep);
139
140/* The closure argument will be marked. */
141extern JS_PUBLIC_API(JSBool)
142JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
143           JSTrapHandler handler, jsval closure);
144
145extern JS_PUBLIC_API(void)
146JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
147             JSTrapHandler *handlerp, jsval *closurep);
148
149extern JS_PUBLIC_API(void)
150JS_ClearScriptTraps(JSContext *cx, JSScript *script);
151
152extern JS_PUBLIC_API(void)
153JS_ClearAllTrapsForCompartment(JSContext *cx);
154
155extern JS_PUBLIC_API(JSBool)
156JS_SetInterrupt(JSRuntime *rt, JSInterruptHook handler, void *closure);
157
158extern JS_PUBLIC_API(JSBool)
159JS_ClearInterrupt(JSRuntime *rt, JSInterruptHook *handlerp, void **closurep);
160
161/************************************************************************/
162
163extern JS_PUBLIC_API(JSBool)
164JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsid id,
165                 JSWatchPointHandler handler, JSObject *closure);
166
167extern JS_PUBLIC_API(JSBool)
168JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsid id,
169                   JSWatchPointHandler *handlerp, JSObject **closurep);
170
171extern JS_PUBLIC_API(JSBool)
172JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj);
173
174extern JS_PUBLIC_API(JSBool)
175JS_ClearAllWatchPoints(JSContext *cx);
176
177/************************************************************************/
178
179extern JS_PUBLIC_API(uintN)
180JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc);
181
182extern JS_PUBLIC_API(jsbytecode *)
183JS_LineNumberToPC(JSContext *cx, JSScript *script, uintN lineno);
184
185extern JS_PUBLIC_API(jsbytecode *)
186JS_EndPC(JSContext *cx, JSScript *script);
187
188extern JS_PUBLIC_API(JSBool)
189JS_GetLinePCs(JSContext *cx, JSScript *script,
190              uintN startLine, uintN maxLines,
191              uintN* count, uintN** lines, jsbytecode*** pcs);
192
193extern JS_PUBLIC_API(uintN)
194JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun);
195
196extern JS_PUBLIC_API(JSBool)
197JS_FunctionHasLocalNames(JSContext *cx, JSFunction *fun);
198
199/*
200 * N.B. The mark is in the context temp pool and thus the caller must take care
201 * to call JS_ReleaseFunctionLocalNameArray in a LIFO manner (wrt to any other
202 * call that may use the temp pool.
203 */
204extern JS_PUBLIC_API(uintptr_t *)
205JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **markp);
206
207extern JS_PUBLIC_API(JSAtom *)
208JS_LocalNameToAtom(uintptr_t w);
209
210extern JS_PUBLIC_API(JSString *)
211JS_AtomKey(JSAtom *atom);
212
213extern JS_PUBLIC_API(void)
214JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark);
215
216extern JS_PUBLIC_API(JSScript *)
217JS_GetFunctionScript(JSContext *cx, JSFunction *fun);
218
219extern JS_PUBLIC_API(JSNative)
220JS_GetFunctionNative(JSContext *cx, JSFunction *fun);
221
222extern JS_PUBLIC_API(JSPrincipals *)
223JS_GetScriptPrincipals(JSContext *cx, JSScript *script);
224
225extern JS_PUBLIC_API(JSPrincipals *)
226JS_GetScriptOriginPrincipals(JSContext *cx, JSScript *script);
227
228/*
229 * Stack Frame Iterator
230 *
231 * Used to iterate through the JS stack frames to extract
232 * information from the frames.
233 */
234
235extern JS_PUBLIC_API(JSStackFrame *)
236JS_FrameIterator(JSContext *cx, JSStackFrame **iteratorp);
237
238extern JS_PUBLIC_API(JSScript *)
239JS_GetFrameScript(JSContext *cx, JSStackFrame *fp);
240
241extern JS_PUBLIC_API(jsbytecode *)
242JS_GetFramePC(JSContext *cx, JSStackFrame *fp);
243
244/*
245 * Get the closest scripted frame below fp.  If fp is null, start from cx->fp.
246 */
247extern JS_PUBLIC_API(JSStackFrame *)
248JS_GetScriptedCaller(JSContext *cx, JSStackFrame *fp);
249
250extern JS_PUBLIC_API(void *)
251JS_GetFrameAnnotation(JSContext *cx, JSStackFrame *fp);
252
253extern JS_PUBLIC_API(void)
254JS_SetFrameAnnotation(JSContext *cx, JSStackFrame *fp, void *annotation);
255
256extern JS_PUBLIC_API(JSBool)
257JS_IsScriptFrame(JSContext *cx, JSStackFrame *fp);
258
259extern JS_PUBLIC_API(JSObject *)
260JS_GetFrameScopeChain(JSContext *cx, JSStackFrame *fp);
261
262extern JS_PUBLIC_API(JSObject *)
263JS_GetFrameCallObject(JSContext *cx, JSStackFrame *fp);
264
265extern JS_PUBLIC_API(JSBool)
266JS_GetFrameThis(JSContext *cx, JSStackFrame *fp, jsval *thisv);
267
268extern JS_PUBLIC_API(JSFunction *)
269JS_GetFrameFunction(JSContext *cx, JSStackFrame *fp);
270
271extern JS_PUBLIC_API(JSObject *)
272JS_GetFrameFunctionObject(JSContext *cx, JSStackFrame *fp);
273
274JS_PUBLIC_API(JSFunction *)
275JS_GetScriptFunction(JSContext *cx, JSScript *script);
276
277extern JS_PUBLIC_API(JSObject *)
278JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj);
279
280/* XXXrginda Initially published with typo */
281#define JS_IsContructorFrame JS_IsConstructorFrame
282extern JS_PUBLIC_API(JSBool)
283JS_IsConstructorFrame(JSContext *cx, JSStackFrame *fp);
284
285extern JS_PUBLIC_API(JSBool)
286JS_IsDebuggerFrame(JSContext *cx, JSStackFrame *fp);
287
288extern JS_PUBLIC_API(JSBool)
289JS_IsGlobalFrame(JSContext *cx, JSStackFrame *fp);
290
291extern JS_PUBLIC_API(jsval)
292JS_GetFrameReturnValue(JSContext *cx, JSStackFrame *fp);
293
294extern JS_PUBLIC_API(void)
295JS_SetFrameReturnValue(JSContext *cx, JSStackFrame *fp, jsval rval);
296
297/**
298 * Return fp's callee function object (fp->callee) if it has one. Note that
299 * this API cannot fail. A null return means "no callee": fp is a global or
300 * eval-from-global frame, not a call frame.
301 *
302 * This API began life as an infallible getter, but now it can return either:
303 *
304 * 1. An optimized closure that was compiled assuming the function could not
305 *    escape and be called from sites the compiler could not see.
306 *
307 * 2. A "joined function object", an optimization whereby SpiderMonkey avoids
308 *    creating fresh function objects for every evaluation of a function
309 *    expression that is used only once by a consumer that either promises to
310 *    clone later when asked for the value or that cannot leak the value.
311 *
312 * Because Mozilla's Gecko embedding of SpiderMonkey (and no doubt other
313 * embeddings) calls this API in potentially performance-sensitive ways (e.g.
314 * in nsContentUtils::GetDocumentFromCaller), we are leaving this API alone. It
315 * may now return an unwrapped non-escaping optimized closure, or a joined
316 * function object. Such optimized objects may work well if called from the
317 * correct context, never mutated or compared for identity, etc.
318 *
319 * However, if you really need to get the same callee object that JS code would
320 * see, which means undoing the optimizations, where an undo attempt can fail,
321 * then use JS_GetValidFrameCalleeObject.
322 */
323extern JS_PUBLIC_API(JSObject *)
324JS_GetFrameCalleeObject(JSContext *cx, JSStackFrame *fp);
325
326/**
327 * Return fp's callee function object after running the deferred closure
328 * cloning "method read barrier". This API can fail! If the frame has no
329 * callee, this API returns true with JSVAL_IS_VOID(*vp).
330 */
331extern JS_PUBLIC_API(JSBool)
332JS_GetValidFrameCalleeObject(JSContext *cx, JSStackFrame *fp, jsval *vp);
333
334/************************************************************************/
335
336extern JS_PUBLIC_API(const char *)
337JS_GetScriptFilename(JSContext *cx, JSScript *script);
338
339extern JS_PUBLIC_API(const jschar *)
340JS_GetScriptSourceMap(JSContext *cx, JSScript *script);
341
342extern JS_PUBLIC_API(uintN)
343JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script);
344
345extern JS_PUBLIC_API(uintN)
346JS_GetScriptLineExtent(JSContext *cx, JSScript *script);
347
348extern JS_PUBLIC_API(JSVersion)
349JS_GetScriptVersion(JSContext *cx, JSScript *script);
350
351/************************************************************************/
352
353/*
354 * Hook setters for script creation and destruction, see jsprvtd.h for the
355 * typedefs.  These macros provide binary compatibility and newer, shorter
356 * synonyms.
357 */
358#define JS_SetNewScriptHook     JS_SetNewScriptHookProc
359#define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc
360
361extern JS_PUBLIC_API(void)
362JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata);
363
364extern JS_PUBLIC_API(void)
365JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
366                        void *callerdata);
367
368/************************************************************************/
369
370extern JS_PUBLIC_API(JSBool)
371JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp,
372                          const jschar *chars, uintN length,
373                          const char *filename, uintN lineno,
374                          jsval *rval);
375
376extern JS_PUBLIC_API(JSBool)
377JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp,
378                        const char *bytes, uintN length,
379                        const char *filename, uintN lineno,
380                        jsval *rval);
381
382/************************************************************************/
383
384typedef struct JSPropertyDesc {
385    jsval           id;         /* primary id, atomized string, or int */
386    jsval           value;      /* property value */
387    uint8_t         flags;      /* flags, see below */
388    uint8_t         spare;      /* unused */
389    uint16_t        slot;       /* argument/variable slot */
390    jsval           alias;      /* alias id if JSPD_ALIAS flag */
391} JSPropertyDesc;
392
393#define JSPD_ENUMERATE  0x01    /* visible to for/in loop */
394#define JSPD_READONLY   0x02    /* assignment is error */
395#define JSPD_PERMANENT  0x04    /* property cannot be deleted */
396#define JSPD_ALIAS      0x08    /* property has an alias id */
397#define JSPD_ARGUMENT   0x10    /* argument to function */
398#define JSPD_VARIABLE   0x20    /* local variable in function */
399#define JSPD_EXCEPTION  0x40    /* exception occurred fetching the property, */
400                                /* value is exception */
401#define JSPD_ERROR      0x80    /* native getter returned JS_FALSE without */
402                                /* throwing an exception */
403
404typedef struct JSPropertyDescArray {
405    uint32_t        length;     /* number of elements in array */
406    JSPropertyDesc  *array;     /* alloc'd by Get, freed by Put */
407} JSPropertyDescArray;
408
409typedef struct JSScopeProperty JSScopeProperty;
410
411extern JS_PUBLIC_API(JSScopeProperty *)
412JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp);
413
414extern JS_PUBLIC_API(JSBool)
415JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *shape,
416                   JSPropertyDesc *pd);
417
418extern JS_PUBLIC_API(JSBool)
419JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda);
420
421extern JS_PUBLIC_API(void)
422JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda);
423
424/************************************************************************/
425
426extern JS_PUBLIC_API(JSBool)
427JS_SetDebuggerHandler(JSRuntime *rt, JSDebuggerHandler hook, void *closure);
428
429extern JS_PUBLIC_API(JSBool)
430JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure);
431
432extern JS_PUBLIC_API(JSBool)
433JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
434
435extern JS_PUBLIC_API(JSBool)
436JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
437
438extern JS_PUBLIC_API(JSBool)
439JS_SetThrowHook(JSRuntime *rt, JSThrowHook hook, void *closure);
440
441extern JS_PUBLIC_API(JSBool)
442JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure);
443
444/************************************************************************/
445
446extern JS_PUBLIC_API(size_t)
447JS_GetObjectTotalSize(JSContext *cx, JSObject *obj);
448
449extern JS_PUBLIC_API(size_t)
450JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun);
451
452extern JS_PUBLIC_API(size_t)
453JS_GetScriptTotalSize(JSContext *cx, JSScript *script);
454
455/*
456 * Return true if obj is a "system" object, that is, one created by
457 * JS_NewSystemObject with the system flag set and not JS_NewObject.
458 *
459 * What "system" means is up to the API client.
460 */
461extern JS_PUBLIC_API(JSBool)
462JS_IsSystemObject(JSContext *cx, JSObject *obj);
463
464/*
465 * Mark an object as being a system object. This should be called immediately
466 * after allocating the object. A system object is an object for which
467 * JS_IsSystemObject returns true.
468 */
469extern JS_PUBLIC_API(JSBool)
470JS_MakeSystemObject(JSContext *cx, JSObject *obj);
471
472/************************************************************************/
473
474extern JS_FRIEND_API(void)
475js_RevertVersion(JSContext *cx);
476
477extern JS_PUBLIC_API(const JSDebugHooks *)
478JS_GetGlobalDebugHooks(JSRuntime *rt);
479
480extern JS_PUBLIC_API(JSDebugHooks *)
481JS_SetContextDebugHooks(JSContext *cx, const JSDebugHooks *hooks);
482
483/* Disable debug hooks for this context. */
484extern JS_PUBLIC_API(JSDebugHooks *)
485JS_ClearContextDebugHooks(JSContext *cx);
486
487/**
488 * Start any profilers that are available and have been configured on for this
489 * platform. This is NOT thread safe.
490 *
491 * The profileName is used by some profilers to describe the current profiling
492 * run. It may be used for part of the filename of the output, but the
493 * specifics depend on the profiler. Many profilers will ignore it. Passing in
494 * NULL is legal; some profilers may use it to output to stdout or similar.
495 *
496 * Returns true if no profilers fail to start.
497 */
498extern JS_PUBLIC_API(JSBool)
499JS_StartProfiling(const char *profileName);
500
501/**
502 * Stop any profilers that were previously started with JS_StartProfiling.
503 * Returns true if no profilers fail to stop.
504 */
505extern JS_PUBLIC_API(JSBool)
506JS_StopProfiling(const char *profileName);
507
508/**
509 * Write the current profile data to the given file, if applicable to whatever
510 * profiler is being used.
511 */
512extern JS_PUBLIC_API(JSBool)
513JS_DumpProfile(const char *outfile, const char *profileName);
514
515/**
516 * Pause currently active profilers (only supported by some profilers). Returns
517 * whether any profilers failed to pause. (Profilers that do not support
518 * pause/resume do not count.)
519 */
520extern JS_PUBLIC_API(JSBool)
521JS_PauseProfilers(const char *profileName);
522
523/**
524 * Resume suspended profilers
525 */
526extern JS_PUBLIC_API(JSBool)
527JS_ResumeProfilers(const char *profileName);
528
529/**
530 * Add various profiling-related functions as properties of the given object.
531 */
532extern JS_PUBLIC_API(JSBool)
533JS_DefineProfilingFunctions(JSContext *cx, JSObject *obj);
534
535/* Defined in vm/Debugger.cpp. */
536extern JS_PUBLIC_API(JSBool)
537JS_DefineDebuggerObject(JSContext *cx, JSObject *obj);
538
539/**
540 * The profiling API calls are not able to report errors, so they use a
541 * thread-unsafe global memory buffer to hold the last error encountered. This
542 * should only be called after something returns false.
543 */
544JS_PUBLIC_API(const char *)
545JS_UnsafeGetLastProfilingError();
546
547#ifdef MOZ_CALLGRIND
548
549extern JS_FRIEND_API(JSBool)
550js_StopCallgrind();
551
552extern JS_FRIEND_API(JSBool)
553js_StartCallgrind();
554
555extern JS_FRIEND_API(JSBool)
556js_DumpCallgrind(const char *outfile);
557
558#endif /* MOZ_CALLGRIND */
559
560#ifdef MOZ_VTUNE
561
562extern JS_FRIEND_API(bool)
563js_StartVtune(const char *profileName);
564
565extern JS_FRIEND_API(bool)
566js_StopVtune();
567
568extern JS_FRIEND_API(bool)
569js_PauseVtune();
570
571extern JS_FRIEND_API(bool)
572js_ResumeVtune();
573
574#endif /* MOZ_VTUNE */
575
576extern JS_PUBLIC_API(void)
577JS_DumpBytecode(JSContext *cx, JSScript *script);
578
579extern JS_PUBLIC_API(void)
580JS_DumpCompartmentBytecode(JSContext *cx);
581
582extern JS_PUBLIC_API(void)
583JS_DumpPCCounts(JSContext *cx, JSScript *script);
584
585extern JS_PUBLIC_API(void)
586JS_DumpCompartmentPCCounts(JSContext *cx);
587
588extern JS_PUBLIC_API(JSObject *)
589JS_UnwrapObject(JSObject *obj);
590
591JS_END_EXTERN_C
592
593#endif /* jsdbgapi_h___ */