Author Topic: A little brother of OxIde  (Read 28019 times)

0 Members and 3 Guests are viewing this topic.

Charles Pegge

  • Guest
Re: A little brother of OxIde
« Reply #45 on: May 14, 2017, 04:08:33 AM »
Thanks Roland, that looks really nice. :)

I'm still focussed on the project/file groups side, and also using the compiler to feed info back to the IDE.

Oxide will be using .o2proj files which can be associated directly with Oxide.exe. You may like to adopt a similar scheme for o2hedit.

« Last Edit: May 14, 2017, 06:31:26 AM by Charles Pegge »

Arnold

  • Guest
Re: A little brother of OxIde
« Reply #46 on: May 14, 2017, 11:36:44 PM »
Hi Charles,

thank you for the review. This project is also my attempt to implement what I have learned from you, Mike and John the last two years. And if I should ever manage to add a list with the used files for an application then this will be indeed a cool thing. But at the moment I will concentrate on the basic stuff. I noticed that I will need to turn wrapping lines on/off and that I need a monospace mode which turns bold and italic on/off. Maybe I should add the option for hiding line numbers on/off also.

I noticed that I can use the ExtracData function too for creating the keyword lists. In this way the keywords can be managed in a separate file. Scintilla can support four keyword lists. I used the third list for asm keywords, but I think the third and fourth list could also be used for other purposes e.g. Opengl keywords or the names of the functions in the folder Oxygenbasic/inc.

At the moment I try to retrieve the data of O2HEditColors from a separate file similar to the keyword lists and store them into arrays. I am not sure if there already exists an equivalent procedure provided with Oxygenbasic?

Roland

Arnold

  • Guest
Re: A little brother of OxIde
« Reply #47 on: May 16, 2017, 02:01:35 AM »
Hi Charles,

this is a sub which I would like to use in order to  retrieve arrays from a text file. It is derived from function ExtractData of OxIde. I assume I could use override to apply the sub for other types too. I know there are more solutions possible with Oxygenbasic so maybe the sub could be improved a little bit? Yet I am still not sure if there is already an existing functionality provided with the include files.

Roland

Code: [Select]
include "$/inc/console.inc"

  sub ExtractArray(string *s, k, int arr[], int c) 'array Id, dimension
  'format: $keyword {data}
  sys *array=@arr
  sys a=instr(s,k)
  if a=0 then print k " not found" : exit sub
  a=instr a,s,"{" : if a=0 then print "Error in string " k : exit sub
  b=instr a,s,"}" : if b=0 then print "Error in string " k : exit sub
  if a then
    a++ : st=mid s,a,b-a
  end if
print "text = " & st     
  sys i=1,p=1
  int n,l
  for x=1 to c
    i=instr p,st,","
    if i=0 then exit for
    l=i-p : n=mid(st,p,l) : array[x]=n
    p=i+1 : i=p
  next x
  n=mid(st,p) : array[c]=n
  end sub

'Test

string text = "
$color {
0x000000,0x800000,0x008000,0x808000,0x0000C4,0x800080,0x004080,0xC4C4C4,
0x808080,0xFF0000,0x00FF00,0xFFFF00,0x0000FF,0xFF00FF,0x00FFFF,0xFFFFFF,
0xA4A4A4,0xFFA080,0xA0FFA0,0xFFFFA0,0xA0A0FF,0xFFA0FF,0xA0FFFF,0xD4D4D4,
0xB4B4B4,0xFFDCBC,0xDCFFDC,0xFFFFDC,0xDCDCFF,0xFFDCFF,0xDCFFFF,0xE4E4E4
}
"

dim as int color(32)
ExtractArray text, "$color ", color[], 32
printl
 
for x=1 to 4
   for y=1 to 8 : print "0x" hex(color[(x-1)*8 +y]) "," : next y
printl
next x
printl

printl "Enter..." : waitkey



.

Charles Pegge

  • Guest
Re: A little brother of OxIde
« Reply #48 on: May 17, 2017, 01:52:30 AM »
Hi Roland,

These procedures are part of the next ParseUtil.inc, and might be useful to you.

Code: [Select]
function BlockData(string*s, int*i) as string
=============================================
skipspace(s,i)
byte b at i-1+strptr(s)
int lb,rb,d,e,k
def setb k=i+1 : d++
do
  select b
  case 0 : e=i : exit do
  case 1 to 31 : if not lb then e=i : exit do
  case "("  : if not lb then lb=40  : rb=41  : setb
  case "<"  : if not lb then lb=60  : rb=62  : setb
  case "["  : if not lb then lb=91  : rb=93  : setb
  case "{"  : if not lb then lb=123 : rb=125 : setb
  case lb   : d++ 'nesting
  case rb   : d-- : if d<=0 then e=i : i++ : exit do
  case else : if not k then k=i : lb=-1
  end select
  @b++
  i++
