Re: [Gambas-user] SimpleEval

2015-12-29 Thread Fabien Bodard
In fact internally it use two process.

the first one when you set the formula. It compile it... understand
reorganize and traduce the formula into interpreter readable
sequences.
The second one when you call Execute, the interpreter read the stored sequence.
During this process if some variables are used the interpreter raise
the data event and give the required var name. So you can give it
throuth the .data property.


Internally the interpreter have bridges to every math and string
common functions of Gambas. You can extent the functions by inheriting
the simpleEval and adding your own function.

example :

Export
Inherits SimpleEval

Public Sub _New()

  SimpleEval.Functions.Add("Message")
  SimpleEval.FunctionsArgsCount.Add(1)

End


''Show a windowed message
Public Sub _MESSAGE(Val1 As CResult) As CResult

  Message(Val1.Value)
  Return New CResult(Null, CResult.TypeValue)

End

Void not exist, you must return a null result on a void function.


Simple eval does what i need... a simple extendable formula
interpreter like the one we can se on spreadsheet. I use it now on
report too.
So i can say now "='Page ' & page & ' on ' & pages"

I forgot " and ' are accepted for string delemiter


2015-12-30 7:21 GMT+01:00 Fabien Bodard :
> you can get the error and the error pos too,
>
> i've updated the class on the farm to remove the compilation warnings
>
> 2015-12-30 7:21 GMT+01:00 Fabien Bodard :
>> From the Main Module in the Farm example :
>>
>>
>> Public Sub Main()
>>   Dim hEval As New SimpleEval As "Eval"
>>   Dim hEx As New EvalEx As "Eval"
>>
>>   'Test with an unknown variable
>>   hEval.Formula = "IF(Test=1;'TROUVE';'PERDU')"
>>   hEval.Execute
>>   If Not hEval.Error Then
>> Print hEval.Value
>>   Else
>> Print hEval.ErrorText
>>   Endif
>>
>>
>>   'Test extention
>>   hEx.Formula = "Message('coucou')"
>>   hEx.Execute
>>
>>   'Test Both
>>hEx.Formula = "Message(If(Test=1;'TROUVE ' & prenom;'PERDU'))"
>>   hEx.Execute
>>
>>   'Test Calculation
>>   hEx.Formula = "Cos(1)+pi()*2^mypower"
>>   hEx.Execute
>>   Print hEx.Value
>>
>> End
>>
>>
>> Public Sub Eval_Data(Value As String)
>>
>>   If Value = "Test" Then
>> Last.data = 1
>>   Endif
>>   If Value = "mypower" Then
>> Last.data = 3
>>   Endif
>>   If Value = "prenom" Then Last.Data = "Fabien"
>>
>>
>> End
>>
>> 2015-12-30 7:10 GMT+01:00 Fabien Bodard :
>>> You get the class from where ?
>>>
>>>
>>> 2015-12-29 15:18 GMT+01:00 Charlie :
 Hi Fabian,
 I presume that you wrote the code in SimpleEval. I can't work out how to 
 use
 it. I thought it might work with my gbCalculator (see Gmabas Farm). There
 are quite a few compile warning errors.
 
 *The main thing is some examples on how to use it please.*
 Thanks.



 --
 View this message in context: 
 http://gambas.8142.n7.nabble.com/SimpleEval-tp55114.html
 Sent from the gambas-user mailing list archive at Nabble.com.
 --
 ___
 Gambas-user mailing list
 Gambas-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>
>>>
>>>
>>> --
>>> Fabien Bodard
>>
>>
>>
>> --
>> Fabien Bodard
>
>
>
> --
> Fabien Bodard



-- 
Fabien Bodard

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SimpleEval

2015-12-29 Thread Fabien Bodard
you can get the error and the error pos too,

i've updated the class on the farm to remove the compilation warnings

2015-12-30 7:21 GMT+01:00 Fabien Bodard :
> From the Main Module in the Farm example :
>
>
> Public Sub Main()
>   Dim hEval As New SimpleEval As "Eval"
>   Dim hEx As New EvalEx As "Eval"
>
>   'Test with an unknown variable
>   hEval.Formula = "IF(Test=1;'TROUVE';'PERDU')"
>   hEval.Execute
>   If Not hEval.Error Then
> Print hEval.Value
>   Else
> Print hEval.ErrorText
>   Endif
>
>
>   'Test extention
>   hEx.Formula = "Message('coucou')"
>   hEx.Execute
>
>   'Test Both
>hEx.Formula = "Message(If(Test=1;'TROUVE ' & prenom;'PERDU'))"
>   hEx.Execute
>
>   'Test Calculation
>   hEx.Formula = "Cos(1)+pi()*2^mypower"
>   hEx.Execute
>   Print hEx.Value
>
> End
>
>
> Public Sub Eval_Data(Value As String)
>
>   If Value = "Test" Then
> Last.data = 1
>   Endif
>   If Value = "mypower" Then
> Last.data = 3
>   Endif
>   If Value = "prenom" Then Last.Data = "Fabien"
>
>
> End
>
> 2015-12-30 7:10 GMT+01:00 Fabien Bodard :
>> You get the class from where ?
>>
>>
>> 2015-12-29 15:18 GMT+01:00 Charlie :
>>> Hi Fabian,
>>> I presume that you wrote the code in SimpleEval. I can't work out how to use
>>> it. I thought it might work with my gbCalculator (see Gmabas Farm). There
>>> are quite a few compile warning errors.
>>> 
>>> *The main thing is some examples on how to use it please.*
>>> Thanks.
>>>
>>>
>>>
>>> --
>>> View this message in context: 
>>> http://gambas.8142.n7.nabble.com/SimpleEval-tp55114.html
>>> Sent from the gambas-user mailing list archive at Nabble.com.
>>> --
>>> ___
>>> Gambas-user mailing list
>>> Gambas-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
>>
>> --
>> Fabien Bodard
>
>
>
> --
> Fabien Bodard



