Welcome to Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c). Type :help for assistance.
1> :help
The REPL (Read-Eval-Print-Loop) acts like an interpreter. Valid statements, expressions, and declarations are immediately compiled
and executed.
The complete set of LLDB debugging commands are also available as described below. Commands must be prefixed with a colon at the
REPL prompt (:quit for example.) Typing just a colon followed by return will switch to the LLDB prompt.
Debugger commands:
apropos -- Find a list of debugger commands related to a particular word/subject.
breakpoint -- A set of commands for operating on breakpoints. Also see _regexp-break.
bugreport -- Set of commands for creating domain specific bugreports.
command -- A set of commands for managing or customizing the debugger commands.
disassemble -- Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.
expression -- Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined variables and
variables currently in scope.
frame -- A set of commands for operating on the current thread's frames.
gdb-remote -- Connect to a remote GDB server. If no hostname is provided, localhost is assumed.
gui -- Switch into the curses based GUI mode.
help -- Show a list of all debugger commands, or give details about specific commands.
kdp-remote -- Connect to a remote KDP server. udp port 41139 is the default port number.
language -- A set of commands for managing language-specific functionality.'.
log -- A set of commands for operating on logs.
memory -- A set of commands for operating on memory.
platform -- A set of commands to manage and create platforms.
plugin -- A set of commands for managing or customizing plugin commands.
process -- A set of commands for operating on a process.
quit -- Quit out of the LLDB debugger.
register -- A set of commands to access thread registers.
script -- Pass an expression to the script interpreter for evaluation and return the results. Drop into the
interactive interpreter if no expression is given.
settings -- A set of commands for manipulating internal settable debugger variables.
source -- A set of commands for accessing source file information
target -- A set of commands for operating on debugger targets.
thread -- A set of commands for operating on one or more threads within a running process.
type -- A set of commands for operating on the type system
version -- Show version of LLDB debugger.
watchpoint -- A set of commands for operating on watchpoints.
Current command abbreviations (type ':help command alias' for more info):
add-dsym -- ('target symbols add') Add a debug symbol file to one of the target's current modules by specifying a path to a
debug symbols file, or using the options to specify a module to download symbols for.
attach -- ('_regexp-attach') Attach to a process id if in decimal, otherwise treat the argument as a process name to attach
to.
b -- ('_regexp-break') Set a breakpoint using a regular expression to specify the location, where <linenum> is in
decimal and <address> is in hex.
bt -- ('_regexp-bt') Show a backtrace. An optional argument is accepted; if that argument is a number, it specifies the
number of frames to display. If that argument is 'all', full backtraces of all threads are displayed.
c -- ('process continue') Continue execution of all threads in the current process.
call -- ('expression --') Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined
variables and variables currently in scope.
continue -- ('process continue') Continue execution of all threads in the current process.
detach -- ('process detach') Detach from the current process being debugged.
di -- ('disassemble') Disassemble bytes in the current function, or elsewhere in the executable program as specified by
the user.
dis -- ('disassemble') Disassemble bytes in the current function, or elsewhere in the executable program as specified by
the user.
display -- ('_regexp-display') Add an expression evaluation stop-hook.
down -- ('_regexp-down') Go down "n" frames in the stack (1 frame by default).
env -- ('_regexp-env') Implements a shortcut to viewing and setting environment variables.
exit -- ('quit') Quit out of the LLDB debugger.
f -- ('frame select') Select a frame by index from within the current thread and make it the current frame.
file -- ('target create') Create a target using the argument as the main executable.
finish -- ('thread step-out') Finish executing the function of the currently selected frame and return to its call site in
specified thread (current thread, if none specified).
image -- ('target modules') A set of commands for accessing information for one or more target modules.
j -- ('_regexp-jump') Sets the program counter to a new address.
jump -- ('_regexp-jump') Sets the program counter to a new address.
kill -- ('process kill') Terminate the current process being debugged.
l -- ('_regexp-list') Implements the GDB 'list' command in all of its forms except FILE:FUNCTION and maps them to the
appropriate 'source list' commands.
list -- ('_regexp-list') Implements the GDB 'list' command in all of its forms except FILE:FUNCTION and maps them to the
appropriate 'source list' commands.
n -- ('thread step-over') Source level single step in specified thread (current thread, if none specified), stepping
over calls.
next -- ('thread step-over') Source level single step in specified thread (current thread, if none specified), stepping
over calls.
nexti -- ('thread step-inst-over') Single step one instruction in specified thread (current thread, if none specified),
stepping over calls.
ni -- ('thread step-inst-over') Single step one instruction in specified thread (current thread, if none specified),
stepping over calls.
p -- ('expression --') Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined
variables and variables currently in scope.
po -- ('expression -O -- ') Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined
variables and variables currently in scope.
print -- ('expression --') Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined
variables and variables currently in scope.
q -- ('quit') Quit out of the LLDB debugger.
r -- ('process launch -X true --') Launch the executable in the debugger.
rbreak -- ('breakpoint set -r %1') Sets a breakpoint or set of breakpoints in the executable.
repl -- ('expression -r -- ') Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined
variables and variables currently in scope.
run -- ('process launch -X true --') Launch the executable in the debugger.
s -- ('thread step-in') Source level single step in specified thread (current thread, if none specified).
si -- ('thread step-inst') Single step one instruction in specified thread (current thread, if none specified).
step -- ('thread step-in') Source level single step in specified thread (current thread, if none specified).
stepi -- ('thread step-inst') Single step one instruction in specified thread (current thread, if none specified).
t -- ('thread select') Select a thread as the currently active thread.
tbreak -- ('_regexp-tbreak') Set a one shot breakpoint using a regular expression to specify the location, where <linenum> is
in decimal and <address> is in hex.
undisplay -- ('_regexp-undisplay') Remove an expression evaluation stop-hook.
up -- ('_regexp-up') Go up "n" frames in the stack (1 frame by default).
x -- ('memory read') Read from the memory of the process being debugged.
For more information on any command, type ':help <command-name>'.
1> let sb="Script BASIC"
sb: String = "Script BASIC"
2> print(sb)
Script BASIC
3> import Glibc
4> random() % 10
$R0: Int = 3
5>
The IBM Swift Sandbox is an interactive website that lets you write Swift code and execute it in a server environment – on top of Linux! Each sandbox runs on IBM Cloud in a Docker container. In addition, both the latest versions of Swift and its standard library are available for you to use.
int button_cb(Ihandle* ih)
func button_cb(ih: UnsafeMutablePointer<Ihandle>) -> Int32
Unfortunately, swift doesn't appear to allow you to have a single literal over multiple lines but you can add + literals together over multiple lines.
IupSetFunction("LED_reference", callback_function_name)
img1 = IMAGE[0="0 0 0",1="BGCOLOR",2="255 0 0"]
(32,32
,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1
,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2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2,2,2
)
mnu = MENU
(
SUBMENU("IupSubMenu 1",
MENU
(
ITEM[VALUE=ON]("IupItem 1 Checked",myaction),
SEPARATOR(),
ITEM[ACTIVE="NO"]("IupItem 2 Disabled",myaction)
)
),
ITEM("IupItem 3",myaction),
ITEM("IupItem 4",myaction)
)
dlg = DIALOG[TITLE="Swift IUP LED",MENU="mnu"]
(
VBOX[GAP="5",ALIGNMENT="ARIGHT",MARGIN="5x5"]
(
HBOX
(
FRAME[TITLE="IupButton"]
(
VBOX
(
BUTTON("Quit Dialog",exit_dlg),
BUTTON[IMAGE=img1]("",myaction),
BUTTON[IMAGE=img1,IMPRESS=img2]("",myaction)
)
),
FRAME[TITLE="IupLabel"]
(
VBOX
(
LABEL("Label Text"),
LABEL[SEPARATOR=HORIZONTAL](""),
LABEL[IMAGE=img1]("")
)
),
FRAME[TITLE="IupToggle"]
(
VBOX
(
TOGGLE[VALUE="ON"]("Toggle Text",myaction),
TOGGLE[IMAGE=img1,IMPRESS=img2]("",myaction),
FRAME[TITLE="IupRadio"]
(
RADIO
(
VBOX
(
TOGGLE("Toggle Text",myaction),
TOGGLE("Toggle Text",myaction)
)
)
)
)
),
FRAME[TITLE="IupText/IupMultiline"]
(
VBOX
(
TEXT[SIZE="80x",VALUE="IupText Text"](myaction),
MULTILINE[SIZE="80x60",EXPAND="YES",VALUE="IupMultiline Text\nSecond Line\nThird Line"](myaction)
)
),
FRAME[TITLE="IupList"]
(
VBOX
(
LIST[EXPAND="YES",VALUE="1",1="Item 1 Text",2="Item 2 Text",3="Item 3 Text"](myaction),
LIST[DROPDOWN="YES",EXPAND="YES",VALUE="2",1="Item 1 Text",2="Item 2 Text",3="Item 3 Text"](myaction),
LIST[EDITBOX="YES",EXPAND="YES",VALUE="3",1="Item 1 Text",2="Item 2 Text",3="Item 3 Text"](myaction)
)
)
),
CANVAS[BGCOLOR="128 255 0"](myaction)
)
)
Of course it has errors, it's using Apple-specific API calls.
When the application defines the SIZE or RASTERSIZE attributes, it changes the User size in IUP. The initial internal value is "0x0". When set to NULL the User size is internally set to "0x0". If the element is not mapped then the returned value by SIZE or RASTERSIZE is the User size, if the element is mapped then the returned value is the Current size. To obtain the User size after the element is mapped use the USERSIZE attribute (since 3.12).
By default the layout computation uses the Natural size of the element to compose the layout of the dialog, but if the User size is defined then it is used instead of the Natural size. In this case the Natural size is not even computed. But there are two exceptions.
If the element is a container (not including the dialog) the User size will be used instead of the Natural size only if bigger than the Natural size. So for containers the User size will also act as a minimum value for Natural size.
For the dialog, if the User size is defined then it is used instead of the Natural size, but the Natural size of the dialog is always computed. And if the User size is not defined, the Natural size is used only if bigger than the Current size, so in this case the dialog will always increase its size to fit all its contents. In other words, in this case the dialog will not shrink its Current size unless the User size is defined. See the SHRINK attribute guide bellow for an alternative.
When the user is interactively changing the dialog size the Current size is updated. But the dialog contents will always occupy the Natural size available, being smaller or bigger than the dialog Current size.
When SIZE or RASTERSIZE attributes are set for the dialog (changing the User size) the Current size is also reset to "0x0". Allowing the application to force an update of its Window size. To only change the User size in pixels, without resetting the Current size, set the USERSIZE attribute (since 3.12).
After the Natural size is calculated for all the elements in the dialog, the the Current size is set based on the available space in the dialog. So the Current size is set from the outer element (the dialog) to the inner element, in opposite of what it is done for the Natural size.
After all the elements have their Current size updated, the elements positions are calculated, and finally, after the element is mapped, the Window size and position are set for the native elements. The Window size is set exactly to the Current size.
After the element is mapped the returned value for SIZE or RASTERSIZE is the Current size. It actually returns the native Window size of the element. Before mapping, the returned value is the User size.
ALIGNMENT (non inheritable): horizontal and vertical alignment. Possible values: "ALEFT", "ACENTER" and "ARIGHT", combined to "ATOP", "ACENTER" and "ABOTTOM". Default: "ACENTER:ACENTER". Partial values are also accepted, like "ARIGHT" or ":ATOP", the other value will be used from the current alignment.
MARGIN, CMARGIN: Defines a margin in pixels, CMARGIN is in the same units of the SIZE attribute. Its value has the format "widthxheight", where width and height are integer values corresponding to the horizontal and vertical margins, respectively. Default: "0x0" (no margin).
GAP, CGAP: Defines a vertical space in pixels between the children, CGAP is in the same units of the SIZE attribute for the height. Default: "0".
To reduce the size of the dialog and its containers to a size smaller than the Natural size the SHRINK attribute of the dialog can be used. If set to YES all the containers of the dialog will be able to reduce its size. But be aware that elements may overlap and the layout result could be visually bad if the dialog size is smaller than its Natural size.
Another way to increase the size of elements is to use the EXPAND attribute. When there is room in the container to expand an element, the container layout will expand the elements that have the EXPAND attribute set to YES, HORIZONTAL or VERTICAL accordingly, even if they have the User size defined. The default is EXPAND=NO, but for containers is EXPAND=YES.
I'll leave it in your hands what we should do for a SQLite Swift solution.
That is the first time I've been kissed and slapped at the same time. ;D
Didn't I mention that the Swift-C effort here was experimental?
Thanks again AIR for being a good friend and allowing me to continue being optimistic towards Swift's future. I have to laugh hearing you bad mouthing an Apple offering. :-X
How can I make your SQLite3 Swift code an include or import?
By building on the CSQlite3 module I created.
People use Swift because a huge (<--cue Donald Trump Accent) company is behind it. Kind of like how Objective C became popular.
At least with Objective C, I can drop straight C into it without having to jump through crazy hoops to get shit to work.
Now that we’ve built and tested our command line tool, let’s install it to enable it to be run from anywhere on the command line. To do that, build the tool using the release configuration, and then move the compiled binary to /usr/local/bin:
$ swift build -c release
$ cd .build/release
$ cp -f CommandLineTool /usr/local/bin/commandlinetool