Files
llvm/lldb/source/Core/InputReaderEZ.cpp
Enrico Granata f2bbf717f7 Python summary strings:
- you can use a Python script to write a summary string for data-types, in one of
   three ways:
    -P option and typing the script a line at a time
    -s option and passing a one-line Python script
    -F option and passing the name of a Python function
   these options all work for the "type summary add" command
   your Python code (if provided through -P or -s) is wrapped in a function
   that accepts two parameters: valobj (a ValueObject) and dict (an LLDB
   internal dictionary object). if you use -F and give a function name,
   you're expected to define the function on your own and with the right
   prototype. your function, however defined, must return a Python string
 - test case for the Python summary feature
 - a few quirks:
  Python summaries cannot have names, and cannot use regex as type names
  both issues will be fixed ASAP
major redesign of type summary code:
 - type summary working with strings and type summary working with Python code
   are two classes, with a common base class SummaryFormat
 - SummaryFormat classes now are able to actively format objects rather than
   just aggregating data
 - cleaner code to print descriptions for summaries
the public API now exports a method to easily navigate a ValueObject hierarchy
New InputReaderEZ and PriorityPointerPair classes
Several minor fixes and improvements

llvm-svn: 135238
2011-07-15 02:26:42 +00:00

80 lines
2.3 KiB
C++

//===-- InputReaderEZ.cpp ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <string>
#include "lldb/Core/InputReaderEZ.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
using namespace lldb;
using namespace lldb_private;
size_t
InputReaderEZ::Callback_Impl(void *baton,
InputReader &reader,
lldb::InputReaderAction notification,
const char *bytes,
size_t bytes_len)
{
HandlerData hand_data(reader,
bytes,
bytes_len,
baton);
switch (notification)
{
case eInputReaderActivate:
reader.ActivateHandler(hand_data);
break;
case eInputReaderDeactivate:
reader.DeactivateHandler(hand_data);
break;
case eInputReaderReactivate:
reader.ReactivateHandler(hand_data);
break;
case eInputReaderAsynchronousOutputWritten:
reader.AsynchronousOutputWrittenHandler(hand_data);
break;
case eInputReaderGotToken:
reader.GotTokenHandler(hand_data);
break;
case eInputReaderInterrupt:
reader.InterruptHandler(hand_data);
break;
case eInputReaderEndOfFile:
reader.EOFHandler(hand_data);
break;
case eInputReaderDone:
reader.DoneHandler(hand_data);
break;
}
return bytes_len;
}
Error
InputReaderEZ::Initialize(void* baton,
lldb::InputReaderGranularity token_size,
const char* end_token,
const char *prompt,
bool echo)
{
return InputReader::Initialize(Callback_Impl,
baton,
token_size,
end_token,
prompt,
echo);
}
InputReaderEZ::~InputReaderEZ ()
{
}