-- 
Fabien Bodard

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SimpleEval

2015-12-29 Thread Fabien Bodard
>From the Main Module in the Farm example :


Public Sub Main()
  Dim hEval As New SimpleEval As "Eval"
  Dim hEx As New EvalEx As "Eval"

  'Test with an unknown variable
  hEval.Formula = "IF(Test=1;'TROUVE';'PERDU')"
  hEval.Execute
  If Not hEval.Error Then
Print hEval.Value
  Else
Print hEval.ErrorText
  Endif


  'Test extention
  hEx.Formula = "Message('coucou')"
  hEx.Execute

  'Test Both
   hEx.Formula = "Message(If(Test=1;'TROUVE ' & prenom;'PERDU'))"
  hEx.Execute

  'Test Calculation
  hEx.Formula = "Cos(1)+pi()*2^mypower"
  hEx.Execute
  Print hEx.Value

End


Public Sub Eval_Data(Value As String)

  If Value = "Test" Then
Last.data = 1
  Endif
  If Value = "mypower" Then
Last.data = 3
  Endif
  If Value = "prenom" Then Last.Data = "Fabien"


End

2015-12-30 7:10 GMT+01:00 Fabien Bodard :
> You get the class from where ?
>
>
> 2015-12-29 15:18 GMT+01:00 Charlie :
>> Hi Fabian,
>> I presume that you wrote the code in SimpleEval. I can't work out how to use
>> it. I thought it might work with my gbCalculator (see Gmabas Farm). There
>> are quite a few compile warning errors.
>> 
>> *The main thing is some examples on how to use it please.*
>> Thanks.
>>
>>
>>
>> --
>> View this message in context: 
>> http://gambas.8142.n7.nabble.com/SimpleEval-tp55114.html
>> Sent from the gambas-user mailing list archive at Nabble.com.
>> --
>> ___
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard



-- 
Fabien Bodard

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] SimpleEval

2015-12-29 Thread Fabien Bodard
You get the class from where ?


2015-12-29 15:18 GMT+01:00 Charlie :
> Hi Fabian,
> I presume that you wrote the code in SimpleEval. I can't work out how to use
> it. I thought it might work with my gbCalculator (see Gmabas Farm). There
> are quite a few compile warning errors.
> 
> *The main thing is some examples on how to use it please.*
> Thanks.
>
>
>
> --
> View this message in context: 
> http://gambas.8142.n7.nabble.com/SimpleEval-tp55114.html
> Sent from the gambas-user mailing list archive at Nabble.com.
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread Fabien Bodard
Thank you Bruce :-)... It was really interresting. We can't figure out
how the world was so different and so identical at the same time.
Ascii is old, control sequences too, but they are also always the
underlying tools used on our modern systems and programs.


Oups i've forgotten DEL ... yes asc 127 is not printable. I'm really
curious to know why DEL is on the end of the table ... maybe they have
forget it :-/

The character "Ⱶ" is sometime used as replacement by some monitor for
unradable char. But Monitor like vt100 also have the capabilities to
use characters combination, and a set of different characaters can
give one special char. In thi case the problem is not this character
in fact but only all charaters lower than asc 32.. control chars that
interact with the terminal interpreter or with the textarea of gambas.
In the case of the text area gtk can generate error on unreconised
chars, in the case of terminal maybe too because of the char
combination.




2015-12-30 1:32 GMT+01:00 adamn...@gmail.com :
> On Tue, 29 Dec 2015 15:07:53 -0500
> Stephen  wrote:
>
>> On 12/29/2015 10:54 AM, Fabien Bodard wrote:
>> > To resume ... in the old past of ascii all standart printer or monitor
>> > can manage ascii and print 32 to 127 chars. So Ansi C provide a
>> > standart function named IsPrint that allow to say if a char was able
>> > to be printed.
>> >
>> > IN 2015... Ascii is known in it's 8 bit format so printable chars are
>> > from 32 to 255.
>> >
>> > Characters lower than 32 are for monitor, modem and printer management.
>> >
>> > Thanks to my terminal studie i'm now able to understand all of that :-).
>> >
>> > It's really interresting to study the past ...
>> >
>>It's more interesting to have LIVED it and now be working with UTF-8.
>> ASCII was SOOO simple, but also S restrictive.
>>
>> > 2015-12-29 16:39 GMT+01:00 Fabien Bodard:
>> >> But is print just take into account the old asci table
>> >>
>> >>
>> >> 2015-12-29 16:35 GMT+01:00 ML:
>> >>> All,
>> >>>
>> >>> I might be utterly wrong, but since Linux normally uses UTF-8, any
>> >>> high-bit-set char may be interpreted as one of the "multibyte char" 
>> >>> flags.
>> >>> If isprint() takes this into account, then it's dead right that char by
>> >>> itself is not printable!
>> >>>
>> >>> Hope that helps and makes sense...
>> >>>
>> >>> On 2015-12-29 11:53, Ru Vuott wrote:
>>  Tchao Fabien,
>>  Ru ..  Characters>  to 127 are printable...
>>  uhmmm... excuse me, but I do not understand.
>>  If I test the "printability" :-)  of "characters>  to 127" by using C 
>>  "isprint()" function (that checks whether the passed character is 
>>  printable), I obtain only zero results.
>>  Where: "isprint()" function returns a non-zero value (true) if 
>>  character is printable, else zero (false) if character is NOT printable.
>> 
>>  *
>>  #include
>>  int main() {
>> int i, c;
>> for (i=128; i<= 255; ++i) {
>> c = isprint(i);
>> printf("%d %d\n", i, c);
>> }
>>  return (0);
>>  }
>>  *
>>  So, it seems resulting that "characters>  to 127" are NOT printable 
>>  characters.
>>  Ciao
>
> Yes and no.  Short answer: 129 though 255 are "extended ACSII"  - a very 
> nebulous area.  What is "printable" depends on the "printing device" 
> "character code" set.
> The character "Ⱶ"  is part of a code set I recall being called the "box 
> drawing" set that was used on some CRT "print" devices from a bygone era (aka 
> before Unicode).
> In fact, the fact that I can see and recognize it means something.  The 
> following is a link to an archived article in which you can see the "amazing" 
> things that were done with such code sets in the 1980's.
>
> https://books.google.com.au/books?id=C6JUZUHEBuAC&pg=PA327&lpg=PA327&dq=the+software+bottling+company&source=bl&ots=dCVO1ZWFmo&sig=tzzYiReg3OW8NI65rmBvQXo1GXU&hl=en&sa=X&ved=0ahUKEwiC_PHvqYLKAhXjFqYKHRgrCmc4ChDoAQgwMAA#v=onepage&q=the%20software%20bottling%20company&f=false
>
> cheers
> bruce
>
>> >>> --
>> >>> ___
>> >>> Gambas-user mailing list
>> >>> Gambas-user@lists.sourceforge.net
>> >>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>> >>
>> >>
>> >> --
>> >> Fabien Bodard
>> >
>> >
>>
>>
>> --
>> Kindest Regards
>> Stephen A. Bungay, Prop.
>> Smarts On Site Information Systems
>>
>>
>> --
>> ___
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
> --
> B Bruen 
>
> ---

Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread adamn...@gmail.com
On Tue, 29 Dec 2015 15:07:53 -0500
Stephen  wrote:

