[Gambas-user] Gambas All Basic Moderator & Advocates Needed

2008-08-19 Thread admin
List,

There is a new web site that is dedicated to All Basic languages. This  
site is not
another support site but a Basic language information and code  
repository. (see Mission Statement)

We need a representative from the Gambas camp to moderate the Gambas  
board on www.AllBasic.Info and work with the Gambas advocates.

Regards,

John Spikowski
All Basic Administrator
http://www.AllBasic.Info
[EMAIL PROTECTED]

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] All Basic new look

2008-08-20 Thread admin
List,

Our webmaster just release the new look for www.AllBasic.Info. The  
Gambas board is looking pretty bare and could use a condensed language  
reference guide, tutorials, screen shots and code examples.

Gambas is the best kept secrete in the Basic community and I hope  
working together we can change that.

It would be great if one of the senior members of the Gambas team  
would step up and be the team leader for your board on All Basic.

Hope to see you there !

John

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] AllBasic.Info Gambas Help

2008-08-21 Thread admin
>
> All your boards are looking pretty bare, because your site has only  
> existed for a few weeks.

> When the BASIC community starts visiting allbasic.info, I'll  
> probably be part of it.  But with the most active board having 6  
> posts on it as I type this, I don't think that has happened yet.

I think we are doing pretty good with the board only being two weeks old.
There is a lot of excitement about www.AllBasic.Info in the Basic community.
The site dwarfed the www.scriptbasic.org (the open source Basic  
interpreter project I manage) in activity the second day after it went  
live.


> As far as I know, I'm the only one here who regularly takes part in  
> web forum support, and I haven't even had time to visit  
> linuxbasic.net, which has the most active Web forum for Gambas, in a  
> month or two.  I know that a lot of BASIC users prefer the web forum  
> approach, especially novices, but most developers still seem to  
> prefer mailing lists.  The posts come to us rather than the other  
> way around.
>

Do you think you could post enough information to the All Basic site  
for Gambas that someone that hasn't heard of it before would take the  
next step and install it on their system. (no a easy job for most)

Thanks Rob for the reply !


John Spikowski


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-08-31 Thread admin
Quoting Jason Hackney <[EMAIL PROTECTED]>:

> First of all, I bought this book. Mr. Rittinghouse obviously worked
> very hard on it and I felt he deserves a little something for his
> effort.
>
> Does anyone know if Mr. Rittinghouse plans on releasing an updated
> version of this book? There are inconsistencies, errors, and just
> plain outdated information throughout the current version.
>
> Just two examples:
>
> 1) There are some details omitted (or just not well clarified for a
> beginner) in the chapter regarding drawing.
> 2) The CASE/SELECT information could be more complete.
>
>  I'd really, REALLY like to see some sort of reference (I know,
> that would be a book in itself!!) 
>
> Otherwise, it's a decent book (I've been using it primarily as a
> reference). I'd love to help make it better. I have a knack for
> finding mundane nuggets of goodness that can be cleaned up.
>
> Jason

Sounds like a prime candidate for a Wiki project. ;-)

>
> p.s. John, if you're out there, I'm serious about the offer to help.
>

Thanks !

I didn't want to be a pest here. I think the www.AllBasic.Info site is  
maturing quickly. (almost a month old) I wish you guys would show some  
of your stuff over there and knock some socks off with Gambas. You  
already have the HotBasic Linux guru hooked. ;-)

John

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-08-31 Thread admin
Quoting Fabien Bodard <[EMAIL PROTECTED]>:

> i'mm not sure that J. Rittinghouse write something else as he is really sick.
>
> Fabien Bodard

That is sad news.

Maybe the work he did could be used as a foundation to build on with a  
wiki and a PayPal Donation button could be added. I would contribute.


John

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-09-01 Thread admin
Quoting Hamish Robertson <[EMAIL PROTECTED]>:

> So would I. Turning that book into a wiki is a great Idea. Would John
> be up for that though?
>

I would be happy to host this wiki. I'll set it up and the group here  
can pick an administrator which can assign sysop's to help.

http://Gambas.AllBasic.Info

I would install Mediawiki as the platform.

Just over the net and in your court. ;-)


John

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-09-01 Thread admin
Quoting Hamish Robertson <[EMAIL PROTECTED]>:

> Er, I think this one should be up to John. :)
>
> I've emailed him. See what he says.
>

I didn't get your e-mail so try support_AT_scriptbasic_DOT_org .

If you already have permission to make this a GNU FDL document, I have  
no problem with facilitating it as a sub-domain of All Basic. Moving  
the content to the wiki will have to the Gambas groups project.


John

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-09-01 Thread admin
Quoting Hamish Robertson <[EMAIL PROTECTED]>:

> Er, I think this one should be up to John. :)
>

I fine with it after reading the license and restrictions.

