# Copyright (C) 2002-2008, The Perl Foundation.
# $Id: call_list.txt 25859 2008-02-19 00:49:11Z chromatic $

# Function signature declarations for Parrot Native Call Interface.
# The first alphanumeric is the type of the return value,
# the other alphanumerics denote the input parameter types.

# Types

# INT register stuff
# I - INTVAL
# c - char
# s - short
# i - int
# l - long

# NUM register stuff
# N - FLOATVAL
# f - float
# d - double

# STR register stuff
# S - pointer to a STRING-register
# t - character string (0-terminated)
# Buffers are not valid return parameters,
# use 'p' when the native function returns a pointer value
# b - void *
# B - void **

# PMC register stuff
# P - pointer to a PMC-register
# O - pointer to PMC-register (object)
# p - data pointer from PMC (on store into a new UnManagedStruct PMC)
# 2 - pointer to short
# 3 - pointer to int
# 4 - pointer to long

# void stuff
# v - void

# special stuff
# 0 - insert a NULL (pointer) - doesn't consume a register
# J - Parrot_Interp param
# @ - slurpy array

# Callback Things

# U - Single PMC parameter to pass into callback - user data

c             # t/pmc/nci.t
c    p
c    pi

d             # t/pmc/nci.t
d    d
d    JOd      # Parrot builtins
I    JOS
S    JOS      # ParrotIO.readline
I    JI       # Parrot_is_char_*
v    JOSP     # String.trans
v    JOS      # String.reverse
P    JOS      # Added for os.stat
I    JOI      # os.umask
P    JOPS     # Namespace.get_global
v    JOPSP    # Namespace.set_global

v    JPPP     # infix MMD
v    JPIP
v    JPSP
v    JPNP

v    JPP      # inplace infix MMD
v    JPI
v    JPS
v    JPN

P    JPPP     # infix MMD new
P    JPIP
P    JPSP
P    JPNP

I    JPP      # MMD compare

f             # t/pmc/nci.t
f    ff       # t/pmc/nci.t
f    is

i
i    b        # t/pmc/nci.t
i    d
i    i
i    ii
i    ii4
i    ii4i
i    iiii
i    iiilsp
i    iil
i    iili
i    iip
i    iit
i    iiti
i    ilsp
i    iti
i    l
i    li
i    lp
i    lsp
i    p
i    p33
i    p333
i    p333333
i    p4
i    p42p
i    p4i
i    pb
i    pi
i    pii
i    pii4
i    pii4i
i    piii
i    piiiiii
i    piiilsp
i    piil
i    piili
i    piit
i    piiti
i    pilsp
i    pit
i    pl
i    pli
i    pll
i    pllllllll
i    plp
i    plsp
i    pp
i    ppi
i    ppiiiiiiii
i    pppp
i    psp
i    pt
i    pti
i    pitl
i    s
i    s22
i    s222
i    sp
i    sss
i    ssss
i    t
i    ti
i    4
i    4i
i    42p

l             # t/pmc/nci.t
l    ii
l    l4
l    p
l    pi
l    pii
l    p33l
l    33l

P    JOP      # atan2
P    Ji       # Needed for parrot threads
P    JOl      # Parrot builtins
P    Jt

p
p    B
p    b
p    Jt
p    i
p    ii
p    iiii
p    iiiiii
p    iiiiiiii
p    p
p    pt
p    pi
p    pii
p    piiii
p    t
p    tpp
p    ttttttt

s             # t/pmc/nci.t

t             # t/pmc/nci.t
t    i
t    ii
t    p
t    pi
t    pii
t    pt
t    t
t    tl4
t    t4

v
v    Jiiip    # examples/japh/japh11.pasm
v    JOP      # Needed for parrot threads
v    i
v    ii
v    illllllll
v    l
v    p
v    pbip     # for libsyck
v    pi
v    piiii
v    pl
v    pp