> On 12/29/2015 10:54 AM, Fabien Bodard wrote:
> > To resume ... in the old past of ascii all standart printer or monitor
> > can manage ascii and print 32 to 127 chars. So Ansi C provide a
> > standart function named IsPrint that allow to say if a char was able
> > to be printed.
> >
> > IN 2015... Ascii is known in it's 8 bit format so printable chars are
> > from 32 to 255.
> >
> > Characters lower than 32 are for monitor, modem and printer management.
> >
> > Thanks to my terminal studie i'm now able to understand all of that :-).
> >
> > It's really interresting to study the past ...
> >
>It's more interesting to have LIVED it and now be working with UTF-8.
> ASCII was SOOO simple, but also S restrictive.
> 
> > 2015-12-29 16:39 GMT+01:00 Fabien Bodard:
> >> But is print just take into account the old asci table
> >>
> >>
> >> 2015-12-29 16:35 GMT+01:00 ML:
> >>> All,
> >>>
> >>> I might be utterly wrong, but since Linux normally uses UTF-8, any
> >>> high-bit-set char may be interpreted as one of the "multibyte char" flags.
> >>> If isprint() takes this into account, then it's dead right that char by
> >>> itself is not printable!
> >>>
> >>> Hope that helps and makes sense...
> >>>
> >>> On 2015-12-29 11:53, Ru Vuott wrote:
>  Tchao Fabien,
>  Ru ..  Characters>  to 127 are printable...
>  uhmmm... excuse me, but I do not understand.
>  If I test the "printability" :-)  of "characters>  to 127" by using C 
>  "isprint()" function (that checks whether the passed character is 
>  printable), I obtain only zero results.
>  Where: "isprint()" function returns a non-zero value (true) if character 
>  is printable, else zero (false) if character is NOT printable.
> 
>  *
>  #include
>  int main() {
> int i, c;
> for (i=128; i<= 255; ++i) {
> c = isprint(i);
> printf("%d %d\n", i, c);
> }
>  return (0);
>  }
>  *
>  So, it seems resulting that "characters>  to 127" are NOT printable 
>  characters.
>  Ciao

Yes and no.  Short answer: 129 though 255 are "extended ACSII"  - a very 
nebulous area.  What is "printable" depends on the "printing device" "character 
code" set.
The character "Ⱶ"  is part of a code set I recall being called the "box 
drawing" set that was used on some CRT "print" devices from a bygone era (aka 
before Unicode).
In fact, the fact that I can see and recognize it means something.  The 
following is a link to an archived article in which you can see the "amazing" 
things that were done with such code sets in the 1980's.

https://books.google.com.au/books?id=C6JUZUHEBuAC&pg=PA327&lpg=PA327&dq=the+software+bottling+company&source=bl&ots=dCVO1ZWFmo&sig=tzzYiReg3OW8NI65rmBvQXo1GXU&hl=en&sa=X&ved=0ahUKEwiC_PHvqYLKAhXjFqYKHRgrCmc4ChDoAQgwMAA#v=onepage&q=the%20software%20bottling%20company&f=false

cheers
bruce

> >>> --
> >>> ___
> >>> Gambas-user mailing list
> >>> Gambas-user@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> >>
> >> --
> >> Fabien Bodard
> >
> >
> 
> 
> -- 
> Kindest Regards
> Stephen A. Bungay, Prop.
> Smarts On Site Information Systems
> 
> 
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user


-- 
B Bruen 

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread adamn...@gmail.com
On Tue, 29 Dec 2015 16:54:29 +0100
Fabien Bodard  wrote:

> To resume ... in the old past of ascii all standart printer or monitor
> can manage ascii and print 32 to 127 chars. So Ansi C provide a
> standart function named IsPrint that allow to say if a char was able
> to be printed.
> 
> IN 2015... Ascii is known in it's 8 bit format so printable chars are
> from 32 to 255.
> 
> Characters lower than 32 are for monitor, modem and printer management.
> 
> Thanks to my terminal studie i'm now able to understand all of that :-).
> 
> It's really interresting to study the past ...