Sure would be nice if someone could move this into Open Office which  
exports to Mediawiki.

I'll post something here when the wiki is ready for use.


John


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-09-01 Thread admin
Quoting Kari Laine <[EMAIL PROTECTED]>:

> So did John give permission for the book to go wiki?
> How a pdf can be converted to text? Is it possible with commercial acrobat ?
>
> Best Regards
> Kari Laine

Hi Kari,

I have the http://gambas.allbasic.info domain active with a temporary  
home page. I will install Mediawiki tomorrow. (late here) You will  
need to register an account on the wiki with a valid e-mail address to  
post. (helps with spam bots)

Open Office will export to Mediawiki format. I'll take a shot at  
converting the PDF to a HTML document after the wiki is installed. If  
someone else can take care of content preparation that would be great.

John



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-09-01 Thread admin
Quoting [EMAIL PROTECTED]:

> Am Montag, 1. September 2008 12:33:58 schrieb Kari Laine:
>> So did John give permission for the book to go wiki?
>> How a pdf can be converted to text? Is it possible with commercial acrobat
>> ?
>>
>> Best Regards
>> Kari Laine
> If John would give permission to use his book as basis for a wiki, he also
> could donate his original script...both depends on the contracts between John
> and the publishing company.
>
> Greetz
> Stevie

Based on what I understand from the license section of the PDF, the  
book was made an open document with the ability to expand on it. If I  
read it wrong, please correct my error.

John

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-09-01 Thread admin
Quoting Kari Laine <[EMAIL PROTECTED]>:

>>
>>
>> Based on what I understand from the license section of the PDF, the
>> book was made an open document with the ability to expand on it. If I
>> read it wrong, please correct my error.
>>
>> I think the original text is still needed. I tried to convert it with
> pdftohtml and got this error
>
> susePK1:/home/kari/kirjat # pdftohtml gambas_beginner_guide.pdf gambas.html
> Error: Copying of text from this document is not allowed.
>
> So the pdf is protected. I don't know whether it possible to hack pdftohtml
> to ignore that...
>
> If it is really open document and publishing company or John don't object it
> we could divide the work to 50 pages each and start typing :-) But it would
> be nice to get the source.
>


Kari,

I tried as well.

Can you take the lead on getting the password or the original source document?

John



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-09-01 Thread admin
Quoting Kari Laine <[EMAIL PROTECTED]>:

>> Kari,
>>
>> I tried as well.
>>
>> Can you take the lead on getting the password or the original source
>> document?
>>
>> John
>>
>
> Hi John,
>
>
> I think there is no password on the file because I commented a test in
> pdftohtml to ignore some kind of protection and out it came. BUT there is no
> layout, no pictures only the text. So it is big job to turn it to a nice
> document. Anyway the screen capture pictures would probably be old anyway.
>
> I read the OpenContent license of the book and if I understood right it
> would make difficult to produce derivative work or wiki - quite impossible
> in fact.
>
> Maybe someone with leverage - Benoit - could contact John W Rittinghouse and
> ask.
>
> Fact is Gambas needs more documentation to lure users. Also I would be
> prepared to pay for a technical document how Gambas works. I have used now
> countles hours and I have just scratched the surface. Either I am darn
> stupid or Benoit is about to win obfuscated code contest :-) before this day
> I know very little about compilers and interpreters and I am not very good
> with C - so it is going to take few months...
>
> And Windows version would be nice too :-)
>
>
> Best Regards
> Kari Laine
>

Kari,

I won't install the wiki till you have permission from John R.and the  
source to the original content. I will leave the  
http://gambas.allbasic.info sub-domain active till no hope is left.

I'm still counting on you to get to the bottom of this.

John

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Nice book of Gambas

2008-09-01 Thread admin
Quoting [EMAIL PROTECTED]:

> Am Montag, 1. September 2008 21:14:43 schrieb [EMAIL PROTECTED]:
>> Kari,
>>
>> I won't install the wiki till you have permission from John R.and the
>> source to the original content. I will leave the
>> http://gambas.allbasic.info sub-domain active till no hope is left.
>>
>> I'm still counting on you to get to the bottom of this.
>>
>> John
> Sorry...but what are you trying to do here?? ...you have an "allbasic-site"
> and want it to be a central site for "all" basic dialects. ...so go for
> it!! ...search for the author of the book and drop him a mail, but stop
> pushing other people into fire, which flames cook your meal!
>
> Greetz
> Stevie

I was willing to accommodate the request to save the efforts put into  
an open document that is getting stale by the day. If my contributions  
and kindness aren't needed or appreciated then I will remove the  
Gambas sub-domain and let the book die a slow death.

Sorry I even mentioned it.

John

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Working with .so library