# These are needed for parrotio.pmc
i    JP
v    JP
i    JPi
i    JPii
i    JPiii
i    JPt
P    JOSSS

# Needed by string.pmc
v    JOSS

# Py_func signatures
P    JP
P    JPP
P    JO
S    JO
i       P

# Needed by integer.pmc
S    JOI

# Used by t/pmc/nci.t
i    sc
s    sc
c    sc
i    iii
i    i3
t    b
t    B
v    P
v    pP
p    ip
i    33
v    pii
v    JO
i    JO
i    JOi
i    JOt
i    Jt
i    Ji

# Oddball ones for postgres
p    ptippppi    PQexecParams
p    pi33ipi     PQfn
p    pttip       PQprepage
p    ptipppi     PQexecPrepared
p    ppP         PQsetNoticeReceiver

# Used by library/pcre.pir
p    tiB3P
p    tip3P
i    pPtiiipi
i    tpiibi

# Used by SDL
p    iiil
i    ppl
v    pip
p    pti
i    ppp

# Used by SDL::Font
p    ti
p    ptp
i    pt33

# For python
i    JPP

#required for mod_parrot
i    ip
i    JPip
i    JpP
i    Jpii
i    p
i    tp
p    J
p    Jp
t    J
t    Jpti
t    p
t    pt
v    p
v    pit
v    ptt
v    Jtiiipt

# PyBuiltins
P    JOPP
P    JOPPP
v    JOPP
v    JOPPP
P    JOPPPP
P    JOPPPPP

# Added for Tcl
I    JOSI
P    JOSII

# libpast
p    Ji
p    Jipp
p    Jbip
v    Jp
v    JS

# crypt
t    tt

# Sub.__get_regs_used
I    JOt

# declare_lex_preg
v    JOSI

# Added for .NET => PIR translator dynamic PMCs.
S    JOi
v    JOi
I    JO
N    JO
v    JON
P    JOi
v    JOI

# Make lua stop panic'ing.
P    JOI
P    JOIS
S    JOSP

# ParrotThread creation
i    JOP@
I    JOP@
I    JOIP@

# other ParrotThread
P    JO

# src/pmc/nci.pmc
v    JOb

# --- start mysqlclient library ---
#
# Created from mysql.h using the following manual method:
#
# Edited copy of mysql.h using vi by doing g/, *$/j (repeat) then g/\* *$/j
# (repeat) to get all functions on one line each.
#
# Extracted list of api func names from
# http://dev.mysql.com/doc/refman/4.1/en/c-api-functions.html and copied to a
# temporary file to clean up (mysql_api_names.txt)
#
# Stripped down to bare names and merged into one line separated by |
# then egrep -w `cat mysql_api_names.txt` mysql.h > mysql_api.ncidef
# then edit mysql_api.ncidef in vi: %s/^/   #  /
# to create space for nci signatures and to use original definition as a #
# comment.
#
# This method isn't ideal, I'm just noting it here in case it helps others.
# Ideally the process should be automated - but there be many dragons along
# that path.
#
# NCI doesn't yet handle long long values (my_ulonglong), spec'd as long for now
#
#
#    MYSQL_FIELD and MYSQL_RES are structs
#    typedef char **MYSQL_ROW;           /* return data as array of strings */
#    typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */
#    typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;   /* offset to current row */
#
l    p    #! my_ulonglong mysql_num_rows(MYSQL_RES *res)
i    p    #  unsigned int mysql_num_fields(MYSQL_RES *res)
c    p    #  my_bool mysql_eof(MYSQL_RES *res)
p    pi   #  MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *res,
#               unsigned int fieldnr)
p    p    #  MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES *res)
p    p    #  MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES *res)
i    p    #  MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES *res)
i    p    #  unsigned int mysql_field_count(MYSQL *mysql)
l    p    #! my_ulonglong mysql_affected_rows(MYSQL *mysql)
l    p    #! my_ulonglong mysql_insert_id(MYSQL *mysql)
i    p    #  unsigned int mysql_errno(MYSQL *mysql)
t    p    #  const char * mysql_error(MYSQL *mysql)
t    p    #  const char * mysql_info(MYSQL *mysql)
l    p    #  unsigned long mysql_thread_id(MYSQL *mysql)
t    p    #  const char * mysql_character_set_name(MYSQL *mysql)
p    p    #  MYSQL * mysql_init(MYSQL *mysql)