Having been part of that "past" (and I hope that doesn't mean you are going to 
"study" me...) let me expand your knowledge a bit (I hope).

Long ago and far far away, there were only three (or four) ways to 
"permanently" store  data, on paper tape, on magnetic tape, on punch cards or 
perhaps on paper. The latter being the only medium, that which we called 
"wetware" (humans), could readily understand.  Each  computer manufacturer used 
their own codification for the data they stored. Hence we had such wonderful 
things as EBCDIC, Baudot and CDCcode.  Which was fine as long as the customer 
bought their entire gear from one company, e.g. IBM, CDC, Univac etc.  Then 
along came a thing called the Kennedy tape drive.  This drive you have seen on 
old sci-fi movies, they were (originally) about 6 foot tall and have two spools 
that seem to oscillate in their rotations.  Here is a couple of pictures, the 
first to jog your grandfather's memory of the computer's greatest era and the 
second to explain the following.
http://images.spaceref.com/news/loirp/196704_6.l.highlight.jpg
https://en.wikipedia.org/wiki/File:IBM_System_360_tape_drives.jpg
What was magical about those drives were the two long vertical gray "bars" 
below the middle blue panel.  These were vacuum "tubes" that enclosed loops of 
tape "loosened" from the two spools. Why?  Because, since most tape operations 
in those days involved repeated access to the same area of a particular spool, 
this allowed the capstan that moved the tape to and fro across the read and 
write/erase heads to move at a much faster speed than the tape could be reeled 
on and off the spools, Hence that backwards and forwards movement of the spools 
seen in the old movies.
The other "magical" aspect of the Kennedy drives is that they were incorporated 
in the hardware of different computer manufacturers. This resulted in a need 
for a (or at least several) "standard" data encoding mechanism(s). 
To cut a (very) long story short along came ASCII.   Or to be very specific the 
7-bit variant thereof.  Why 7 bit? Because 2^7 = 128 and that, then was 
considered the efficient length for data encoding that could be passed across a 
modem between two devices.  Thus we get the lower 32 (IMHO) badly named 
"control characters" and the 96 very, very badly named "printable characters"!  
Why the latter? Because char(128) is NOT printable on a mechanical printer, not 
one manufactured to my recollection could actually delete (DEL) the previous 
character!  They did not have erasers. Also, many (ahem) printing devices of 
that day did "different" things when you send them a DEL. 
In the former case, to my mind, some of these "control characters" are (were) 
actually "printable". Notably the char(7) "BEL" character which caused the 
"printer" to sound an actual bell or (if they were the "fancy" ones a "BEEP".  
Others are the char(9) through char(13) set, i.e. HT, LF, VT, FF and CR 
characters. These made the "printer" do something and if you think about it 
those "somethings" are not dissimilar to what they did with a char(32), the 
infamously unnamed SPC character. They all "printed" white space, aka "nothing" 
for a specific length of character spaces. (Aside: One of the peculiar skills 
computer professionals of that era had was the recognition of those 
"nothings"!)  
Of the other supposed "control characters" they actually had two (in fact 
several) general purposes. Firstly, some of them actually "controlled" the 
communication between the sending and receiving devices.  These were STX, ETX, 
EOT, ENQ, ACK, DLE, DC1-4, NAK, SYN, ETB.  Thank the gods for these, otherwise 
we would not have the TCP stack.  
Secondly, some were specific data "items": SOH, FS, GS, RS and US and the 
dreaded EOM! (Aaargh no more tape!).  These were particularly useful for 
serially encoded data (and what we now call data streams).  The others had some 
generally arcane meanings but proved useful anyway: SO, SI, DLE, CAN, SUB and 
to some extent ESC. When I say useful I mean someone somewhere must have needed 
them - I can't say I ever did. 
This (unless I have forgotten any) leaves the notorious NUL character - which 
from my memory never actually did anything at all (but was handy if you wanted 
to send some sort of "hang in there bozo" message to the receiver).
Now, to get back to a bit of hardware.  The first (professional)

Re: [Gambas-user] C component declaration

2015-12-29 Thread Benoît Minisini
Le 29/12/2015 23:48, tercoide a écrit :
> How to declare arrays when making a component, ie :
> C declaration in library
> void glVertexPointer(GLint size, GLenum type, GLsize stride, const 
> GLvoid*array)
>
> C gb component
>
> GB_STATIC_METHOD( ..??
>
> DECLARE_METHOD(.?
>
>
>
> Ing. Martín P. Cristiá
>

This is the -user- mailing-list. I prefer that you use the -developer- 
mailing-list for C component development...

Regards,

-- 
Benoît Minisini

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] C component declaration

2015-12-29 Thread Tobias Boege
On Tue, 29 Dec 2015, tercoide wrote:
> How to declare arrays when making a component, ie :
> C declaration in library
> void glVertexPointer(GLint size, GLenum type, GLsize stride, const 
> GLvoid*array)
> 
> C gb component
> 
> GB_STATIC_METHOD( ..??
> 
> DECLARE_METHOD(.?
> 

I'll tell you how I answer such questions for myself when I forgot the
details: think hard if any Gambas component has any class with a method
that returns an array object. If you're lucky there is such a component
which is written in C. Then look into its source code how it's done.

In this case I remembered that gb.net.curl's HttpClient can return a
String[] of headers. You go to gb.net.curl/src/CHttpClient.c and find:

  GB_PROPERTY_READ("Headers", "String[]", HttpClient_Headers),

that is you treat array types like every other class by writing the full
class name into the signature. Only the primitive data types have
abbreviations.

Also you should subscribe to gambas-devel and ask C development questions
there. The gambas-user list is for... users, not developers.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] C component declaration

2015-12-29 Thread tercoide
How to declare arrays when making a component, ie :
C declaration in library
void glVertexPointer(GLint size, GLenum type, GLsize stride, const GLvoid*array)

C gb component

GB_STATIC_METHOD( ..??

DECLARE_METHOD(.?



Ing. Martín P. Cristiá


 Mensaje original 
De: gambas-user-requ...@lists.sourceforge.net
Fecha:29/12/2015  14:15  (GMT-03:00)
A: gambas-user@lists.sourceforge.net
Asunto: Gambas-user Digest, Vol 115, Issue 66

Send Gambas-user mailing list submissions to
gambas-user@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/gambas-user
or, via email, send a message with subject or body 'help' to
gambas-user-requ...@lists.sourceforge.net

You can reach the person managing the list at
gambas-user-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gambas-user digest..."


Today's Topics:

   1. Re: POSSIBLE!   bug in while loop (Stephen)
   2. Re: non printable char "?" how to remove from string!
  (Ru Vuott)
   3. SimpleEval (Charlie)
   4. Re: non printable char "?" how to remove from string! (ML)
   5. Re: non printable char "?" how to remove from string!
  (Fabien Bodard)
   6. Re: non printable char "?" how to remove from string!
  (Fabien Bodard)
   7. Re: Global variables (was: POSSIBLE! bug in while loop)
  (Tobias Boege)


--

Message: 1
Date: Tue, 29 Dec 2015 08:37:14 -0500
From: Stephen 
Subject: Re: [Gambas-user] POSSIBLE!   bug in while loop
To: Robert Boykin ,   mailing list for gambas users

Message-ID: <56828c8a.7060...@smartsonsite.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Reading this, in addition to seeing the need for a "Wait", I thought the
following;

   Does putting the desired global variable in a class mean the class
needs to be instantiated within the scope of the code example given? i.e.

PUBLIC GlobalVar as globalVars ' Change the name of the class to keep
the var name within the example unchanged.

within the code of the form which contains the GObtn and exitBtn objects?

The above would make GlobalVars.iexit visible to all classes outside of
the scope of where it was instantiated, so all forms in the project
could then see it.

However this can be avoided if the variable "iexit" is declared in a
"module" as opposed to a "class". Doing this it instantly becomes global
within the scope of the project, requiring only the addition of the
"Wait" to process the exitBtn_Click() event and exit the loop.

The change to the code is minimal;

' Gambas class file

' Static Private iexit As Integer = 0
Public Sub _new()
End

Public Sub Form_Open()
  GlobalVars.iexit = 0
End

Public Sub GObtn_Click()
  Dim n As Integer

  n = 0

  While n < 10
Print n
n = n + 1
Wait ' This is new
If GlobalVars.iexit > 0 Then Break
  Wend
End

Public Sub exitBtn_Click()
   GlobalVars.iexit = 10
End

   This works, tested under GAMBAS 3 on Fedora 14.


On 12/28/2015 09:55 PM, Robert Boykin wrote:
> Test Program code is:
> ' Gambas class file
>
> ' Static Private iexit As Integer = 0
> Public Sub _new()
> End
>
> Public Sub Form_Open()
>   GlobalVar.iexit = 0
> End
>
> Public Sub GObtn_Click()
>   Dim n As Integer
>   n = 0
>   While n<  10
>   Print n
>   n = n + 1
>   If GlobalVar.iexit>  0 Then Break
>   Wend
> End
> Public Sub exitBtn_Click()
>   GlobalVar.iexit = 10
> End
>
> This is gambas3 on linux mint 17.3 using gb.qt4
> running on a generic desktop PC
>
> The simple form has two buttons,
> one to start a while loop
> that prints numbers to the console, and
> one to set a global variable to a value which
> should cause a break in the while loop.
>
> The global variable is defined in the class GlobalVar
> ' Gambas class file
>
> Static Public iexit As Integer = 0
>
> The program begins printing numbers upon clicking the Gobtn
> but will not stop printing when the exitBtn is cliked.
>
> It appears that the exitBtn _Click() event is not recognized
>   during execution of the while loop.
>
> I am just learning gambas on my own using
>   what examples and tutorials I can find on the internet
> and believe I may have left something out.
>
> Robert S. Boykin
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>


--
Kindest Regards
Stephen A. Bungay, Prop.
Smarts On Site Information Systems




--

Message: 2
Date: Tue, 29 Dec 2015 14:53:06 + (UTC)
From: Ru Vuott 
Subject: Re: [Gambas-user] non printable char "?" how to remove from
string!
To: mailing list for gambas users ,
Fabien Bodard 

Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread Stephen
On 12/29/2015 10:54 AM, Fabien Bodard wrote:
> To resume ... in the old past of ascii all standart printer or monitor
> can manage ascii and print 32 to 127 chars. So Ansi C provide a
> standart function named IsPrint that allow to say if a char was able
> to be printed.
>
> IN 2015... Ascii is known in it's 8 bit format so printable chars are
> from 32 to 255.
>
> Characters lower than 32 are for monitor, modem and printer management.
>
> Thanks to my terminal studie i'm now able to understand all of that :-).
>
> It's really interresting to study the past ...
>
   It's more interesting to have LIVED it and now be working with UTF-8.
ASCII was SOOO simple, but also S restrictive.

> 2015-12-29 16:39 GMT+01:00 Fabien Bodard:
>> But is print just take into account the old asci table
>>
>>
>> 2015-12-29 16:35 GMT+01:00 ML:
>>> All,
>>>
>>> I might be utterly wrong, but since Linux normally uses UTF-8, any
>>> high-bit-set char may be interpreted as one of the "multibyte char" flags.
>>> If isprint() takes this into account, then it's dead right that char by
>>> itself is not printable!
>>>
>>> Hope that helps and makes sense...
>>>
>>> On 2015-12-29 11:53, Ru Vuott wrote:
 Tchao Fabien,
 Ru ..  Characters>  to 127 are printable...
 uhmmm... excuse me, but I do not understand.
 If I test the "printability" :-)  of "characters>  to 127" by using C 
 "isprint()" function (that checks whether the passed character is 
 printable), I obtain only zero results.
 Where: "isprint()" function returns a non-zero value (true) if character 
 is printable, else zero (false) if character is NOT printable.

 *
 #include
 int main() {
int i, c;
for (i=128; i<= 255; ++i) {
c = isprint(i);
printf("%d %d\n", i, c);
}
 return (0);
 }
 *
 So, it seems resulting that "characters>  to 127" are NOT printable 
 characters.
 Ciao
>>> --
>>> ___
>>> Gambas-user mailing list
>>> Gambas-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
>> --
>> Fabien Bodard
>
>


-- 
Kindest Regards
Stephen A. Bungay, Prop.
Smarts On Site Information Systems


--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Global variables

2015-12-29 Thread Stephen

On 12/29/2015 12:14 PM, Tobias Boege wrote:
> On Tue, 29 Dec 2015, Stephen wrote:
>> Reading this, in addition to seeing the need for a "Wait", I thought the
>> following;
>>
>> Does putting the desired global variable in a class mean the class
>> needs to be instantiated within the scope of the code example given? i.e.
>>
> Strictly speaking, yes.
>
>> PUBLIC GlobalVar as globalVars ' Change the name of the class to keep
>> the var name within the example unchanged.
>>
>> within the code of the form which contains the GObtn and exitBtn objects?
>>
>> The above would make GlobalVars.iexit visible to all classes outside of
>> the scope of where it was instantiated, so all forms in the project
>> could then see it.
>>
> Not really. If Form1 is the form where the Public declaration above is made,
> then another class would have to use Form1.GlobalVar.iexit to access the
> iexit variable. It cannot directly *see* the GlobalVar object.
Yes, of course.
>> However this can be avoided if the variable "iexit" is declared in a
>> "module" as opposed to a "class". Doing this it instantly becomes global
>> within the scope of the project, requiring only the addition of the
>> "Wait" to process the exitBtn_Click() event and exit the loop.
>>
> I take it that your question is "why?".
   No, not at all. It was just a statement of fact, another way of doing it.

> You can think of a module as a class
> which has an implicit
>
>Create Static
>
> statement in its header and where every symbol is implicitly Static. [ Note
> that you *can* instantiate a module using New, i.e. it is not implicitly
> Create Private, but you cannot do anything with an instance of a module
> because every symbol is static (accessing any symbol from the instance
> throws a ".  is static" error). ]
>
   Yes, exactly.

> Read about the Create Static statement here[0]. To explain my first comment
> above: You need to have an object of your global variables class available
> to use those variables. But employing Create Static you can basically make a
> class name (and class names are project-global) refer to an object (the
> automatic instance of that class). The result is that you have a globally
> accessible object.
   Yes. Is that not equivalent to using a module, albeit perhaps with 
more control.

> Regards,
> Tobi
>
> [0] http://gambaswiki.org/wiki/lang/createstatic
>


-- 
Kindest Regards
Stephen A. Bungay, Prop.
Smarts On Site Information Systems


--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Global variables (was: POSSIBLE! bug in while loop)

2015-12-29 Thread Tobias Boege
On Tue, 29 Dec 2015, Stephen wrote:
> Reading this, in addition to seeing the need for a "Wait", I thought the 
> following;
> 
>Does putting the desired global variable in a class mean the class 
> needs to be instantiated within the scope of the code example given? i.e.
> 

Strictly speaking, yes.

> PUBLIC GlobalVar as globalVars ' Change the name of the class to keep 
> the var name within the example unchanged.
> 
> within the code of the form which contains the GObtn and exitBtn objects?
> 
> The above would make GlobalVars.iexit visible to all classes outside of 
> the scope of where it was instantiated, so all forms in the project 
> could then see it.
> 

Not really. If Form1 is the form where the Public declaration above is made,
then another class would have to use Form1.GlobalVar.iexit to access the
iexit variable. It cannot directly *see* the GlobalVar object.

> However this can be avoided if the variable "iexit" is declared in a 
> "module" as opposed to a "class". Doing this it instantly becomes global 
> within the scope of the project, requiring only the addition of the 
> "Wait" to process the exitBtn_Click() event and exit the loop.
> 

I take it that your question is "why?". You can think of a module as a class
which has an implicit

  Create Static

statement in its header and where every symbol is implicitly Static. [ Note
that you *can* instantiate a module using New, i.e. it is not implicitly
Create Private, but you cannot do anything with an instance of a module
because every symbol is static (accessing any symbol from the instance
throws a ". is static" error). ]

Read about the Create Static statement here[0]. To explain my first comment
above: You need to have an object of your global variables class available
to use those variables. But employing Create Static you can basically make a
class name (and class names are project-global) refer to an object (the
automatic instance of that class). The result is that you have a globally
accessible object.

Regards,
Tobi

[0] http://gambaswiki.org/wiki/lang/createstatic

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread Fabien Bodard
To resume ... in the old past of ascii all standart printer or monitor
can manage ascii and print 32 to 127 chars. So Ansi C provide a
standart function named IsPrint that allow to say if a char was able
to be printed.

IN 2015... Ascii is known in it's 8 bit format so printable chars are
from 32 to 255.

Characters lower than 32 are for monitor, modem and printer management.

Thanks to my terminal studie i'm now able to understand all of that :-).

It's really interresting to study the past ...

2015-12-29 16:39 GMT+01:00 Fabien Bodard :
> But is print just take into account the old asci table
>
>
> 2015-12-29 16:35 GMT+01:00 ML :
>> All,
>>
>> I might be utterly wrong, but since Linux normally uses UTF-8, any
>> high-bit-set char may be interpreted as one of the "multibyte char" flags.
>> If isprint() takes this into account, then it's dead right that char by
>> itself is not printable!
>>
>> Hope that helps and makes sense...
>>
>> On 2015-12-29 11:53, Ru Vuott wrote:
>>> Tchao Fabien,
>>> Ru ..  Characters > to 127 are printable...
>>> uhmmm... excuse me, but I do not understand.
>>> If I test the "printability" :-)  of "characters > to 127" by using C 
>>> "isprint()" function (that checks whether the passed character is 
>>> printable), I obtain only zero results.
>>> Where: "isprint()" function returns a non-zero value (true) if character is 
>>> printable, else zero (false) if character is NOT printable.
>>>
>>> *
>>> #include 
>>> int main() {
>>>   int i, c;
>>>   for (i=128; i <= 255; ++i) {
>>>   c = isprint(i);
>>>   printf("%d %d\n", i, c);
>>>   }
>>>return (0);
>>> }
>>> *
>>> So, it seems resulting that "characters > to 127" are NOT printable 
>>> characters.
>>> Ciao
>>
>> --
>> ___
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard



-- 
Fabien Bodard

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread Fabien Bodard
But is print just take into account the old asci table


2015-12-29 16:35 GMT+01:00 ML :
> All,
>
> I might be utterly wrong, but since Linux normally uses UTF-8, any
> high-bit-set char may be interpreted as one of the "multibyte char" flags.
> If isprint() takes this into account, then it's dead right that char by
> itself is not printable!
>
> Hope that helps and makes sense...
>
> On 2015-12-29 11:53, Ru Vuott wrote:
>> Tchao Fabien,
>> Ru ..  Characters > to 127 are printable...
>> uhmmm... excuse me, but I do not understand.
>> If I test the "printability" :-)  of "characters > to 127" by using C 
>> "isprint()" function (that checks whether the passed character is 
>> printable), I obtain only zero results.
>> Where: "isprint()" function returns a non-zero value (true) if character is 
>> printable, else zero (false) if character is NOT printable.
>>
>> *
>> #include 
>> int main() {
>>   int i, c;
>>   for (i=128; i <= 255; ++i) {
>>   c = isprint(i);
>>   printf("%d %d\n", i, c);
>>   }
>>return (0);
>> }
>> *
>> So, it seems resulting that "characters > to 127" are NOT printable 
>> characters.
>> Ciao
>
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread ML
All,

I might be utterly wrong, but since Linux normally uses UTF-8, any
high-bit-set char may be interpreted as one of the "multibyte char" flags.
If isprint() takes this into account, then it's dead right that char by
itself is not printable!

Hope that helps and makes sense...

On 2015-12-29 11:53, Ru Vuott wrote:
> Tchao Fabien,
> Ru ..  Characters > to 127 are printable... 
> uhmmm... excuse me, but I do not understand.
> If I test the "printability" :-)  of "characters > to 127" by using C 
> "isprint()" function (that checks whether the passed character is printable), 
> I obtain only zero results.
> Where: "isprint()" function returns a non-zero value (true) if character is 
> printable, else zero (false) if character is NOT printable.
>
> *
> #include 
> int main() {
>   int i, c;
>   for (i=128; i <= 255; ++i) {
>   c = isprint(i);
>   printf("%d %d\n", i, c);
>   }
>return (0);
> }
> *
> So, it seems resulting that "characters > to 127" are NOT printable 
> characters.
> Ciao

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] SimpleEval