2017-05-30 Thread Admin
So, I am writing a programm for my business that would basically be a 
cash register. Don't know for other countries but here in Russia the tax 
law works like this: you have to form a check for a customer in a 
spicific way spicified by the law, so some hardware manufacturers are 
making certified cash registers/check printers that simply form the 
check needed and automatically send tax info to authorities, very simple 
and easy to integrate with ERP systems. The only problem is that most of 
accounting software that is compatible with those registers is written 
for Windows. Now that Windows becomes more and more monstrous, many 
businesses turn to Linux, at least on those computers that are only a 
cashier's workstation that does not need to do much in terms of 
performance power. But the problem is, there's only one or two cashier's 
programms for linux exist for now, that are compatible with that 
certified hardware, and it's not open source or free.



First of all I want to make my own for myself, and second - I want to 
share it. Gambas is a great language in this case because of many 
aspects. In small buisnesses usually there are not a lot of qualified 
programmers to make some apps in C or C++, but instead there usually is 
just a single sysadmin, who is servicing the IT stuff wich usually is 
just one or two PCs and a router/switch. So, Gambas is much more 
accessible to those people as I see it. Programs written on it are easy 
to understand and modify to the needs of a small business.



And what is great - the manufacturers of that certified hardware are 
willing to help: ofcourse they mostly do business with Windows stuff, 
they only work directly with big businesses and they don't produce 
accounting software themselves, but they are kind enough to provide at 
least a binary libraries (they call those - drivers, but i'm not shure 
if it's technically correct) for their hardware even for Linux as a x86 
and x64 .so files. What those binary libraries do is simple conversion 
of easy commands to hex codes that are then passed to a hardware via USB 
or RS232 or Ethernet. It is MUCH easier to work with those commands then 
implement the whole communication protocol from scratch. Ofcourse I am 
not the only one who is interested in those devices to work under linux, 
and as I can tell from different forums in the internet - programmers 
successfully use this libraries and thank the developers. There's not a 
lot of documentation out there, but yeah, on paper it seems to be simple 
enough... if you write your code in C or C++.



Things get much different when you try to use the library in Gambas. 
What I was able to understand from the documentation is that you need to 
"initialize the interface" with the library, which will create a 
"virtual class" and than you can pass your data to it. So, in C (using 
QT) that would look something like this:



 typedef IFptr * (*_CreateFptrInterface)(int ver);

bool init() {
QLibrary *lib = new QLibrary("fptr");
lib->load();
if(lib->isLoaded()) {
_CreateFptrInterface CreateFptrInterface = 
(_CreateFptrInterface)lib->resolve("CreateFptrInterface");

if(CreateFptrInterface) {
IFptr * iface = CreateFptrInterface(12);
iface->put_DeviceEnabled(true);
int result = 0;
iface->get_ResultCode(&result);
qDebug() << result;
wchar_t bfr[1000];
int length = iface->get_ResultDescription(bfr,1000);
qDebug() << QString::fromWCharArray(bfr,length);
}
}
}


So, as I understand we create a pointer called IFptr by calling 
CreateFptrInterface() and then we pass any other pointer through this 
one. Pardon my terminology, I am new to this stuff.


I wrote some simple code that basically initializes this driver just so 
I can see some output in the driver logs which are kindly created in 
~/.atol. It also sends some data to driver which must change just one 
setting:


-

Library "~/ATOL/linux-x64/libfptr"

Extern CreateFptrInterface(ver As Integer) As Pointer
Extern put_DeviceSingleSettingAsInt(p As Pointer, s1 As String, s2 As 
Integer) As Integer

Extern ApplySingleSettings(p As Pointer) As Pointer

[...]

Public Sub Button1_Click()
Dim IFptr As Pointer

IFptr = CreateFptrInterface(12)
put_DeviceSingleSettingAsInt(IFptr, "Model", 63)

ApplySingleSettings(IFptr)

End

-

When I click Button1, the driver surely initializes, I see in logs that 
IFptr object is created. If I provide the wrong version in 
CreateFptrInterface it fails, saying in logs that there's missmatch in 
interface version, so no doubt the argument is passed correctly. I also 
can see that put_DeviceSingleSetting is being called, but the 
configuration does not actually change. The commercial software that 
uses this very same driver and works fine - leaves mostly the same trace 
in driver's log except 

Re: [Gambas-user] Working with .so library

2017-05-31 Thread Admin

Hi, Caveat.

Yes, ofcourse, this is basically the only article outthere that explains 
at least something. But I still can't understand why arguments are not 
sent to my lib and what do I do wrong if it's not the Gambas issue.


31.05.2017 16:35, Caveat пишет:

Hallo Dmitry

Did you already look at:

http://gambaswiki.org/wiki/howto/extern ?

Kind regards,
Caveat

On 31-05-17 06:48, Admin wrote:
So, I am writing a programm for my business that would basically be a 
cash register. Don't know for other countries but here in Russia the 
tax law works like this: you have to form a check for a customer in a 
spicific way spicified by the law, so some hardware manufacturers are 
making certified cash registers/check printers that simply form the 
check needed and automatically send tax info to authorities, very 
simple and easy to integrate with ERP systems. The only problem is 
that most of accounting software that is compatible with those 
registers is written for Windows. Now that Windows becomes more and 
more monstrous, many businesses turn to Linux, at least on those 
computers that are only a cashier's workstation that does not need to 
do much in terms of performance power. But the problem is, there's 
only one or two cashier's programms for linux exist for now, that are 
compatible with that certified hardware, and it's not open source or 
free.



First of all I want to make my own for myself, and second - I want to 
share it. Gambas is a great language in this case because of many 
aspects. In small buisnesses usually there are not a lot of qualified 
programmers to make some apps in C or C++, but instead there usually 
is just a single sysadmin, who is servicing the IT stuff wich usually 
is just one or two PCs and a router/switch. So, Gambas is much more 
accessible to those people as I see it. Programs written on it are 
easy to understand and modify to the needs of a small business.



And what is great - the manufacturers of that certified hardware are 
willing to help: ofcourse they mostly do business with Windows stuff, 
they only work directly with big businesses and they don't produce 
accounting software themselves, but they are kind enough to provide 
at least a binary libraries (they call those - drivers, but i'm not 
shure if it's technically correct) for their hardware even for Linux 
as a x86 and x64 .so files. What those binary libraries do is simple 
conversion of easy commands to hex codes that are then passed to a 
hardware via USB or RS232 or Ethernet. It is MUCH easier to work with 
those commands then implement the whole communication protocol from 
scratch. Ofcourse I am not the only one who is interested in those 
devices to work under linux, and as I can tell from different forums 
in the internet - programmers successfully use this libraries and 
thank the developers. There's not a lot of documentation out there, 
but yeah, on paper it seems to be simple enough... if you write your 
code in C or C++.



Things get much different when you try to use the library in Gambas. 
What I was able to understand from the documentation is that you need 
to "initialize the interface" with the library, which will create a 
"virtual class" and than you can pass your data to it. So, in C 
(using QT) that would look something like this:



 typedef IFptr * (*_CreateFptrInterface)(int ver);

bool init() {
QLibrary *lib = new QLibrary("fptr");
lib->load();
if(lib->isLoaded()) {
_CreateFptrInterface CreateFptrInterface = 
(_CreateFptrInterface)lib->resolve("CreateFptrInterface");

if(CreateFptrInterface) {
IFptr * iface = CreateFptrInterface(12);
iface->put_DeviceEnabled(true);
int result = 0;
iface->get_ResultCode(&result);
qDebug() << result;
wchar_t bfr[1000];
int length = iface->get_ResultDescription(bfr,1000);
qDebug() << QString::fromWCharArray(bfr,length);
}
}
}


So, as I understand we create a pointer called IFptr by calling 
CreateFptrInterface() and then we pass any other pointer through this 
one. Pardon my terminology, I am new to this stuff.


I wrote some simple code that basically initializes this driver just 
so I can see some output in the driver logs which are kindly created 
in ~/.atol. It also sends some data to driver which must change just 
one setting:


-

Library "~/ATOL/linux-x64/libfptr"

Extern CreateFptrInterface(ver As Integer) As Pointer
Extern put_DeviceSingleSettingAsInt(p As Pointer, s1 As String, s2 As 
Integer) As Integer

Extern ApplySingleSettings(p As Pointer) As Pointer

[...]

Public Sub Button1_Click()
Dim IFptr As Pointer

IFptr = CreateFptrInterface(12)
put_DeviceSingleSettingAsInt(IFptr, "Model"

Re: [Gambas-user] Working with .so library

2017-05-31 Thread Admin

31.05.2017 16:58, Benoît Minisini пишет:

Le 31/05/2017 à 06:48, Admin a écrit :
So, I am writing a programm for my business that would basically be a 
cash register. Don't know for other countries but here in Russia the 
tax law works like this: you have to form a check for a customer in a 
spicific way spicified by the law, so some hardware manufacturers are 
making certified cash registers/check printers that simply form the 
check needed and automatically send tax info to authorities, very 
simple and easy to integrate with ERP systems. The only problem is 
that most of accounting software that is compatible with those 
registers is written for Windows. Now that Windows becomes more and 
more monstrous, many businesses turn to Linux, at least on those 
computers that are only a cashier's workstation that does not need to 
do much in terms of performance power. But the problem is, there's 
only one or two cashier's programms for linux exist for now, that are 
compatible with that certified hardware, and it's not open source or 
free.



First of all I want to make my own for myself, and second - I want to 
share it. Gambas is a great language in this case because of many 
aspects. In small buisnesses usually there are not a lot of qualified 
programmers to make some apps in C or C++, but instead there usually 
is just a single sysadmin, who is servicing the IT stuff wich usually 
is just one or two PCs and a router/switch. So, Gambas is much more 
accessible to those people as I see it. Programs written on it are 
easy to understand and modify to the needs of a small business.



And what is great - the manufacturers of that certified hardware are 
willing to help: ofcourse they mostly do business with Windows stuff, 
they only work directly with big businesses and they don't produce 
accounting software themselves, but they are kind enough to provide 
at least a binary libraries (they call those - drivers, but i'm not 
shure if it's technically correct) for their hardware even for Linux 
as a x86 and x64 .so files. What those binary libraries do is simple 
conversion of easy commands to hex codes that are then passed to a 
hardware via USB or RS232 or Ethernet. It is MUCH easier to work with 
those commands then implement the whole communication protocol from 
scratch. Ofcourse I am not the only one who is interested in those 
devices to work under linux, and as I can tell from different forums 
in the internet - programmers successfully use this libraries and 
thank the developers. There's not a lot of documentation out there, 
but yeah, on paper it seems to be simple enough... if you write your 
code in C or C++.



Things get much different when you try to use the library in Gambas. 
What I was able to understand from the documentation is that you need 
to "initialize the interface" with the library, which will create a 
"virtual class" and than you can pass your data to it. So, in C 
(using QT) that would look something like this:



  typedef IFptr * (*_CreateFptrInterface)(int ver);

 bool init() {
 QLibrary *lib = new QLibrary("fptr");
 lib->load();
 if(lib->isLoaded()) {
 _CreateFptrInterface CreateFptrInterface = 
(_CreateFptrInterface)lib->resolve("CreateFptrInterface");

 if(CreateFptrInterface) {
 IFptr * iface = CreateFptrInterface(12);
 iface->put_DeviceEnabled(true);
 int result = 0;
 iface->get_ResultCode(&result);
 qDebug() << result;
 wchar_t bfr[1000];
 int length = iface->get_ResultDescription(bfr,1000);
 qDebug() << QString::fromWCharArray(bfr,length);
 }
 }
 }


So, as I understand we create a pointer called IFptr by calling 
CreateFptrInterface() and then we pass any other pointer through this 
one. Pardon my terminology, I am new to this stuff.


I wrote some simple code that basically initializes this driver just 
so I can see some output in the driver logs which are kindly created 
in ~/.atol. It also sends some data to driver which must change just 
one setting:


-

Library "~/ATOL/linux-x64/libfptr"

Extern CreateFptrInterface(ver As Integer) As Pointer
Extern put_DeviceSingleSettingAsInt(p As Pointer, s1 As String, s2 As 
Integer) As Integer

Extern ApplySingleSettings(p As Pointer) As Pointer

[...]

Public Sub Button1_Click()
Dim IFptr As Pointer

IFptr = CreateFptrInterface(12)
put_DeviceSingleSettingAsInt(IFptr, "Model", 63)

ApplySingleSettings(IFptr)

End

-

When I click Button1, the driver surely initializes, I see in logs 
that IFptr object is created. If I provide the wrong version in 
CreateFptrInterface it fails, saying in logs that there's missmatch 
in interface version, so no doubt the argument is passed c

Re: [Gambas-user] Working with .so library

2017-05-31 Thread Admin

31.05.2017 18:18, Benoît Minisini пишет:

Le 31/05/2017 à 12:38, Admin a écrit :

31.05.2017 16:58, Benoît Minisini пишет:
Apparently all that black box is written in C++ with QT, and without 
the header of the library interface , I can't tell you if it is 
possible to use the library with Gambas, and how.


Regards,

I was lucky enough to find the header file shared by developers and 
an example program in C++ that utilizes this lib.


Here they are: http://allunix.ru/back/atol-header.tar.gz



Maybe CreateFptrInterface() is a C++ only thing, and that you must 
call another function from the C interface to do something similar. 
But I couldn't find it reading the C header.


You need the documentation of the C interface, or at least an example 
written in C to know. You usually can't use C++ exported functions 
from Gambas.


Regards,

Maybe it is. One of the authors of the original .so library stated on 
one forum:


"You can use purely C interface like this:

void *fptr = CreateFptrInterface();
put_DeviceSingleSetting(fptr, L"Port", "4");
ApplySingleSettings(fptr);

"

but I can't see the difference.


Dmitry.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Working with .so library

2017-06-01 Thread Admin

31.05.2017 19:50, Benoît Minisini пишет:

Le 31/05/2017 à 14:36, Admin a écrit :

31.05.2017 18:18, Benoît Minisini пишет:

Le 31/05/2017 à 12:38, Admin a écrit :

31.05.2017 16:58, Benoît Minisini пишет:
Apparently all that black box is written in C++ with QT, and 
without the header of the library interface , I can't tell you if 
it is possible to use the library with Gambas, and how.


Regards,

I was lucky enough to find the header file shared by developers and 
an example program in C++ that utilizes this lib.


Here they are: http://allunix.ru/back/atol-header.tar.gz



Maybe CreateFptrInterface() is a C++ only thing, and that you must 
call another function from the C interface to do something similar. 
But I couldn't find it reading the C header.


You need the documentation of the C interface, or at least an 
example written in C to know. You usually can't use C++ exported 
functions from Gambas.


Regards,

Maybe it is. One of the authors of the original .so library stated on 
one forum:


"You can use purely C interface like this:

void *fptr = CreateFptrInterface();
put_DeviceSingleSetting(fptr, L"Port", "4");
ApplySingleSettings(fptr);

"

but I can't see the difference.


Dmitry.



Then it should work the way you did. But you did not respect the 
interface of put_DeviceSingleSettingAsInt(). It wants a "wchar_t *", 
whereas the Gambas strings are encoded in ASCII or UTF-8.


You must first convert the Gambas string to wchar_t by using 
Conv$(, "UTF-8", "WCHAR_T") or Conv$(, "ASCII", 
"WCHAR_T").


Regards,


Oh. My. God. That's exactly what I needed.

Actually, I saw that the library expetcs a variable in wchar_t format, I 
had no idea what it was, so I googled "gambas wchar_t" and found 
absolutely nothing. Then I wrote my first letter to this maillist.


And now when you gave me this line of the code, the library works 
exactly the way it should, doing everything I'm asking it for.


Huge thank you!

Dmitry/


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Working with .so library

2017-06-14 Thread Admin

01.06.2017 16:25, Admin пишет:

31.05.2017 19:50, Benoît Minisini пишет:

Le 31/05/2017 à 14:36, Admin a écrit :

31.05.2017 18:18, Benoît Minisini пишет:

Le 31/05/2017 à 12:38, Admin a écrit :

31.05.2017 16:58, Benoît Minisini пишет:
Apparently all that black box is written in C++ with QT, and 
without the header of the library interface , I can't tell you if 
it is possible to use the library with Gambas, and how.


Regards,

I was lucky enough to find the header file shared by developers 
and an example program in C++ that utilizes this lib.


Here they are: http://allunix.ru/back/atol-header.tar.gz



Maybe CreateFptrInterface() is a C++ only thing, and that you must 
call another function from the C interface to do something similar. 
But I couldn't find it reading the C header.


You need the documentation of the C interface, or at least an 
example written in C to know. You usually can't use C++ exported 
functions from Gambas.


Regards,

Maybe it is. One of the authors of the original .so library stated 
on one forum:


"You can use purely C interface like this:

void *fptr = CreateFptrInterface();
put_DeviceSingleSetting(fptr, L"Port", "4");
ApplySingleSettings(fptr);

"

but I can't see the difference.


Dmitry.



Then it should work the way you did. But you did not respect the 
interface of put_DeviceSingleSettingAsInt(). It wants a "wchar_t *", 
whereas the Gambas strings are encoded in ASCII or UTF-8.


You must first convert the Gambas string to wchar_t by using 
Conv$(, "UTF-8", "WCHAR_T") or Conv$(, "ASCII", 
"WCHAR_T").


Regards,


Oh. My. God. That's exactly what I needed.

Actually, I saw that the library expetcs a variable in wchar_t format, 
I had no idea what it was, so I googled "gambas wchar_t" and found 
absolutely nothing. Then I wrote my first letter to this maillist.


And now when you gave me this line of the code, the library works 
exactly the way it should, doing everything I'm asking it for.


Huge thank you!

Dmitry



Greetings again.

All your help was very important for me, I now have completed my cash 
register software to the point where it does everything my company 
needs. I must say Gambas is a great language, it's very easy to learn 
from scratch, I'm surprised how obvious everything is. But there is a 
lot of work for me left to do mostly in terms of managing wrong human 
actions. My software works good if the employee doesn't do any mistakes, 
but that's unrealistic, so there's a lot of things I want to control and 
check. And that's where I'm stuck.


This library (which still calls itself a driver) theoretically is able 
to return a lot of values that I need, but I can't understand basic 
rules of how do we take output from a C-lib in Gambas.


From http://gambaswiki.org/wiki/howto/extern I understood that I need 
to locate a space in memory and pass a pointer to a library so that it 
can write data into that place in ram, which I would then read and set free.


So I have to declare a pointer, then Alloc(8) it, then pass it to my 
library and then read from it like it is a stream. Does this principle 
still work in current version of Gambas?


What I don't understand is how I construct the code in my particular case.

To make an interface to the library I declare external pointer like this:

Extern CreateFptrInterface(ver As Integer) As Pointer

Then I declare some pointers that I'll use with help of the interface I 
created:


Extern put_DeviceEnable(p as Pointer, mode as Integer)

Extern GetStatus(p as Pointer, StatRequest as String)

Then I declare the pointer which will be that interface:

Public kkmDrv as Pointer

So then in sub I can do

kkmDrv = CreateFptrInterface(12) ' this establishes the interface

put_DeviceEnabled(kkmDrv, 1) ' this transfers the comand to the library 
through the interface.


And it works great.

But then If I want to get some data from the library, as I understand, I 
have to declare another pointer, allocate ram for it and pass my request.


I don't understand how should I pass that pointer to GetStatus() while 
also passing my interface pointer to it, let alone reading data back. 
Totally confused.


Any advice would be much appriciated. I don't desperately need to listen 
to my library, it's almost enough just to talk to it one way, but this 
ability could make my software much more reliable and self-controlled, 
so I really wish I could hear my library back.


Best regards.

Dmitry.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Working with .so library

2017-06-15 Thread Admin

15.06.2017 16:19, Tobias Boege пишет:

All your help was very important for me, I now have completed my cash
register software to the point where it does everything my company needs. I
must say Gambas is a great language, it's very easy to learn from scratch,
I'm surprised how obvious everything is. But there is a lot of work for me
left to do mostly in terms of managing wrong human actions. My software
works good if the employee doesn't do any mistakes, but that's unrealistic,
so there's a lot of things I want to control and check. And that's where I'm
stuck.

This library (which still calls itself a driver) theoretically is able to
return a lot of values that I need, but I can't understand basic rules of
how do we take output from a C-lib in Gambas.

 From http://gambaswiki.org/wiki/howto/extern I understood that I need to
locate a space in memory and pass a pointer to a library so that it can
write data into that place in ram, which I would then read and set free.

So I have to declare a pointer, then Alloc(8) it, then pass it to my library
and then read from it like it is a stream. Does this principle still work in
current version of Gambas?


If you do Alloc(8), then you get 8 bytes of memory. You most likely *don't*
want to read that like a stream, but use Integer@() or similar functions.


What I don't understand is how I construct the code in my particular case.

To make an interface to the library I declare external pointer like this:

 Extern CreateFptrInterface(ver As Integer) As Pointer

Then I declare some pointers that I'll use with help of the interface I
created:

 Extern put_DeviceEnable(p as Pointer, mode as Integer)

 Extern GetStatus(p as Pointer, StatRequest as String)

Then I declare the pointer which will be that interface:

 Public kkmDrv as Pointer

So then in sub I can do

kkmDrv = CreateFptrInterface(12) ' this establishes the interface

put_DeviceEnabled(kkmDrv, 1) ' this transfers the comand to the library
through the interface.

And it works great.

But then If I want to get some data from the library, as I understand, I
have to declare another pointer, allocate ram for it and pass my request.

I don't understand how should I pass that pointer to GetStatus() while also
passing my interface pointer to it, let alone reading data back. Totally
confused.


This entirely depends on how the C functions in your library are declared.
I don't know about your specific library but commonly the occurence of an
error is indicated by an integer return code, e.g. this might be the
signature of one of the functions in your library:

   int myfunction(void *interface, int argument)

If the documentation says that the return value (int) of this function
indicates an error, then you just need to get that return value back into
your Gambas program, which you accomplish by declaring the function in
Gambas as

   Extern myfunction(interface As Pointer, argument As Integer) As Integer

(notice the trailing "As Integer"). Then you can use "myfunction" in your
Gambas code like any other function and get and interpret its return value.

So, if this convention for error reporting is used, it is much simpler to
get information about errors, without using Alloc() and co. Your library
may use a different convention which actually involves pointers, but
I wouldn't know.

Regards,
Tobi

I should've said it in the beginning. Ofcourse any function returns 
integer value of 0 as success or -1 as error, but that only indicates 
that function was successfully executed or not. So GetStatus() will 
always return 0 because it shurely ran, nothing can go wrong here. But 
that's not the result I want. GetStatus() actually gives back a string 
with the status I asked for. Not that I fully understand how it does 
that. I already gave links to the libfptr.so library itself 
(http://allunix.ru/back/atol.tar.gz) and it's header files 
(http://allunix.ru/back/atol-header.tar.gz) so that it's clearer, what 
I'm talking about, unfortunately I am absolute zero in C to figure 
things out myself.


For example I can see that to get serial number of the device driven by 
that library i can use a function described like this:


get_SerialNumber(void *ptr, wchar_t *bfr, int bfrSize);

As far as I can tell what it does is it gets data needed and puts it 
into some buffer. The result of executing this function through 
put_SerialNumber(kkmDrv) will always be returned to me as 0.


So to see what's in that buffer, I have to then invoke GetStatus(kkmDrv) 
describe in .h file like GetStatus(void *ptr); and the integer result of 
this operation will also always be 0, which means that GetStatus itself 
ran successfully, but I don't care about that, I want to see what it 
actually told me, not that if it told me it successfully or not. So 
that's the main confusion. If all this is too complicated and lamely 
explained then nevermind, I expect it to be so and I'm sorry, that's the 
best I can do. I'm just really confused th

Re: [Gambas-user] Working with .so library

2017-06-15 Thread Admin

15.06.2017 17:54, Admin пишет:

15.06.2017 16:19, Tobias Boege пишет:

All your help was very important for me, I now have completed my cash
register software to the point where it does everything my company 
needs. I
must say Gambas is a great language, it's very easy to learn from 
scratch,
I'm surprised how obvious everything is. But there is a lot of work 
for me

left to do mostly in terms of managing wrong human actions. My software
works good if the employee doesn't do any mistakes, but that's 
unrealistic,
so there's a lot of things I want to control and check. And that's 
where I'm

stuck.

This library (which still calls itself a driver) theoretically is 
able to
return a lot of values that I need, but I can't understand basic 
rules of

how do we take output from a C-lib in Gambas.

 From http://gambaswiki.org/wiki/howto/extern I understood that I 
need to

locate a space in memory and pass a pointer to a library so that it can
write data into that place in ram, which I would then read and set 
free.


So I have to declare a pointer, then Alloc(8) it, then pass it to my 
library
and then read from it like it is a stream. Does this principle still 
work in

current version of Gambas?

If you do Alloc(8), then you get 8 bytes of memory. You most likely 
*don't*
want to read that like a stream, but use Integer@() or similar 
functions.


What I don't understand is how I construct the code in my particular 
case.


To make an interface to the library I declare external pointer like 
this:


 Extern CreateFptrInterface(ver As Integer) As Pointer

Then I declare some pointers that I'll use with help of the interface I
created:

 Extern put_DeviceEnable(p as Pointer, mode as Integer)

 Extern GetStatus(p as Pointer, StatRequest as String)

Then I declare the pointer which will be that interface:

 Public kkmDrv as Pointer

So then in sub I can do

kkmDrv = CreateFptrInterface(12) ' this establishes the interface

put_DeviceEnabled(kkmDrv, 1) ' this transfers the comand to the library
through the interface.

And it works great.

But then If I want to get some data from the library, as I 
understand, I
have to declare another pointer, allocate ram for it and pass my 
request.


I don't understand how should I pass that pointer to GetStatus() 
while also
passing my interface pointer to it, let alone reading data back. 
Totally

confused.

This entirely depends on how the C functions in your library are 
declared.
I don't know about your specific library but commonly the occurence 
of an

error is indicated by an integer return code, e.g. this might be the
signature of one of the functions in your library:

   int myfunction(void *interface, int argument)

If the documentation says that the return value (int) of this function
indicates an error, then you just need to get that return value back 
into

your Gambas program, which you accomplish by declaring the function in
Gambas as

   Extern myfunction(interface As Pointer, argument As Integer) As 
Integer


(notice the trailing "As Integer"). Then you can use "myfunction" in 
your
Gambas code like any other function and get and interpret its return 
value.


So, if this convention for error reporting is used, it is much 
simpler to

get information about errors, without using Alloc() and co. Your library
may use a different convention which actually involves pointers, but
I wouldn't know.

Regards,
Tobi

I should've said it in the beginning. Ofcourse any function returns 
integer value of 0 as success or -1 as error, but that only indicates 
that function was successfully executed or not. So GetStatus() will 
always return 0 because it shurely ran, nothing can go wrong here. But 
that's not the result I want. GetStatus() actually gives back a string 
with the status I asked for. Not that I fully understand how it does 
that. I already gave links to the libfptr.so library itself 
(http://allunix.ru/back/atol.tar.gz) and it's header files 
(http://allunix.ru/back/atol-header.tar.gz) so that it's clearer, what 
I'm talking about, unfortunately I am absolute zero in C to figure 
things out myself.


For example I can see that to get serial number of the device driven 
by that library i can use a function described like this:


get_SerialNumber(void *ptr, wchar_t *bfr, int bfrSize);

As far as I can tell what it does is it gets data needed and puts it 
into some buffer. The result of executing this function through 
put_SerialNumber(kkmDrv) will always be returned to me as 0.


So to see what's in that buffer, I have to then invoke 
GetStatus(kkmDrv) describe in .h file like GetStatus(void *ptr); and 
the integer result of this operation will also always be 0, which 
means that GetStatus itself ran successfully, but I don't care about 
that, I want to see what it actually told me, not that if it told me 
it su