end do
skipspace(s,i)
if k then return mid(s,k,e-k)
end function


function ExtractData(string s,w, int i=1) as string
===================================================
  'format: $keyword lbracket data rbracket
  i=instr(i,s,w)
  if i then return BlockData(s,i+len(w))
end function


macro ReadNextItem(w,s,i)
=========================
  w = lcase getitem(s,i)
  select ascb
    case 0  : exit do
    case 44 : continue do
  end select
end macro


macro split(s,d, max,j,  i,w)
=============================
scope
  indexbase 1
  int i = 1
  string w
  do
    ReadNextItem w,s,i
    if j>=max then exit do
    j++
    d[j]=unquote(w)
  end do
end scope
end macro

Extracting datasets then becomes a 2 step process, supporting any primitive array type

Code: [Select]
int d[100], n
string w=ExtractData (s,"$dat ")
split(w,d, 100, n)

.
« Last Edit: May 17, 2017, 02:00:46 AM by Charles Pegge »

Arnold

  • Guest
Re: A little brother of OxIde
« Reply #49 on: May 17, 2017, 09:20:40 AM »
Charles,

I tried the example above with the new parseutil.inc and ExtractData works fine. But if I try to split w then I get an error which refers to unquote. I am not sure now if something changed with stringutils.inc too or if I simply used the split macro the wrong way?

Roland
Code: [Select]
include "$/inc/console.inc"

include "parseutil.inc"


string text = "
$color {
0x000000,0x800000,0x008000,0x808000,0x0000C4,0x800080,0x004080,0xC4C4C4,
0x808080,0xFF0000,0x00FF00,0xFFFF00,0x0000FF,0xFF00FF,0x00FFFF,0xFFFFFF,
0xA4A4A4,0xFFA080,0xA0FFA0,0xFFFFA0,0xA0A0FF,0xFFA0FF,0xA0FFFF,0xD4D4D4,
0xB4B4B4,0xFFDCBC,0xDCFFDC,0xFFFFDC,0xDCDCFF,0xFFDCFF,0xDCFFFF,0xE4E4E4
}
"

'string text = "$color [0x000000,0x800000,0x008000,0x808000,0x0000C4,0x800080,0x004080,0xC4C4C4]"

int color[32]
int n=8
string w=ExtractData (text,"$color ")
print "text w ="
printl w

'split(w,color,32, n)

printl "Enter ..." : waitkey
« Last Edit: May 18, 2017, 03:12:43 AM by Arnold »

Charles Pegge

  • Guest
Re: A little brother of OxIde
« Reply #50 on: May 18, 2017, 12:55:53 AM »
Hi Roland,

Your code works perfectly  on my new system, so I think this is a good time to post another OxygenBasic update: version A43

I've done some reorganisation of the /inc files so they relate better to each other. And I anticipate that this will be the last major update to oxygen.dll, so we can soon move to a beta phase for o2.

jcfuller

  • Guest
Re: A little brother of OxIde
« Reply #51 on: May 18, 2017, 01:46:30 AM »
I've done some reorganisation of the /inc files so they relate better to each other. And I anticipate that this will be the last major update to oxygen.dll, so we can soon move to a beta phase for o2.

Charles,
  This is excellent news. Looking forward to the Beta Release!!!

James

Arnold

  • Guest
Re: A little brother of OxIde
« Reply #52 on: May 18, 2017, 03:21:47 AM »
Hi Charles,

after installing the new release of Oxygenbasic there is no problem any more. I assume n indicates an index which defaults to zero?
When reading Oxylog.txt and Applog.txt it is obvious that you have spent a lot of work since the last release. It will take some time to cope with all the innovations. My editor project works very nice with the new version.
I see that you added the special Scilexer.dll with this release. Maybe it is possible to use the new dll from this post for your next upload:

http://www.oxygenbasic.org/forum/index.php?topic=1490.msg16251#msg16251

This dll is certainly not perfect (a programmer comfortable with C really could do much more). But I added the lexers for VB, PB, FB and Lout with this dll and it reflects the version 3.74 (without c++11 regex). It is only 5kb bigger in size, but I can use it with Scite of your download site and it works with AscEdit2.o2bas and AurelEdit.o2bas too. So there would be a small advantage until there will be a better Scilexer.dll available.

Roland