i    pttttt      #  int mysql_ssl_set(MYSQL *mysql, const char *key,
#                        const char *cert, const char *ca, const char *capath,
#                        const char *cipher)
c    pttt        #  my_bool mysql_change_user(MYSQL *mysql, const char *user,
#                        const char *passwd, const char *db)
p    pttttiti    #  MYSQL * mysql_real_connect(MYSQL *mysql, const char *host,
#                               const char *user, const char *passwd,
#                               const char *db, unsigned int port,
#                               const char *unix_socket,
#                               unsigned int clientflag)
v    p     #  void mysql_close(MYSQL *sock)
i    pt    #  int mysql_select_db(MYSQL *mysql, const char *db)
i    pt    #  int mysql_query(MYSQL *mysql, const char *q)
i    ptl   #  int mysql_real_query(MYSQL *mysql, const char *q,
#                                  unsigned long length)
i    p     #  int mysql_shutdown(MYSQL *mysql)
i    p     #  int mysql_dump_debug_info(MYSQL *mysql)
i    pi    #  int mysql_refresh(MYSQL *mysql, unsigned int refresh_options)
i    pl    #  int mysql_kill(MYSQL *mysql,unsigned long pid)
i    p     #  int mysql_ping(MYSQL *mysql)
t    p     #  const char * mysql_stat(MYSQL *mysql)
t    p     #  const char * mysql_get_server_info(MYSQL *mysql)
t    p     #  const char * mysql_get_client_info(void)
l          #  unsigned long mysql_get_client_version(void)
t    p     #  const char * mysql_get_host_info(MYSQL *mysql)
t    p     #  unsigned int mysql_get_proto_info(MYSQL *mysql)
p    pt    #  MYSQL_RES * mysql_list_dbs(MYSQL *mysql,const char *wild)
p    pt    #  MYSQL_RES * mysql_list_tables(MYSQL *mysql,const char *wild)
p    ptt   #  MYSQL_RES * mysql_list_fields(MYSQL *mysql, const char *table,
#                                           const char *wild)
p    p     #  MYSQL_RES * mysql_list_processes(MYSQL *mysql)
p    p     #  MYSQL_RES * mysql_store_result(MYSQL *mysql)
p    p     #  MYSQL_RES * mysql_use_result(MYSQL *mysql)
i    pit   #  int mysql_options(MYSQL *mysql,enum mysql_option option,
#                               const char *arg)
v    p     #  void mysql_free_result(MYSQL_RES *result)
v    pl    #  void mysql_data_seek(MYSQL_RES *result, my_ulonglong offset)
p    pp    #  MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES *result,
#                                             MYSQL_ROW_OFFSET offset)
i    pi    #  MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result,
#                                                 MYSQL_FIELD_OFFSET offset)

p    p     #  MYSQL_ROW mysql_fetch_row(MYSQL_RES *result)
l    p     #  unsigned long * mysql_fetch_lengths(MYSQL_RES *result)
p    p     #  MYSQL_FIELD * mysql_fetch_field(MYSQL_RES *result)
l    ttl   #  unsigned long mysql_escape_string(char *to,const char *from, unsigned long from_length)
l    pttl  #  unsigned long mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, unsigned long length)
v    t     #  void mysql_debug(const char *debug)
# --- end mysqlclient library ---

i          # void function returning int like fork()
i    i3i   # POSIX's waitpid
i    ibi   # POSIX's read

# win32
l     lttl

i     pip
i     piS
S     i
