<commit_before>
/*
 * trace.h
 *
 * (C) Copyright IBM Corp. 2005
 *
 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE
 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
 * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
 *
 * You can obtain a current copy of the Common Public License from
 * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html
 *
 * Author:        <NAME> <<EMAIL>>
 * Based on concepts developed by <NAME> <<EMAIL>>
 *
 * Description:
 *
 * Trace support for sfcb.
 *
*/

#ifndef _trace_h
#define _trace_h

#include "mlog.h"

#ifdef SFCB_DEBUG
#define _SFCB_TRACE(LEVEL,STR) \
  if ((_sfcb_trace_mask & __traceMask) && (LEVEL<=_sfcb_debug) && (LEVEL>0) ) \
  _sfcb_trace(LEVEL,__FILE__,__LINE__,_sfcb_format_trace STR);

#define _SFCB_ENTER(n,f) \
   char *__func_=f; \
   unsigned long __traceMask=n; \
   _SFCB_TRACE(1,("Entering: %s",__func_));

#define _SFCB_EXIT() {\
   _SFCB_TRACE(1,("Leaving: %s",__func_)); \
   return; }

#define _SFCB_RETURN(v) {\
   _SFCB_TRACE(1,("Leaving: %s",__func_)); \
   return v; }

#define _SFCB_TRACE_INIT() \
   _sfcb_trace_init();

#define _SFCB_TRACE_START(n) \
   _sfcb_trace_start(n);

#define _SFCB_TRACE_STOP() \
   _sfcb_trace_stop(n);

#define _SFCB_TRACE_FUNCTION(LEVEL,f) \
   _SFCB_TRACE(LEVEL,("Invoking trace function %s",#f)); \
    if ((_sfcb_trace_mask & __traceMask) &&  (LEVEL<=_sfcb_debug) && (LEVEL>0) ) { \
    f;}

#define _SFCB_ABORT() {\
   _SFCB_TRACE(1,("Aborting: %s",__func_)); \
   abort(); }

#define TRAP(n) \
      _sfcb_trap(n);

extern int _sfcb_debug;
extern unsigned long _sfcb_trace_mask;

extern char *_sfcb_format_trace(char *fmt, ...);
extern void _sfcb_trace(int, char *, int, char *);
extern void _sfcb_trace_start(int l);
extern void _sfcb_trace_init();
extern void _sfcb_trace_stop();
extern void _sfcb_set_trace_mask(int n);
extern void _sfcb_trap(int n);

#else
#define _SFCB_TRACE_FUNCTION(n,f)
#define _SFCB_TRACE(LEVEL,STR)<commit_msg>fix bug in _SFCB_TRACE_STOP() macro<commit_after>
/*
 * trace.h
 *
 * (C) Copyright IBM Corp. 2005
 *
 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE
 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
 * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
 *
 * You can obtain a current copy of the Common Public License from
 * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html
 *
 * Author:        <NAME> <<EMAIL>>
 * Based on concepts developed by <NAME> <<EMAIL>>
 *
 * Description:
 *
 * Trace support for sfcb.
 *
*/

#ifndef _trace_h
#define _trace_h

#include "mlog.h"

#ifdef SFCB_DEBUG
#define _SFCB_TRACE(LEVEL,STR) \
  if ((_sfcb_trace_mask & __traceMask) && (LEVEL<=_sfcb_debug) && (LEVEL>0) ) \
  _sfcb_trace(LEVEL,__FILE__,__LINE__,_sfcb_format_trace STR);

#define _SFCB_ENTER(n,f) \
   char *__func_=f; \
   unsigned long __traceMask=n; \
   _SFCB_TRACE(1,("Entering: %s",__func_));

#define _SFCB_EXIT() {\
   _SFCB_TRACE(1,("Leaving: %s",__func_)); \
   return; }

#define _SFCB_RETURN(v) {\
   _SFCB_TRACE(1,("Leaving: %s",__func_)); \
   return v; }

#define _SFCB_TRACE_INIT() \
   _sfcb_trace_init();

#define _SFCB_TRACE_START(n) \
   _sfcb_trace_start(n);

#define _SFCB_TRACE_STOP() \
   _sfcb_trace_stop();

#define _SFCB_TRACE_FUNCTION(LEVEL,f) \
   _SFCB_TRACE(LEVEL,("Invoking trace function %s",#f)); \
    if ((_sfcb_trace_mask & __traceMask) &&  (LEVEL<=_sfcb_debug) && (LEVEL>0) ) { \
    f;}

#define _SFCB_ABORT() {\
   _SFCB_TRACE(1,("Aborting: %s",__func_)); \
   abort(); }

#define TRAP(n) \
      _sfcb_trap(n);

extern int _sfcb_debug;
extern unsigned long _sfcb_trace_mask;

extern char *_sfcb_format_trace(char *fmt, ...);
extern void _sfcb_trace(int, char *, int, char *);
extern void _sfcb_trace_start(int l);
extern void _sfcb_trace_init();
extern void _sfcb_trace_stop();
extern void _sfcb_set_trace_mask(int n);
extern void _sfcb_trap(int n);

#else
#define _SFCB_TRACE_FUNCTION(n,f)
#define _SFCB_TRACE(LEVEL,STR)
{'fraction_non_alphanumeric': 0.14303451701018127, 'fraction_numerical': 0.004966476285075739, 'mean_word_length': 4.602225312934632, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4271209', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1621, 'n_words': 339}