3
# Low-level stack data structure. With wrapping usable as
6
# Copyright (c) 2008-2011 Andreas Kupries <andreas_kupries@users.sourceforge.net>
8
# Example of exporting a C-level stubs API through critcl v3, with a
9
# package header file containing public type definitions, macros,
10
# etc., and internal C companion files.
12
# # ## ### ##### ######## ############# #####################
15
package require Tcl 8.4
16
package require critcl 3 ;# stubs management
18
# # ## ### ##### ######## ############# #####################
21
critcl::license {Andreas Kupries} BSD
23
critcl::summary {A C-level abstract datatype for stacks}
26
This package implements an abstract
27
data type for stacks, at the C-level.
28
No Tcl-binding is provided. See package
33
critcl::subject {data structure}
34
critcl::subject structure
35
critcl::subject {abstract data structure}
36
critcl::subject {generic data structure}
38
# # ## ### ##### ######## ############# #####################
41
critcl::api header cstack.h
42
critcl::cheaders cstackInt.h
44
# # ## ### ##### ######## ############# #####################
49
# - push -- Item allocation is responsibility of caller.
50
# Stack takes ownership of the item.
51
# - pop -- Stack frees allocated item.
53
# - top -- Provides top item, no transfer of ownership.
54
# - del -- Releases stack, cell array, and items, if any.
55
# - drop -- Like pop, but doesn't free, assumes that caller
56
# is taking ownership of the pointer.
59
critcl::api function CSTACK cstack_new {CSTACK_CELL_FREE freeCell void* clientdata}
60
critcl::api function void cstack_del {CSTACK s}
62
critcl::api function {long int} cstack_size {CSTACK s}
63
critcl::api function void* cstack_top {CSTACK s}
64
critcl::api function void cstack_push {CSTACK s void* item}
65
critcl::api function void cstack_pop {CSTACK s {long int} n}
66
critcl::api function void cstack_trim {CSTACK s {long int} n}
67
critcl::api function void cstack_drop {CSTACK s {long int} n}
68
critcl::api function void cstack_rol {CSTACK s {long int} n {long int} step}
69
critcl::api function void cstack_get {CSTACK s {long int} n CSTACK_DIRECTION dir CSTACK_SLICE* slice}
70
critcl::api function void cstack_move {CSTACK s CSTACK src}
72
critcl::api function void cstack_clientdata_set {CSTACK s void* clientdata}
73
critcl::api function void* cstack_clientdata_get {CSTACK s}
75
# # ## ### ##### ######## ############# #####################
78
critcl::csources cstack.c
79
critcl::ccode {} ; # Fake the 'nothing to build detector'
81
# ### ### ### ######### ######### #########
83
package provide cstack 1