| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 1 |  | 
|  | 2 | %extend lldb::SBAddress { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 3 | PyObject *lldb::SBAddress::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 4 | lldb::SBStream description; | 
|  | 5 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 6 | const char *desc = description.GetData(); | 
|  | 7 | size_t desc_len = description.GetSize(); | 
|  | 8 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 9 | --desc_len; | 
|  | 10 | if (desc_len > 0) | 
|  | 11 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 12 | else | 
|  | 13 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 14 | } | 
|  | 15 | } | 
|  | 16 | %extend lldb::SBBlock { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 17 | PyObject *lldb::SBBlock::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 18 | lldb::SBStream description; | 
|  | 19 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 20 | const char *desc = description.GetData(); | 
|  | 21 | size_t desc_len = description.GetSize(); | 
|  | 22 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 23 | --desc_len; | 
|  | 24 | if (desc_len > 0) | 
|  | 25 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 26 | else | 
|  | 27 | return PyString_FromString(""); | 
|  | 28 |  | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 29 | } | 
|  | 30 | } | 
|  | 31 | %extend lldb::SBBreakpoint { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 32 | PyObject *lldb::SBBreakpoint::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 33 | lldb::SBStream description; | 
| Greg Clayton | 05faeb7 | 2010-10-07 04:19:01 +0000 | [diff] [blame] | 34 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 35 | const char *desc = description.GetData(); | 
|  | 36 | size_t desc_len = description.GetSize(); | 
|  | 37 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 38 | --desc_len; | 
|  | 39 | if (desc_len > 0) | 
|  | 40 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 41 | else | 
|  | 42 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 43 | } | 
|  | 44 | } | 
|  | 45 | %extend lldb::SBBreakpointLocation { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 46 | PyObject *lldb::SBBreakpointLocation::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 47 | lldb::SBStream description; | 
| Johnny Chen | fc87e2d | 2011-04-25 20:23:05 +0000 | [diff] [blame] | 48 | $self->GetDescription (description, lldb::eDescriptionLevelFull); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 49 | const char *desc = description.GetData(); | 
|  | 50 | size_t desc_len = description.GetSize(); | 
|  | 51 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 52 | --desc_len; | 
|  | 53 | if (desc_len > 0) | 
|  | 54 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 55 | else | 
|  | 56 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 57 | } | 
|  | 58 | } | 
|  | 59 | %extend lldb::SBCommandReturnObject { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 60 | PyObject *lldb::SBCommandReturnObject::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 61 | lldb::SBStream description; | 
|  | 62 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 63 | const char *desc = description.GetData(); | 
|  | 64 | size_t desc_len = description.GetSize(); | 
|  | 65 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 66 | --desc_len; | 
|  | 67 | if (desc_len > 0) | 
|  | 68 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 69 | else | 
|  | 70 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 71 | } | 
|  | 72 | } | 
|  | 73 | %extend lldb::SBCompileUnit { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 74 | PyObject *lldb::SBCompileUnit::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 75 | lldb::SBStream description; | 
|  | 76 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 77 | const char *desc = description.GetData(); | 
|  | 78 | size_t desc_len = description.GetSize(); | 
|  | 79 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 80 | --desc_len; | 
|  | 81 | if (desc_len > 0) | 
|  | 82 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 83 | else | 
|  | 84 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 85 | } | 
|  | 86 | } | 
| Enrico Granata | 9128ee2 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 87 | %extend lldb::SBData { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 88 | PyObject *lldb::SBData::__str__ (){ | 
| Enrico Granata | 9128ee2 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 89 | lldb::SBStream description; | 
|  | 90 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 91 | const char *desc = description.GetData(); | 
|  | 92 | size_t desc_len = description.GetSize(); | 
|  | 93 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 94 | --desc_len; | 
|  | 95 | if (desc_len > 0) | 
|  | 96 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 97 | else | 
|  | 98 | return PyString_FromString(""); | 
| Enrico Granata | 9128ee2 | 2011-09-06 19:20:51 +0000 | [diff] [blame] | 99 | } | 
|  | 100 | } | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 101 | %extend lldb::SBDebugger { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 102 | PyObject *lldb::SBDebugger::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 103 | lldb::SBStream description; | 
|  | 104 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 105 | const char *desc = description.GetData(); | 
|  | 106 | size_t desc_len = description.GetSize(); | 
|  | 107 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 108 | --desc_len; | 
|  | 109 | if (desc_len > 0) | 
|  | 110 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 111 | else | 
|  | 112 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 113 | } | 
|  | 114 | } | 
|  | 115 | %extend lldb::SBError { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 116 | PyObject *lldb::SBError::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 117 | lldb::SBStream description; | 
|  | 118 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 119 | const char *desc = description.GetData(); | 
|  | 120 | size_t desc_len = description.GetSize(); | 
|  | 121 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 122 | --desc_len; | 
|  | 123 | if (desc_len > 0) | 
|  | 124 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 125 | else | 
|  | 126 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 127 | } | 
|  | 128 | } | 
|  | 129 | %extend lldb::SBFileSpec { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 130 | PyObject *lldb::SBFileSpec::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 131 | lldb::SBStream description; | 
|  | 132 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 133 | const char *desc = description.GetData(); | 
|  | 134 | size_t desc_len = description.GetSize(); | 
|  | 135 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 136 | --desc_len; | 
|  | 137 | if (desc_len > 0) | 
|  | 138 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 139 | else | 
|  | 140 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 141 | } | 
|  | 142 | } | 
|  | 143 | %extend lldb::SBFrame { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 144 | PyObject *lldb::SBFrame::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 145 | lldb::SBStream description; | 
|  | 146 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 147 | const char *desc = description.GetData(); | 
|  | 148 | size_t desc_len = description.GetSize(); | 
|  | 149 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 150 | --desc_len; | 
|  | 151 | if (desc_len > 0) | 
|  | 152 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 153 | else | 
|  | 154 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 155 | } | 
|  | 156 | } | 
|  | 157 | %extend lldb::SBFunction { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 158 | PyObject *lldb::SBFunction::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 159 | lldb::SBStream description; | 
|  | 160 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 161 | const char *desc = description.GetData(); | 
|  | 162 | size_t desc_len = description.GetSize(); | 
|  | 163 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 164 | --desc_len; | 
|  | 165 | if (desc_len > 0) | 
|  | 166 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 167 | else | 
|  | 168 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 169 | } | 
|  | 170 | } | 
| Greg Clayton | 1d27316 | 2010-10-06 03:09:58 +0000 | [diff] [blame] | 171 | %extend lldb::SBInstruction { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 172 | PyObject *lldb::SBInstruction::__str__ (){ | 
| Greg Clayton | 1d27316 | 2010-10-06 03:09:58 +0000 | [diff] [blame] | 173 | lldb::SBStream description; | 
|  | 174 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 175 | const char *desc = description.GetData(); | 
|  | 176 | size_t desc_len = description.GetSize(); | 
|  | 177 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 178 | --desc_len; | 
|  | 179 | if (desc_len > 0) | 
|  | 180 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 181 | else | 
|  | 182 | return PyString_FromString(""); | 
| Greg Clayton | 1d27316 | 2010-10-06 03:09:58 +0000 | [diff] [blame] | 183 | } | 
|  | 184 | } | 
|  | 185 | %extend lldb::SBInstructionList { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 186 | PyObject *lldb::SBInstructionList::__str__ (){ | 
| Greg Clayton | 1d27316 | 2010-10-06 03:09:58 +0000 | [diff] [blame] | 187 | lldb::SBStream description; | 
|  | 188 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 189 | const char *desc = description.GetData(); | 
|  | 190 | size_t desc_len = description.GetSize(); | 
|  | 191 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 192 | --desc_len; | 
|  | 193 | if (desc_len > 0) | 
|  | 194 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 195 | else | 
|  | 196 | return PyString_FromString(""); | 
| Greg Clayton | 1d27316 | 2010-10-06 03:09:58 +0000 | [diff] [blame] | 197 | } | 
|  | 198 | } | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 199 | %extend lldb::SBLineEntry { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 200 | PyObject *lldb::SBLineEntry::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 201 | lldb::SBStream description; | 
|  | 202 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 203 | const char *desc = description.GetData(); | 
|  | 204 | size_t desc_len = description.GetSize(); | 
|  | 205 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 206 | --desc_len; | 
|  | 207 | if (desc_len > 0) | 
|  | 208 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 209 | else | 
|  | 210 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 211 | } | 
|  | 212 | } | 
|  | 213 | %extend lldb::SBModule { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 214 | PyObject *lldb::SBModule::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 215 | lldb::SBStream description; | 
|  | 216 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 217 | const char *desc = description.GetData(); | 
|  | 218 | size_t desc_len = description.GetSize(); | 
|  | 219 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 220 | --desc_len; | 
|  | 221 | if (desc_len > 0) | 
|  | 222 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 223 | else | 
|  | 224 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 225 | } | 
|  | 226 | } | 
|  | 227 | %extend lldb::SBProcess { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 228 | PyObject *lldb::SBProcess::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 229 | lldb::SBStream description; | 
|  | 230 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 231 | const char *desc = description.GetData(); | 
|  | 232 | size_t desc_len = description.GetSize(); | 
|  | 233 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 234 | --desc_len; | 
|  | 235 | if (desc_len > 0) | 
|  | 236 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 237 | else | 
|  | 238 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 239 | } | 
|  | 240 | } | 
| Greg Clayton | d9dc52d | 2011-09-24 05:04:40 +0000 | [diff] [blame] | 241 | %extend lldb::SBSection { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 242 | PyObject *lldb::SBSection::__str__ (){ | 
| Greg Clayton | d9dc52d | 2011-09-24 05:04:40 +0000 | [diff] [blame] | 243 | lldb::SBStream description; | 
|  | 244 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 245 | const char *desc = description.GetData(); | 
|  | 246 | size_t desc_len = description.GetSize(); | 
|  | 247 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 248 | --desc_len; | 
|  | 249 | if (desc_len > 0) | 
|  | 250 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 251 | else | 
|  | 252 | return PyString_FromString(""); | 
| Greg Clayton | d9dc52d | 2011-09-24 05:04:40 +0000 | [diff] [blame] | 253 | } | 
|  | 254 | } | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 255 | %extend lldb::SBSymbol { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 256 | PyObject *lldb::SBSymbol::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 257 | lldb::SBStream description; | 
|  | 258 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 259 | const char *desc = description.GetData(); | 
|  | 260 | size_t desc_len = description.GetSize(); | 
|  | 261 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 262 | --desc_len; | 
|  | 263 | if (desc_len > 0) | 
|  | 264 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 265 | else | 
|  | 266 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 267 | } | 
|  | 268 | } | 
|  | 269 | %extend lldb::SBSymbolContext { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 270 | PyObject *lldb::SBSymbolContext::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 271 | lldb::SBStream description; | 
|  | 272 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 273 | const char *desc = description.GetData(); | 
|  | 274 | size_t desc_len = description.GetSize(); | 
|  | 275 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 276 | --desc_len; | 
|  | 277 | if (desc_len > 0) | 
|  | 278 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 279 | else | 
|  | 280 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 281 | } | 
|  | 282 | } | 
| Greg Clayton | 5569e64 | 2012-02-06 01:44:54 +0000 | [diff] [blame] | 283 | %extend lldb::SBSymbolContextList { | 
|  | 284 | PyObject *lldb::SBSymbolContextList::__str__ (){ | 
|  | 285 | lldb::SBStream description; | 
|  | 286 | $self->GetDescription (description); | 
|  | 287 | const char *desc = description.GetData(); | 
|  | 288 | size_t desc_len = description.GetSize(); | 
|  | 289 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 290 | --desc_len; | 
|  | 291 | if (desc_len > 0) | 
|  | 292 | return PyString_FromStringAndSize (desc, desc_len); | 
|  | 293 | else | 
|  | 294 | return PyString_FromString(""); | 
|  | 295 | } | 
|  | 296 | } | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 297 | %extend lldb::SBTarget { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 298 | PyObject *lldb::SBTarget::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 299 | lldb::SBStream description; | 
| Caroline Tice | ceb6b13 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 300 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 301 | const char *desc = description.GetData(); | 
|  | 302 | size_t desc_len = description.GetSize(); | 
|  | 303 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 304 | --desc_len; | 
|  | 305 | if (desc_len > 0) | 
|  | 306 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 307 | else | 
|  | 308 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 309 | } | 
|  | 310 | } | 
| Greg Clayton | da7bc7d | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 311 | %extend lldb::SBType { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 312 | PyObject *lldb::SBType::__str__ (){ | 
| Greg Clayton | da7bc7d | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 313 | lldb::SBStream description; | 
|  | 314 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 315 | const char *desc = description.GetData(); | 
|  | 316 | size_t desc_len = description.GetSize(); | 
|  | 317 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 318 | --desc_len; | 
|  | 319 | if (desc_len > 0) | 
|  | 320 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 321 | else | 
|  | 322 | return PyString_FromString(""); | 
| Greg Clayton | da7bc7d | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 323 | } | 
|  | 324 | } | 
| Enrico Granata | 061858c | 2012-02-15 02:34:21 +0000 | [diff] [blame] | 325 | %extend lldb::SBTypeCategory { | 
|  | 326 | PyObject *lldb::SBTypeCategory::__str__ (){ | 
|  | 327 | lldb::SBStream description; | 
|  | 328 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
|  | 329 | const char *desc = description.GetData(); | 
|  | 330 | size_t desc_len = description.GetSize(); | 
|  | 331 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 332 | --desc_len; | 
|  | 333 | if (desc_len > 0) | 
|  | 334 | return PyString_FromStringAndSize (desc, desc_len); | 
|  | 335 | else | 
|  | 336 | return PyString_FromString(""); | 
|  | 337 | } | 
|  | 338 | } | 
|  | 339 | %extend lldb::SBTypeFilter { | 
|  | 340 | PyObject *lldb::SBTypeFilter::__str__ (){ | 
|  | 341 | lldb::SBStream description; | 
|  | 342 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
|  | 343 | const char *desc = description.GetData(); | 
|  | 344 | size_t desc_len = description.GetSize(); | 
|  | 345 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 346 | --desc_len; | 
|  | 347 | if (desc_len > 0) | 
|  | 348 | return PyString_FromStringAndSize (desc, desc_len); | 
|  | 349 | else | 
|  | 350 | return PyString_FromString(""); | 
|  | 351 | } | 
|  | 352 | } | 
|  | 353 | %extend lldb::SBTypeFormat { | 
|  | 354 | PyObject *lldb::SBTypeFormat::__str__ (){ | 
|  | 355 | lldb::SBStream description; | 
|  | 356 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
|  | 357 | const char *desc = description.GetData(); | 
|  | 358 | size_t desc_len = description.GetSize(); | 
|  | 359 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 360 | --desc_len; | 
|  | 361 | if (desc_len > 0) | 
|  | 362 | return PyString_FromStringAndSize (desc, desc_len); | 
|  | 363 | else | 
|  | 364 | return PyString_FromString(""); | 
|  | 365 | } | 
|  | 366 | } | 
| Greg Clayton | da7bc7d | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 367 | %extend lldb::SBTypeMember { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 368 | PyObject *lldb::SBTypeMember::__str__ (){ | 
| Greg Clayton | da7bc7d | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 369 | lldb::SBStream description; | 
|  | 370 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 371 | const char *desc = description.GetData(); | 
|  | 372 | size_t desc_len = description.GetSize(); | 
|  | 373 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 374 | --desc_len; | 
|  | 375 | if (desc_len > 0) | 
|  | 376 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 377 | else | 
|  | 378 | return PyString_FromString(""); | 
| Greg Clayton | da7bc7d | 2011-11-13 06:57:31 +0000 | [diff] [blame] | 379 | } | 
|  | 380 | } | 
| Enrico Granata | 061858c | 2012-02-15 02:34:21 +0000 | [diff] [blame] | 381 | %extend lldb::SBTypeNameSpecifier { | 
|  | 382 | PyObject *lldb::SBTypeNameSpecifier::__str__ (){ | 
|  | 383 | lldb::SBStream description; | 
|  | 384 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
|  | 385 | const char *desc = description.GetData(); | 
|  | 386 | size_t desc_len = description.GetSize(); | 
|  | 387 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 388 | --desc_len; | 
|  | 389 | if (desc_len > 0) | 
|  | 390 | return PyString_FromStringAndSize (desc, desc_len); | 
|  | 391 | else | 
|  | 392 | return PyString_FromString(""); | 
|  | 393 | } | 
|  | 394 | } | 
|  | 395 | %extend lldb::SBTypeSummary { | 
|  | 396 | PyObject *lldb::SBTypeSummary::__str__ (){ | 
|  | 397 | lldb::SBStream description; | 
|  | 398 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
|  | 399 | const char *desc = description.GetData(); | 
|  | 400 | size_t desc_len = description.GetSize(); | 
|  | 401 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 402 | --desc_len; | 
|  | 403 | if (desc_len > 0) | 
|  | 404 | return PyString_FromStringAndSize (desc, desc_len); | 
|  | 405 | else | 
|  | 406 | return PyString_FromString(""); | 
|  | 407 | } | 
|  | 408 | } | 
|  | 409 | %extend lldb::SBTypeSynthetic { | 
|  | 410 | PyObject *lldb::SBTypeSynthetic::__str__ (){ | 
|  | 411 | lldb::SBStream description; | 
|  | 412 | $self->GetDescription (description, lldb::eDescriptionLevelBrief); | 
|  | 413 | const char *desc = description.GetData(); | 
|  | 414 | size_t desc_len = description.GetSize(); | 
|  | 415 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 416 | --desc_len; | 
|  | 417 | if (desc_len > 0) | 
|  | 418 | return PyString_FromStringAndSize (desc, desc_len); | 
|  | 419 | else | 
|  | 420 | return PyString_FromString(""); | 
|  | 421 | } | 
|  | 422 | } | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 423 | %extend lldb::SBThread { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 424 | PyObject *lldb::SBThread::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 425 | lldb::SBStream description; | 
|  | 426 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 427 | const char *desc = description.GetData(); | 
|  | 428 | size_t desc_len = description.GetSize(); | 
|  | 429 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 430 | --desc_len; | 
|  | 431 | if (desc_len > 0) | 
|  | 432 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 433 | else | 
|  | 434 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 435 | } | 
|  | 436 | } | 
|  | 437 | %extend lldb::SBValue { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 438 | PyObject *lldb::SBValue::__str__ (){ | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 439 | lldb::SBStream description; | 
|  | 440 | $self->GetDescription (description); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 441 | const char *desc = description.GetData(); | 
|  | 442 | size_t desc_len = description.GetSize(); | 
|  | 443 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 444 | --desc_len; | 
|  | 445 | if (desc_len > 0) | 
|  | 446 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 447 | else | 
|  | 448 | return PyString_FromString(""); | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 449 | } | 
|  | 450 | } | 
| Greg Clayton | 7edbdfc | 2012-02-03 07:02:37 +0000 | [diff] [blame] | 451 | %extend lldb::SBValueList { | 
|  | 452 | PyObject *lldb::SBValueList::__repr__ (){ | 
|  | 453 | lldb::SBStream description; | 
|  | 454 | const size_t n = $self->GetSize(); | 
|  | 455 | if (n) | 
|  | 456 | { | 
|  | 457 | for (size_t i=0; i<n; ++i) | 
|  | 458 | $self->GetValueAtIndex(i).GetDescription(description); | 
|  | 459 | } | 
|  | 460 | else | 
|  | 461 | { | 
|  | 462 | description.Printf("<empty> lldb.SBValueList()"); | 
|  | 463 | } | 
|  | 464 | const char *desc = description.GetData(); | 
|  | 465 | size_t desc_len = description.GetSize(); | 
|  | 466 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 467 | --desc_len; | 
|  | 468 | if (desc_len > 0) | 
|  | 469 | return PyString_FromStringAndSize (desc, desc_len); | 
|  | 470 | return Py_None; | 
|  | 471 | } | 
|  | 472 | } | 
| Greg Clayton | 1b282f9 | 2011-10-13 18:08:26 +0000 | [diff] [blame] | 473 | %extend lldb::SBWatchpoint { | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 474 | PyObject *lldb::SBWatchpoint::__str__ (){ | 
| Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 475 | lldb::SBStream description; | 
|  | 476 | $self->GetDescription (description, lldb::eDescriptionLevelVerbose); | 
| Greg Clayton | 2415586 | 2012-02-01 02:30:27 +0000 | [diff] [blame] | 477 | const char *desc = description.GetData(); | 
|  | 478 | size_t desc_len = description.GetSize(); | 
|  | 479 | if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) | 
|  | 480 | --desc_len; | 
|  | 481 | if (desc_len > 0) | 
|  | 482 | return PyString_FromStringAndSize (desc, desc_len); | 
| Greg Clayton | 81e871e | 2012-02-04 02:27:34 +0000 | [diff] [blame] | 483 | else | 
|  | 484 | return PyString_FromString(""); | 
| Johnny Chen | d4dd799 | 2011-09-27 01:19:20 +0000 | [diff] [blame] | 485 | } | 
|  | 486 | } | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 487 |  | 
| Greg Clayton | 05e8d19 | 2012-02-01 01:46:19 +0000 | [diff] [blame] | 488 | %pythoncode %{ | 
|  | 489 |  | 
| Greg Clayton | 5569e64 | 2012-02-06 01:44:54 +0000 | [diff] [blame] | 490 | class declaration(object): | 
|  | 491 | '''A class that represents a source declaration location with file, line and column.''' | 
|  | 492 | def __init__(self, file, line, col): | 
|  | 493 | self.file = file | 
|  | 494 | self.line = line | 
|  | 495 | self.col = col | 
|  | 496 |  | 
| Greg Clayton | 05e8d19 | 2012-02-01 01:46:19 +0000 | [diff] [blame] | 497 | class value(object): | 
|  | 498 | '''A class designed to wrap lldb.SBValue() objects so the resulting object | 
|  | 499 | can be used as a variable would be in code. So if you have a Point structure | 
|  | 500 | variable in your code in the current frame named "pt", you can initialize an instance | 
|  | 501 | of this class with it: | 
|  | 502 |  | 
|  | 503 | pt = lldb.value(lldb.frame.FindVariable("pt")) | 
|  | 504 | print pt | 
|  | 505 | print pt.x | 
|  | 506 | print pt.y | 
|  | 507 |  | 
|  | 508 | pt = lldb.value(lldb.frame.FindVariable("rectangle_array")) | 
|  | 509 | print rectangle_array[12] | 
|  | 510 | print rectangle_array[5].origin.x''' | 
|  | 511 | def __init__(self, sbvalue): | 
|  | 512 | self.sbvalue = sbvalue | 
|  | 513 |  | 
|  | 514 | def __nonzero__(self): | 
|  | 515 | return self.sbvalue.__nonzero__() | 
|  | 516 |  | 
| Greg Clayton | 05e8d19 | 2012-02-01 01:46:19 +0000 | [diff] [blame] | 517 | def __str__(self): | 
|  | 518 | return self.sbvalue.__str__() | 
|  | 519 |  | 
|  | 520 | def __getitem__(self, key): | 
|  | 521 | # Allow array access if this value has children... | 
|  | 522 | if type(key) is int: | 
|  | 523 | return value(self.sbvalue.GetValueForExpressionPath("[%i]" % key)) | 
|  | 524 | raise TypeError | 
|  | 525 |  | 
|  | 526 | def __getattr__(self, name): | 
|  | 527 | child_sbvalue = self.sbvalue.GetChildMemberWithName (name) | 
|  | 528 | if child_sbvalue: | 
|  | 529 | return value(child_sbvalue) | 
|  | 530 | raise AttributeError | 
|  | 531 |  | 
|  | 532 | def __add__(self, other): | 
|  | 533 | return int(self) + int(other) | 
|  | 534 |  | 
|  | 535 | def __sub__(self, other): | 
|  | 536 | return int(self) - int(other) | 
|  | 537 |  | 
|  | 538 | def __mul__(self, other): | 
|  | 539 | return int(self) * int(other) | 
|  | 540 |  | 
|  | 541 | def __floordiv__(self, other): | 
|  | 542 | return int(self) // int(other) | 
|  | 543 |  | 
|  | 544 | def __mod__(self, other): | 
|  | 545 | return int(self) % int(other) | 
|  | 546 |  | 
|  | 547 | def __divmod__(self, other): | 
|  | 548 | return int(self) % int(other) | 
|  | 549 |  | 
|  | 550 | def __pow__(self, other): | 
|  | 551 | return int(self) ** int(other) | 
|  | 552 |  | 
|  | 553 | def __lshift__(self, other): | 
|  | 554 | return int(self) << int(other) | 
|  | 555 |  | 
|  | 556 | def __rshift__(self, other): | 
|  | 557 | return int(self) >> int(other) | 
|  | 558 |  | 
|  | 559 | def __and__(self, other): | 
|  | 560 | return int(self) & int(other) | 
|  | 561 |  | 
|  | 562 | def __xor__(self, other): | 
|  | 563 | return int(self) ^ int(other) | 
|  | 564 |  | 
|  | 565 | def __or__(self, other): | 
|  | 566 | return int(self) | int(other) | 
|  | 567 |  | 
|  | 568 | def __div__(self, other): | 
|  | 569 | return int(self) / int(other) | 
|  | 570 |  | 
|  | 571 | def __truediv__(self, other): | 
|  | 572 | return int(self) / int(other) | 
|  | 573 |  | 
|  | 574 | def __iadd__(self, other): | 
|  | 575 | result = self.__add__(other) | 
|  | 576 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 577 | return result | 
|  | 578 |  | 
|  | 579 | def __isub__(self, other): | 
|  | 580 | result = self.__sub__(other) | 
|  | 581 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 582 | return result | 
|  | 583 |  | 
|  | 584 | def __imul__(self, other): | 
|  | 585 | result = self.__mul__(other) | 
|  | 586 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 587 | return result | 
|  | 588 |  | 
|  | 589 | def __idiv__(self, other): | 
|  | 590 | result = self.__div__(other) | 
|  | 591 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 592 | return result | 
|  | 593 |  | 
|  | 594 | def __itruediv__(self, other): | 
|  | 595 | result = self.__truediv__(other) | 
|  | 596 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 597 | return result | 
|  | 598 |  | 
|  | 599 | def __ifloordiv__(self, other): | 
|  | 600 | result =  self.__floordiv__(self, other) | 
|  | 601 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 602 | return result | 
|  | 603 |  | 
|  | 604 | def __imod__(self, other): | 
|  | 605 | result =  self.__and__(self, other) | 
|  | 606 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 607 | return result | 
|  | 608 |  | 
|  | 609 | def __ipow__(self, other): | 
|  | 610 | result = self.__pow__(self, other) | 
|  | 611 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 612 | return result | 
|  | 613 |  | 
|  | 614 | def __ipow__(self, other, modulo): | 
|  | 615 | result = self.__pow__(self, other, modulo) | 
|  | 616 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 617 | return result | 
|  | 618 |  | 
|  | 619 | def __ilshift__(self, other): | 
|  | 620 | result = self.__lshift__(other) | 
|  | 621 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 622 | return result | 
|  | 623 |  | 
|  | 624 | def __irshift__(self, other): | 
|  | 625 | result =  self.__rshift__(other) | 
|  | 626 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 627 | return result | 
|  | 628 |  | 
|  | 629 | def __iand__(self, other): | 
|  | 630 | result =  self.__and__(self, other) | 
|  | 631 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 632 | return result | 
|  | 633 |  | 
|  | 634 | def __ixor__(self, other): | 
|  | 635 | result =  self.__xor__(self, other) | 
|  | 636 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 637 | return result | 
|  | 638 |  | 
|  | 639 | def __ior__(self, other): | 
|  | 640 | result =  self.__ior__(self, other) | 
|  | 641 | self.sbvalue.SetValueFromCString (str(result)) | 
|  | 642 | return result | 
|  | 643 |  | 
|  | 644 | def __neg__(self): | 
|  | 645 | return -int(self) | 
|  | 646 |  | 
|  | 647 | def __pos__(self): | 
|  | 648 | return +int(self) | 
|  | 649 |  | 
|  | 650 | def __abs__(self): | 
|  | 651 | return abs(int(self)) | 
|  | 652 |  | 
|  | 653 | def __invert__(self): | 
|  | 654 | return ~int(self) | 
|  | 655 |  | 
|  | 656 | def __complex__(self): | 
|  | 657 | return complex (int(self)) | 
|  | 658 |  | 
|  | 659 | def __int__(self): | 
|  | 660 | return self.sbvalue.GetValueAsSigned() | 
|  | 661 |  | 
|  | 662 | def __long__(self): | 
|  | 663 | return self.sbvalue.GetValueAsSigned() | 
|  | 664 |  | 
|  | 665 | def __float__(self): | 
|  | 666 | return float (self.sbvalue.GetValueAsSigned()) | 
|  | 667 |  | 
|  | 668 | def __oct__(self): | 
| Greg Clayton | 43484c5 | 2012-02-02 00:12:47 +0000 | [diff] [blame] | 669 | return '0%o' % self.sbvalue.GetValueAsUnsigned() | 
| Greg Clayton | 05e8d19 | 2012-02-01 01:46:19 +0000 | [diff] [blame] | 670 |  | 
|  | 671 | def __hex__(self): | 
| Greg Clayton | 43484c5 | 2012-02-02 00:12:47 +0000 | [diff] [blame] | 672 | return '0x%x' % self.sbvalue.GetValueAsUnsigned() | 
| Greg Clayton | 05e8d19 | 2012-02-01 01:46:19 +0000 | [diff] [blame] | 673 |  | 
| Greg Clayton | 43484c5 | 2012-02-02 00:12:47 +0000 | [diff] [blame] | 674 | def __eq__(self, other): | 
|  | 675 | return self.sbvalue.GetValueAsUnsigned() == self.sbvalue.GetValueAsUnsigned() | 
|  | 676 |  | 
|  | 677 | def __neq__(self, other): | 
|  | 678 | return not self.__eq__(other) | 
| Greg Clayton | 05e8d19 | 2012-02-01 01:46:19 +0000 | [diff] [blame] | 679 | %} | 
|  | 680 |  |