2015-12-29 Thread Charlie
Hi Fabian,
I presume that you wrote the code in SimpleEval. I can't work out how to use
it. I thought it might work with my gbCalculator (see Gmabas Farm). There
are quite a few compile warning errors.
 
*The main thing is some examples on how to use it please.*
Thanks.



--
View this message in context: 
http://gambas.8142.n7.nabble.com/SimpleEval-tp55114.html
Sent from the gambas-user mailing list archive at Nabble.com.
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread Ru Vuott
Tchao Fabien,


> Ru ..  Characters > to 127 are printable... 

uhmmm... excuse me, but I do not understand.
If I test the "printability" :-)  of "characters > to 127" by using C 
"isprint()" function (that checks whether the passed character is printable), I 
obtain only zero results.
Where: "isprint()" function returns a non-zero value (true) if character is 
printable, else zero (false) if character is NOT printable.

*
#include 


int main() {

int i, c;

for (i=128; i <= 255; ++i) {
c = isprint(i);
printf("%d %d\n", i, c);
}

   return (0);

}
*

So, it seems resulting that "characters > to 127" are NOT printable characters.


Ciao

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] POSSIBLE! bug in while loop

2015-12-29 Thread Stephen
Reading this, in addition to seeing the need for a "Wait", I thought the 
following;

   Does putting the desired global variable in a class mean the class 
