Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Bugs & Feature Requests / Re: Is this a bug?
« Last post by Charles Pegge on September 14, 2020, 07:43:53 AM »
You can limit the decimal places by using a second param for str():

example:
str(1/3, 5)
0.33333

Using 0 will give you rounded integer strings.
22
Bugs & Feature Requests / Re: Removal of C-style Ternary
« Last post by Charles Pegge on September 14, 2020, 07:20:18 AM »
Code: [Select]
macro iif int(r, a ,b, c)
'int indicates the type of temp variable r
'r will replace the macro invoked in an expression
'the macro is executed beforehand to resolve the value of r
'a is a boolean / comparative expression
'b and c are return values for r
  if a
    r=b
  else
    r=c
  endif
end macro

r=iif(a>b , c, d)

'expands to:

'int temp_r
'if a>b
'  temp_r=c
'else
' temp_r=d
'endif
'...
'r=temp_r
23
Bugs & Feature Requests / Re: O2 dialog editor
« Last post by John on September 14, 2020, 07:12:54 AM »
Here is another IUP based IDE written in D for FreeBasic.

https://www.allbasic.info/forum/index.php?topic=516.msg5582#msg5582
24
Bugs & Feature Requests / Re: O2 dialog editor
« Last post by Charles Pegge on September 14, 2020, 06:53:51 AM »
You can find IUP examples in projectsB\IUP

projectsB\IUP\Scanf1.o2bas is a good demo
25
Bugs & Feature Requests / Re: O2 dialog editor
« Last post by John on September 14, 2020, 06:49:24 AM »
Here is where I left off adding a few formatting improvements.

https://sandbox.allbasic.info:8181/scriptbasic/sb-ide

It's in C but Charles has O2 examples in the distribution that will show you how to use it. The forms designer is actually a function call as part of IupShow() that would be a good starting point to incorporate in your IDE.
26
Bugs & Feature Requests / Re: O2 dialog editor
« Last post by Nicola on September 14, 2020, 06:35:34 AM »
@John

Where do I find this example?

Of course it is only applicable and with IUP or not?
27
Bugs & Feature Requests / Re: Removal of C-style Ternary
« Last post by Nicola on September 14, 2020, 06:08:11 AM »
Please explain to me how this macro works?
thank you :-[
28
Bugs & Feature Requests / Re: O2 dialog editor
« Last post by John on September 14, 2020, 05:39:20 AM »
There is an IUP editor example that might be a good place to start. I was thinking of using it as a cross platform solution for ScriptBasic as an IDE / Debugger. It also has a forms designer that could be incorporated.
29
Bugs & Feature Requests / Re: O2 dialog editor
« Last post by Nicola on September 14, 2020, 05:04:29 AM »
Hi.
What do you think of Koda?
30
Bugs & Feature Requests / Re: Is this a bug?
« Last post by Nicola on September 14, 2020, 05:03:03 AM »
Thanks Charlie, also for your patience.
At this point I like to see the results I get with the set of functions you have indicated to me.
For printing convenience I put the _str function. I'm sure you already have some function in o2 that does the same thing ...
Code: OxygenBasic
  1. use console
  2.  
  3. function _str(string s,int d=20) as string
  4.         function = s+ space(d-len(s))
  5. end function
  6.  
  7. cls
  8.  
  9. double N,r
  10. print "N" tab _str("sqrt(N)",22) _str("frac(sqrt(N))") _str("trunc(sqrt(N))") _str("ceil(sqrt(N))") _str("floor(sqrt(N))") cr
  11. for N=1 to 16
  12.   r=sqrt(N)
  13.   print N tab _str(r,22) _str(frac(r)) _str(trunc(r)) _str(ceil(r)) _str(floor(r)) cr
  14. next
  15. waitkey
  16.  

This is the result:

N       sqrt(N)               frac(sqrt(N))       trunc(sqrt(N))      ceil(sqrt(N))       floor(sqrt(N))
1       1                     0                   1                   1                   1
2       1.4142135623730951    0.4142135623730951  1                   2                   1
3       1.7320508075688772    0.7320508075688772  1                   2                   1
4       2                     0                   2                   2                   2
5       2.2360679774997898    0.2360679774997898  2                   3                   2
6       2.4494897427831779    0.4494897427831779  2                   3                   2
7       2.6457513110645907    0.6457513110645907  2                   3                   2
8       2.8284271247461903    0.8284271247461903  2                   3                   2
9       3                     0                   3                   3                   3
10      3.1622776601683795    0.1622776601683795  3                   4                   3
11      3.3166247903553998    0.3166247903553998  3                   4                   3
12      3.4641016151377544    0.4641016151377544  3                   4                   3
13      3.6055512754639891    0.6055512754639891  3                   4                   3
14      3.7416573867739413    0.7416573867739413  3                   4                   3
15      3.872983346207417     0.872983346207417   3                   4                   3
16      4                     0                   4                   4                   4


Hello
Pages: 1 2 [3] 4 5 ... 10