PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/list.dylan

https://github.com/dylan-foundry/python-dylan
Unknown | 32 lines | 29 code | 3 blank | 0 comment | 0 complexity | 1b21096a19eca9f82f70c11ed063c816 MD5 | raw file
  1. module: python-dylan
  2. synopsis: Python types support.
  3. author: Bruce Mitchener, Jr.
  4. copyright: See LICENSE file in this distribution.
  5. define inline function py-list-check (value :: <py-object>)
  6. primitive-raw-as-boolean(
  7. %call-c-function("dylan_PyList_Check")
  8. (value :: <raw-py-object>) => (check? :: <raw-c-signed-int>)
  9. (as-raw-py-object(value))
  10. end
  11. )
  12. end;
  13. define inline function py-list-size (value :: <py-object>)
  14. //---*** Check for error!
  15. raw-as-integer(
  16. %call-c-function("PyList_Size")
  17. (value :: <raw-py-object>) => (result :: <raw-c-signed-int>)
  18. (as-raw-py-object(value))
  19. end)
  20. end;
  21. define inline function py-list-get-item (value :: <py-object>, index :: <integer>)
  22. //---*** Check for error!
  23. wrap-raw-py-object
  24. (%call-c-function("PyList_GetItem")
  25. (value :: <raw-py-object>, index :: <raw-c-signed-int>)
  26. => (result :: <raw-py-object>)
  27. (as-raw-py-object(value), integer-as-raw(index))
  28. end)
  29. end;