needs to be instantiated within the scope of the code example given? i.e.

PUBLIC GlobalVar as globalVars ' Change the name of the class to keep 
the var name within the example unchanged.

within the code of the form which contains the GObtn and exitBtn objects?

The above would make GlobalVars.iexit visible to all classes outside of 
the scope of where it was instantiated, so all forms in the project 
could then see it.

However this can be avoided if the variable "iexit" is declared in a 
"module" as opposed to a "class". Doing this it instantly becomes global 
within the scope of the project, requiring only the addition of the 
"Wait" to process the exitBtn_Click() event and exit the loop.

The change to the code is minimal;

' Gambas class file

' Static Private iexit As Integer = 0
Public Sub _new()
End

Public Sub Form_Open()
  GlobalVars.iexit = 0
End

Public Sub GObtn_Click()
  Dim n As Integer

  n = 0

  While n < 10
Print n
n = n + 1
Wait ' This is new
If GlobalVars.iexit > 0 Then Break
  Wend
End

Public Sub exitBtn_Click()
   GlobalVars.iexit = 10
End

   This works, tested under GAMBAS 3 on Fedora 14.


On 12/28/2015 09:55 PM, Robert Boykin wrote:
> Test Program code is:
> ' Gambas class file
>
> ' Static Private iexit As Integer = 0
> Public Sub _new()
> End
>
> Public Sub Form_Open()
>   GlobalVar.iexit = 0
> End
>
> Public Sub GObtn_Click()
>   Dim n As Integer
>   n = 0
>   While n<  10
>   Print n
>   n = n + 1
>   If GlobalVar.iexit>  0 Then Break
>   Wend
> End
> Public Sub exitBtn_Click()
>   GlobalVar.iexit = 10
> End
>
> This is gambas3 on linux mint 17.3 using gb.qt4
> running on a generic desktop PC
>
> The simple form has two buttons,
> one to start a while loop
> that prints numbers to the console, and
> one to set a global variable to a value which
> should cause a break in the while loop.
>
> The global variable is defined in the class GlobalVar
> ' Gambas class file
>
> Static Public iexit As Integer = 0
>
> The program begins printing numbers upon clicking the Gobtn
> but will not stop printing when the exitBtn is cliked.
>
> It appears that the exitBtn _Click() event is not recognized
>   during execution of the while loop.
>
> I am just learning gambas on my own using
>   what examples and tutorials I can find on the internet
> and believe I may have left something out.
>
> Robert S. Boykin
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>


