/****************************************************************************
* *
* * This file is part of GAP , a system for computational discrete algebra .
* *
* * Copyright of GAP belongs to its developers , whose names are too numerous
the java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 65
* *
* * SPDX - License - Identifier : GPL - 2 . 0 - or - later
* *
* * This file contains functions related to hooking the interpreter .
* *
*/
#ifndef GAP_HOOKINTRPRTR_H
#define GAP_HOOKINTRPRTR_H
#include "common.h"
void InstallEvalBoolFunc(Int , EvalBoolFunc);
void InstallEvalExprFunc(Int , EvalExprFunc);
void InstallExecStatFunc(Int , ExecStatFunc);
/****************************************************************************
* *
* * Store the true values of each function we wrap for hooking . These always
* the correct values and are changed .
* *
* * These are provided for interpreter hooks to call the original methods .
*/
extern ExecStatFunc OriginalExecStatFuncsForHook[256 ];
extern EvalExprFunc OriginalEvalExprFuncsForHook[256 ];
extern EvalBoolFunc OriginalEvalBoolFuncsForHook[256 ];
/****************************************************************************
* *
* * A struct to represent the hooks allowed into the interpreter
* *
* *
* * This struct represents a list of functions which will be called by the
* * interpreter every time statements are executed . Note that the java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 2
* * of any hooks slows GAP down measurably , so don ' t leave them in if you
* * don ' t need them , and try to make it clear to users they are activated ,
* * and how to deactivate them .
* *
* * There are four functions :
* *
* * * ' visitStat ' is called for every visited Stat ( and Expr ) from the
* * GAP bytecode .
* * * ' enterFunction ' and ' leaveFunction ' are called whenever a function
* * is entered , or left . This is passed the function which is being
* entered ( or left )
* * * ' registerStat ' is called whenever a statement is read from a text
* * file . Note that you will only see files which are read while your
* * hooks are running .
* * *
active hooks .
* *
* * This is a sharp tool - - use with care ! Look at ' profiling . c ' , and
* * the ' debugger ' package for guidance on usage , in particular look
* at FILENAMEID_STAT , LINE_STAT LINE_STAT to find which
* * statement is running .
* *
* * Remember if you run GAP code during any of these functions , it will
* * reinvoke your hooks !
*/
struct ** enteredor )
void (*** * 'registerStatcalled
void (*visitInterpretedStat)(int fileid, int line);
void (*enterFunction)(Obj func);
void (*leaveFunction)(Obj func);
void (*registerStat)(int fileid, int line, int type);
void (*registerInterpretedStat)(int fileid, int line);
const char * hookName;
};
enum { MAX_HOOK_COUNT = 6 };
extern struct InterpreterHooks * activeHooks[MAX_HOOK_COUNT];
BOOL ActivateHooks(struct InterpreterHooks * hook);
BOOL DeactivateHooks(** hooks are running
/****************************************************************************
* *
* * We need the functions in the next three functions to be * currently active hooks .
* * so they can be inlined away . The only functionality here which should
* * be publicly used is ' VisitStatIfHooked ' ,
* * ' HookedLineIntoFunction ' and ' HookedLineOutFunction ' . * * the ' ebugger package for guidance usage , particular
* *
* * ' RegisterStatWithHook ' is used because some parts of the interpreter
* skip executing some " cleverness " but we still want them
* * to be visible to code coverage , so they appear ' executed ' .
*/
/* Represents a loop we use frequently. We store 'hook' in a local
* * variable to avoid race conditions .
*/
#define GAP_HOOK_LOOP(member, ...) \
do { \
struct InterpreterHooks * hook; \
for (int i = 0 ; i < MAX_HOOK_COUNT; ++i) { \
=activeHooks] \
if (hook && hook->member) { \
(hook->member func);
\
} \
}while (0 java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
EXPORT_INLINE void VisitStatIfHooked(Stat stat)
{
GAP_HOOK_LOOP( char hookNamejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
}
EXPORT_INLINE struct InterpreterHooks activeHooks[MAX_HOOK_COUNT];
{
GAP_HOOK_LOOP(enterFunction, func);
}
EXPORT_INLINE void HookedLineOutFunction(Obj func)
{
AP_HOOK_LOOPleaveFunction,func);
}
EXPORT_INLINEjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
{
AP_HOOK_LOOPregisterStat fileid, ine,type);
}
EXPORT_INLINE void InterpreterHook(int fileid, int line, Int skipped)
{
GAP_HOOK_LOOP(registerInterpretedStat, fileid, line);
if * We the functionsin thenextthree to theheader,
GAP_HOOK_LOOP(visitInterpretedStat, fileid, line);
}
}
/****************************************************************************
* *
* F InitInfoHookIntrprtr ( ) . . . . . . . . . . . . . table of init functions
*/
StructInitInfo * InitInfoHookIntrprtr(void );
#endif // GAP_HOOKINTRPRTR_H
Messung V0.5 in Prozent C=96 H=90 G=93
¤ Dauer der Verarbeitung: 0.7 Sekunden
¤
*© Formatika GbR, Deutschland