package mopsa

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Heap addresses of Python objects.

val debug : ('a, Stdlib.Format.formatter, unit, unit) Stdlib.format4 -> 'a

Addresses

type class_address =
  1. | C_builtin of string
  2. | C_unsupported of string
    (*

    unsupported class

    *)

Classes

type function_address =
  1. | F_builtin of string * string
  2. | F_unsupported of string
    (*

    unsupported function

    *)

Functions

type module_address =
  1. | M_user of string * Mopsa.var list
    (*

    globals

    *)
  2. | M_builtin of string
    (*

    name

    *)
type Mopsa.addr_kind +=
  1. | A_py_class of class_address * (Mopsa.addr * Mopsa.expr option) list
    (*

    mro

    *)
  2. | A_py_function of function_address
    (*

    function

    *)
  3. | A_py_method of Mopsa.addr * Mopsa.expr option * Mopsa.addr * Mopsa.expr option * string
  4. | A_py_module of module_address

These addresses refer only to static objects

Allocate an object on the heap and return its address as an evaluation

Built-ins

val classes : (string, Mopsa.addr * Mopsa.expr option) Stdlib.Hashtbl.t

Lists of built-ins

val functions : (string, Mopsa.addr * Mopsa.expr option) Stdlib.Hashtbl.t
val modules : (string, Mopsa.addr * Mopsa.expr option) Stdlib.Hashtbl.t
val type_aliases : (Mopsa.var, Mopsa.expr) Stdlib.Hashtbl.t
val typed_functions : (string, Mopsa.addr * Mopsa.expr option) Stdlib.Hashtbl.t
val mk_dot_name : string option -> string -> string

Name of a builtin with an optional dot notation in case of sub-objects (methods of classes, etc.)

val split_dot_name : string -> (string * string) option

Return the base and the attribute of a dot name

val addr_of_object : (Mopsa.addr * Mopsa.expr option) -> Mopsa.addr

Address of an object

val kind_of_object : (Mopsa.addr * Mopsa.expr option) -> Mopsa.addr_kind
val oobject_name : (Mopsa.addr * Mopsa.expr option) -> string option

Name of an object

val object_name : (Mopsa.addr * Mopsa.expr option) -> string
val add_type_alias : Mopsa.var -> Mopsa.expr -> unit
val find_type_alias_by_name : string -> Mopsa.expr
val add_builtin_class : (Mopsa.addr * Mopsa.expr option) -> unit -> unit
val print_classes : Stdlib.Format.formatter -> 'a -> unit
val print_functions : Stdlib.Format.formatter -> 'a -> unit
val add_builtin_function : (Mopsa.addr * Mopsa.expr option) -> unit -> unit
val add_typed : (Mopsa.addr * Mopsa.expr option) -> unit
val add_typed_overload : (Mopsa.addr * Mopsa.expr option) -> unit
val add_builtin_module : (Mopsa.addr * Mopsa.expr option) -> unit -> unit
val find_builtin : string -> Mopsa.addr * Mopsa.expr option

Search for the address of a builtin given its name

val find_builtin_function : string -> Mopsa.addr * Mopsa.expr option
val is_object_unsupported : (Mopsa.addr * Mopsa.expr option) -> bool
val is_builtin_name : string -> bool

Check whether a built-in exists given its name

val is_builtin_var : Mopsa.var -> bool
val is_builtin_module : string -> bool
val find_builtin_module : string -> Mopsa.addr * Mopsa.expr option
val is_builtin_attribute : (Mopsa.addr * Mopsa.expr option) -> string -> bool

Check whether an attribute of a built-in object exists, given its name

val find_builtin_attribute : (Mopsa.addr * Mopsa.expr option) -> string -> Mopsa.addr * Mopsa.expr option

Search for the address of a builtin attribute

val is_builtin_class_function : string -> string -> bool

Check whether a dot-named function f is a member of the class cls

Utility functions

val mk_py_z_interval : Z.t -> Z.t -> Mopsa_utils.Location.range -> Mopsa.expr
val mk_py_float_interval : float -> float -> Mopsa_utils.Location.range -> Mopsa.expr
val mk_py_issubclass_builtin_r : Mopsa.expr -> string -> Mopsa_utils.Location.range -> Mopsa.expr
val mk_py_issubclass_builtin_l : string -> Mopsa.expr -> Mopsa_utils.Location.range -> Mopsa.expr
val mk_py_issubclass_builtin2 : string -> string -> Mopsa_utils.Location.range -> Mopsa.expr
val mk_py_hasattr : Mopsa.expr -> string -> Mopsa_utils.Location.range -> Mopsa.expr
val mk_py_isinstance_builtin : Mopsa.expr -> string -> Mopsa_utils.Location.range -> Mopsa.expr
type py_c_function_kind =
  1. | Builtin_function_or_method
  2. | Wrapper_descriptor of string option
  3. | Method_descriptor
val str_of_py_c_function_kind : py_c_function_kind -> string
type Mopsa.addr_kind +=
  1. | A_py_c_module of string
    (*

    name

    *)
  2. | A_py_c_function of string * int * py_c_function_kind * int option * Mopsa.addr * Mopsa.expr option
    (*

    self

    *)
  3. | A_py_c_class of string
    (*

    name

    *)
exception C3_lin_failure
val c3_lin : (Mopsa.addr * Mopsa.expr option) -> (Mopsa.addr * Mopsa.expr option) list

Computes the c3 linearization of an object. This is Python's approach to deal with redundant parents in the inheritance

val merge : (Mopsa.addr * Mopsa.expr option) list list -> (Mopsa.addr * Mopsa.expr option) list
val search_c : (Mopsa.addr * Mopsa.expr option) list list -> (Mopsa.addr * Mopsa.expr option) option
val create_builtin_class : class_address -> 'a -> 'b -> (Mopsa.addr * Mopsa.expr option) list -> 'c -> unit
val builtin_cl_and_mro : string -> class_address * (Mopsa.addr * Mopsa.expr option) list
type Mopsa.addr_kind +=
  1. | A_py_instance of Mopsa.addr
val nominal_type_of_addr_kind : (Mopsa.addr_kind -> string) Stdlib.ref
val structural_type_of_addr_kind : (Mopsa.addr_kind -> string -> bool) Stdlib.ref
val register_addr_kind_nominal_type : ((Mopsa.addr_kind -> string) -> Mopsa.addr_kind -> string) -> unit
val register_addr_kind_structural_type : ((Mopsa.addr_kind -> string -> bool) -> Mopsa.addr_kind -> string -> bool) -> unit
val addr_kind_find_nominal_type : Mopsa.addr_kind -> string
val addr_kind_find_structural_type : Mopsa.addr_kind -> string -> bool
val mro : (Mopsa.addr * Mopsa.expr option) -> (Mopsa.addr * Mopsa.expr option) list
OCaml

Innovation. Community. Security.