Code: OxygenBasic
  1. include "$/inc/console.inc"
  2.  
  3. includepath "$/inc/"
  4. include "parseutil.inc"
  5.  
  6. string text = "
  7. $color {
  8. 0x000000,0x800000,0x008000,0x808000,0x0000C4,0x800080,0x004080,0xC4C4C4,
  9. 0x808080,0xFF0000,0x00FF00,0xFFFF00,0x0000FF,0xFF00FF,0x00FFFF,0xFFFFFF,
  10. 0xA4A4A4,0xFFA080,0xA0FFA0,0xFFFFA0,0xA0A0FF,0xFFA0FF,0xA0FFFF,0xD4D4D4,
  11. 0xB4B4B4,0xFFDCBC,0xDCFFDC,0xFFFFDC,0xDCDCFF,0xFFDCFF,0xDCFFFF,0xE4E4E4
  12. }
  13. "
  14.  
  15. int color[32], n
  16. string w=ExtractData (text,"$color ")
  17. print "text w ="
  18. printl w
  19.  
  20. split(w,color,32, n)
  21.  
  22. printl
  23. for x=1 to 4
  24.    for y=1 to 8 : print "0x" hex(color[(x-1)*8 +y]) "," : next y
  25. printl
  26. next x
  27. printl
  28.  
  29. printl "Enter ..." : waitkey
  30.  

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #53 on: May 18, 2017, 06:06:03 AM »
Hi to ALL...  :)
This is really good news ,I only hope that all string functions work without quirks  :D

Quote
AscEdit2.o2bas and AurelEdit.o2bas too

Arnold ..so do you compile this programs with new 043 ?

Arnold

  • Guest
Re: A little brother of OxIde - AurelEdit
« Reply #54 on: May 18, 2017, 09:57:30 AM »
Hi Aurel,

yes I can execute AurelEdit with the new release A43. I am not sure though if I use the latest code of AurelEdit and awinh.inc. I do not compile to an exe file but run AurelEdit directly. I also did not compile or save the files opened with AurelEdit.
You should upload all the files which are necessary for running AurelEdit. I myself prefer to use minwin.inc as much as possible. This does save a lot of redundant work.


.

Charles Pegge

  • Guest
Re: A little brother of OxIde
« Reply #55 on: May 18, 2017, 10:06:57 AM »
Hi Roland,

I have left n to be initially set by the caller, this allows multiple data sets to be appended in one array.

I have included your Scintilla.dll, and will update tomorrow. (fixed 2 bugs, and included a few more examples)

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #56 on: May 18, 2017, 10:56:08 AM »
Hi Arnold
Quote
You should upload all the files which are necessary for running AurelEdit
yeah ..I agree but first i must fix things in awinh ,i cannot simply use minwin
by the way where is this download for A043 ?

Charles Pegge

  • Guest
Re: A little brother of OxIde
« Reply #57 on: May 19, 2017, 02:12:32 AM »
For the latest A43 click on the wizard's nose :)

Aurel

  • Guest
Re: A little brother of OxIde
« Reply #58 on: May 19, 2017, 04:52:41 AM »
OK Charles  :)

I can compile AurelEdit and looks that work ok.
I still cannot figure how to set more keywords using this new scilexer
as i said before in old 1680 i can use 3 keyword colors using LOUT lexer
but with this new versions i cannot do that ..any help with that ?
arnold maybe ..?

Arnold

  • Guest
Re: A little brother of OxIde
« Reply #59 on: May 20, 2017, 01:28:44 AM »
Hi Aurel,

searching in Internet I found a link for a custom made scintilla lexer for ebasic where I found some messages of you. Do you use this dll for your project? But then you use a specialized dll too and this would not work the same way as the Scintilla Scilexer.dll of version 2.2.0 or the Scilexer.dll for Oxygenbasic. There is a real problem then because the constants for the styles are assigned differently with the different lexers and probably handled differently. I do not know ebasic and it's syntax but for Oxygenbasic I use these assignments (for the special dll):

      ... SCI_SETLEXER, 200, 0   ' SCLEX_OXYGENBASIC

      ... SCI_SETKEYWORDS, 0, strptr OxyKeywords
      ... SCI_SETKEYWORDS, 1, strptr ApiKeywords
      ... SCI_SETKEYWORDS, 2, strptr AsmKeywords

The values for the keyword styles are defined in Scintilla.iface / Scilexer.h:

SCE_B_KEYWORD=3
SCE_B_KEYWORD2=10
SCE_B_KEYWORD3=11
SCE_B_KEYWORD4=12

and I set the FG/BG colors for these styles. The constants for the SCE_B_... values are not the same as the SCE_OB_... values of AurelEdit.o2bas.

Roland