<commit_before>//
//  Logger.h
//
//  Created by <NAME> on 12/9/12.
//  Copyright (c) 2012 <NAME>. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "libextobjc/metamacros.h"

#import "Descriptions/Foundation.h"

#define __VA_NUM_ARGS(...) __VA_NUM_ARGS_IMPL(0, ##__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define __VA_NUM_ARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N

/* Focused logging */
FOUNDATION_EXPORT BOOL LOGGER_FOCUSED_MODE;
void __LoggerRunInFocusedMode(void (^block)(void));

/* Logger internal methods */
void __L(NSString *sourceInfo, NSString *logString);
NSString * __LoggerSourceInfo(const char *file, int lineNumber, const char *funcName);

#define __L_ITER(INDEX, ARG) \
    LoggerDescription(ARG),

#define L(...) do { \
    if (LOGGER_FOCUSED_MODE) break; \
    \
    NSString *finalString; \
    metamacro_if_eq(0, __VA_NUM_ARGS(__VA_ARGS__))( \
        finalString = @"L()"; \
    )( \
        NSString *echoedInput = @("L(" #__VA_ARGS__ ")"); \
        \
        NSString *describedOutput = [@[ \
            metamacro_foreach(__L_ITER,, __VA_ARGS__) \
        ] componentsJoinedByString:@"; "]; \
        \
        finalString = [@[ echoedInput, describedOutput] componentsJoinedByString:@" ~> "]; \
    ) \
    \
    __L(__LoggerSourceInfo(__FILE__, __LINE__, __PRETTY_FUNCTION__), finalString); \
} while(0)

#define LS(...) do { \
    if (LOGGER_FOCUSED_MODE) break; \
    \
    metamacro_if_eq(0, __VA_NUM_ARGS(__VA_ARGS__))( \
        printf("LS()\n"); \
        break; \
    )(); \
    \
    NSString *echoedInput = @("LS(" #__VA_ARGS__ ")"); \
    \
    NSString *describedOutput = [@[ \
    metamacro_foreach(__L_ITER,, __VA_ARGS__) \
    ] componentsJoinedByString:@"; "]; \
    \
    NSString *finalString = [@[ echoedInput, describedOutput] componentsJoinedByString:@" ~> "]; \
    __L(nil, finalString); \
} while(0)

#define LF(...) __LoggerRunInFocusedMode(^{ \
    NSString *finalString; \
    metamacro_if_eq(0, __VA_NUM_ARGS(__VA_ARGS__))( \
        finalString = @"LF()"; \
    )( \
        NSString *echoedInput = @("LF(" #__VA_ARGS__ ")"); \
        \
        NSString *describedOutput = [@[ \
            metamacro_foreach(__L_ITER,, __VA_ARGS__) \
        ] componentsJoinedByString:@"; "]; \
        \
        finalString = [@[ echoedInput, describedOutput] componentsJoinedByString:@" ~> "]; \
    ) \
    \
    __L(__LoggerSourceInfo(__FILE__, __LINE__, __PRETTY_FUNCTION__), finalString); \
})

#define LSF(...) __LoggerRunInFocusedMode(^{ \
    metamacro_if_eq(0, __VA_NUM_ARGS(__VA_ARGS__))( \
        printf("LSF()\n"); \
        return; \
    )() \
    NSString *echoedInput = @("LSF(" #__VA_ARGS__ ")"); \
    \
    NSString *describedOutput = [@[ \
    metamacro_foreach(__L_ITER,, __VA_ARGS__) \
    ] componentsJoinedByString:@"; "]; \
    \
    NSString *finalString = [@[ echoedInput, describedOutput] componentsJoinedByString:@" ~> "]; \
    __L(nil, finalString); \
})
<commit_msg>__VA_NUM_ARGS -> metamacro_argcount2<commit_after>//
//  Logger.h
//
//  Created by <NAME> on 12/9/12.
//  Copyright (c) 2012 <NAME>. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "libextobjc/metamacros.h"

#import "Descriptions/Foundation.h"

#define metamacro_argcount2(...) _metamacro_argcount2(0, ##__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define _metamacro_argcount2(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N

/* Focused logging */
FOUNDATION_EXPORT BOOL LOGGER_FOCUSED_MODE;
void __LoggerRunInFocusedMode(void (^block)(void));

/* Logger internal methods */
void __L(NSString *sourceInfo, NSString *logString);
NSString * __LoggerSourceInfo(const char *file, int lineNumber, const char *funcName);

#define __L_ITER(INDEX, ARG) \
    LoggerDescription(ARG),

#define L(...) do { \
    if (LOGGER_FOCUSED_MODE) break; \
    \
    NSString *finalString; \
    metamacro_if_eq(0, metamacro_argcount2(__VA_ARGS__))( \
        finalString = @"L()"; \
    )( \
        NSString *echoedInput = @("L(" #__VA_ARGS__ ")"); \
        \
        NSString *describedOutput = [@[ \
            metamacro_foreach(__L_ITER,, __VA_ARGS__) \
        ] componentsJoinedByString:@"; "]; \
        \
        finalString = [@[ echoedInput, describedOutput] componentsJoinedByString:@" ~> "]; \
    ) \
    \
    __L(__LoggerSourceInfo(__FILE__, __LINE__, __PRETTY_FUNCTION__), finalString); \
} while(0)

#define LS(...) do { \
    if (LOGGER_FOCUSED_MODE) break; \
    \
    metamacro_if_eq(0, metamacro_argcount2(__VA_ARGS__))( \
        printf("LS()\n"); \
        break; \
    )(); \
    \
    NSString *echoedInput = @("LS(" #__VA_ARGS__ ")"); \
    \
    NSString *describedOutput = [@[ \
    metamacro_foreach(__L_ITER,, __VA_ARGS__) \
    ] componentsJoinedByString:@"; "]; \
    \
    NSString *finalString = [@[ echoedInput, describedOutput] componentsJoinedByString:@" ~> "]; \
    __L(nil, finalString); \
} while(0)

#define LF(...) __LoggerRunInFocusedMode(^{ \
    NSString *finalString; \
    metamacro_if_eq(0, metamacro_argcount2(__VA_ARGS__))( \
        finalString = @"LF()"; \
    )( \
        NSString *echoedInput = @("LF(" #__VA_ARGS__ ")"); \
        \
        NSString *describedOutput = [@[ \
            metamacro_foreach(__L_ITER,, __VA_ARGS__) \
        ] componentsJoinedByString:@"; "]; \
        \
        finalString = [@[ echoedInput, describedOutput] componentsJoinedByString:@" ~> "]; \
    ) \
    \
    __L(__LoggerSourceInfo(__FILE__, __LINE__, __PRETTY_FUNCTION__), finalString); \
})

#define LSF(...) __LoggerRunInFocusedMode(^{ \
    metamacro_if_eq(0, metamacro_argcount2(__VA_ARGS__))( \
        printf("LSF()\n"); \
        return; \
    )() \
    NSString *echoedInput = @("LSF(" #__VA_ARGS__ ")"); \
    \
    NSString *describedOutput = [@[ \
    metamacro_foreach(__L_ITER,, __VA_ARGS__) \
    ] componentsJoinedByString:@"; "]; \
    \
    NSString *finalString = [@[ echoedInput, describedOutput] componentsJoinedByString:@" ~> "]; \
    __L(nil, finalString); \
})

{'fraction_non_alphanumeric': 0.16785536573229393, 'fraction_numerical': 0.014596118759329906, 'mean_word_length': 2.988095238095238, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5412369', 'n_tokens_mistral': 2307, 'n_tokens_neox': 2146, 'n_words': 369}