mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-19 15:31:28 +00:00
Removed lua, python, tcl, cairo
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
import cairo
|
||||
|
||||
var surface = image_surface_create(FORMAT_ARGB32, 240, 80)
|
||||
var cr = create(surface)
|
||||
|
||||
select_font_face(cr, "serif", FONT_SLANT_NORMAL,
|
||||
FONT_WEIGHT_BOLD)
|
||||
set_font_size(cr, 32.0)
|
||||
set_source_rgb(cr, 0.0, 0.0, 1.0)
|
||||
move_to(cr, 10.0, 50.0)
|
||||
show_text(cr, "Hello, world")
|
||||
destroy(cr)
|
||||
discard write_to_png(surface, "hello.png")
|
||||
destroy(surface)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# Embedds Lua into a Nimrod application
|
||||
|
||||
import
|
||||
lua, lualib, lauxlib
|
||||
|
||||
const
|
||||
code = """
|
||||
print 'hi'
|
||||
"""
|
||||
|
||||
var L = newstate()
|
||||
openlibs(L)
|
||||
discard loadbuffer(L, code, code.len, "line")
|
||||
discard pcall(L, 0, 0, 0)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# Example to embed Python into your application
|
||||
|
||||
import python
|
||||
|
||||
# IMPORTANT: Python on Windows does not like CR characters, so
|
||||
# we use only \L here.
|
||||
|
||||
Py_Initialize()
|
||||
discard PyRun_SimpleString("from time import time,ctime\L" &
|
||||
"print 'Today is',ctime(time())\L")
|
||||
Py_Finalize()
|
||||
@@ -1,25 +0,0 @@
|
||||
# Example to embed TCL in Nimrod
|
||||
|
||||
import tcl, os
|
||||
|
||||
const
|
||||
myScript = """puts "Hello, World - In quotes" """
|
||||
myScript2 = """
|
||||
package require Tk
|
||||
pack [entry .e -textvar e -width 50]
|
||||
bind .e <Return> {
|
||||
set e [regsub { *=.*} $e ""] ;# remove evaluation (Chris)
|
||||
catch {expr [string map {/ *1./} $e]} res
|
||||
append e " = $res"
|
||||
}
|
||||
"""
|
||||
|
||||
FindExecutable(getAppFilename())
|
||||
var interp = CreateInterp()
|
||||
if interp == nil: quit("cannot create TCL interpreter")
|
||||
if Init(interp) != TCL_OK:
|
||||
quit("cannot init interpreter")
|
||||
if tcl.Eval(interp, myScript) != TCL_OK:
|
||||
quit("cannot execute script.tcl")
|
||||
|
||||
|
||||
@@ -1,733 +0,0 @@
|
||||
#* cairo - a vector graphics library with display and print output
|
||||
# *
|
||||
# * Copyright <20> 2002 University of Southern California
|
||||
# * Copyright <20> 2005 Red Hat, Inc.
|
||||
# *
|
||||
# * This library is free software; you can redistribute it and/or
|
||||
# * modify it either under the terms of the GNU Lesser General Public
|
||||
# * License version 2.1 as published by the Free Software Foundation
|
||||
# * (the "LGPL") or, at your option, under the terms of the Mozilla
|
||||
# * Public License Version 1.1 (the "MPL"). If you do not alter this
|
||||
# * notice, a recipient may use your version of this file under either
|
||||
# * the MPL or the LGPL.
|
||||
# *
|
||||
# * You should have received a copy of the LGPL along with this library
|
||||
# * in the file COPYING-LGPL-2.1; if not, write to the Free Software
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
# * You should have received a copy of the MPL along with this library
|
||||
# * in the file COPYING-MPL-1.1
|
||||
# *
|
||||
# * The contents of this file are subject to the Mozilla Public License
|
||||
# * Version 1.1 (the "License"); you may not use this file except in
|
||||
# * compliance with the License. You may obtain a copy of the License at
|
||||
# * http://www.mozilla.org/MPL/
|
||||
# *
|
||||
# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
|
||||
# * OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
# * the specific language governing rights and limitations.
|
||||
# *
|
||||
# * The Original Code is the cairo graphics library.
|
||||
# *
|
||||
# * The Initial Developer of the Original Code is University of Southern
|
||||
# * California.
|
||||
# *
|
||||
# * Contributor(s):
|
||||
# * Carl D. Worth <cworth@cworth.org>
|
||||
# #*
|
||||
# * This FreePascal binding generated August 26, 2005
|
||||
# * by Jeffrey Pohlmeyer <yetanothergeek@yahoo.com>
|
||||
#
|
||||
|
||||
#
|
||||
# - Updated to cairo version 1.4
|
||||
# - Grouped OS specific fuctions in separated units
|
||||
# - Organized the functions by group and ordered exactly as the c header
|
||||
# - Cleared parameter list syntax according to pascal standard
|
||||
#
|
||||
# By Luiz Am<41>rico Pereira C<>mara
|
||||
# October 2007
|
||||
#
|
||||
|
||||
include "cairo_pragma.nim"
|
||||
|
||||
type
|
||||
PByte = cstring
|
||||
TStatus* = enum
|
||||
STATUS_SUCCESS = 0,
|
||||
STATUS_NO_MEMORY,
|
||||
STATUS_INVALID_RESTORE,
|
||||
STATUS_INVALID_POP_GROUP,
|
||||
STATUS_NO_CURRENT_POINT,
|
||||
STATUS_INVALID_MATRIX,
|
||||
STATUS_INVALID_STATUS,
|
||||
STATUS_NULL_POINTER,
|
||||
STATUS_INVALID_STRING,
|
||||
STATUS_INVALID_PATH_DATA,
|
||||
STATUS_READ_ERROR,
|
||||
STATUS_WRITE_ERROR,
|
||||
STATUS_SURFACE_FINISHED,
|
||||
STATUS_SURFACE_TYPE_MISMATCH,
|
||||
STATUS_PATTERN_TYPE_MISMATCH,
|
||||
STATUS_INVALID_CONTENT,
|
||||
STATUS_INVALID_FORMAT,
|
||||
STATUS_INVALID_VISUAL,
|
||||
STATUS_FILE_NOT_FOUND,
|
||||
STATUS_INVALID_DASH,
|
||||
STATUS_INVALID_DSC_COMMENT,
|
||||
STATUS_INVALID_INDEX,
|
||||
STATUS_CLIP_NOT_REPRESENTABLE,
|
||||
STATUS_TEMP_FILE_ERROR,
|
||||
STATUS_INVALID_STRIDE,
|
||||
STATUS_FONT_TYPE_MISMATCH,
|
||||
STATUS_USER_FONT_IMMUTABLE,
|
||||
STATUS_USER_FONT_ERROR,
|
||||
STATUS_NEGATIVE_COUNT,
|
||||
STATUS_INVALID_CLUSTERS,
|
||||
STATUS_INVALID_SLANT,
|
||||
STATUS_INVALID_WEIGHT
|
||||
|
||||
|
||||
TOperator* = enum
|
||||
OPERATOR_CLEAR, OPERATOR_SOURCE, OPERATOR_OVER, OPERATOR_IN, OPERATOR_OUT,
|
||||
OPERATOR_ATOP, OPERATOR_DEST, OPERATOR_DEST_OVER, OPERATOR_DEST_IN,
|
||||
OPERATOR_DEST_OUT, OPERATOR_DEST_ATOP, OPERATOR_XOR, OPERATOR_ADD,
|
||||
OPERATOR_SATURATE
|
||||
TAntialias* = enum
|
||||
ANTIALIAS_DEFAULT, ANTIALIAS_NONE, ANTIALIAS_GRAY, ANTIALIAS_SUBPIXEL
|
||||
TFillRule* = enum
|
||||
FILL_RULE_WINDING, FILL_RULE_EVEN_ODD
|
||||
TLineCap* = enum
|
||||
LINE_CAP_BUTT, LINE_CAP_ROUND, LINE_CAP_SQUARE
|
||||
TLineJoin* = enum
|
||||
LINE_JOIN_MITER, LINE_JOIN_ROUND, LINE_JOIN_BEVEL
|
||||
TFontSlant* = enum
|
||||
FONT_SLANT_NORMAL, FONT_SLANT_ITALIC, FONT_SLANT_OBLIQUE
|
||||
TFontWeight* = enum
|
||||
FONT_WEIGHT_NORMAL, FONT_WEIGHT_BOLD
|
||||
TSubpixelOrder* = enum
|
||||
SUBPIXEL_ORDER_DEFAULT, SUBPIXEL_ORDER_RGB, SUBPIXEL_ORDER_BGR,
|
||||
SUBPIXEL_ORDER_VRGB, SUBPIXEL_ORDER_VBGR
|
||||
THintStyle* = enum
|
||||
HINT_STYLE_DEFAULT, HINT_STYLE_NONE, HINT_STYLE_SLIGHT, HINT_STYLE_MEDIUM,
|
||||
HINT_STYLE_FULL
|
||||
THintMetrics* = enum
|
||||
HINT_METRICS_DEFAULT, HINT_METRICS_OFF, HINT_METRICS_ON
|
||||
TPathDataType* = enum
|
||||
PATH_MOVE_TO, PATH_LINE_TO, PATH_CURVE_TO, PATH_CLOSE_PATH
|
||||
TContent* = enum
|
||||
CONTENT_COLOR = 0x00001000, CONTENT_ALPHA = 0x00002000,
|
||||
CONTENT_COLOR_ALPHA = 0x00003000
|
||||
TFormat* = enum
|
||||
FORMAT_ARGB32, FORMAT_RGB24, FORMAT_A8, FORMAT_A1
|
||||
TExtend* = enum
|
||||
EXTEND_NONE, EXTEND_REPEAT, EXTEND_REFLECT, EXTEND_PAD
|
||||
TFilter* = enum
|
||||
FILTER_FAST, FILTER_GOOD, FILTER_BEST, FILTER_NEAREST, FILTER_BILINEAR,
|
||||
FILTER_GAUSSIAN
|
||||
TFontType* = enum
|
||||
FONT_TYPE_TOY, FONT_TYPE_FT, FONT_TYPE_WIN32, FONT_TYPE_ATSUI
|
||||
TPatternType* = enum
|
||||
PATTERN_TYPE_SOLID, PATTERN_TYPE_SURFACE, PATTERN_TYPE_LINEAR,
|
||||
PATTERN_TYPE_RADIAL
|
||||
TSurfaceType* = enum
|
||||
SURFACE_TYPE_IMAGE, SURFACE_TYPE_PDF, SURFACE_TYPE_PS, SURFACE_TYPE_XLIB,
|
||||
SURFACE_TYPE_XCB, SURFACE_TYPE_GLITZ, SURFACE_TYPE_QUARTZ,
|
||||
SURFACE_TYPE_WIN32, SURFACE_TYPE_BEOS, SURFACE_TYPE_DIRECTFB,
|
||||
SURFACE_TYPE_SVG, SURFACE_TYPE_OS2
|
||||
TSvgVersion* = enum
|
||||
SVG_VERSION_1_1, SVG_VERSION_1_2
|
||||
PSurface* = ptr TSurface
|
||||
PPSurface* = ptr PSurface
|
||||
PContext* = ptr TContext
|
||||
PPattern* = ptr TPattern
|
||||
PFontOptions* = ptr TFontOptions
|
||||
PFontFace* = ptr TFontFace
|
||||
PScaledFont* = ptr TScaledFont
|
||||
PBool* = ptr TBool
|
||||
TBool* = int32
|
||||
PMatrix* = ptr TMatrix
|
||||
PUserDataKey* = ptr TUserDataKey
|
||||
PGlyph* = ptr TGlyph
|
||||
PTextExtents* = ptr TTextExtents
|
||||
PFontExtents* = ptr TFontExtents
|
||||
PPathDataType* = ptr TPathDataType
|
||||
PPathData* = ptr TPathData
|
||||
PPath* = ptr TPath
|
||||
PRectangle* = ptr TRectangle
|
||||
PRectangleList* = ptr TRectangleList
|
||||
TDestroyFunc* = proc (data: Pointer){.cdecl.}
|
||||
TWriteFunc* = proc (closure: Pointer, data: PByte, len: int32): TStatus{.cdecl.}
|
||||
TReadFunc* = proc (closure: Pointer, data: PByte, len: int32): TStatus{.cdecl.}
|
||||
TContext*{.final.} = object #OPAQUE
|
||||
TSurface*{.final.} = object #OPAQUE
|
||||
TPattern*{.final.} = object #OPAQUE
|
||||
TScaledFont*{.final.} = object #OPAQUE
|
||||
TFontFace*{.final.} = object #OPAQUE
|
||||
TFontOptions*{.final.} = object #OPAQUE
|
||||
TMatrix*{.final.} = object
|
||||
xx: float64
|
||||
yx: float64
|
||||
xy: float64
|
||||
yy: float64
|
||||
x0: float64
|
||||
y0: float64
|
||||
|
||||
TUserDataKey*{.final.} = object
|
||||
unused: int32
|
||||
|
||||
TGlyph*{.final.} = object
|
||||
index: int32
|
||||
x: float64
|
||||
y: float64
|
||||
|
||||
TTextExtents*{.final.} = object
|
||||
x_bearing: float64
|
||||
y_bearing: float64
|
||||
width: float64
|
||||
height: float64
|
||||
x_advance: float64
|
||||
y_advance: float64
|
||||
|
||||
TFontExtents*{.final.} = object
|
||||
ascent: float64
|
||||
descent: float64
|
||||
height: float64
|
||||
max_x_advance: float64
|
||||
max_y_advance: float64
|
||||
|
||||
TPathData*{.final.} = object #* _type : TCairoPathDataType;
|
||||
# length : LongInt;
|
||||
# end
|
||||
x: float64
|
||||
y: float64
|
||||
|
||||
TPath*{.final.} = object
|
||||
status: TStatus
|
||||
data: PPathData
|
||||
num_data: int32
|
||||
|
||||
TRectangle*{.final.} = object
|
||||
x, y, width, height: float64
|
||||
|
||||
TRectangleList*{.final.} = object
|
||||
status: TStatus
|
||||
rectangles: PRectangle
|
||||
num_rectangles: int32
|
||||
|
||||
|
||||
proc version*(): int32{.cdecl, importc: "cairo_version", libcairo.}
|
||||
proc version_string*(): cstring{.cdecl, importc: "cairo_version_string",
|
||||
libcairo.}
|
||||
#Helper function to retrieve decoded version
|
||||
proc version*(major, minor, micro: var int32)
|
||||
#* Functions for manipulating state objects
|
||||
proc create*(target: PSurface): PContext{.cdecl, importc: "cairo_create",
|
||||
libcairo.}
|
||||
proc reference*(cr: PContext): PContext{.cdecl, importc: "cairo_reference", libcairo.}
|
||||
proc destroy*(cr: PContext){.cdecl, importc: "cairo_destroy", libcairo.}
|
||||
proc get_reference_count*(cr: PContext): int32{.cdecl,
|
||||
importc: "cairo_get_reference_count", libcairo.}
|
||||
proc get_user_data*(cr: PContext, key: PUserDataKey): pointer{.cdecl,
|
||||
importc: "cairo_get_user_data", libcairo.}
|
||||
proc set_user_data*(cr: PContext, key: PUserDataKey, user_data: Pointer,
|
||||
destroy: TDestroyFunc): TStatus{.cdecl,
|
||||
importc: "cairo_set_user_data", libcairo.}
|
||||
proc save*(cr: PContext){.cdecl, importc: "cairo_save", libcairo.}
|
||||
proc restore*(cr: PContext){.cdecl, importc: "cairo_restore", libcairo.}
|
||||
proc push_group*(cr: PContext){.cdecl, importc: "cairo_push_group", libcairo.}
|
||||
proc push_group_with_content*(cr: PContext, content: TContent){.cdecl,
|
||||
importc: "cairo_push_group_with_content", libcairo.}
|
||||
proc pop_group*(cr: PContext): PPattern{.cdecl, importc: "cairo_pop_group",
|
||||
libcairo.}
|
||||
proc pop_group_to_source*(cr: PContext){.cdecl, importc: "cairo_pop_group_to_source",
|
||||
libcairo.}
|
||||
#* Modify state
|
||||
proc set_operator*(cr: PContext, op: TOperator){.cdecl, importc: "cairo_set_operator",
|
||||
libcairo.}
|
||||
proc set_source*(cr: PContext, source: PPattern){.cdecl, importc: "cairo_set_source",
|
||||
libcairo.}
|
||||
proc set_source_rgb*(cr: PContext, red, green, blue: float64){.cdecl,
|
||||
importc: "cairo_set_source_rgb", libcairo.}
|
||||
proc set_source_rgba*(cr: PContext, red, green, blue, alpha: float64){.cdecl,
|
||||
importc: "cairo_set_source_rgba", libcairo.}
|
||||
proc set_source*(cr: PContext, surface: PSurface, x, y: float64){.cdecl,
|
||||
importc: "cairo_set_source_surface", libcairo.}
|
||||
proc set_tolerance*(cr: PContext, tolerance: float64){.cdecl,
|
||||
importc: "cairo_set_tolerance", libcairo.}
|
||||
proc set_antialias*(cr: PContext, antialias: TAntialias){.cdecl,
|
||||
importc: "cairo_set_antialias", libcairo.}
|
||||
proc set_fill_rule*(cr: PContext, fill_rule: TFillRule){.cdecl,
|
||||
importc: "cairo_set_fill_rule", libcairo.}
|
||||
proc set_line_width*(cr: PContext, width: float64){.cdecl,
|
||||
importc: "cairo_set_line_width", libcairo.}
|
||||
proc set_line_cap*(cr: PContext, line_cap: TLineCap){.cdecl,
|
||||
importc: "cairo_set_line_cap", libcairo.}
|
||||
proc set_line_join*(cr: PContext, line_join: TLineJoin){.cdecl,
|
||||
importc: "cairo_set_line_join", libcairo.}
|
||||
proc set_dash*(cr: PContext, dashes: openarray[float64], offset: float64){.cdecl,
|
||||
importc: "cairo_set_dash", libcairo.}
|
||||
proc set_miter_limit*(cr: PContext, limit: float64){.cdecl,
|
||||
importc: "cairo_set_miter_limit", libcairo.}
|
||||
proc translate*(cr: PContext, tx, ty: float64){.cdecl, importc: "cairo_translate",
|
||||
libcairo.}
|
||||
proc scale*(cr: PContext, sx, sy: float64){.cdecl, importc: "cairo_scale",
|
||||
libcairo.}
|
||||
proc rotate*(cr: PContext, angle: float64){.cdecl, importc: "cairo_rotate",
|
||||
libcairo.}
|
||||
proc transform*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_transform",
|
||||
libcairo.}
|
||||
proc set_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_set_matrix",
|
||||
libcairo.}
|
||||
proc identity_matrix*(cr: PContext){.cdecl, importc: "cairo_identity_matrix",
|
||||
libcairo.}
|
||||
proc user_to_device*(cr: PContext, x, y: var float64){.cdecl,
|
||||
importc: "cairo_user_to_device", libcairo.}
|
||||
proc user_to_device_distance*(cr: PContext, dx, dy: var float64){.cdecl,
|
||||
importc: "cairo_user_to_device_distance", libcairo.}
|
||||
proc device_to_user*(cr: PContext, x, y: var float64){.cdecl,
|
||||
importc: "cairo_device_to_user", libcairo.}
|
||||
proc device_to_user_distance*(cr: PContext, dx, dy: var float64){.cdecl,
|
||||
importc: "cairo_device_to_user_distance", libcairo.}
|
||||
#* Path creation functions
|
||||
proc new_path*(cr: PContext){.cdecl, importc: "cairo_new_path", libcairo.}
|
||||
proc move_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_move_to",
|
||||
libcairo.}
|
||||
proc new_sub_path*(cr: PContext){.cdecl, importc: "cairo_new_sub_path",
|
||||
libcairo.}
|
||||
proc line_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_line_to",
|
||||
libcairo.}
|
||||
proc curve_to*(cr: PContext, x1, y1, x2, y2, x3, y3: float64){.cdecl,
|
||||
importc: "cairo_curve_to", libcairo.}
|
||||
proc arc*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl,
|
||||
importc: "cairo_arc", libcairo.}
|
||||
proc arc_negative*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl,
|
||||
importc: "cairo_arc_negative", libcairo.}
|
||||
proc rel_move_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_move_to",
|
||||
libcairo.}
|
||||
proc rel_line_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_line_to",
|
||||
libcairo.}
|
||||
proc rel_curve_to*(cr: PContext, dx1, dy1, dx2, dy2, dx3, dy3: float64){.cdecl,
|
||||
importc: "cairo_rel_curve_to", libcairo.}
|
||||
proc rectangle*(cr: PContext, x, y, width, height: float64){.cdecl,
|
||||
importc: "cairo_rectangle", libcairo.}
|
||||
proc close_path*(cr: PContext){.cdecl, importc: "cairo_close_path", libcairo.}
|
||||
#* Painting functions
|
||||
proc paint*(cr: PContext){.cdecl, importc: "cairo_paint", libcairo.}
|
||||
proc paint_with_alpha*(cr: PContext, alpha: float64){.cdecl,
|
||||
importc: "cairo_paint_with_alpha", libcairo.}
|
||||
proc mask*(cr: PContext, pattern: PPattern){.cdecl, importc: "cairo_mask",
|
||||
libcairo.}
|
||||
proc mask*(cr: PContext, surface: PSurface, surface_x, surface_y: float64){.
|
||||
cdecl, importc: "cairo_mask_surface", libcairo.}
|
||||
proc stroke*(cr: PContext){.cdecl, importc: "cairo_stroke", libcairo.}
|
||||
proc stroke_preserve*(cr: PContext){.cdecl, importc: "cairo_stroke_preserve",
|
||||
libcairo.}
|
||||
proc fill*(cr: PContext){.cdecl, importc: "cairo_fill", libcairo.}
|
||||
proc fill_preserve*(cr: PContext){.cdecl, importc: "cairo_fill_preserve",
|
||||
libcairo.}
|
||||
proc copy_page*(cr: PContext){.cdecl, importc: "cairo_copy_page", libcairo.}
|
||||
proc show_page*(cr: PContext){.cdecl, importc: "cairo_show_page", libcairo.}
|
||||
#* Insideness testing
|
||||
proc in_stroke*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_stroke",
|
||||
libcairo.}
|
||||
proc in_fill*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_fill",
|
||||
libcairo.}
|
||||
#* Rectangular extents
|
||||
proc stroke_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
||||
importc: "cairo_stroke_extents", libcairo.}
|
||||
proc fill_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
||||
importc: "cairo_fill_extents", libcairo.}
|
||||
#* Clipping
|
||||
proc reset_clip*(cr: PContext){.cdecl, importc: "cairo_reset_clip", libcairo.}
|
||||
proc clip*(cr: PContext){.cdecl, importc: "cairo_clip", libcairo.}
|
||||
proc clip_preserve*(cr: PContext){.cdecl, importc: "cairo_clip_preserve",
|
||||
libcairo.}
|
||||
proc clip_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
||||
importc: "cairo_clip_extents", libcairo.}
|
||||
proc copy_clip_rectangle_list*(cr: PContext): PRectangleList{.cdecl,
|
||||
importc: "cairo_copy_clip_rectangle_list", libcairo.}
|
||||
proc rectangle_list_destroy*(rectangle_list: PRectangleList){.cdecl,
|
||||
importc: "cairo_rectangle_list_destroy", libcairo.}
|
||||
#* Font/Text functions
|
||||
proc font_options_create*(): PFontOptions{.cdecl,
|
||||
importc: "cairo_font_options_create", libcairo.}
|
||||
proc copy*(original: PFontOptions): PFontOptions{.cdecl,
|
||||
importc: "cairo_font_options_copy", libcairo.}
|
||||
proc destroy*(options: PFontOptions){.cdecl,
|
||||
importc: "cairo_font_options_destroy", libcairo.}
|
||||
proc status*(options: PFontOptions): TStatus{.cdecl,
|
||||
importc: "cairo_font_options_status", libcairo.}
|
||||
proc merge*(options, other: PFontOptions){.cdecl,
|
||||
importc: "cairo_font_options_merge", libcairo.}
|
||||
proc equal*(options, other: PFontOptions): TBool{.cdecl,
|
||||
importc: "cairo_font_options_equal", libcairo.}
|
||||
proc hash*(options: PFontOptions): int32{.cdecl,
|
||||
importc: "cairo_font_options_hash", libcairo.}
|
||||
proc set_antialias*(options: PFontOptions, antialias: TAntialias){.
|
||||
cdecl, importc: "cairo_font_options_set_antialias", libcairo.}
|
||||
proc get_antialias*(options: PFontOptions): TAntialias{.cdecl,
|
||||
importc: "cairo_font_options_get_antialias", libcairo.}
|
||||
proc set_subpixel_order*(options: PFontOptions,
|
||||
subpixel_order: TSubpixelOrder){.cdecl,
|
||||
importc: "cairo_font_options_set_subpixel_order", libcairo.}
|
||||
proc get_subpixel_order*(options: PFontOptions): TSubpixelOrder{.
|
||||
cdecl, importc: "cairo_font_options_get_subpixel_order", libcairo.}
|
||||
proc set_hint_style*(options: PFontOptions, hint_style: THintStyle){.
|
||||
cdecl, importc: "cairo_font_options_set_hint_style", libcairo.}
|
||||
proc get_hint_style*(options: PFontOptions): THintStyle{.cdecl,
|
||||
importc: "cairo_font_options_get_hint_style", libcairo.}
|
||||
proc set_hint_metrics*(options: PFontOptions,
|
||||
hint_metrics: THintMetrics){.cdecl,
|
||||
importc: "cairo_font_options_set_hint_metrics", libcairo.}
|
||||
proc get_hint_metrics*(options: PFontOptions): THintMetrics{.cdecl,
|
||||
importc: "cairo_font_options_get_hint_metrics", libcairo.}
|
||||
#* This interface is for dealing with text as text, not caring about the
|
||||
# font object inside the the TCairo.
|
||||
proc select_font_face*(cr: PContext, family: cstring, slant: TFontSlant,
|
||||
weight: TFontWeight){.cdecl,
|
||||
importc: "cairo_select_font_face", libcairo.}
|
||||
proc set_font_size*(cr: PContext, size: float64){.cdecl,
|
||||
importc: "cairo_set_font_size", libcairo.}
|
||||
proc set_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl,
|
||||
importc: "cairo_set_font_matrix", libcairo.}
|
||||
proc get_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl,
|
||||
importc: "cairo_get_font_matrix", libcairo.}
|
||||
proc set_font_options*(cr: PContext, options: PFontOptions){.cdecl,
|
||||
importc: "cairo_set_font_options", libcairo.}
|
||||
proc get_font_options*(cr: PContext, options: PFontOptions){.cdecl,
|
||||
importc: "cairo_get_font_options", libcairo.}
|
||||
proc set_font_face*(cr: PContext, font_face: PFontFace){.cdecl,
|
||||
importc: "cairo_set_font_face", libcairo.}
|
||||
proc get_font_face*(cr: PContext): PFontFace{.cdecl, importc: "cairo_get_font_face",
|
||||
libcairo.}
|
||||
proc set_scaled_font*(cr: PContext, scaled_font: PScaledFont){.cdecl,
|
||||
importc: "cairo_set_scaled_font", libcairo.}
|
||||
proc get_scaled_font*(cr: PContext): PScaledFont{.cdecl,
|
||||
importc: "cairo_get_scaled_font", libcairo.}
|
||||
proc show_text*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_show_text",
|
||||
libcairo.}
|
||||
proc show_glyphs*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl,
|
||||
importc: "cairo_show_glyphs", libcairo.}
|
||||
proc text_path*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_text_path",
|
||||
libcairo.}
|
||||
proc glyph_path*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl,
|
||||
importc: "cairo_glyph_path", libcairo.}
|
||||
proc text_extents*(cr: PContext, utf8: cstring, extents: PTextExtents){.cdecl,
|
||||
importc: "cairo_text_extents", libcairo.}
|
||||
proc glyph_extents*(cr: PContext, glyphs: PGlyph, num_glyphs: int32,
|
||||
extents: PTextExtents){.cdecl,
|
||||
importc: "cairo_glyph_extents", libcairo.}
|
||||
proc font_extents*(cr: PContext, extents: PFontExtents){.cdecl,
|
||||
importc: "cairo_font_extents", libcairo.}
|
||||
#* Generic identifier for a font style
|
||||
proc reference*(font_face: PFontFace): PFontFace{.cdecl,
|
||||
importc: "cairo_font_face_reference", libcairo.}
|
||||
proc destroy*(font_face: PFontFace){.cdecl,
|
||||
importc: "cairo_font_face_destroy", libcairo.}
|
||||
proc get_reference_count*(font_face: PFontFace): int32{.cdecl,
|
||||
importc: "cairo_font_face_get_reference_count", libcairo.}
|
||||
proc status*(font_face: PFontFace): TStatus{.cdecl,
|
||||
importc: "cairo_font_face_status", libcairo.}
|
||||
proc get_type*(font_face: PFontFace): TFontType{.cdecl,
|
||||
importc: "cairo_font_face_get_type", libcairo.}
|
||||
proc get_user_data*(font_face: PFontFace, key: PUserDataKey): pointer{.
|
||||
cdecl, importc: "cairo_font_face_get_user_data", libcairo.}
|
||||
proc set_user_data*(font_face: PFontFace, key: PUserDataKey,
|
||||
user_data: pointer, destroy: TDestroyFunc): TStatus{.
|
||||
cdecl, importc: "cairo_font_face_set_user_data", libcairo.}
|
||||
#* Portable interface to general font features
|
||||
proc scaled_font_create*(font_face: PFontFace, font_matrix: PMatrix,
|
||||
ctm: PMatrix, options: PFontOptions): PScaledFont{.
|
||||
cdecl, importc: "cairo_scaled_font_create", libcairo.}
|
||||
proc reference*(scaled_font: PScaledFont): PScaledFont{.cdecl,
|
||||
importc: "cairo_scaled_font_reference", libcairo.}
|
||||
proc destroy*(scaled_font: PScaledFont){.cdecl,
|
||||
importc: "cairo_scaled_font_destroy", libcairo.}
|
||||
proc get_reference_count*(scaled_font: PScaledFont): int32{.cdecl,
|
||||
importc: "cairo_scaled_font_get_reference_count", libcairo.}
|
||||
proc status*(scaled_font: PScaledFont): TStatus{.cdecl,
|
||||
importc: "cairo_scaled_font_status", libcairo.}
|
||||
proc get_type*(scaled_font: PScaledFont): TFontType{.cdecl,
|
||||
importc: "cairo_scaled_font_get_type", libcairo.}
|
||||
proc get_user_data*(scaled_font: PScaledFont, key: PUserDataKey): Pointer{.
|
||||
cdecl, importc: "cairo_scaled_font_get_user_data", libcairo.}
|
||||
proc set_user_data*(scaled_font: PScaledFont, key: PUserDataKey,
|
||||
user_data: Pointer, destroy: TDestroyFunc): TStatus{.
|
||||
cdecl, importc: "cairo_scaled_font_set_user_data", libcairo.}
|
||||
proc extents*(scaled_font: PScaledFont, extents: PFontExtents){.
|
||||
cdecl, importc: "cairo_scaled_font_extents", libcairo.}
|
||||
proc text_extents*(scaled_font: PScaledFont, utf8: cstring,
|
||||
extents: PTextExtents){.cdecl,
|
||||
importc: "cairo_scaled_font_text_extents", libcairo.}
|
||||
proc glyph_extents*(scaled_font: PScaledFont, glyphs: PGlyph,
|
||||
num_glyphs: int32, extents: PTextExtents){.
|
||||
cdecl, importc: "cairo_scaled_font_glyph_extents", libcairo.}
|
||||
proc get_font_face*(scaled_font: PScaledFont): PFontFace{.cdecl,
|
||||
importc: "cairo_scaled_font_get_font_face", libcairo.}
|
||||
proc get_font_matrix*(scaled_font: PScaledFont, font_matrix: PMatrix){.
|
||||
cdecl, importc: "cairo_scaled_font_get_font_matrix", libcairo.}
|
||||
proc get_ctm*(scaled_font: PScaledFont, ctm: PMatrix){.cdecl,
|
||||
importc: "cairo_scaled_font_get_ctm", libcairo.}
|
||||
proc get_font_options*(scaled_font: PScaledFont,
|
||||
options: PFontOptions){.cdecl,
|
||||
importc: "cairo_scaled_font_get_font_options", libcairo.}
|
||||
#* Query functions
|
||||
proc get_operator*(cr: PContext): TOperator{.cdecl, importc: "cairo_get_operator",
|
||||
libcairo.}
|
||||
proc get_source*(cr: PContext): PPattern{.cdecl, importc: "cairo_get_source",
|
||||
libcairo.}
|
||||
proc get_tolerance*(cr: PContext): float64{.cdecl, importc: "cairo_get_tolerance",
|
||||
libcairo.}
|
||||
proc get_antialias*(cr: PContext): TAntialias{.cdecl, importc: "cairo_get_antialias",
|
||||
libcairo.}
|
||||
proc get_current_point*(cr: PContext, x, y: var float64){.cdecl,
|
||||
importc: "cairo_get_current_point", libcairo.}
|
||||
proc get_fill_rule*(cr: PContext): TFillRule{.cdecl, importc: "cairo_get_fill_rule",
|
||||
libcairo.}
|
||||
proc get_line_width*(cr: PContext): float64{.cdecl, importc: "cairo_get_line_width",
|
||||
libcairo.}
|
||||
proc get_line_cap*(cr: PContext): TLineCap{.cdecl, importc: "cairo_get_line_cap",
|
||||
libcairo.}
|
||||
proc get_line_join*(cr: PContext): TLineJoin{.cdecl, importc: "cairo_get_line_join",
|
||||
libcairo.}
|
||||
proc get_miter_limit*(cr: PContext): float64{.cdecl, importc: "cairo_get_miter_limit",
|
||||
libcairo.}
|
||||
proc get_dash_count*(cr: PContext): int32{.cdecl, importc: "cairo_get_dash_count",
|
||||
libcairo.}
|
||||
proc get_dash*(cr: PContext, dashes, offset: var float64){.cdecl,
|
||||
importc: "cairo_get_dash", libcairo.}
|
||||
proc get_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_get_matrix",
|
||||
libcairo.}
|
||||
proc get_target*(cr: PContext): PSurface{.cdecl, importc: "cairo_get_target",
|
||||
libcairo.}
|
||||
proc get_group_target*(cr: PContext): PSurface{.cdecl,
|
||||
importc: "cairo_get_group_target", libcairo.}
|
||||
proc copy_path*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path",
|
||||
libcairo.}
|
||||
proc copy_path_flat*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path_flat",
|
||||
libcairo.}
|
||||
proc append_path*(cr: PContext, path: PPath){.cdecl, importc: "cairo_append_path",
|
||||
libcairo.}
|
||||
proc destroy*(path: PPath){.cdecl, importc: "cairo_path_destroy",
|
||||
libcairo.}
|
||||
#* Error status queries
|
||||
proc status*(cr: PContext): TStatus{.cdecl, importc: "cairo_status", libcairo.}
|
||||
proc status_to_string*(status: TStatus): cstring{.cdecl,
|
||||
importc: "cairo_status_to_string", libcairo.}
|
||||
#* Surface manipulation
|
||||
proc surface_create_similar*(other: PSurface, content: TContent,
|
||||
width, height: int32): PSurface{.cdecl,
|
||||
importc: "cairo_surface_create_similar", libcairo.}
|
||||
proc reference*(surface: PSurface): PSurface{.cdecl,
|
||||
importc: "cairo_surface_reference", libcairo.}
|
||||
proc finish*(surface: PSurface){.cdecl, importc: "cairo_surface_finish",
|
||||
libcairo.}
|
||||
proc destroy*(surface: PSurface){.cdecl,
|
||||
importc: "cairo_surface_destroy", libcairo.}
|
||||
proc get_reference_count*(surface: PSurface): int32{.cdecl,
|
||||
importc: "cairo_surface_get_reference_count", libcairo.}
|
||||
proc status*(surface: PSurface): TStatus{.cdecl,
|
||||
importc: "cairo_surface_status", libcairo.}
|
||||
proc get_type*(surface: PSurface): TSurfaceType{.cdecl,
|
||||
importc: "cairo_surface_get_type", libcairo.}
|
||||
proc get_content*(surface: PSurface): TContent{.cdecl,
|
||||
importc: "cairo_surface_get_content", libcairo.}
|
||||
proc write_to_png*(surface: PSurface, filename: cstring): TStatus{.
|
||||
cdecl, importc: "cairo_surface_write_to_png", libcairo.}
|
||||
proc write_to_png*(surface: PSurface, write_func: TWriteFunc,
|
||||
closure: pointer): TStatus{.cdecl,
|
||||
importc: "cairo_surface_write_to_png_stream", libcairo.}
|
||||
proc get_user_data*(surface: PSurface, key: PUserDataKey): pointer{.
|
||||
cdecl, importc: "cairo_surface_get_user_data", libcairo.}
|
||||
proc set_user_data*(surface: PSurface, key: PUserDataKey,
|
||||
user_data: pointer, destroy: TDestroyFunc): TStatus{.
|
||||
cdecl, importc: "cairo_surface_set_user_data", libcairo.}
|
||||
proc get_font_options*(surface: PSurface, options: PFontOptions){.cdecl,
|
||||
importc: "cairo_surface_get_font_options", libcairo.}
|
||||
proc flush*(surface: PSurface){.cdecl, importc: "cairo_surface_flush",
|
||||
libcairo.}
|
||||
proc mark_dirty*(surface: PSurface){.cdecl,
|
||||
importc: "cairo_surface_mark_dirty", libcairo.}
|
||||
proc mark_dirty_rectangle*(surface: PSurface, x, y, width, height: int32){.
|
||||
cdecl, importc: "cairo_surface_mark_dirty_rectangle", libcairo.}
|
||||
proc set_device_offset*(surface: PSurface, x_offset, y_offset: float64){.
|
||||
cdecl, importc: "cairo_surface_set_device_offset", libcairo.}
|
||||
proc get_device_offset*(surface: PSurface,
|
||||
x_offset, y_offset: var float64){.cdecl,
|
||||
importc: "cairo_surface_get_device_offset", libcairo.}
|
||||
proc set_fallback_resolution*(surface: PSurface, x_pixels_per_inch,
|
||||
y_pixels_per_inch: float64){.cdecl, importc: "cairo_surface_set_fallback_resolution",
|
||||
libcairo.}
|
||||
#* Image-surface functions
|
||||
proc image_surface_create*(format: TFormat, width, height: int32): PSurface{.
|
||||
cdecl, importc: "cairo_image_surface_create", libcairo.}
|
||||
proc image_surface_create*(data: Pbyte, format: TFormat,
|
||||
width, height, stride: int32): PSurface{.
|
||||
cdecl, importc: "cairo_image_surface_create_for_data", libcairo.}
|
||||
proc get_data*(surface: PSurface): cstring{.cdecl,
|
||||
importc: "cairo_image_surface_get_data", libcairo.}
|
||||
proc get_format*(surface: PSurface): TFormat{.cdecl,
|
||||
importc: "cairo_image_surface_get_format", libcairo.}
|
||||
proc get_width*(surface: PSurface): int32{.cdecl,
|
||||
importc: "cairo_image_surface_get_width", libcairo.}
|
||||
proc get_height*(surface: PSurface): int32{.cdecl,
|
||||
importc: "cairo_image_surface_get_height", libcairo.}
|
||||
proc get_stride*(surface: PSurface): int32{.cdecl,
|
||||
importc: "cairo_image_surface_get_stride", libcairo.}
|
||||
proc image_surface_create_from_png*(filename: cstring): PSurface{.cdecl,
|
||||
importc: "cairo_image_surface_create_from_png", libcairo.}
|
||||
proc image_surface_create_from_png*(read_func: TReadFunc,
|
||||
closure: pointer): PSurface{.cdecl, importc: "cairo_image_surface_create_from_png_stream",
|
||||
libcairo.}
|
||||
#* Pattern creation functions
|
||||
proc pattern_create_rgb*(red, green, blue: float64): PPattern{.cdecl,
|
||||
importc: "cairo_pattern_create_rgb", libcairo.}
|
||||
proc pattern_create_rgba*(red, green, blue, alpha: float64): PPattern{.cdecl,
|
||||
importc: "cairo_pattern_create_rgba", libcairo.}
|
||||
proc pattern_create_for_surface*(surface: PSurface): PPattern{.cdecl,
|
||||
importc: "cairo_pattern_create_for_surface", libcairo.}
|
||||
proc pattern_create_linear*(x0, y0, x1, y1: float64): PPattern{.cdecl,
|
||||
importc: "cairo_pattern_create_linear", libcairo.}
|
||||
proc pattern_create_radial*(cx0, cy0, radius0, cx1, cy1, radius1: float64): PPattern{.
|
||||
cdecl, importc: "cairo_pattern_create_radial", libcairo.}
|
||||
proc reference*(pattern: PPattern): PPattern{.cdecl,
|
||||
importc: "cairo_pattern_reference", libcairo.}
|
||||
proc destroy*(pattern: PPattern){.cdecl,
|
||||
importc: "cairo_pattern_destroy", libcairo.}
|
||||
proc get_reference_count*(pattern: PPattern): int32{.cdecl,
|
||||
importc: "cairo_pattern_get_reference_count", libcairo.}
|
||||
proc status*(pattern: PPattern): TStatus{.cdecl,
|
||||
importc: "cairo_pattern_status", libcairo.}
|
||||
proc get_user_data*(pattern: PPattern, key: PUserDataKey): Pointer{.
|
||||
cdecl, importc: "cairo_pattern_get_user_data", libcairo.}
|
||||
proc set_user_data*(pattern: PPattern, key: PUserDataKey,
|
||||
user_data: Pointer, destroy: TDestroyFunc): TStatus{.
|
||||
cdecl, importc: "cairo_pattern_set_user_data", libcairo.}
|
||||
proc get_type*(pattern: PPattern): TPatternType{.cdecl,
|
||||
importc: "cairo_pattern_get_type", libcairo.}
|
||||
proc add_color_stop_rgb*(pattern: PPattern,
|
||||
offset, red, green, blue: float64){.cdecl,
|
||||
importc: "cairo_pattern_add_color_stop_rgb", libcairo.}
|
||||
proc add_color_stop_rgba*(pattern: PPattern,
|
||||
offset, red, green, blue, alpha: float64){.
|
||||
cdecl, importc: "cairo_pattern_add_color_stop_rgba", libcairo.}
|
||||
proc set_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl,
|
||||
importc: "cairo_pattern_set_matrix", libcairo.}
|
||||
proc get_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl,
|
||||
importc: "cairo_pattern_get_matrix", libcairo.}
|
||||
proc set_extend*(pattern: PPattern, extend: TExtend){.cdecl,
|
||||
importc: "cairo_pattern_set_extend", libcairo.}
|
||||
proc get_extend*(pattern: PPattern): TExtend{.cdecl,
|
||||
importc: "cairo_pattern_get_extend", libcairo.}
|
||||
proc set_filter*(pattern: PPattern, filter: TFilter){.cdecl,
|
||||
importc: "cairo_pattern_set_filter", libcairo.}
|
||||
proc get_filter*(pattern: PPattern): TFilter{.cdecl,
|
||||
importc: "cairo_pattern_get_filter", libcairo.}
|
||||
proc get_rgba*(pattern: PPattern,
|
||||
red, green, blue, alpha: var float64): TStatus{.
|
||||
cdecl, importc: "cairo_pattern_get_rgba", libcairo.}
|
||||
proc get_surface*(pattern: PPattern, surface: PPSurface): TStatus{.
|
||||
cdecl, importc: "cairo_pattern_get_surface", libcairo.}
|
||||
proc get_color_stop_rgba*(pattern: PPattern, index: int32,
|
||||
offset, red, green, blue, alpha: var float64): TStatus{.
|
||||
cdecl, importc: "cairo_pattern_get_color_stop_rgba", libcairo.}
|
||||
proc get_color_stop_count*(pattern: PPattern, count: var int32): TStatus{.
|
||||
cdecl, importc: "cairo_pattern_get_color_stop_count", libcairo.}
|
||||
proc get_linear_points*(pattern: PPattern,
|
||||
x0, y0, x1, y1: var float64): TStatus{.
|
||||
cdecl, importc: "cairo_pattern_get_linear_points", libcairo.}
|
||||
proc get_radial_circles*(pattern: PPattern,
|
||||
x0, y0, r0, x1, y1, r1: var float64): TStatus{.
|
||||
cdecl, importc: "cairo_pattern_get_radial_circles", libcairo.}
|
||||
#* Matrix functions
|
||||
proc init*(matrix: PMatrix, xx, yx, xy, yy, x0, y0: float64){.cdecl,
|
||||
importc: "cairo_matrix_init", libcairo.}
|
||||
proc init_identity*(matrix: PMatrix){.cdecl,
|
||||
importc: "cairo_matrix_init_identity", libcairo.}
|
||||
proc init_translate*(matrix: PMatrix, tx, ty: float64){.cdecl,
|
||||
importc: "cairo_matrix_init_translate", libcairo.}
|
||||
proc init_scale*(matrix: PMatrix, sx, sy: float64){.cdecl,
|
||||
importc: "cairo_matrix_init_scale", libcairo.}
|
||||
proc init_rotate*(matrix: PMatrix, radians: float64){.cdecl,
|
||||
importc: "cairo_matrix_init_rotate", libcairo.}
|
||||
proc translate*(matrix: PMatrix, tx, ty: float64){.cdecl,
|
||||
importc: "cairo_matrix_translate", libcairo.}
|
||||
proc scale*(matrix: PMatrix, sx, sy: float64){.cdecl,
|
||||
importc: "cairo_matrix_scale", libcairo.}
|
||||
proc rotate*(matrix: PMatrix, radians: float64){.cdecl,
|
||||
importc: "cairo_matrix_rotate", libcairo.}
|
||||
proc invert*(matrix: PMatrix): TStatus{.cdecl,
|
||||
importc: "cairo_matrix_invert", libcairo.}
|
||||
proc multiply*(result, a, b: PMatrix){.cdecl,
|
||||
importc: "cairo_matrix_multiply", libcairo.}
|
||||
proc transform_distance*(matrix: PMatrix, dx, dy: var float64){.cdecl,
|
||||
importc: "cairo_matrix_transform_distance", libcairo.}
|
||||
proc transform_point*(matrix: PMatrix, x, y: var float64){.cdecl,
|
||||
importc: "cairo_matrix_transform_point", libcairo.}
|
||||
#* PDF functions
|
||||
proc pdf_surface_create*(filename: cstring,
|
||||
width_in_points, height_in_points: float64): PSurface{.
|
||||
cdecl, importc: "cairo_pdf_surface_create", libcairo.}
|
||||
proc pdf_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
||||
width_in_points, height_in_points: float64): PSurface{.
|
||||
cdecl, importc: "cairo_pdf_surface_create_for_stream", libcairo.}
|
||||
proc pdf_surface_set_size*(surface: PSurface,
|
||||
width_in_points, height_in_points: float64){.cdecl,
|
||||
importc: "cairo_pdf_surface_set_size", libcairo.}
|
||||
#* PS functions
|
||||
proc ps_surface_create*(filename: cstring,
|
||||
width_in_points, height_in_points: float64): PSurface{.
|
||||
cdecl, importc: "cairo_ps_surface_create", libcairo.}
|
||||
proc ps_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
||||
width_in_points, height_in_points: float64): PSurface{.
|
||||
cdecl, importc: "cairo_ps_surface_create_for_stream", libcairo.}
|
||||
proc ps_surface_set_size*(surface: PSurface,
|
||||
width_in_points, height_in_points: float64){.cdecl,
|
||||
importc: "cairo_ps_surface_set_size", libcairo.}
|
||||
proc ps_surface_dsc_comment*(surface: PSurface, comment: cstring){.cdecl,
|
||||
importc: "cairo_ps_surface_dsc_comment", libcairo.}
|
||||
proc ps_surface_dsc_begin_setup*(surface: PSurface){.cdecl,
|
||||
importc: "cairo_ps_surface_dsc_begin_setup", libcairo.}
|
||||
proc ps_surface_dsc_begin_page_setup*(surface: PSurface){.cdecl,
|
||||
importc: "cairo_ps_surface_dsc_begin_page_setup", libcairo.}
|
||||
#* SVG functions
|
||||
proc svg_surface_create*(filename: cstring,
|
||||
width_in_points, height_in_points: float64): PSurface{.
|
||||
cdecl, importc: "cairo_svg_surface_create", libcairo.}
|
||||
proc svg_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
||||
width_in_points, height_in_points: float64): PSurface{.
|
||||
cdecl, importc: "cairo_svg_surface_create_for_stream", libcairo.}
|
||||
proc svg_surface_restrict_to_version*(surface: PSurface, version: TSvgVersion){.
|
||||
cdecl, importc: "cairo_svg_surface_restrict_to_version", libcairo.}
|
||||
#todo: see how translate this
|
||||
#procedure cairo_svg_get_versions(TCairoSvgVersion const **versions,
|
||||
# int *num_versions);
|
||||
proc svg_version_to_string*(version: TSvgVersion): cstring{.cdecl,
|
||||
importc: "cairo_svg_version_to_string", libcairo.}
|
||||
#* Functions to be used while debugging (not intended for use in production code)
|
||||
proc debug_reset_static_data*(){.cdecl,
|
||||
importc: "cairo_debug_reset_static_data",
|
||||
libcairo.}
|
||||
# implementation
|
||||
|
||||
proc version(major, minor, micro: var int32) =
|
||||
var version: int32
|
||||
version = version()
|
||||
major = version div 10000'i32
|
||||
minor = (version mod (major * 10000'i32)) div 100'i32
|
||||
micro = (version mod ((major * 10000'i32) + (minor * 100'i32)))
|
||||
|
||||
proc checkStatus*(s: cairo.TStatus) {.noinline.} =
|
||||
## if ``s != StatusSuccess`` the error is turned into an appropirate Nimrod
|
||||
## exception and raised.
|
||||
case s
|
||||
of StatusSuccess: nil
|
||||
of StatusNoMemory:
|
||||
raise newException(EOutOfMemory, $statusToString(s))
|
||||
of STATUS_READ_ERROR, STATUS_WRITE_ERROR, STATUS_FILE_NOT_FOUND,
|
||||
STATUS_TEMP_FILE_ERROR:
|
||||
raise newException(EIO, $statusToString(s))
|
||||
else:
|
||||
raise newException(EAssertionFailed, $statusToString(s))
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# included by cairo bindings
|
||||
|
||||
when defined(use_pkg_config) or defined(use_pkg_config_static):
|
||||
{.pragma: libcairo, cdecl.}
|
||||
when defined(use_pkg_config_static):
|
||||
{.passl: gorge("pkg-config cairo --libs --static").}
|
||||
else:
|
||||
{.passl: gorge("pkg-config cairo --libs").}
|
||||
else:
|
||||
when defined(windows):
|
||||
const LIB_CAIRO* = "libcairo-2.dll"
|
||||
elif defined(macosx):
|
||||
const LIB_CAIRO* = "libcairo.dylib"
|
||||
else:
|
||||
const LIB_CAIRO* = "libcairo.so(|.2)"
|
||||
{.pragma: libcairo, cdecl, dynlib: LIB_CAIRO.}
|
||||
@@ -1,36 +0,0 @@
|
||||
#
|
||||
# Translation of cairo-ft.h
|
||||
# by Jeffrey Pohlmeyer
|
||||
# updated to version 1.4 by Luiz Am<41>rico Pereira C<>mara 2007
|
||||
#
|
||||
|
||||
import
|
||||
cairo, freetypeh
|
||||
|
||||
include "cairo_pragma.nim"
|
||||
#todo: properly define FcPattern:
|
||||
#It will require translate FontConfig header
|
||||
|
||||
#*
|
||||
#typedef struct _XftPattern {
|
||||
# int num;
|
||||
# int size;
|
||||
# XftPatternElt *elts;
|
||||
# } XftPattern;
|
||||
# typedef FcPattern XftPattern;
|
||||
#
|
||||
|
||||
type
|
||||
FcPattern* = Pointer
|
||||
PFcPattern* = ptr FcPattern
|
||||
|
||||
proc ft_font_face_create_for_pattern*(pattern: PFcPattern): PFontFace{.libcairo,
|
||||
importc: "cairo_ft_font_face_create_for_pattern".}
|
||||
proc ft_font_options_substitute*(options: PFontOptions, pattern: PFcPattern){.
|
||||
libcairo, importc: "cairo_ft_font_options_substitute".}
|
||||
proc ft_font_face_create_for_ft_face*(face: TFT_Face, load_flags: int32): PFontFace{.libcairo,
|
||||
importc: "cairo_ft_font_face_create_for_ft_face".}
|
||||
proc ft_scaled_font_lock_face*(scaled_font: PScaledFont): TFT_Face{.libcairo,
|
||||
importc: "cairo_ft_scaled_font_lock_face".}
|
||||
proc ft_scaled_font_unlock_face*(scaled_font: PScaledFont){.libcairo,
|
||||
importc: "cairo_ft_scaled_font_unlock_face".}
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
# Translation of cairo-win32.h version 1.4
|
||||
# by Luiz Am<41>rico Pereira C<>mara 2007
|
||||
#
|
||||
|
||||
import
|
||||
cairo, windows
|
||||
|
||||
proc win32_surface_create*(hdc: HDC): PSurface{.cdecl,
|
||||
importc: "cairo_win32_surface_create", dynlib: LIB_CAIRO.}
|
||||
proc win32_surface_create_with_ddb*(hdc: HDC, format: TFormat,
|
||||
width, height: int32): PSurface{.cdecl,
|
||||
importc: "cairo_win32_surface_create_with_ddb", dynlib: LIB_CAIRO.}
|
||||
proc win32_surface_create_with_dib*(format: TFormat, width, height: int32): PSurface{.
|
||||
cdecl, importc: "cairo_win32_surface_create_with_dib", dynlib: LIB_CAIRO.}
|
||||
proc win32_surface_get_dc*(surface: PSurface): HDC{.cdecl,
|
||||
importc: "cairo_win32_surface_get_dc", dynlib: LIB_CAIRO.}
|
||||
proc win32_surface_get_image*(surface: PSurface): PSurface{.cdecl,
|
||||
importc: "cairo_win32_surface_get_image", dynlib: LIB_CAIRO.}
|
||||
proc win32_font_face_create_for_logfontw*(logfont: pLOGFONTW): PFontFace{.cdecl,
|
||||
importc: "cairo_win32_font_face_create_for_logfontw", dynlib: LIB_CAIRO.}
|
||||
proc win32_font_face_create_for_hfont*(font: HFONT): PFontFace{.cdecl,
|
||||
importc: "cairo_win32_font_face_create_for_hfont", dynlib: LIB_CAIRO.}
|
||||
proc win32_scaled_font_select_font*(scaled_font: PScaledFont, hdc: HDC): TStatus{.
|
||||
cdecl, importc: "cairo_win32_scaled_font_select_font", dynlib: LIB_CAIRO.}
|
||||
proc win32_scaled_font_done_font*(scaled_font: PScaledFont){.cdecl,
|
||||
importc: "cairo_win32_scaled_font_done_font", dynlib: LIB_CAIRO.}
|
||||
proc win32_scaled_font_get_metrics_factor*(scaled_font: PScaledFont): float64{.
|
||||
cdecl, importc: "cairo_win32_scaled_font_get_metrics_factor",
|
||||
dynlib: LIB_CAIRO.}
|
||||
proc win32_scaled_font_get_logical_to_device*(scaled_font: PScaledFont,
|
||||
logical_to_device: PMatrix){.cdecl, importc: "cairo_win32_scaled_font_get_logical_to_device",
|
||||
dynlib: LIB_CAIRO.}
|
||||
proc win32_scaled_font_get_device_to_logical*(scaled_font: PScaledFont,
|
||||
device_to_logical: PMatrix){.cdecl, importc: "cairo_win32_scaled_font_get_device_to_logical",
|
||||
dynlib: LIB_CAIRO.}
|
||||
# implementation
|
||||
@@ -1,41 +0,0 @@
|
||||
#
|
||||
# Translation of cairo-xlib.h version 1.4
|
||||
# by Jeffrey Pohlmeyer
|
||||
# updated to version 1.4 by Luiz Am<41>rico Pereira C<>mara 2007
|
||||
#
|
||||
|
||||
import
|
||||
cairo, x, xlib, xrender
|
||||
|
||||
include "cairo_pragma.nim"
|
||||
|
||||
proc xlib_surface_create*(dpy: PDisplay, drawable: TDrawable, visual: PVisual,
|
||||
width, height: int32): PSurface{.cdecl,
|
||||
importc: "cairo_xlib_surface_create", libcairo.}
|
||||
proc xlib_surface_create_for_bitmap*(dpy: PDisplay, bitmap: TPixmap,
|
||||
screen: PScreen, width, height: int32): PSurface{.
|
||||
cdecl, importc: "cairo_xlib_surface_create_for_bitmap", libcairo.}
|
||||
proc xlib_surface_create_with_xrender_format*(dpy: PDisplay,
|
||||
drawable: TDrawable, screen: PScreen, format: PXRenderPictFormat,
|
||||
width, height: int32): PSurface{.cdecl, importc: "cairo_xlib_surface_create_with_xrender_format",
|
||||
libcairo.}
|
||||
proc xlib_surface_get_depth*(surface: PSurface): int32{.cdecl,
|
||||
importc: "cairo_xlib_surface_get_depth", libcairo.}
|
||||
proc xlib_surface_get_display*(surface: PSurface): PDisplay{.cdecl,
|
||||
importc: "cairo_xlib_surface_get_display", libcairo.}
|
||||
proc xlib_surface_get_drawable*(surface: PSurface): TDrawable{.cdecl,
|
||||
importc: "cairo_xlib_surface_get_drawable", libcairo.}
|
||||
proc xlib_surface_get_height*(surface: PSurface): int32{.cdecl,
|
||||
importc: "cairo_xlib_surface_get_height", libcairo.}
|
||||
proc xlib_surface_get_screen*(surface: PSurface): PScreen{.cdecl,
|
||||
importc: "cairo_xlib_surface_get_screen", libcairo.}
|
||||
proc xlib_surface_get_visual*(surface: PSurface): PVisual{.cdecl,
|
||||
importc: "cairo_xlib_surface_get_visual", libcairo.}
|
||||
proc xlib_surface_get_width*(surface: PSurface): int32{.cdecl,
|
||||
importc: "cairo_xlib_surface_get_width", libcairo.}
|
||||
proc xlib_surface_set_size*(surface: PSurface, width, height: int32){.cdecl,
|
||||
importc: "cairo_xlib_surface_set_size", libcairo.}
|
||||
proc xlib_surface_set_drawable*(surface: PSurface, drawable: TDrawable,
|
||||
width, height: int32){.cdecl,
|
||||
importc: "cairo_xlib_surface_set_drawable", libcairo.}
|
||||
# implementation
|
||||
@@ -1,208 +0,0 @@
|
||||
#*****************************************************************************
|
||||
# * *
|
||||
# * File: lauxlib.pas *
|
||||
# * Authors: TeCGraf (C headers + actual Lua libraries) *
|
||||
# * Lavergne Thomas (original translation to Pascal) *
|
||||
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
|
||||
# * Description: Lua auxiliary library *
|
||||
# * *
|
||||
# *****************************************************************************
|
||||
#
|
||||
#** $Id: lauxlib.h,v 1.59 2003/03/18 12:25:32 roberto Exp $
|
||||
#** Auxiliary functions for building Lua libraries
|
||||
#** See Copyright Notice in lua.h
|
||||
#
|
||||
#
|
||||
#** Translated to pascal by Lavergne Thomas
|
||||
#** Notes :
|
||||
#** - Pointers type was prefixed with 'P'
|
||||
#** Bug reports :
|
||||
#** - thomas.lavergne@laposte.net
|
||||
#** In french or in english
|
||||
#
|
||||
|
||||
import
|
||||
lua
|
||||
|
||||
proc pushstring*(L: PState, s: string)
|
||||
# compatibilty macros
|
||||
proc getn*(L: PState, n: cint): cint
|
||||
# calls lua_objlen
|
||||
proc setn*(L: PState, t, n: cint)
|
||||
# does nothing!
|
||||
type
|
||||
Treg*{.final.} = object
|
||||
name*: cstring
|
||||
func*: CFunction
|
||||
|
||||
Preg* = ptr Treg
|
||||
|
||||
|
||||
{.push callConv: cdecl, dynlib: lua.LIB_NAME.}
|
||||
{.push importc: "luaL_$1".}
|
||||
|
||||
proc openlib*(L: PState, libname: cstring, lr: Preg, nup: cint)
|
||||
proc register*(L: PState, libname: cstring, lr: Preg)
|
||||
|
||||
proc getmetafield*(L: PState, obj: cint, e: cstring): cint
|
||||
proc callmeta*(L: PState, obj: cint, e: cstring): cint
|
||||
proc typerror*(L: PState, narg: cint, tname: cstring): cint
|
||||
proc argerror*(L: PState, numarg: cint, extramsg: cstring): cint
|
||||
proc checklstring*(L: PState, numArg: cint, len: ptr int): cstring
|
||||
proc optlstring*(L: PState, numArg: cint, def: cstring, len: ptr cint): cstring
|
||||
proc checknumber*(L: PState, numArg: cint): Number
|
||||
proc optnumber*(L: PState, nArg: cint, def: Number): Number
|
||||
proc checkinteger*(L: PState, numArg: cint): Integer
|
||||
proc optinteger*(L: PState, nArg: cint, def: Integer): Integer
|
||||
proc checkstack*(L: PState, sz: cint, msg: cstring)
|
||||
proc checktype*(L: PState, narg, t: cint)
|
||||
|
||||
proc checkany*(L: PState, narg: cint)
|
||||
proc newmetatable*(L: PState, tname: cstring): cint
|
||||
|
||||
proc checkudata*(L: PState, ud: cint, tname: cstring): Pointer
|
||||
proc where*(L: PState, lvl: cint)
|
||||
proc error*(L: PState, fmt: cstring): cint{.varargs.}
|
||||
proc checkoption*(L: PState, narg: cint, def: cstring, lst: cstringArray): cint
|
||||
|
||||
proc unref*(L: PState, t, theref: cint)
|
||||
proc loadfile*(L: PState, filename: cstring): cint
|
||||
proc loadbuffer*(L: PState, buff: cstring, size: cint, name: cstring): cint
|
||||
proc loadstring*(L: PState, s: cstring): cint
|
||||
proc newstate*(): PState
|
||||
|
||||
{.pop.}
|
||||
proc reference*(L: PState, t: cint): cint{.importc: "luaL_ref".}
|
||||
|
||||
{.pop.}
|
||||
|
||||
proc open*(): PState
|
||||
# compatibility; moved from unit lua to lauxlib because it needs luaL_newstate
|
||||
#
|
||||
#** ===============================================================
|
||||
#** some useful macros
|
||||
#** ===============================================================
|
||||
#
|
||||
proc argcheck*(L: PState, cond: bool, numarg: cint, extramsg: cstring)
|
||||
proc checkstring*(L: PState, n: cint): cstring
|
||||
proc optstring*(L: PState, n: cint, d: cstring): cstring
|
||||
proc checkint*(L: PState, n: cint): cint
|
||||
proc checklong*(L: PState, n: cint): clong
|
||||
proc optint*(L: PState, n: cint, d: float64): cint
|
||||
proc optlong*(L: PState, n: cint, d: float64): clong
|
||||
proc dofile*(L: PState, filename: cstring): cint
|
||||
proc dostring*(L: PState, str: cstring): cint
|
||||
proc getmetatable*(L: PState, tname: cstring)
|
||||
# not translated:
|
||||
# #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
|
||||
#
|
||||
#** =======================================================
|
||||
#** Generic Buffer manipulation
|
||||
#** =======================================================
|
||||
#
|
||||
const # note: this is just arbitrary, as it related to the BUFSIZ defined in stdio.h ...
|
||||
BUFFERSIZE* = 4096
|
||||
|
||||
type
|
||||
Buffer*{.final.} = object
|
||||
p*: cstring # current position in buffer
|
||||
lvl*: cint # number of strings in the stack (level)
|
||||
L*: PState
|
||||
buffer*: array[0..BUFFERSIZE - 1, Char] # warning: see note above about LUAL_BUFFERSIZE
|
||||
|
||||
PBuffer* = ptr Buffer
|
||||
|
||||
proc addchar*(B: PBuffer, c: Char)
|
||||
# warning: see note above about LUAL_BUFFERSIZE
|
||||
# compatibility only (alias for luaL_addchar)
|
||||
proc putchar*(B: PBuffer, c: Char)
|
||||
# warning: see note above about LUAL_BUFFERSIZE
|
||||
proc addsize*(B: PBuffer, n: cint)
|
||||
|
||||
{.push callConv: cdecl, dynlib: lua.LIB_NAME, importc: "luaL_$1".}
|
||||
proc buffinit*(L: PState, B: PBuffer)
|
||||
proc prepbuffer*(B: PBuffer): cstring
|
||||
proc addlstring*(B: PBuffer, s: cstring, L: cint)
|
||||
proc addstring*(B: PBuffer, s: cstring)
|
||||
proc addvalue*(B: PBuffer)
|
||||
proc pushresult*(B: PBuffer)
|
||||
proc gsub*(L: PState, s, p, r: cstring): cstring
|
||||
proc findtable*(L: PState, idx: cint, fname: cstring, szhint: cint): cstring
|
||||
# compatibility with ref system
|
||||
# pre-defined references
|
||||
{.pop.}
|
||||
|
||||
const
|
||||
NOREF* = - 2
|
||||
REFNIL* = - 1
|
||||
|
||||
proc unref*(L: PState, theref: cint)
|
||||
proc getref*(L: PState, theref: cint)
|
||||
#
|
||||
#** Compatibility macros and functions
|
||||
#
|
||||
# implementation
|
||||
|
||||
proc pushstring(L: PState, s: string) =
|
||||
pushlstring(L, cstring(s), s.len.cint)
|
||||
|
||||
proc getn(L: PState, n: cint): cint =
|
||||
Result = objlen(L, n)
|
||||
|
||||
proc setn(L: PState, t, n: cint) =
|
||||
# does nothing as this operation is deprecated
|
||||
nil
|
||||
|
||||
proc open(): PState =
|
||||
Result = newstate()
|
||||
|
||||
proc dofile(L: PState, filename: cstring): cint =
|
||||
Result = loadfile(L, filename)
|
||||
if Result == 0: Result = pcall(L, 0, MULTRET, 0)
|
||||
|
||||
proc dostring(L: PState, str: cstring): cint =
|
||||
Result = loadstring(L, str)
|
||||
if Result == 0: Result = pcall(L, 0, MULTRET, 0)
|
||||
|
||||
proc getmetatable(L: PState, tname: cstring) =
|
||||
getfield(L, REGISTRYINDEX, tname)
|
||||
|
||||
proc argcheck(L: PState, cond: bool, numarg: cint, extramsg: cstring) =
|
||||
if not cond:
|
||||
discard argerror(L, numarg, extramsg)
|
||||
|
||||
proc checkstring(L: PState, n: cint): cstring =
|
||||
Result = checklstring(L, n, nil)
|
||||
|
||||
proc optstring(L: PState, n: cint, d: cstring): cstring =
|
||||
Result = optlstring(L, n, d, nil)
|
||||
|
||||
proc checkint(L: PState, n: cint): cint =
|
||||
Result = cint(checknumber(L, n))
|
||||
|
||||
proc checklong(L: PState, n: cint): clong =
|
||||
Result = int32(ToInt(checknumber(L, n)))
|
||||
|
||||
proc optint(L: PState, n: cint, d: float64): cint =
|
||||
Result = optnumber(L, n, d).cint
|
||||
|
||||
proc optlong(L: PState, n: cint, d: float64): clong =
|
||||
Result = int32(ToInt(optnumber(L, n, d)))
|
||||
|
||||
proc addchar(B: PBuffer, c: Char) =
|
||||
if cast[int](addr((B.p))) < (cast[int](addr((B.buffer[0]))) + BUFFERSIZE):
|
||||
discard prepbuffer(B)
|
||||
B.p[1] = c
|
||||
B.p = cast[cstring](cast[int](B.p) + 1)
|
||||
|
||||
proc putchar(B: PBuffer, c: Char) =
|
||||
addchar(B, c)
|
||||
|
||||
proc addsize(B: PBuffer, n: cint) =
|
||||
B.p = cast[cstring](cast[int](B.p) + n)
|
||||
|
||||
proc unref(L: PState, theref: cint) =
|
||||
unref(L, REGISTRYINDEX, theref)
|
||||
|
||||
proc getref(L: PState, theref: cint) =
|
||||
rawgeti(L, REGISTRYINDEX, theref)
|
||||
@@ -1,364 +0,0 @@
|
||||
#*****************************************************************************
|
||||
# * *
|
||||
# * File: lua.pas *
|
||||
# * Authors: TeCGraf (C headers + actual Lua libraries) *
|
||||
# * Lavergne Thomas (original translation to Pascal) *
|
||||
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
|
||||
# * Description: Basic Lua library *
|
||||
# * *
|
||||
# *****************************************************************************
|
||||
#
|
||||
#** $Id: lua.h,v 1.175 2003/03/18 12:31:39 roberto Exp $
|
||||
#** Lua - An Extensible Extension Language
|
||||
#** TeCGraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
||||
#** http://www.lua.org mailto:info@lua.org
|
||||
#** See Copyright Notice at the end of this file
|
||||
#
|
||||
#
|
||||
#** Updated to Lua 5.1.1 by Bram Kuijvenhoven (bram at kuijvenhoven dot net),
|
||||
#** Hexis BV (http://www.hexis.nl), the Netherlands
|
||||
#** Notes:
|
||||
#** - Only tested with FPC (FreePascal Compiler)
|
||||
#** - Using LuaBinaries styled DLL/SO names, which include version names
|
||||
#** - LUA_YIELD was suffixed by '_' for avoiding name collision
|
||||
#
|
||||
#
|
||||
#** Translated to pascal by Lavergne Thomas
|
||||
#** Notes :
|
||||
#** - Pointers type was prefixed with 'P'
|
||||
#** - lua_upvalueindex constant was transformed to function
|
||||
#** - Some compatibility function was isolated because with it you must have
|
||||
#** lualib.
|
||||
#** - LUA_VERSION was suffixed by '_' for avoiding name collision.
|
||||
#** Bug reports :
|
||||
#** - thomas.lavergne@laposte.net
|
||||
#** In french or in english
|
||||
#
|
||||
|
||||
when defined(useLuajit):
|
||||
when defined(MACOSX):
|
||||
const
|
||||
NAME* = "libluajit.dylib"
|
||||
LIB_NAME* = "libluajit.dylib"
|
||||
elif defined(UNIX):
|
||||
const
|
||||
NAME* = "libluajit.so(|.0)"
|
||||
LIB_NAME* = "libluajit.so(|.0)"
|
||||
else:
|
||||
const
|
||||
NAME* = "luajit.dll"
|
||||
LIB_NAME* = "luajit.dll"
|
||||
else:
|
||||
when defined(MACOSX):
|
||||
const
|
||||
NAME* = "liblua(|5.1|5.0).dylib"
|
||||
LIB_NAME* = "liblua(|5.1|5.0).dylib"
|
||||
elif defined(UNIX):
|
||||
const
|
||||
NAME* = "liblua(|5.1|5.0).so(|.0)"
|
||||
LIB_NAME* = "liblua(|5.1|5.0).so(|.0)"
|
||||
else:
|
||||
const
|
||||
NAME* = "lua(|5.1|5.0).dll"
|
||||
LIB_NAME* = "lua(|5.1|5.0).dll"
|
||||
|
||||
const
|
||||
VERSION* = "Lua 5.1"
|
||||
RELEASE* = "Lua 5.1.1"
|
||||
VERSION_NUM* = 501
|
||||
COPYRIGHT* = "Copyright (C) 1994-2006 Lua.org, PUC-Rio"
|
||||
AUTHORS* = "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
|
||||
# option for multiple returns in `lua_pcall' and `lua_call'
|
||||
MULTRET* = - 1 #
|
||||
#** pseudo-indices
|
||||
#
|
||||
REGISTRYINDEX* = - 10000
|
||||
ENVIRONINDEX* = - 10001
|
||||
GLOBALSINDEX* = - 10002
|
||||
|
||||
proc upvalueindex*(I: cint): cint
|
||||
const # thread status; 0 is OK
|
||||
constYIELD* = 1
|
||||
ERRRUN* = 2
|
||||
ERRSYNTAX* = 3
|
||||
ERRMEM* = 4
|
||||
ERRERR* = 5
|
||||
|
||||
type
|
||||
PState* = Pointer
|
||||
CFunction* = proc (L: PState): cint{.cdecl.}
|
||||
|
||||
#
|
||||
#** functions that read/write blocks when loading/dumping Lua chunks
|
||||
#
|
||||
|
||||
type
|
||||
Reader* = proc (L: PState, ud: Pointer, sz: ptr cint): cstring{.cdecl.}
|
||||
Writer* = proc (L: PState, p: Pointer, sz: cint, ud: Pointer): cint{.cdecl.}
|
||||
Alloc* = proc (ud, theptr: Pointer, osize, nsize: cint){.cdecl.}
|
||||
|
||||
const
|
||||
TNONE* = - 1
|
||||
TNIL* = 0
|
||||
TBOOLEAN* = 1
|
||||
TLIGHTUSERDATA* = 2
|
||||
TNUMBER* = 3
|
||||
TSTRING* = 4
|
||||
TTABLE* = 5
|
||||
TFUNCTION* = 6
|
||||
TUSERDATA* = 7
|
||||
TTHREAD* = 8 # minimum Lua stack available to a C function
|
||||
MINSTACK* = 20
|
||||
|
||||
type # Type of Numbers in Lua
|
||||
Number* = float
|
||||
Integer* = cint
|
||||
|
||||
{.pragma: ilua, importc: "lua_$1".}
|
||||
|
||||
{.push callConv: cdecl, dynlib: LibName.}
|
||||
#{.push importc: "lua_$1".}
|
||||
|
||||
proc newstate*(f: Alloc, ud: Pointer): PState {.ilua.}
|
||||
|
||||
proc close*(L: PState){.ilua.}
|
||||
proc newthread*(L: PState): PState{.ilua.}
|
||||
proc atpanic*(L: PState, panicf: CFunction): CFunction{.ilua.}
|
||||
|
||||
proc gettop*(L: PState): cint{.ilua.}
|
||||
proc settop*(L: PState, idx: cint){.ilua.}
|
||||
proc pushvalue*(L: PState, Idx: cint){.ilua.}
|
||||
proc remove*(L: PState, idx: cint){.ilua.}
|
||||
proc insert*(L: PState, idx: cint){.ilua.}
|
||||
proc replace*(L: PState, idx: cint){.ilua.}
|
||||
proc checkstack*(L: PState, sz: cint): cint{.ilua.}
|
||||
proc xmove*(`from`, `to`: PState, n: cint){.ilua.}
|
||||
proc isnumber*(L: PState, idx: cint): cint{.ilua.}
|
||||
proc isstring*(L: PState, idx: cint): cint{.ilua.}
|
||||
proc iscfunction*(L: PState, idx: cint): cint{.ilua.}
|
||||
proc isuserdata*(L: PState, idx: cint): cint{.ilua.}
|
||||
proc luatype*(L: PState, idx: cint): cint{.importc: "lua_type".}
|
||||
proc typename*(L: PState, tp: cint): cstring{.ilua.}
|
||||
proc equal*(L: PState, idx1, idx2: cint): cint{.ilua.}
|
||||
proc rawequal*(L: PState, idx1, idx2: cint): cint{.ilua.}
|
||||
proc lessthan*(L: PState, idx1, idx2: cint): cint{.ilua.}
|
||||
proc tonumber*(L: PState, idx: cint): Number{.ilua.}
|
||||
proc tointeger*(L: PState, idx: cint): Integer{.ilua.}
|
||||
proc toboolean*(L: PState, idx: cint): cint{.ilua.}
|
||||
proc tolstring*(L: PState, idx: cint, length: ptr cint): cstring{.ilua.}
|
||||
proc objlen*(L: PState, idx: cint): cint{.ilua.}
|
||||
proc tocfunction*(L: PState, idx: cint): CFunction{.ilua.}
|
||||
proc touserdata*(L: PState, idx: cint): Pointer{.ilua.}
|
||||
proc tothread*(L: PState, idx: cint): PState{.ilua.}
|
||||
proc topointer*(L: PState, idx: cint): Pointer{.ilua.}
|
||||
proc pushnil*(L: PState){.ilua.}
|
||||
proc pushnumber*(L: PState, n: Number){.ilua.}
|
||||
proc pushinteger*(L: PState, n: Integer){.ilua.}
|
||||
proc pushlstring*(L: PState, s: cstring, len: cint){.ilua.}
|
||||
proc pushstring*(L: PState, s: cstring){.ilua.}
|
||||
proc pushvfstring*(L: PState, fmt: cstring, argp: Pointer): cstring{.ilua.}
|
||||
proc pushfstring*(L: PState, fmt: cstring): cstring{.varargs,ilua.}
|
||||
proc pushcclosure*(L: PState, fn: CFunction, n: cint){.ilua.}
|
||||
proc pushboolean*(L: PState, b: cint){.ilua.}
|
||||
proc pushlightuserdata*(L: PState, p: Pointer){.ilua.}
|
||||
proc pushthread*(L: PState){.ilua.}
|
||||
proc gettable*(L: PState, idx: cint){.ilua.}
|
||||
proc getfield*(L: Pstate, idx: cint, k: cstring){.ilua.}
|
||||
proc rawget*(L: PState, idx: cint){.ilua.}
|
||||
proc rawgeti*(L: PState, idx, n: cint){.ilua.}
|
||||
proc createtable*(L: PState, narr, nrec: cint){.ilua.}
|
||||
proc newuserdata*(L: PState, sz: cint): Pointer{.ilua.}
|
||||
proc getmetatable*(L: PState, objindex: cint): cint{.ilua.}
|
||||
proc getfenv*(L: PState, idx: cint){.ilua.}
|
||||
proc settable*(L: PState, idx: cint){.ilua.}
|
||||
proc setfield*(L: PState, idx: cint, k: cstring){.ilua.}
|
||||
proc rawset*(L: PState, idx: cint){.ilua.}
|
||||
proc rawseti*(L: PState, idx, n: cint){.ilua.}
|
||||
proc setmetatable*(L: PState, objindex: cint): cint{.ilua.}
|
||||
proc setfenv*(L: PState, idx: cint): cint{.ilua.}
|
||||
proc call*(L: PState, nargs, nresults: cint){.ilua.}
|
||||
proc pcall*(L: PState, nargs, nresults, errf: cint): cint{.ilua.}
|
||||
proc cpcall*(L: PState, func: CFunction, ud: Pointer): cint{.ilua.}
|
||||
proc load*(L: PState, reader: Reader, dt: Pointer, chunkname: cstring): cint{.ilua.}
|
||||
proc dump*(L: PState, writer: Writer, data: Pointer): cint{.ilua.}
|
||||
proc luayield*(L: PState, nresults: cint): cint{.importc: "lua_yield".}
|
||||
proc resume*(L: PState, narg: cint): cint{.ilua.}
|
||||
proc status*(L: PState): cint{.ilua.}
|
||||
proc gc*(L: PState, what, data: cint): cint{.ilua.}
|
||||
proc error*(L: PState): cint{.ilua.}
|
||||
proc next*(L: PState, idx: cint): cint{.ilua.}
|
||||
proc concat*(L: PState, n: cint){.ilua.}
|
||||
proc getallocf*(L: PState, ud: ptr Pointer): Alloc{.ilua.}
|
||||
proc setallocf*(L: PState, f: Alloc, ud: Pointer){.ilua.}
|
||||
{.pop.}
|
||||
|
||||
#
|
||||
#** Garbage-collection functions and options
|
||||
#
|
||||
|
||||
const
|
||||
GCSTOP* = 0
|
||||
GCRESTART* = 1
|
||||
GCCOLLECT* = 2
|
||||
GCCOUNT* = 3
|
||||
GCCOUNTB* = 4
|
||||
GCSTEP* = 5
|
||||
GCSETPAUSE* = 6
|
||||
GCSETSTEPMUL* = 7
|
||||
|
||||
#
|
||||
#** ===============================================================
|
||||
#** some useful macros
|
||||
#** ===============================================================
|
||||
#
|
||||
|
||||
proc pop*(L: PState, n: cint)
|
||||
proc newtable*(L: Pstate)
|
||||
proc register*(L: PState, n: cstring, f: CFunction)
|
||||
proc pushcfunction*(L: PState, f: CFunction)
|
||||
proc strlen*(L: Pstate, i: cint): cint
|
||||
proc isfunction*(L: PState, n: cint): bool
|
||||
proc istable*(L: PState, n: cint): bool
|
||||
proc islightuserdata*(L: PState, n: cint): bool
|
||||
proc isnil*(L: PState, n: cint): bool
|
||||
proc isboolean*(L: PState, n: cint): bool
|
||||
proc isthread*(L: PState, n: cint): bool
|
||||
proc isnone*(L: PState, n: cint): bool
|
||||
proc isnoneornil*(L: PState, n: cint): bool
|
||||
proc pushliteral*(L: PState, s: cstring)
|
||||
proc setglobal*(L: PState, s: cstring)
|
||||
proc getglobal*(L: PState, s: cstring)
|
||||
proc tostring*(L: PState, i: cint): cstring
|
||||
#
|
||||
#** compatibility macros and functions
|
||||
#
|
||||
|
||||
proc getregistry*(L: PState)
|
||||
proc getgccount*(L: PState): cint
|
||||
type
|
||||
Chunkreader* = Reader
|
||||
Chunkwriter* = Writer
|
||||
|
||||
#
|
||||
#** ======================================================================
|
||||
#** Debug API
|
||||
#** ======================================================================
|
||||
#
|
||||
|
||||
const
|
||||
HOOKCALL* = 0
|
||||
HOOKRET* = 1
|
||||
HOOKLINE* = 2
|
||||
HOOKCOUNT* = 3
|
||||
HOOKTAILRET* = 4
|
||||
|
||||
const
|
||||
MASKCALL* = 1 shl Ord(HOOKCALL)
|
||||
MASKRET* = 1 shl Ord(HOOKRET)
|
||||
MASKLINE* = 1 shl Ord(HOOKLINE)
|
||||
MASKCOUNT* = 1 shl Ord(HOOKCOUNT)
|
||||
|
||||
const
|
||||
IDSIZE* = 60
|
||||
|
||||
type
|
||||
TDebug*{.final.} = object # activation record
|
||||
event*: cint
|
||||
name*: cstring # (n)
|
||||
namewhat*: cstring # (n) `global', `local', `field', `method'
|
||||
what*: cstring # (S) `Lua', `C', `main', `tail'
|
||||
source*: cstring # (S)
|
||||
currentline*: cint # (l)
|
||||
nups*: cint # (u) number of upvalues
|
||||
linedefined*: cint # (S)
|
||||
lastlinedefined*: cint # (S)
|
||||
short_src*: array[0.. <IDSIZE, Char] # (S) \
|
||||
# private part
|
||||
i_ci*: cint # active function
|
||||
|
||||
PDebug* = ptr TDebug
|
||||
Hook* = proc (L: PState, ar: PDebug){.cdecl.}
|
||||
|
||||
#
|
||||
#** ======================================================================
|
||||
#** Debug API
|
||||
#** ======================================================================
|
||||
#
|
||||
|
||||
{.push callConv: cdecl, dynlib: lua.LIB_NAME.}
|
||||
|
||||
proc getstack*(L: PState, level: cint, ar: PDebug): cint{.ilua.}
|
||||
proc getinfo*(L: PState, what: cstring, ar: PDebug): cint{.ilua.}
|
||||
proc getlocal*(L: PState, ar: PDebug, n: cint): cstring{.ilua.}
|
||||
proc setlocal*(L: PState, ar: PDebug, n: cint): cstring{.ilua.}
|
||||
proc getupvalue*(L: PState, funcindex: cint, n: cint): cstring{.ilua.}
|
||||
proc setupvalue*(L: PState, funcindex: cint, n: cint): cstring{.ilua.}
|
||||
proc sethook*(L: PState, func: Hook, mask: cint, count: cint): cint{.ilua.}
|
||||
proc gethook*(L: PState): Hook{.ilua.}
|
||||
proc gethookmask*(L: PState): cint{.ilua.}
|
||||
proc gethookcount*(L: PState): cint{.ilua.}
|
||||
|
||||
{.pop.}
|
||||
|
||||
# implementation
|
||||
|
||||
proc upvalueindex(I: cint): cint =
|
||||
Result = GLOBALSINDEX - i
|
||||
|
||||
proc pop(L: PState, n: cint) =
|
||||
settop(L, - n - 1)
|
||||
|
||||
proc newtable(L: PState) =
|
||||
createtable(L, 0, 0)
|
||||
|
||||
proc register(L: PState, n: cstring, f: CFunction) =
|
||||
pushcfunction(L, f)
|
||||
setglobal(L, n)
|
||||
|
||||
proc pushcfunction(L: PState, f: CFunction) =
|
||||
pushcclosure(L, f, 0)
|
||||
|
||||
proc strlen(L: PState, i: cint): cint =
|
||||
Result = objlen(L, i)
|
||||
|
||||
proc isfunction(L: PState, n: cint): bool =
|
||||
Result = luatype(L, n) == TFUNCTION
|
||||
|
||||
proc istable(L: PState, n: cint): bool =
|
||||
Result = luatype(L, n) == TTABLE
|
||||
|
||||
proc islightuserdata(L: PState, n: cint): bool =
|
||||
Result = luatype(L, n) == TLIGHTUSERDATA
|
||||
|
||||
proc isnil(L: PState, n: cint): bool =
|
||||
Result = luatype(L, n) == TNIL
|
||||
|
||||
proc isboolean(L: PState, n: cint): bool =
|
||||
Result = luatype(L, n) == TBOOLEAN
|
||||
|
||||
proc isthread(L: PState, n: cint): bool =
|
||||
Result = luatype(L, n) == TTHREAD
|
||||
|
||||
proc isnone(L: PState, n: cint): bool =
|
||||
Result = luatype(L, n) == TNONE
|
||||
|
||||
proc isnoneornil(L: PState, n: cint): bool =
|
||||
Result = luatype(L, n) <= 0
|
||||
|
||||
proc pushliteral(L: PState, s: cstring) =
|
||||
pushlstring(L, s, s.len.cint)
|
||||
|
||||
proc setglobal(L: PState, s: cstring) =
|
||||
setfield(L, GLOBALSINDEX, s)
|
||||
|
||||
proc getglobal(L: PState, s: cstring) =
|
||||
getfield(L, GLOBALSINDEX, s)
|
||||
|
||||
proc tostring(L: PState, i: cint): cstring =
|
||||
Result = tolstring(L, i, nil)
|
||||
|
||||
proc getregistry(L: PState) =
|
||||
pushvalue(L, REGISTRYINDEX)
|
||||
|
||||
proc getgccount(L: PState): cint =
|
||||
Result = gc(L, GCCOUNT, 0)
|
||||
@@ -1,64 +0,0 @@
|
||||
#*****************************************************************************
|
||||
# * *
|
||||
# * File: lualib.pas *
|
||||
# * Authors: TeCGraf (C headers + actual Lua libraries) *
|
||||
# * Lavergne Thomas (original translation to Pascal) *
|
||||
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
|
||||
# * Description: Standard Lua libraries *
|
||||
# * *
|
||||
# *****************************************************************************
|
||||
#
|
||||
#** $Id: lualib.h,v 1.28 2003/03/18 12:24:26 roberto Exp $
|
||||
#** Lua standard libraries
|
||||
#** See Copyright Notice in lua.h
|
||||
#
|
||||
#
|
||||
#** Translated to pascal by Lavergne Thomas
|
||||
#** Bug reports :
|
||||
#** - thomas.lavergne@laposte.net
|
||||
#** In french or in english
|
||||
#
|
||||
|
||||
import
|
||||
lua
|
||||
|
||||
const
|
||||
COLIBNAME* = "coroutine"
|
||||
TABLIBNAME* = "table"
|
||||
IOLIBNAME* = "io"
|
||||
OSLIBNAME* = "os"
|
||||
STRLINAME* = "string"
|
||||
MATHLIBNAME* = "math"
|
||||
DBLIBNAME* = "debug"
|
||||
LOADLIBNAME* = "package"
|
||||
|
||||
{.pragma: ilua, importc: "lua$1".}
|
||||
|
||||
{.push callConv: cdecl, dynlib: lua.LIB_NAME.}
|
||||
proc open_base*(L: PState): cint{.ilua.}
|
||||
proc open_table*(L: PState): cint{.ilua.}
|
||||
proc open_io*(L: PState): cint{.ilua.}
|
||||
proc open_string*(L: PState): cint{.ilua.}
|
||||
proc open_math*(L: PState): cint{.ilua.}
|
||||
proc open_debug*(L: PState): cint{.ilua.}
|
||||
proc open_package*(L: PState): cint{.ilua.}
|
||||
proc openlibs*(L: PState){.importc: "luaL_openlibs".}
|
||||
{.pop.}
|
||||
|
||||
proc baselibopen*(L: PState): Bool =
|
||||
open_base(L) != 0'i32
|
||||
|
||||
proc tablibopen*(L: PState): Bool =
|
||||
open_table(L) != 0'i32
|
||||
|
||||
proc iolibopen*(L: PState): Bool =
|
||||
open_io(L) != 0'i32
|
||||
|
||||
proc strlibopen*(L: PState): Bool =
|
||||
open_string(L) != 0'i32
|
||||
|
||||
proc mathlibopen*(L: PState): Bool =
|
||||
open_math(L) != 0'i32
|
||||
|
||||
proc dblibopen*(L: PState): Bool =
|
||||
open_debug(L) != 0'i32
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,865 +0,0 @@
|
||||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2010 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
## This module is a wrapper for the TCL programming language.
|
||||
|
||||
#
|
||||
# tcl.h --
|
||||
#
|
||||
# This header file describes the externally-visible facilities of the Tcl
|
||||
# interpreter.
|
||||
#
|
||||
# Translated to Pascal Copyright (c) 2002 by Max Artemev
|
||||
# aka Bert Raccoon (bert@furry.ru, bert_raccoon@freemail.ru)
|
||||
#
|
||||
#
|
||||
# Copyright (c) 1998-2000 by Scriptics Corporation.
|
||||
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
|
||||
# Copyright (c) 1993-1996 Lucent Technologies.
|
||||
# Copyright (c) 1987-1994 John Ousterhout, The Regents of the
|
||||
# University of California, Berkeley.
|
||||
#
|
||||
# ***********************************************************************
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# ***********************************************************************
|
||||
#
|
||||
|
||||
{.deadCodeElim: on.}
|
||||
|
||||
when defined(WIN32):
|
||||
const
|
||||
dllName = "tcl(85|84|83|82|81|80).dll"
|
||||
elif defined(macosx):
|
||||
const
|
||||
dllName = "libtcl(8.5|8.4|8.3|8.2|8.1).dylib"
|
||||
else:
|
||||
const
|
||||
dllName = "libtcl(8.5|8.4|8.3|8.2|8.1).so(|.1|.0)"
|
||||
const
|
||||
TCL_DESTROYED* = 0xDEADDEAD
|
||||
TCL_OK* = 0
|
||||
TCL_ERROR* = 1
|
||||
TCL_RETURN* = 2
|
||||
TCL_BREAK* = 3
|
||||
TCL_CONTINUE* = 4
|
||||
RESULT_SIZE* = 200
|
||||
MAX_ARGV* = 0x00007FFF
|
||||
VERSION_MAJOR* = 0
|
||||
VERSION_MINOR* = 0
|
||||
NO_EVAL* = 0x00010000
|
||||
EVAL_GLOBAL* = 0x00020000 # Flag values passed to variable-related proc
|
||||
GLOBAL_ONLY* = 1
|
||||
NAMESPACE_ONLY* = 2
|
||||
APPEND_VALUE* = 4
|
||||
LIST_ELEMENT* = 8
|
||||
TRACE_READS* = 0x00000010
|
||||
TRACE_WRITES* = 0x00000020
|
||||
TRACE_UNSETS* = 0x00000040
|
||||
TRACE_DESTROYED* = 0x00000080
|
||||
INTERP_DESTROYED* = 0x00000100
|
||||
LEAVE_ERR_MSG* = 0x00000200
|
||||
PARSE_PART1* = 0x00000400 # Types for linked variables: *
|
||||
LINK_INT* = 1
|
||||
LINK_DOUBLE* = 2
|
||||
LINK_BOOLEAN* = 3
|
||||
LINK_STRING* = 4
|
||||
LINK_READ_ONLY* = 0x00000080
|
||||
SMALL_HASH_TABLE* = 4 # Hash Table *
|
||||
STRING_KEYS* = 0
|
||||
ONE_WORD_KEYS* = 1 # Const/enums Tcl_QueuePosition *
|
||||
|
||||
QUEUE_TAIL* = 0
|
||||
QUEUE_HEAD* = 1
|
||||
QUEUE_MARK* = 2 # Tcl_QueuePosition;
|
||||
# Event Flags
|
||||
DONT_WAIT* = 1 shl 1
|
||||
WINDOW_EVENTS* = 1 shl 2
|
||||
FILE_EVENTS* = 1 shl 3
|
||||
TIMER_EVENTS* = 1 shl 4
|
||||
IDLE_EVENTS* = 1 shl 5 # WAS 0x10 ???? *
|
||||
ALL_EVENTS* = not DONT_WAIT
|
||||
VOLATILE* = 1
|
||||
TCL_STATIC* = 0
|
||||
DYNAMIC* = 3 # Channel
|
||||
TCL_STDIN* = 1 shl 1
|
||||
TCL_STDOUT* = 1 shl 2
|
||||
TCL_STDERR* = 1 shl 3
|
||||
ENFORCE_MODE* = 1 shl 4
|
||||
READABLE* = 1 shl 1
|
||||
WRITABLE* = 1 shl 2
|
||||
EXCEPTION* = 1 shl 3 # POSIX *
|
||||
EPERM* = 1 # Operation not permitted; only the owner of the file (or other
|
||||
# resource) or processes with special privileges can perform the
|
||||
# operation.
|
||||
#
|
||||
ENOENT* = 2 # No such file or directory. This is a "file doesn't exist" error
|
||||
# for ordinary files that are referenced in contexts where they are
|
||||
# expected to already exist.
|
||||
#
|
||||
ESRCH* = 3 # No process matches the specified process ID. *
|
||||
EINTR* = 4 # Interrupted function call; an asynchronous signal occurred and
|
||||
# prevented completion of the call. When this happens, you should
|
||||
# try the call again.
|
||||
#
|
||||
EIO* = 5 # Input/output error; usually used for physical read or write errors. *
|
||||
ENXIO* = 6 # No such device or address. The system tried to use the device
|
||||
# represented by a file you specified, and it couldn't find the
|
||||
# device. This can mean that the device file was installed
|
||||
# incorrectly, or that the physical device is missing or not
|
||||
# correctly attached to the computer.
|
||||
#
|
||||
E2BIG* = 7 # Argument list too long; used when the arguments passed to a new
|
||||
# program being executed with one of the `exec' functions (*note
|
||||
# Executing a File::.) occupy too much memory space. This condition
|
||||
# never arises in the GNU system.
|
||||
#
|
||||
ENOEXEC* = 8 # Invalid executable file format. This condition is detected by the
|
||||
# `exec' functions; see *Note Executing a File::.
|
||||
#
|
||||
EBADF* = 9 # Bad file descriptor; for example, I/O on a descriptor that has been
|
||||
# closed or reading from a descriptor open only for writing (or vice
|
||||
# versa).
|
||||
#
|
||||
ECHILD* = 10 # There are no child processes. This error happens on operations
|
||||
# that are supposed to manipulate child processes, when there aren't
|
||||
# any processes to manipulate.
|
||||
#
|
||||
EDEADLK* = 11 # Deadlock avoided; allocating a system resource would have resulted
|
||||
# in a deadlock situation. The system does not guarantee that it
|
||||
# will notice all such situations. This error means you got lucky
|
||||
# and the system noticed; it might just hang. *Note File Locks::,
|
||||
# for an example.
|
||||
#
|
||||
ENOMEM* = 12 # No memory available. The system cannot allocate more virtual
|
||||
# memory because its capacity is full.
|
||||
#
|
||||
EACCES* = 13 # Permission denied; the file permissions do not allow the attempted
|
||||
# operation.
|
||||
#
|
||||
EFAULT* = 14 # Bad address; an invalid pointer was detected. In the GNU system,
|
||||
# this error never happens; you get a signal instead.
|
||||
#
|
||||
ENOTBLK* = 15 # A file that isn't a block special file was given in a situation
|
||||
# that requires one. For example, trying to mount an ordinary file
|
||||
# as a file system in Unix gives this error.
|
||||
#
|
||||
EBUSY* = 16 # Resource busy; a system resource that can't be shared is already
|
||||
# in use. For example, if you try to delete a file that is the root
|
||||
# of a currently mounted filesystem, you get this error.
|
||||
#
|
||||
EEXIST* = 17 # File exists; an existing file was specified in a context where it
|
||||
# only makes sense to specify a new file.
|
||||
#
|
||||
EXDEV* = 18 # An attempt to make an improper link across file systems was
|
||||
# detected. This happens not only when you use `link' (*note Hard
|
||||
# Links::.) but also when you rename a file with `rename' (*note
|
||||
# Renaming Files::.).
|
||||
#
|
||||
ENODEV* = 19 # The wrong type of device was given to a function that expects a
|
||||
# particular sort of device.
|
||||
#
|
||||
ENOTDIR* = 20 # A file that isn't a directory was specified when a directory is
|
||||
# required.
|
||||
#
|
||||
EISDIR* = 21 # File is a directory; you cannot open a directory for writing, or
|
||||
# create or remove hard links to it.
|
||||
#
|
||||
EINVAL* = 22 # Invalid argument. This is used to indicate various kinds of
|
||||
# problems with passing the wrong argument to a library function.
|
||||
#
|
||||
EMFILE* = 24 # The current process has too many files open and can't open any
|
||||
# more. Duplicate descriptors do count toward this limit.
|
||||
#
|
||||
# In BSD and GNU, the number of open files is controlled by a
|
||||
# resource limit that can usually be increased. If you get this
|
||||
# error, you might want to increase the `RLIMIT_NOFILE' limit or
|
||||
# make it unlimited; *note Limits on Resources::..
|
||||
#
|
||||
ENFILE* = 23 # There are too many distinct file openings in the entire system.
|
||||
# Note that any number of linked channels count as just one file
|
||||
# opening; see *Note Linked Channels::. This error never occurs in
|
||||
# the GNU system.
|
||||
#
|
||||
ENOTTY* = 25 # Inappropriate I/O control operation, such as trying to set terminal
|
||||
# modes on an ordinary file.
|
||||
#
|
||||
ETXTBSY* = 26 # An attempt to execute a file that is currently open for writing, or
|
||||
# write to a file that is currently being executed. Often using a
|
||||
# debugger to run a program is considered having it open for writing
|
||||
# and will cause this error. (The name stands for "text file
|
||||
# busy".) This is not an error in the GNU system; the text is
|
||||
# copied as necessary.
|
||||
#
|
||||
EFBIG* = 27 # File too big; the size of a file would be larger than allowed by
|
||||
# the system.
|
||||
#
|
||||
ENOSPC* = 28 # No space left on device; write operation on a file failed because
|
||||
# the disk is full.
|
||||
#
|
||||
ESPIPE* = 29 # Invalid seek operation (such as on a pipe). *
|
||||
EROFS* = 30 # An attempt was made to modify something on a read-only file system. *
|
||||
EMLINK* = 31 # Too many links; the link count of a single file would become too
|
||||
# large. `rename' can cause this error if the file being renamed
|
||||
# already has as many links as it can take (*note Renaming Files::.).
|
||||
#
|
||||
EPIPE* = 32 # Broken pipe; there is no process reading from the other end of a
|
||||
# pipe. Every library function that returns this error code also
|
||||
# generates a `SIGPIPE' signal; this signal terminates the program
|
||||
# if not handled or blocked. Thus, your program will never actually
|
||||
# see `EPIPE' unless it has handled or blocked `SIGPIPE'.
|
||||
#
|
||||
EDOM* = 33 # Domain error; used by mathematical functions when an argument
|
||||
# value does not fall into the domain over which the function is
|
||||
# defined.
|
||||
#
|
||||
ERANGE* = 34 # Range error; used by mathematical functions when the result value
|
||||
# is not representable because of overflow or underflow.
|
||||
#
|
||||
EAGAIN* = 35 # Resource temporarily unavailable; the call might work if you try
|
||||
# again later. The macro `EWOULDBLOCK' is another name for `EAGAIN';
|
||||
# they are always the same in the GNU C library.
|
||||
#
|
||||
EWOULDBLOCK* = EAGAIN # In the GNU C library, this is another name for `EAGAIN' (above).
|
||||
# The values are always the same, on every operating system.
|
||||
# C libraries in many older Unix systems have `EWOULDBLOCK' as a
|
||||
# separate error code.
|
||||
#
|
||||
EINPROGRESS* = 36 # An operation that cannot complete immediately was initiated on an
|
||||
# object that has non-blocking mode selected. Some functions that
|
||||
# must always block (such as `connect'; *note Connecting::.) never
|
||||
# return `EAGAIN'. Instead, they return `EINPROGRESS' to indicate
|
||||
# that the operation has begun and will take some time. Attempts to
|
||||
# manipulate the object before the call completes return `EALREADY'.
|
||||
# You can use the `select' function to find out when the pending
|
||||
# operation has completed; *note Waiting for I/O::..
|
||||
#
|
||||
EALREADY* = 37 # An operation is already in progress on an object that has
|
||||
# non-blocking mode selected.
|
||||
#
|
||||
ENOTSOCK* = 38 # A file that isn't a socket was specified when a socket is required. *
|
||||
EDESTADDRREQ* = 39 # No default destination address was set for the socket. You get
|
||||
# this error when you try to transmit data over a connectionless
|
||||
# socket, without first specifying a destination for the data with
|
||||
# `connect'.
|
||||
#
|
||||
EMSGSIZE* = 40 # The size of a message sent on a socket was larger than the
|
||||
# supported maximum size.
|
||||
#
|
||||
EPROTOTYPE* = 41 # The socket type does not support the requested communications
|
||||
# protocol.
|
||||
#
|
||||
ENOPROTOOPT* = 42 # You specified a socket option that doesn't make sense for the
|
||||
# particular protocol being used by the socket. *Note Socket
|
||||
# Options::.
|
||||
#
|
||||
EPROTONOSUPPORT* = 43 # The socket domain does not support the requested communications
|
||||
# protocol (perhaps because the requested protocol is completely
|
||||
# invalid.) *Note Creating a Socket::.
|
||||
#
|
||||
ESOCKTNOSUPPORT* = 44 # The socket type is not supported. *
|
||||
EOPNOTSUPP* = 45 # The operation you requested is not supported. Some socket
|
||||
# functions don't make sense for all types of sockets, and others
|
||||
# may not be implemented for all communications protocols. In the
|
||||
# GNU system, this error can happen for many calls when the object
|
||||
# does not support the particular operation; it is a generic
|
||||
# indication that the server knows nothing to do for that call.
|
||||
#
|
||||
EPFNOSUPPORT* = 46 # The socket communications protocol family you requested is not
|
||||
# supported.
|
||||
#
|
||||
EAFNOSUPPORT* = 47 # The address family specified for a socket is not supported; it is
|
||||
# inconsistent with the protocol being used on the socket. *Note
|
||||
# Sockets::.
|
||||
#
|
||||
EADDRINUSE* = 48 # The requested socket address is already in use. *Note Socket
|
||||
# Addresses::.
|
||||
#
|
||||
EADDRNOTAVAIL* = 49 # The requested socket address is not available; for example, you
|
||||
# tried to give a socket a name that doesn't match the local host
|
||||
# name. *Note Socket Addresses::.
|
||||
#
|
||||
ENETDOWN* = 50 # A socket operation failed because the network was down. *
|
||||
ENETUNREACH* = 51 # A socket operation failed because the subnet containing the remote
|
||||
# host was unreachable.
|
||||
#
|
||||
ENETRESET* = 52 # A network connection was reset because the remote host crashed. *
|
||||
ECONNABORTED* = 53 # A network connection was aborted locally. *
|
||||
ECONNRESET* = 54 # A network connection was closed for reasons outside the control of
|
||||
# the local host, such as by the remote machine rebooting or an
|
||||
# unrecoverable protocol violation.
|
||||
#
|
||||
ENOBUFS* = 55 # The kernel's buffers for I/O operations are all in use. In GNU,
|
||||
# this error is always synonymous with `ENOMEM'; you may get one or
|
||||
# the other from network operations.
|
||||
#
|
||||
EISCONN* = 56 # You tried to connect a socket that is already connected. *Note
|
||||
# Connecting::.
|
||||
#
|
||||
ENOTCONN* = 57 # The socket is not connected to anything. You get this error when
|
||||
# you try to transmit data over a socket, without first specifying a
|
||||
# destination for the data. For a connectionless socket (for
|
||||
# datagram protocols, such as UDP), you get `EDESTADDRREQ' instead.
|
||||
#
|
||||
ESHUTDOWN* = 58 # The socket has already been shut down. *
|
||||
ETOOMANYREFS* = 59 # ??? *
|
||||
ETIMEDOUT* = 60 # A socket operation with a specified timeout received no response
|
||||
# during the timeout period.
|
||||
#
|
||||
ECONNREFUSED* = 61 # A remote host refused to allow the network connection (typically
|
||||
# because it is not running the requested service).
|
||||
#
|
||||
ELOOP* = 62 # Too many levels of symbolic links were encountered in looking up a
|
||||
# file name. This often indicates a cycle of symbolic links.
|
||||
#
|
||||
ENAMETOOLONG* = 63 # Filename too long (longer than `PATH_MAX'; *note Limits for
|
||||
# Files::.) or host name too long (in `gethostname' or
|
||||
# `sethostname'; *note Host Identification::.).
|
||||
#
|
||||
EHOSTDOWN* = 64 # The remote host for a requested network connection is down. *
|
||||
EHOSTUNREACH* = 65 # The remote host for a requested network connection is not
|
||||
# reachable.
|
||||
#
|
||||
ENOTEMPTY* = 66 # Directory not empty, where an empty directory was expected.
|
||||
# Typically, this error occurs when you are trying to delete a
|
||||
# directory.
|
||||
#
|
||||
EPROCLIM* = 67 # This means that the per-user limit on new process would be
|
||||
# exceeded by an attempted `fork'. *Note Limits on Resources::, for
|
||||
# details on the `RLIMIT_NPROC' limit.
|
||||
#
|
||||
EUSERS* = 68 # The file quota system is confused because there are too many users. *
|
||||
EDQUOT* = 69 # The user's disk quota was exceeded. *
|
||||
ESTALE* = 70 # Stale NFS file handle. This indicates an internal confusion in
|
||||
# the NFS system which is due to file system rearrangements on the
|
||||
# server host. Repairing this condition usually requires unmounting
|
||||
# and remounting the NFS file system on the local host.
|
||||
#
|
||||
EREMOTE* = 71 # An attempt was made to NFS-mount a remote file system with a file
|
||||
# name that already specifies an NFS-mounted file. (This is an
|
||||
# error on some operating systems, but we expect it to work properly
|
||||
# on the GNU system, making this error code impossible.)
|
||||
#
|
||||
EBADRPC* = 72 # ??? *
|
||||
ERPCMISMATCH* = 73 # ??? *
|
||||
EPROGUNAVAIL* = 74 # ??? *
|
||||
EPROGMISMATCH* = 75 # ??? *
|
||||
EPROCUNAVAIL* = 76 # ??? *
|
||||
ENOLCK* = 77 # No locks available. This is used by the file locking facilities;
|
||||
# see *Note File Locks::. This error is never generated by the GNU
|
||||
# system, but it can result from an operation to an NFS server
|
||||
# running another operating system.
|
||||
#
|
||||
ENOSYS* = 78 # Function not implemented. Some functions have commands or options
|
||||
# defined that might not be supported in all implementations, and
|
||||
# this is the kind of error you get if you request them and they are
|
||||
# not supported.
|
||||
#
|
||||
EFTYPE* = 79 # Inappropriate file type or format. The file was the wrong type
|
||||
# for the operation, or a data file had the wrong format.
|
||||
# On some systems `chmod' returns this error if you try to set the
|
||||
# sticky bit on a non-directory file; *note Setting Permissions::..
|
||||
#
|
||||
|
||||
type
|
||||
TArgv* = cstringArray
|
||||
TClientData* = pointer
|
||||
TFreeProc* = proc (theBlock: pointer){.cdecl.}
|
||||
PInterp* = ptr TInterp
|
||||
TInterp*{.final.} = object # Event Definitions
|
||||
result*: cstring # Do not access this directly. Use
|
||||
# Tcl_GetStringResult since result
|
||||
# may be pointing to an object
|
||||
freeProc*: TFreeProc
|
||||
errorLine*: int
|
||||
|
||||
TEventSetupProc* = proc (clientData: TClientData, flags: int){.cdecl.}
|
||||
TEventCheckProc* = TEventSetupProc
|
||||
PEvent* = ptr TEvent
|
||||
TEventProc* = proc (evPtr: PEvent, flags: int): int{.cdecl.}
|
||||
TEvent*{.final.} = object
|
||||
prc*: TEventProc
|
||||
nextPtr*: PEvent
|
||||
ClientData*: TObject # ClientData is just pointer.*
|
||||
|
||||
PTime* = ptr TTime
|
||||
TTime*{.final.} = object
|
||||
sec*: int32 # Seconds. *
|
||||
usec*: int32 # Microseconds. *
|
||||
|
||||
TTimerToken* = pointer
|
||||
PInteger* = ptr int
|
||||
PHashTable* = ptr THashTable
|
||||
PHashEntry* = ptr THashEntry
|
||||
PPHashEntry* = ptr PHashEntry
|
||||
THashEntry*{.final.} = object
|
||||
nextPtr*: PHashEntry
|
||||
tablePtr*: PHashTable
|
||||
bucketPtr*: PPHashEntry
|
||||
clientData*: TClientData
|
||||
key*: cstring
|
||||
|
||||
THashFindProc* = proc (tablePtr: PHashTable, key: cstring): PHashEntry{.
|
||||
cdecl.}
|
||||
THashCreateProc* = proc (tablePtr: PHashTable, key: cstring,
|
||||
newPtr: PInteger): PHashEntry{.cdecl.}
|
||||
THashTable*{.final.} = object
|
||||
buckets*: ppHashEntry
|
||||
staticBuckets*: array[0..SMALL_HASH_TABLE - 1, PHashEntry]
|
||||
numBuckets*: int
|
||||
numEntries*: int
|
||||
rebuildSize*: int
|
||||
downShift*: int
|
||||
mask*: int
|
||||
keyType*: int
|
||||
findProc*: THashFindProc
|
||||
createProc*: THashCreateProc
|
||||
|
||||
PHashSearch* = ptr THashSearch
|
||||
THashSearch*{.final.} = object
|
||||
tablePtr*: PHashTable
|
||||
nextIndex*: int
|
||||
nextEntryPtr*: PHashEntry
|
||||
|
||||
TAppInitProc* = proc (interp: pInterp): int{.cdecl.}
|
||||
TPackageInitProc* = proc (interp: pInterp): int{.cdecl.}
|
||||
TCmdProc* = proc (clientData: TClientData, interp: pInterp, argc: int,
|
||||
argv: TArgv): int{.cdecl.}
|
||||
TVarTraceProc* = proc (clientData: TClientData, interp: pInterp,
|
||||
varName: cstring, elemName: cstring, flags: int): cstring{.
|
||||
cdecl.}
|
||||
TInterpDeleteProc* = proc (clientData: TClientData, interp: pInterp){.cdecl.}
|
||||
TCmdDeleteProc* = proc (clientData: TClientData){.cdecl.}
|
||||
TNamespaceDeleteProc* = proc (clientData: TClientData){.cdecl.}
|
||||
|
||||
const
|
||||
DSTRING_STATIC_SIZE* = 200
|
||||
|
||||
type
|
||||
PDString* = ptr TDString
|
||||
TDString*{.final.} = object
|
||||
str*: cstring
|
||||
len*: int
|
||||
spaceAvl*: int
|
||||
staticSpace*: array[0..DSTRING_STATIC_SIZE - 1, char]
|
||||
|
||||
PChannel* = ptr TChannel
|
||||
TChannel*{.final.} = object
|
||||
TDriverBlockModeProc* = proc (instanceData: TClientData, mode: int): int{.
|
||||
cdecl.}
|
||||
TDriverCloseProc* = proc (instanceData: TClientData, interp: PInterp): int{.
|
||||
cdecl.}
|
||||
TDriverInputProc* = proc (instanceData: TClientData, buf: cstring,
|
||||
toRead: int, errorCodePtr: PInteger): int{.cdecl.}
|
||||
TDriverOutputProc* = proc (instanceData: TClientData, buf: cstring,
|
||||
toWrite: int, errorCodePtr: PInteger): int{.cdecl.}
|
||||
TDriverSeekProc* = proc (instanceData: TClientData, offset: int32,
|
||||
mode: int, errorCodePtr: PInteger): int{.cdecl.}
|
||||
TDriverSetOptionProc* = proc (instanceData: TClientData, interp: PInterp,
|
||||
optionName: cstring, value: cstring): int{.cdecl.}
|
||||
TDriverGetOptionProc* = proc (instanceData: TClientData, interp: pInterp,
|
||||
optionName: cstring, dsPtr: PDString): int{.
|
||||
cdecl.}
|
||||
TDriverWatchProc* = proc (instanceData: TClientData, mask: int){.cdecl.}
|
||||
TDriverGetHandleProc* = proc (instanceData: TClientData, direction: int,
|
||||
handlePtr: var TClientData): int{.cdecl.}
|
||||
PChannelType* = ptr TChannelType
|
||||
TChannelType*{.final.} = object
|
||||
typeName*: cstring
|
||||
blockModeProc*: TDriverBlockModeProc
|
||||
closeProc*: TDriverCloseProc
|
||||
inputProc*: TDriverInputProc
|
||||
ouputProc*: TDriverOutputProc
|
||||
seekProc*: TDriverSeekProc
|
||||
setOptionProc*: TDriverSetOptionProc
|
||||
getOptionProc*: TDriverGetOptionProc
|
||||
watchProc*: TDriverWatchProc
|
||||
getHandleProc*: TDriverGetHandleProc
|
||||
|
||||
TChannelProc* = proc (clientData: TClientData, mask: int){.cdecl.}
|
||||
PObj* = ptr TObj
|
||||
PPObj* = ptr PObj
|
||||
TObj*{.final.} = object
|
||||
refCount*: int # ...
|
||||
|
||||
TObjCmdProc* = proc (clientData: TClientData, interp: PInterp, objc: int,
|
||||
PPObj: PPObj): int{.cdecl.}
|
||||
PNamespace* = ptr TNamespace
|
||||
TNamespace*{.final.} = object
|
||||
name*: cstring
|
||||
fullName*: cstring
|
||||
clientData*: TClientData
|
||||
deleteProc*: TNamespaceDeleteProc
|
||||
parentPtr*: PNamespace
|
||||
|
||||
PCallFrame* = ptr TCallFrame
|
||||
TCallFrame*{.final.} = object
|
||||
nsPtr*: PNamespace
|
||||
dummy1*: int
|
||||
dummy2*: int
|
||||
dummy3*: cstring
|
||||
dummy4*: cstring
|
||||
dummy5*: cstring
|
||||
dummy6*: int
|
||||
dummy7*: cstring
|
||||
dummy8*: cstring
|
||||
dummy9*: int
|
||||
dummy10*: cstring
|
||||
|
||||
PCmdInfo* = ptr TCmdInfo
|
||||
TCmdInfo*{.final.} = object
|
||||
isNativeObjectProc*: int
|
||||
objProc*: TObjCmdProc
|
||||
objClientData*: TClientData
|
||||
prc*: TCmdProc
|
||||
clientData*: TClientData
|
||||
deleteProc*: TCmdDeleteProc
|
||||
deleteData*: TClientData
|
||||
namespacePtr*: pNamespace
|
||||
|
||||
pCommand* = ptr TCommand
|
||||
TCommand*{.final.} = object # hPtr : pTcl_HashEntry;
|
||||
# nsPtr : pTcl_Namespace;
|
||||
# refCount : integer;
|
||||
# isCmdEpoch : integer;
|
||||
# compileProc : pointer;
|
||||
# objProc : pointer;
|
||||
# objClientData : Tcl_ClientData;
|
||||
# proc : pointer;
|
||||
# clientData : Tcl_ClientData;
|
||||
# deleteProc : TTclCmdDeleteProc;
|
||||
# deleteData : Tcl_ClientData;
|
||||
# deleted : integer;
|
||||
# importRefPtr : pointer;
|
||||
#
|
||||
|
||||
type
|
||||
TPanicProc* = proc (fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8: cstring){.
|
||||
cdecl.} # 1/15/97 orig. Tcl style
|
||||
TClientDataProc* = proc (clientData: TClientData){.cdecl.}
|
||||
TIdleProc* = proc (clientData: TClientData){.cdecl.}
|
||||
TTimerProc* = TIdleProc
|
||||
TCreateCloseHandler* = proc (channel: pChannel, prc: TClientDataProc,
|
||||
clientData: TClientData){.cdecl.}
|
||||
TDeleteCloseHandler* = TCreateCloseHandler
|
||||
TEventDeleteProc* = proc (evPtr: pEvent, clientData: TClientData): int{.
|
||||
cdecl.}
|
||||
|
||||
proc Alloc*(size: int): cstring{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Alloc".}
|
||||
proc CreateInterp*(): pInterp{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_CreateInterp".}
|
||||
proc DeleteInterp*(interp: pInterp){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_DeleteInterp".}
|
||||
proc ResetResult*(interp: pInterp){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_ResetResult".}
|
||||
proc Eval*(interp: pInterp, script: cstring): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Eval".}
|
||||
proc EvalFile*(interp: pInterp, filename: cstring): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_EvalFile".}
|
||||
proc AddErrorInfo*(interp: pInterp, message: cstring){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_AddErrorInfo".}
|
||||
proc BackgroundError*(interp: pInterp){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_BackgroundError".}
|
||||
proc CreateCommand*(interp: pInterp, name: cstring, cmdProc: TCmdProc,
|
||||
clientData: TClientData, deleteProc: TCmdDeleteProc): pCommand{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_CreateCommand".}
|
||||
proc DeleteCommand*(interp: pInterp, name: cstring): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_DeleteCommand".}
|
||||
proc CallWhenDeleted*(interp: pInterp, prc: TInterpDeleteProc,
|
||||
clientData: TClientData){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_CallWhenDeleted".}
|
||||
proc DontCallWhenDeleted*(interp: pInterp, prc: TInterpDeleteProc,
|
||||
clientData: TClientData){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_DontCallWhenDeleted".}
|
||||
proc CommandComplete*(cmd: cstring): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_CommandComplete".}
|
||||
proc LinkVar*(interp: pInterp, varName: cstring, varAddr: pointer, typ: int): int{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_LinkVar".}
|
||||
proc UnlinkVar*(interp: pInterp, varName: cstring){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_UnlinkVar".}
|
||||
proc TraceVar*(interp: pInterp, varName: cstring, flags: int,
|
||||
prc: TVarTraceProc, clientData: TClientData): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_TraceVar".}
|
||||
proc TraceVar2*(interp: pInterp, varName: cstring, elemName: cstring,
|
||||
flags: int, prc: TVarTraceProc, clientData: TClientData): int{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_TraceVar2".}
|
||||
proc UntraceVar*(interp: pInterp, varName: cstring, flags: int,
|
||||
prc: TVarTraceProc, clientData: TClientData){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_UntraceVar".}
|
||||
proc UntraceVar2*(interp: pInterp, varName: cstring, elemName: cstring,
|
||||
flags: int, prc: TVarTraceProc, clientData: TClientData){.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_UntraceVar2".}
|
||||
proc GetVar*(interp: pInterp, varName: cstring, flags: int): cstring{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_GetVar".}
|
||||
proc GetVar2*(interp: pInterp, varName: cstring, elemName: cstring,
|
||||
flags: int): cstring{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_GetVar2".}
|
||||
proc SetVar*(interp: pInterp, varName: cstring, newValue: cstring,
|
||||
flags: int): cstring{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_SetVar".}
|
||||
proc SetVar2*(interp: pInterp, varName: cstring, elemName: cstring,
|
||||
newValue: cstring, flags: int): cstring{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_SetVar2".}
|
||||
proc UnsetVar*(interp: pInterp, varName: cstring, flags: int): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_UnsetVar".}
|
||||
proc UnsetVar2*(interp: pInterp, varName: cstring, elemName: cstring,
|
||||
flags: int): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_UnsetVar2".}
|
||||
proc SetResult*(interp: pInterp, newValue: cstring, freeProc: TFreeProc){.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_SetResult".}
|
||||
proc FirstHashEntry*(hashTbl: pHashTable, searchInfo: var THashSearch): pHashEntry{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_FirstHashEntry".}
|
||||
proc NextHashEntry*(searchInfo: var THashSearch): pHashEntry{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_NextHashEntry".}
|
||||
proc InitHashTable*(hashTbl: pHashTable, keyType: int){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_InitHashTable".}
|
||||
proc StringMatch*(str: cstring, pattern: cstring): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_StringMatch".}
|
||||
proc GetErrno*(): int{.cdecl, dynlib: dllName, importc: "Tcl_GetErrno".}
|
||||
proc SetErrno*(val: int){.cdecl, dynlib: dllName, importc: "Tcl_SetErrno".}
|
||||
proc SetPanicProc*(prc: TPanicProc){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_SetPanicProc".}
|
||||
proc PkgProvide*(interp: pInterp, name: cstring, version: cstring): int{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_PkgProvide".}
|
||||
proc StaticPackage*(interp: pInterp, pkgName: cstring,
|
||||
initProc: TPackageInitProc,
|
||||
safeInitProc: TPackageInitProc){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_StaticPackage".}
|
||||
proc CreateEventSource*(setupProc: TEventSetupProc,
|
||||
checkProc: TEventCheckProc,
|
||||
clientData: TClientData){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_CreateEventSource".}
|
||||
proc DeleteEventSource*(setupProc: TEventSetupProc,
|
||||
checkProc: TEventCheckProc,
|
||||
clientData: TClientData){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_DeleteEventSource".}
|
||||
proc QueueEvent*(evPtr: pEvent, pos: int){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_QueueEvent".}
|
||||
proc SetMaxBlockTime*(timePtr: pTime){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_SetMaxBlockTime".}
|
||||
proc DeleteEvents*(prc: TEventDeleteProc, clientData: TClientData){.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_DeleteEvents".}
|
||||
proc DoOneEvent*(flags: int): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_DoOneEvent".}
|
||||
proc DoWhenIdle*(prc: TIdleProc, clientData: TClientData){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_DoWhenIdle".}
|
||||
proc CancelIdleCall*(prc: TIdleProc, clientData: TClientData){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_CancelIdleCall".}
|
||||
proc CreateTimerHandler*(milliseconds: int, prc: TTimerProc,
|
||||
clientData: TClientData): TTimerToken{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_CreateTimerHandler".}
|
||||
proc DeleteTimerHandler*(token: TTimerToken){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_DeleteTimerHandler".}
|
||||
# procedure Tcl_CreateModalTimeout(milliseconds: integer; prc: TTclTimerProc; clientData: Tcl_ClientData); cdecl; external dllName;
|
||||
# procedure Tcl_DeleteModalTimeout(prc: TTclTimerProc; clientData: Tcl_ClientData); cdecl; external dllName;
|
||||
proc SplitList*(interp: pInterp, list: cstring, argcPtr: var int,
|
||||
argvPtr: var TArgv): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_SplitList".}
|
||||
proc Merge*(argc: int, argv: TArgv): cstring{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Merge".}
|
||||
proc Free*(p: cstring){.cdecl, dynlib: dllName, importc: "Tcl_Free".}
|
||||
proc Init*(interp: pInterp): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Init".}
|
||||
# procedure Tcl_InterpDeleteProc(clientData: Tcl_ClientData; interp: pTcl_Interp); cdecl; external dllName;
|
||||
proc GetAssocData*(interp: pInterp, key: cstring, prc: var TInterpDeleteProc): TClientData{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_GetAssocData".}
|
||||
proc DeleteAssocData*(interp: pInterp, key: cstring){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_DeleteAssocData".}
|
||||
proc SetAssocData*(interp: pInterp, key: cstring, prc: TInterpDeleteProc,
|
||||
clientData: TClientData){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_SetAssocData".}
|
||||
proc IsSafe*(interp: pInterp): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_IsSafe".}
|
||||
proc MakeSafe*(interp: pInterp): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_MakeSafe".}
|
||||
proc CreateSlave*(interp: pInterp, slaveName: cstring, isSafe: int): pInterp{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_CreateSlave".}
|
||||
proc GetSlave*(interp: pInterp, slaveName: cstring): pInterp{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_GetSlave".}
|
||||
proc GetMaster*(interp: pInterp): pInterp{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_GetMaster".}
|
||||
proc GetInterpPath*(askingInterp: pInterp, slaveInterp: pInterp): int{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_GetInterpPath".}
|
||||
proc CreateAlias*(slaveInterp: pInterp, srcCmd: cstring,
|
||||
targetInterp: pInterp, targetCmd: cstring, argc: int,
|
||||
argv: TArgv): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_CreateAlias".}
|
||||
proc GetAlias*(interp: pInterp, srcCmd: cstring, targetInterp: var pInterp,
|
||||
targetCmd: var cstring, argc: var int, argv: var TArgv): int{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_GetAlias".}
|
||||
proc ExposeCommand*(interp: pInterp, hiddenCmdName: cstring,
|
||||
cmdName: cstring): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_ExposeCommand".}
|
||||
proc HideCommand*(interp: pInterp, cmdName: cstring, hiddenCmdName: cstring): int{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_HideCommand".}
|
||||
proc EventuallyFree*(clientData: TClientData, freeProc: TFreeProc){.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_EventuallyFree".}
|
||||
proc Preserve*(clientData: TClientData){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Preserve".}
|
||||
proc Release*(clientData: TClientData){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Release".}
|
||||
proc InterpDeleted*(interp: pInterp): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_InterpDeleted".}
|
||||
proc GetCommandInfo*(interp: pInterp, cmdName: cstring,
|
||||
info: var TCmdInfo): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_GetCommandInfo".}
|
||||
proc SetCommandInfo*(interp: pInterp, cmdName: cstring,
|
||||
info: var TCmdInfo): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_SetCommandInfo".}
|
||||
proc FindExecutable*(path: cstring){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_FindExecutable".}
|
||||
proc GetStringResult*(interp: pInterp): cstring{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_GetStringResult".}
|
||||
#v1.0
|
||||
proc FindCommand*(interp: pInterp, cmdName: cstring,
|
||||
contextNsPtr: pNamespace, flags: int): TCommand{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_FindCommand".}
|
||||
#v1.0
|
||||
proc DeleteCommandFromToken*(interp: pInterp, cmd: pCommand): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_DeleteCommandFromToken".}
|
||||
proc CreateNamespace*(interp: pInterp, name: cstring,
|
||||
clientData: TClientData,
|
||||
deleteProc: TNamespaceDeleteProc): pNamespace{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_CreateNamespace".}
|
||||
#v1.0
|
||||
proc DeleteNamespace*(namespacePtr: pNamespace){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_DeleteNamespace".}
|
||||
proc FindNamespace*(interp: pInterp, name: cstring,
|
||||
contextNsPtr: pNamespace, flags: int): pNamespace{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_FindNamespace".}
|
||||
proc Tcl_Export*(interp: pInterp, namespacePtr: pNamespace, pattern: cstring,
|
||||
resetListFirst: int): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Export".}
|
||||
proc Tcl_Import*(interp: pInterp, namespacePtr: pNamespace, pattern: cstring,
|
||||
allowOverwrite: int): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Import".}
|
||||
proc GetCurrentNamespace*(interp: pInterp): pNamespace{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_GetCurrentNamespace".}
|
||||
proc GetGlobalNamespace*(interp: pInterp): pNamespace{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_GetGlobalNamespace".}
|
||||
proc PushCallFrame*(interp: pInterp, callFramePtr: var TCallFrame,
|
||||
namespacePtr: pNamespace, isProcCallFrame: int): int{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_PushCallFrame".}
|
||||
proc PopCallFrame*(interp: pInterp){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_PopCallFrame".}
|
||||
proc VarEval*(interp: pInterp): int{.cdecl, varargs, dynlib: dllName,
|
||||
importc: "Tcl_VarEval".}
|
||||
# For TkConsole.c *
|
||||
proc RecordAndEval*(interp: pInterp, cmd: cstring, flags: int): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_RecordAndEval".}
|
||||
proc GlobalEval*(interp: pInterp, command: cstring): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_GlobalEval".}
|
||||
proc DStringFree*(dsPtr: pDString){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_DStringFree".}
|
||||
proc DStringAppend*(dsPtr: pDString, str: cstring, length: int): cstring{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_DStringAppend".}
|
||||
proc DStringAppendElement*(dsPtr: pDString, str: cstring): cstring{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_DStringAppendElement".}
|
||||
proc DStringInit*(dsPtr: pDString){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_DStringInit".}
|
||||
proc AppendResult*(interp: pInterp){.cdecl, varargs, dynlib: dllName,
|
||||
importc: "Tcl_AppendResult".}
|
||||
# actually a "C" var array
|
||||
proc SetStdChannel*(channel: pChannel, typ: int){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_SetStdChannel".}
|
||||
proc SetChannelOption*(interp: pInterp, chan: pChannel, optionName: cstring,
|
||||
newValue: cstring): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_SetChannelOption".}
|
||||
proc GetChannelOption*(interp: pInterp, chan: pChannel, optionName: cstring,
|
||||
dsPtr: pDString): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_GetChannelOption".}
|
||||
proc CreateChannel*(typePtr: pChannelType, chanName: cstring,
|
||||
instanceData: TClientData, mask: int): pChannel{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_CreateChannel".}
|
||||
proc RegisterChannel*(interp: pInterp, channel: pChannel){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_RegisterChannel".}
|
||||
proc UnregisterChannel*(interp: pInterp, channel: pChannel): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_UnregisterChannel".}
|
||||
proc CreateChannelHandler*(chan: pChannel, mask: int, prc: TChannelProc,
|
||||
clientData: TClientData){.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_CreateChannelHandler".}
|
||||
proc GetChannel*(interp: pInterp, chanName: cstring, modePtr: pInteger): pChannel{.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_GetChannel".}
|
||||
proc GetStdChannel*(typ: int): pChannel{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_GetStdChannel".}
|
||||
proc Gets*(chan: pChannel, dsPtr: pDString): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Gets".}
|
||||
proc Write*(chan: pChannel, s: cstring, slen: int): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_Write".}
|
||||
proc Flush*(chan: pChannel): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_Flush".}
|
||||
# TclWinLoadLibrary = function(name: PChar): HMODULE; cdecl; external dllName;
|
||||
proc CreateExitHandler*(prc: TClientDataProc, clientData: TClientData){.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_CreateExitHandler".}
|
||||
proc DeleteExitHandler*(prc: TClientDataProc, clientData: TClientData){.
|
||||
cdecl, dynlib: dllName, importc: "Tcl_DeleteExitHandler".}
|
||||
proc GetStringFromObj*(pObj: pObj, pLen: pInteger): cstring{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_GetStringFromObj".}
|
||||
proc CreateObjCommand*(interp: pInterp, name: cstring, cmdProc: TObjCmdProc,
|
||||
clientData: TClientData,
|
||||
deleteProc: TCmdDeleteProc): pCommand{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_CreateObjCommand".}
|
||||
proc NewStringObj*(bytes: cstring, length: int): pObj{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_NewStringObj".}
|
||||
# procedure TclFreeObj(pObj: pTcl_Obj); cdecl; external dllName;
|
||||
proc EvalObj*(interp: pInterp, pObj: pObj): int{.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_EvalObj".}
|
||||
proc GlobalEvalObj*(interp: pInterp, pObj: pObj): int{.cdecl,
|
||||
dynlib: dllName, importc: "Tcl_GlobalEvalObj".}
|
||||
proc RegComp*(exp: cstring): pointer{.cdecl, dynlib: dllName,
|
||||
importc: "TclRegComp".}
|
||||
|
||||
proc RegExec*(prog: pointer, str: cstring, start: cstring): int{.cdecl,
|
||||
dynlib: dllName, importc: "TclRegExec".}
|
||||
|
||||
proc RegError*(msg: cstring){.cdecl, dynlib: dllName, importc: "TclRegError".}
|
||||
|
||||
proc GetRegError*(): cstring{.cdecl, dynlib: dllName,
|
||||
importc: "TclGetRegError".}
|
||||
|
||||
proc RegExpRange*(prog: pointer, index: int, head: var cstring,
|
||||
tail: var cstring){.cdecl, dynlib: dllName,
|
||||
importc: "Tcl_RegExpRange".}
|
||||
|
||||
proc GetCommandTable*(interp: pInterp): pHashTable =
|
||||
if interp != nil:
|
||||
result = cast[pHashTable](cast[int](interp) + sizeof(Interp) +
|
||||
sizeof(pointer))
|
||||
|
||||
proc CreateHashEntry*(tablePtr: pHashTable, key: cstring,
|
||||
newPtr: pInteger): pHashEntry =
|
||||
result = cast[pHashTable](tablePtr).createProc(tablePtr, key, newPtr)
|
||||
|
||||
proc FindHashEntry*(tablePtr: pHashTable, key: cstring): pHashEntry =
|
||||
result = cast[pHashTable](tablePtr).findProc(tablePtr, key)
|
||||
|
||||
proc SetHashValue*(h: pHashEntry, clientData: TClientData) =
|
||||
h.clientData = clientData
|
||||
|
||||
proc GetHashValue*(h: pHashEntry): TClientData =
|
||||
result = h.clientData
|
||||
|
||||
proc IncrRefCount*(pObj: pObj) =
|
||||
inc(pObj.refCount)
|
||||
|
||||
proc DecrRefCount*(pObj: pObj) =
|
||||
dec(pObj.refCount)
|
||||
if pObj.refCount <= 0:
|
||||
dealloc(pObj)
|
||||
|
||||
proc IsShared*(pObj: pObj): bool =
|
||||
return pObj.refCount > 1
|
||||
|
||||
proc GetHashKey*(hashTbl: pHashTable, hashEntry: pHashEntry): cstring =
|
||||
if hashTbl == nil or hashEntry == nil:
|
||||
result = nil
|
||||
else:
|
||||
result = hashEntry.key
|
||||
Reference in New Issue
Block a user