github.com/goplus/llgo@v0.8.3/py/list.go (about)

     1  /*
     2   * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  package py
    18  
    19  import (
    20  	_ "unsafe"
    21  
    22  	"github.com/goplus/llgo/c"
    23  )
    24  
    25  // https://docs.python.org/3/c-api/list.html
    26  
    27  //go:linkname List llgo.pyList
    28  func List(__llgo_va_list ...any) *Object
    29  
    30  // Return a new list of length len on success, or nil on failure.
    31  //
    32  //go:linkname NewList C.PyList_New
    33  func NewList(len uintptr) *Object
    34  
    35  // Return the length of the list object in list; this is equivalent to len(list)
    36  // on a list object.
    37  //
    38  // llgo:link (*Object).ListLen C.PyList_Size
    39  func (l *Object) ListLen() uintptr { return 0 }
    40  
    41  // Return the object at position index in the list pointed to by list. The position
    42  // must be non-negative; indexing from the end of the list is not supported. If index
    43  // is out of bounds (<0 or >=len(list)), return nil and set an IndexError exception.
    44  //
    45  // llgo:link (*Object).ListItem C.PyList_GetItem
    46  func (l *Object) ListItem(index uintptr) *Object { return nil }
    47  
    48  // Set the item at index index in list to item. Return 0 on success. If index is out
    49  // of bounds, return -1 and set an IndexError exception.
    50  //
    51  // llgo:link (*Object).ListSetItem C.PyList_SetItem
    52  func (l *Object) ListSetItem(index uintptr, item *Object) c.Int { return 0 }
    53  
    54  // Insert the item item into list list in front of index index. Return 0 if successful;
    55  // return -1 and set an exception if unsuccessful. Analogous to list.insert(index, item).
    56  //
    57  // llgo:link (*Object).ListInsert C.PyList_Insert
    58  func (l *Object) ListInsert(index uintptr, item *Object) c.Int { return 0 }
    59  
    60  // Append the object item at the end of list list. Return 0 if successful; return -1
    61  // and set an exception if unsuccessful. Analogous to list.append(item).
    62  //
    63  // llgo:link (*Object).ListAppend C.PyList_Append
    64  func (l *Object) ListAppend(item *Object) c.Int { return 0 }
    65  
    66  // Return a list of the objects in list containing the objects between low and high.
    67  // Return nil and set an exception if unsuccessful. Analogous to list[low:high].
    68  // Indexing from the end of the list is not supported.
    69  //
    70  // llgo:link (*Object).ListSlice C.PyList_GetSlice
    71  func (l *Object) ListSlice(low, high uintptr) *Object { return nil }
    72  
    73  // Set the slice of list between low and high to the contents of itemlist. Analogous
    74  // to list[low:high] = itemlist. The itemlist may be NULL, indicating the assignment
    75  // of an empty list (slice deletion). Return 0 on success, -1 on failure. Indexing
    76  // from the end of the list is not supported.
    77  //
    78  // llgo:link (*Object).ListSetSlice C.PyList_SetSlice
    79  func (l *Object) ListSetSlice(low, high uintptr, itemlist *Object) c.Int { return 0 }
    80  
    81  // Sort the items of list in place. Return 0 on success, -1 on failure. This is equivalent
    82  // to list.sort().
    83  //
    84  // llgo:link (*Object).ListSort C.PyList_Sort
    85  func (l *Object) ListSort() c.Int { return 0 }
    86  
    87  // Reverse the items of list in place. Return 0 on success, -1 on failure. This is the
    88  // equivalent of list.reverse().
    89  //
    90  // llgo:link (*Object).ListReverse C.PyList_Reverse
    91  func (l *Object) ListReverse() c.Int { return 0 }
    92  
    93  // Return a new tuple object containing the contents of list; equivalent to tuple(list).
    94  //
    95  // llgo:link (*Object).ListAsTuple C.PyList_AsTuple
    96  func (l *Object) ListAsTuple() *Object { return nil }