-- 
Kindest Regards
Stephen A. Bungay, Prop.
Smarts On Site Information Systems


--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] [Gambas Bug Tracker] Bug #881: When the ComboBox is initialized with the list property, setting the index to 0 not work.

2015-12-29 Thread bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.881&from=L21haW4-

Fabien BODARD reported a new bug.

Summary
---

When the ComboBox is initialized with the list property, setting the index to 0 
not work.

Type : Bug
Priority : Medium
Gambas version   : Unknown
Product  : QT4 component


Description
---

All is in the description. If I set the index to something up to 0, it work. 
All go well with gtk for this time.





--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] POSSIBLE! bug in while loop

2015-12-29 Thread Fabien Bodard
Private hTimer as timer as "LoopTimer"
Private bHalt as Boolean
Private iCount as integer


Public Sub LoopTimer_Timer()

if bHalt or if iCount>=10 then
  bHalt = False
  iCount = 0
  Return
endif

inc ICount
Print iCount

hTimer.Trigger

End

Public Sub btnGo_Click()
  hTimer.Trigger
End

Public Sub btnStop_Click()
  bHalt = True
End

Async Version that use purely the Gambas Event loop


2015-12-29 5:33 GMT+01:00 adamn...@gmail.com :
> Add a Wait instruction after n=n+1 to invoke the Event Loop. (Research the 
> help on this)
> Also see Inc.
>
> hth
> b
> On Tue, 29 Dec 2015 02:55:41 + (UTC)
> Robert Boykin  wrote:
>
>> Test Program code is:
>> ' Gambas class file
>>
>> ' Static Private iexit As Integer = 0
>> Public Sub _new()
>> End
>>
>> Public Sub Form_Open()
>>  GlobalVar.iexit = 0
>> End
>>
>> Public Sub GObtn_Click()
>>  Dim n As Integer
>>  n = 0
>>  While n < 10
>>  Print n
>>  n = n + 1
>>  If GlobalVar.iexit > 0 Then Break
>>  Wend
>> End
>> Public Sub exitBtn_Click()
>>  GlobalVar.iexit = 10
>> End
>>
>> This is gambas3 on linux mint 17.3 using gb.qt4
>> running on a generic desktop PC
>>
>> The simple form has two buttons,
>> one to start a while loop
>> that prints numbers to the console, and
>> one to set a global variable to a value which
>> should cause a break in the while loop.
>>
>> The global variable is defined in the class GlobalVar
>> ' Gambas class file
>>
>> Static Public iexit As Integer = 0
>>
>> The program begins printing numbers upon clicking the Gobtn
>> but will not stop printing when the exitBtn is cliked.
>>
>> It appears that the exitBtn _Click() event is not recognized
>>  during execution of the while loop.
>>
>> I am just learning gambas on my own using
>>  what examples and tutorials I can find on the internet
>> and believe I may have left something out.
>>
>> Robert S. Boykin
>> --
>> ___
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
> --
> B Bruen 
>
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] non printable char "Ⱶ" how to remove from string!!!!!

2015-12-29 Thread Fabien Bodard
Ru ..  Characters > to 127 are printable... But terminals sometime
replace non printable chars by those one

2015-12-29 0:56 GMT+01:00 Ru Vuott :
>
>> and Ru Vuott  thanks for suggestion i'll try later
>
>
> If the string has 2 or more no-printable characters, you have to modify my 
> code, so:
>
> Public Sub Main()
>
>Dim s As String = "ab" & Chr(180) & "cd ef" & Chr(185) & "g" & Chr(195) & 
> "hil" & Chr(179) & " mnop"
>Dim bb As Byte[]
>Dim b As Byte
>Dim i As Integer
>
> Print s
>
> With bb = Byte[].FromString(s)
>   i = .Count
> End With
>
> While b < i
>   If Not IsAscii(Chr(bb[b])) Then
> bb.Remove(b)
> Dec i
>   Endif
>   Inc b
> Wend
>
> s = bb.ToString(0, bb.count)
>
> Print s
>
> End
> 
>
> Saludosss  ;-)
>
> --
> ___
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user



-- 
Fabien Bodard

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user