[swift-users] read data from the code

2015-12-11 Thread Bee via swift-users
Hi all, Does anyone here remember gwbasic? There is one feature of gwbasic that I miss from modern programming language. It's the pair of READ function and DATA statement. An example here: http://www.antonis.de/qbebooks/gwbasman/data.html READ function is to read input from DATA statement. This i

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
Yeah it should finally work when you import CCairo in main.swift. Keep in mind, though, that everyone is volunteering their time on this mailing list. I'm really glad you're taking a liking to Swift, and I'd suggest maybe trying a few things more simple before exercising the finer points of cro

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
So reimport CCairo and it'll just work, or more bugs? At this point I don't know what else is gonna pop up as soon as I compile. Is there someone on here at all tomorrow? Sent from Outlook Mobile On Fri, Dec 11, 2015 at 9:14 PM -0800, "Harlan Haskins" wrote: Oops, I forgot that identi

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
What exactly is an unresolved identifier? Subject: Re: [swift-users] Need Help with C-to-Swift (finally) From: har...@harlanhaskins.com Date: Fri, 11 Dec 2015 23:33:59 -0500 CC: max.how...@apple.com; ja...@apple.com; swift-users@swift.org To: gagemor...@outlook.com You need to import Cairo, not C

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
I've pushed all three into three separate repos at GitHub. The first one is at:https://github.com/Christoffen-Corporation/swift-cairo-test It hosts the test folder I've been talking about, the methods. The next one is here:https://github.com/Christoffen-Corporation/swift-cairo-ccairo It hosts the

Re: [swift-users] Here's a multi-platform OpenGL loader for Swift.

2015-12-11 Thread Harlan Haskins via swift-users
This is a great use case for multiline string literals! 😅 > On Dec 11, 2015, at 10:56 PM, Joe Groff via swift-users > wrote: > > Nice! Having done OpenGL bindings for other languages, I know this isn't a > trivial task. Giving the functions argument labels is a nice touch. > > -Joe > >> On D

Re: [swift-users] Here's a multi-platform OpenGL loader for Swift.

