~ubuntu-branches/ubuntu/maverick/vim/maverick

« back to all changes in this revision

Viewing changes to src/if_python.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-05-04 11:13:42 UTC
  • mfrom: (1.1.8 upstream) (0.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090504111342-60miqybsixdpc345
Tags: 2:7.2.148-2ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/runtime/vimrc: "syntax on" is a sane default for non-tiny vim.
  - runtime/syntax/debcontrol.vim:
    + Add "metapackages" to the list of valid sections.
  - runtime/syntax/grub.vim:
    + Add Ubuntu-specific 'quiet' keyword.
  - Drop vim-lesstif package and lesstif2-dev build-dependency.
  - Enable Python interpreter on basic builds.
  - Disable autoindent, line-wrapping, and backup files by default.
* Dropped changes, merged in Debian:
  - Add jaunty, karmic to the list of valid suites.
  - runtime/syntax/debsources.vim:
    + Add "jaunty" to debsourcesDistrKeyword
  - Create a .pot file for translations.
* Drop gutsy from the list of valid distro series, it's been EOLed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1151
1151
 
1152
1152
    /* Check if we run into a recursive loop.  The item must be in lookupDict
1153
1153
     * then and we can use it again. */
1154
 
    sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
1155
 
    result = PyDict_GetItemString(lookupDict, ptrBuf);
1156
 
    if (result != NULL)
1157
 
        Py_INCREF(result);
1158
 
    else if (our_tv->v_type == VAR_STRING)
 
1154
    if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
 
1155
            || (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
 
1156
    {
 
1157
        sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
 
1158
                our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
 
1159
                                           : (long_u)our_tv->vval.v_dict);
 
1160
        result = PyDict_GetItemString(lookupDict, ptrBuf);
 
1161
        if (result != NULL)
 
1162
        {
 
1163
            Py_INCREF(result);
 
1164
            return result;
 
1165
        }
 
1166
    }
 
1167
 
 
1168
    if (our_tv->v_type == VAR_STRING)
1159
1169
    {
1160
1170
        result = Py_BuildValue("s", our_tv->vval.v_string);
1161
 
        PyDict_SetItemString(lookupDict, ptrBuf, result);
1162
1171
    }
1163
1172
    else if (our_tv->v_type == VAR_NUMBER)
1164
1173
    {
1167
1176
        /* For backwards compatibility numbers are stored as strings. */
1168
1177
        sprintf(buf, "%ld", (long)our_tv->vval.v_number);
1169
1178
        result = Py_BuildValue("s", buf);
1170
 
        PyDict_SetItemString(lookupDict, ptrBuf, result);
1171
1179
    }
1172
1180
# ifdef FEAT_FLOAT
1173
1181
    else if (our_tv->v_type == VAR_FLOAT)
1176
1184
 
1177
1185
        sprintf(buf, "%f", our_tv->vval.v_float);
1178
1186
        result = Py_BuildValue("s", buf);
1179
 
        PyDict_SetItemString(lookupDict, ptrBuf, result);
1180
1187
    }
1181
1188
# endif
1182
1189
    else if (our_tv->v_type == VAR_LIST)
1185
1192
        listitem_T      *curr;
1186
1193
 
1187
1194
        result = PyList_New(0);
1188
 
        PyDict_SetItemString(lookupDict, ptrBuf, result);
1189
1195
 
1190
1196
        if (list != NULL)
1191
1197
        {
 
1198
            PyDict_SetItemString(lookupDict, ptrBuf, result);
 
1199
 
1192
1200
            for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
1193
1201
            {
1194
1202
                newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
1200
1208
    else if (our_tv->v_type == VAR_DICT)
1201
1209
    {
1202
1210
        result = PyDict_New();
1203
 
        PyDict_SetItemString(lookupDict, ptrBuf, result);
1204
1211
 
1205
1212
        if (our_tv->vval.v_dict != NULL)
1206
1213
        {
1209
1216
            hashitem_T  *hi;
1210
1217
            dictitem_T  *di;
1211
1218
 
 
1219
            PyDict_SetItemString(lookupDict, ptrBuf, result);
 
1220
 
1212
1221
            for (hi = ht->ht_array; todo > 0; ++hi)
1213
1222
            {
1214
1223
                if (!HASHITEM_EMPTY(hi))