<commit_before>//===--- InputData.h - Normalized Inputs ------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines input, abtracted and normalized, whatever the platform
//  or input device.
//
//  <NAME> <<EMAIL>>, 2011-05-12
//===----------------------------------------------------------------------===//

#ifndef TEXTINPUT_INPUTDATA_H
#define TEXTINPUT_INPUTDATA_H

namespace textinput {

  // Normalization of input data.
  class InputData {
  public:
    // Non-character input
    enum EExtendedInput {
      kEIUninitialized,
      kEIHome,
      kEIEnd,
      kEIUp,
      kEIDown,
      kEILeft,
      kEIRight,
      kEIPgUp,
      kEIPgDown,
      kEIBackSpace,
      kEIDel,
      kEIIns,
      kEITab,
      kEIEnter,
      kEIEsc,
      kEIF1,
      kEIF2,
      kEIF3,
      kEIF4,
      kEIF5,
      kEIF6,
      kEIF7,
      kEIF8,
      kEIF9,
      kEIF10,
      kEIF11,
      kEIF12,
      kEIEOF,
      kEIResizeEvent,
      kEIIgnore
    };

    // Input modifier keys, bitset
    enum EInputModifier {
      kModNone = 0,
      kModShift = 1,
      kModCtrl = 2,
      kModAlt = 4
    };

    // Flag (bit) to signal raw input
    enum {
      kIsRaw = 0x80
    };

    InputData(): fExt(kEIUninitialized), fMod(0) {}
    InputData(int ch, char mod = 0): fRaw(ch), fMod(mod | kIsRaw) {}

    bool IsRaw() const { return (fMod & kIsRaw) != 0; }
    int GetRaw() const { return fRaw; }

    EExtendedInput GetExtendedInput() const { return fExt; }
    int GetModifier() const { return fMod & ~kIsRaw; }

    void SetRaw(char R) { fRaw = R; fMod |= kIsRaw; }
    void SetExtended(EExtendedInput E) { fExt = E;  fMod &= ~kIsRaw; }
    void SetModifier(char M) { fMod = M | (fMod & kIsRaw); }

  private:
    union {
      char fRaw; // raw input character, if kIsRaw & fMod
      EExtendedInput fExt; // non-character input
    };
    char fMod; // Modifiers, also stores union descriminator (kIsRaw)
  };
}
#endif // TEXTINPUT_INPUTDATA_H<commit_msg>Avoid sign changes due to kIsRaw / fMod sign extension. Fixes '@' cancelling CINT input.<commit_after>//===--- InputData.h - Normalized Inputs ------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines input, abtracted and normalized, whatever the platform
//  or input device.
//
//  <NAME> <<EMAIL>>, 2011-05-12
//===----------------------------------------------------------------------===//

#ifndef TEXTINPUT_INPUTDATA_H
#define TEXTINPUT_INPUTDATA_H

namespace textinput {

  // Normalization of input data.
  class InputData {
  public:
    // Non-character input
    enum EExtendedInput {
      kEIUninitialized,
      kEIHome,
      kEIEnd,
      kEIUp,
      kEIDown,
      kEILeft,
      kEIRight,
      kEIPgUp,
      kEIPgDown,
      kEIBackSpace,
      kEIDel,
      kEIIns,
      kEITab,
      kEIEnter,
      kEIEsc,
      kEIF1,
      kEIF2,
      kEIF3,
      kEIF4,
      kEIF5,
      kEIF6,
      kEIF7,
      kEIF8,
      kEIF9,
      kEIF10,
      kEIF11,
      kEIF12,
      kEIEOF,
      kEIResizeEvent,
      kEIIgnore
    };

    // Input modifier keys, bitset
    enum EInputModifier {
      kModNone = 0,
      kModShift = 1,
      kModCtrl = 2,
      kModAlt = 4
    };

    // Flag (bit) to signal raw input
    enum {
      kIsRaw = 0x80
    };

    InputData(): fExt(kEIUninitialized), fMod(0) {}
    InputData(int ch, char mod = 0): fRaw(ch), fMod(mod | kIsRaw) {}

    bool IsRaw() const { return (fMod & kIsRaw) != 0; }
    int GetRaw() const { return fRaw; }

    EExtendedInput GetExtendedInput() const { return fExt; }
    unsigned char GetModifier() const { return fMod & ~kIsRaw; }

    void SetRaw(char R) { fRaw = R; fMod |= kIsRaw; }
    void SetExtended(EExtendedInput E) { fExt = E;  fMod &= ~kIsRaw; }
    void SetModifier(char M) { fMod = M | (fMod & kIsRaw); }

  private:
    union {
      char fRaw; // raw input character, if kIsRaw & fMod
      EExtendedInput fExt; // non-character input
    };
    unsigned char fMod; // Modifiers, also stores union descriminator (kIsRaw)
  };
}
#endif // TEXTINPUT_INPUTDATA_H
{'fraction_non_alphanumeric': 0.18257443082311733, 'fraction_numerical': 0.014448336252189142, 'mean_word_length': 1.6876470588235295, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2544269', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1536, 'n_words': 393}