2015-12-11 Thread Joe Groff via swift-users
Nice! Having done OpenGL bindings for other languages, I know this isn't a trivial task. Giving the functions argument labels is a nice touch. -Joe > On Dec 10, 2015, at 9:22 PM, David Turnbull via swift-users > wrote: > > If you tried using OpenGL with something other than Apple's framework

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
Could you push the latest code to GitHub? Sent from my iPhone > On Dec 11, 2015, at 10:42 PM, Gage Morgan wrote: > > Okay, so test.swift is now main.swift, which outputs a much shorter but not > better: > > Compiling Swift Module 'test' (1 sources) > /home/mgage/swift-cairo-bindings/test/main

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Okay, so test.swift is now main.swift, which outputs a much shorter but not better: Compiling Swift Module 'test' (1 sources)/home/mgage/swift-cairo-bindings/test/main.swift:3:15: error: use of unresolved identifier 'Surface'let surface = Surface(format: CAIRO_FORMAT_ARGB32, width: 421, height:

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Yes, we seem to have uncovered someuh.difficulties. Was anyone else aware that stuff like this is a wild-goose chase until now? Subject: Re: [swift-users] Need Help with C-to-Swift (finally) From: har...@harlanhaskins.com Date: Fri, 11 Dec 2015 22:38:42 -0500 CC: max.how...@apple.com;

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Just when I think I make a breakthrough...Cairo and CCairo build, but this test file separates methods from wrappers still won't: Compiling Swift Module 'test' (1 sources)/home/mgage/swift-cairo-bindings/test/test.swift:4:1: error: expressions are not allowed at the top levelsurface.scale(10.0,

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
Gotta make sure to make a git tag git tag 1.0.0 git push --tags Sent from my iPhone > On Dec 11, 2015, at 10:29 PM, Gage Morgan wrote: > > Okay, so I've gone in and noticed that yes, it does create a library. How do > I use that? Dependency graph won't check out for some strange reason. > >

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Okay, so I've gone in and noticed that yes, it does create a library. How do I use that? Dependency graph won't check out for some strange reason. Subject: Re: [swift-users] Need Help with C-to-Swift (finally) From: max.how...@apple.com Date: Fri, 11 Dec 2015 19:02:41 -0800 CC: ja...@apple.com; s

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
I'm in the process of uploading the bits to GitHub, so I can push them over if anything else happens. Subject: Re: [swift-users] Need Help with C-to-Swift (finally) From: max.how...@apple.com Date: Fri, 11 Dec 2015 19:02:41 -0800 CC: ja...@apple.com; swift-users@swift.org; har...@harlanhaskins.com

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
I have no idea what happened here, but: Cloning Packages/CCairoCloning Packages/CairoCompiling Swift Module 'Cairo' (1 sources)Linking Executable: .build/debug/CairoCompiling Swift Module 'test' (1 sources)Linking Executable: .build/debug/test/home/mgage/swift-cairo-bindings/test/.build/debug/

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Max Howell via swift-users
If you could publish your sources on GitHub or somewhere similar we could probably be more help. > On Dec 11, 2015, at 6:21 PM, Gage Morgan via swift-users > wrote: > > I'm going to. Now, does this mean anything labelled func inside the struct > needs tacked on as well? > > Subject: Re: [swi

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Right up ahead lol Subject: Re: [swift-users] Need Help with C-to-Swift (finally) From: max.how...@apple.com Date: Fri, 11 Dec 2015 18:42:03 -0800 CC: ja...@apple.com; swift-users@swift.org To: gagemor...@outlook.com If you could publish your sources on GitHub or somewhere similar we could proba

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
I'm going to. Now, does this mean anything labelled func inside the struct needs tacked on as well? Subject: Re: [swift-users] Need Help with C-to-Swift (finally) From: ja...@apple.com Date: Fri, 11 Dec 2015 18:19:55 -0800 CC: har...@harlanhaskins.com; swift-users@swift.org To: gagemor...@outlook

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Jack Lawrence via swift-users
Did you make the class and its methods public? Jack > On Dec 11, 2015, at 6:16 PM, Gage Morgan wrote: > > Here's what I'm getting: > > /home/mgage/swift-cairo-bindings/test/main.swift:4:15: error: module 'Cairo' > has no member named 'Surface' > let surface = Cairo.Surface(format: CAIRO_FORMAT

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
If they're not the same name, you don't need Cairo.Surface, just Surface. Sent from my iPhone > On Dec 11, 2015, at 9:16 PM, Gage Morgan wrote: > > Here's what I'm getting: > > /home/mgage/swift-cairo-bindings/test/main.swift:4:15: error: module 'Cairo' > has no member named 'Surface' > let s

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Here's what I'm getting: /home/mgage/swift-cairo-bindings/test/main.swift:4:15: error: module 'Cairo' has no member named 'Surface'let surface = Cairo.Surface(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410) ^ ~~~:0: error: build had 1 command failures So what I'm tryin

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
Nope, but you’ll need a way to specify the class inside the module (the fully-qualified type name) Cairo.Cairo should work fine. > On Dec 11, 2015, at 8:14 PM, Gage Morgan wrote: > > The module is Cairo. Do I need to change something (I'm assuming by struct > you mean the name of the class co

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
Is your struct named Cairo or Surface? If Cairo is the module name, you're trying to instantiate the module. - Harlan > On Dec 11, 2015, at 7:55 PM, Gage Morgan wrote: > > How would you use things like cairo.moveTo() outside of the wrapping file? > I've gone as far as writing a module named "

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
The module is Cairo. Do I need to change something (I'm assuming by struct you mean the name of the class containing wrappings). The class is named Cairo as well. Could renaming the module to ModCairo fix this? Sent from Outlook Mobile On Fri, Dec 11, 2015 at 5:11 PM -0800, "Harlan Haskins"

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
How would you use things like cairo.moveTo() outside of the wrapping file? I've gone as far as writing a module named "Cairo," taking the methods as mentioned above out, and moving them to their own directory "tests." I have added "Cairo" as a dependency for "tests," but there appears to be some

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
I considered that but couldn't find a cairo_get_font_scale function quickly to complement the setter 😅 But yes, a full wrapper would transparently handle getting and setting. - Harlan > On Dec 11, 2015, at 7:28 PM, Jack Lawrence wrote: > > For getter-setter pairs like `setLineWidth`, you migh

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Harlan, The answer is yes. I even managed to get a couple you didn't list on my own: let cairo = Cairo(format: CAIRO_FORMAT_ARGB32, width: 421, height: 410)cairo.scale(10.0, y: 10.0)cairo.moveTo(29.0, y: 14.7)cairo.lineTo(37.6, y: 13.0)cairo.moveTo(37.6, y: 13.0)cairo.lineTo(30.4, y: 22.2)cairo.m

[swift-users] New Swift 2.2 Toolchain snapshot - Dec 10, 2015

2015-12-11 Thread Mishal Shah via swift-users
New Swift 2.2 snapshot available! Download new packages from https://swift.org/download/ Following repository are tagged with swift-2.2-SNAPSHOT-2015-12-10-a https://github.com/apple/swift https://

Re: [swift-users] Swift is building from source, failing tests.

2015-12-11 Thread Dmitri Gribenko via swift-users
On Fri, Dec 11, 2015 at 11:12 AM, Dylan Brown via swift-users < swift-users@swift.org> wrote: > Hello! When running `utils/build-script --clean -t`, I'm able to complete > the build but it regularly fails the same 4/6 tests. Also, check-swift and > check-swift-validation are not found in the build

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
Gage, Sorry, I just got back from class. I’ll respond in line! > On Dec 11, 2015, at 5:09 PM, Gage Morgan wrote: > > Harlan, > > I read on cairographics.org about bindings awhile > back. I think they want cairo, not surface, so we would have something like: > > l

Re: [swift-users] Swift is building from source, failing tests.

2015-12-11 Thread Mish Awadah via swift-users
You have a problem with Cmark, not swift. I think you probably have a configuration issue, or are missing some dev library. If you search the archives of swift-users, someone else had a cmark problem too, and the solution provided might help you. I would also recommend ensuring you have instal

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
I meant the code posted in the Gist link above. I don't know jack squat about qsort. I'm hoping that if I can reverse-engineer code already produced, I can apply it to other parts of Cairo. Sent from Outlook Mobile On Fri, Dec 11, 2015 at 1:34 PM -0800, "Kwame Bryan" wrote: Tutorial o

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Kwame Bryan via swift-users
Tutorial on the subject. http://chris.eidhof.nl/posts/swift-c-interop.html Regards Kwame___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Could you put some comments explaining what you did in that code? I wouldn't mind learning to write some wrappers...it's inevitable in the end anyways. Subject: Re: [swift-users] Need Help with C-to-Swift (finally) From: har...@harlanhaskins.com Date: Fri, 11 Dec 2015 15:46:21 -0500 CC: jason.du..

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Sir, you've just made my day. So it's really that simple? Subject: Re: [swift-users] Need Help with C-to-Swift (finally) From: har...@harlanhaskins.com Date: Fri, 11 Dec 2015 15:24:48 -0500 CC: jason.du...@gmail.com; swift-users@swift.org To: gagemor...@outlook.com So, it’s a very simple almost o

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Harlan Haskins via swift-users
So, it’s a very simple almost one-to-one translation of that C code block to Swift. You have to make sure to import CCairo at the beginning of the file, and change the variable declarations to use let instead of the C declaration. This works for me, as is. import CCairo let surface = cairo_ima

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
Do so here in a few. Want a bug report for that? Sent from Outlook Mobile On Fri, Dec 11, 2015 at 12:08 PM -0800, "Harlan Haskins" wrote: Mind sending your CCairo modulemap? I’d love to help you get this translated to Swift. > On Dec 11, 2015, at 2:44 PM, Gage Morgan via swift-users

Re: [swift-users] Need Help with C-to-Swift (finally)

2015-12-11 Thread Gage Morgan via swift-users
I want to call PNG surfaces from Swift, as well as use cairo_line_to() and cairo_move_to() in Swift. Thing is, I need an example of cairo used in Swift so I can apply it to the rest of cairo. My goal is to generate an executable that outputs *.png images using swift. Thanks for the support,--MGag

[swift-users] Swift is building from source, failing tests.

2015-12-11 Thread Dylan Brown via swift-users
Hello! When running `utils/build-script --clean -t`, I'm able to complete the build but it regularly fails the same 4/6 tests. Also, check-swift and check-swift-validation are not found in the build directory alongside Ninja-DebugAssert. I've been working at this for a while, and I'm not sure where

Re: [swift-users] Instantiate Swift class from string

2015-12-11 Thread Matthew Davies via swift-users
The problem is still, how would I call the controller method? I still can't instantiate a new instance of the controller and call a given method on the instance. I was able to partially get this working, but I realized that I still can't instantiate a new controller on each request. I can't figure

Re: [swift-users] Instantiate Swift class from string

2015-12-11 Thread Jeremy Pereira via swift-users
> On 10 Dec 2015, at 20:22, Matthew Davies via swift-users > wrote: > > I'm building a URL router in which I'd like to pass a controller and a > method. I don't want to instantiate all the controllers up front and pass the > methods in as closures, nor do I want old controller instances still

Re: [swift-users] Random Function

2015-12-11 Thread Alex Blewitt via swift-users
If you’re on Linux: import Glibc print(“A random number is \(random())”) If you’re on OSX: import Darwin print(“A random number is \(random())”) > On 11 Dec 2015, at 14:21, Piero Sabino via swift-users > wrote: > > I want to print to video 6 random numbers from a range of values > > __

[swift-users] Random Function

2015-12-11 Thread Piero Sabino via swift-users
I want to print to video 6 random numbers from a range of values ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

Re: [swift-users] hasSuffix(_:) and .hasPrefix(_:) String methods missing on Linux

2015-12-11 Thread Alessandro Morgantini via swift-users
Clear. For my needs, this chunk of code at the beginning of my file is sufficient: #if !_runtime(_ObjC) extension String { public func hasPrefix(prefix: String) -> Bool { return prefix == String(self.characters.prefix(prefix.characters.count)) } public func hasSuffix(suffix: St

Re: [swift-users] hasSuffix(_:) and .hasPrefix(_:) String methods missing on Linux

2015-12-11 Thread Alex Blewitt via swift-users
FYI: https://github.com/apple/swift/blob/master/stdlib/public/core/StringLegacy.swift#L73 These two functions are (currently) only available with the Objective-C bridge, which the Linux port doesn’t have. A

Re: [swift-users] hasSuffix(_:) and .hasPrefix(_:) String methods missing on Linux

2015-12-11 Thread Alex Blewitt via swift-users
They may come as extensions from NSString, which Swift doesn’t have fully implemented on Linux yet. Alex > On 11 Dec 2015, at 11:18, Alessandro Morgantini via swift-users > wrote: > > Hello to everyone! > I'm a very newbie to Swift, I'm doing first experiments on Linux & Mac and I > have the

[swift-users] hasSuffix(_:) and .hasPrefix(_:) String methods missing on Linux

2015-12-11 Thread Alessandro Morgantini via swift-users
Hello to everyone! I'm a very newbie to Swift, I'm doing first experiments on Linux & Mac and I have the following issue: if I call the hasSuffix(_:) or the hasPrefix(_:) methods on a String instance, I obtain the following error: $ swiftc prova.swift prova.swift:110:4: error: value of type 'Strin