o2_mode 9 'to use strings insteat of char*
'
'DIRECT COMPILING : ONLY WORKS WHEN OXIDE IS COMPILED (NO JIT!)
o2_basic s
if not o2_errno then
o2_exec 0
else
print o2_error
end if
'DIRECT COMPILING : ONLY WORKS IN OXIDE.EXE
if mo then
o2_basic s 'COMPILE TO BINARY FILE DIRECTLY
if o2_errno then
s=o2_error
print s
cmsg="" ' "compiling error"
end if
SetWindowText hwnd,cmsg
else 'JIT EXECUTION IN SEPARATE PROCESS
s="\co2.exe" 'CO2 COMPILING
's="\gxo2.exe" 'GXO2 COMPILING
Exec qu+o2dir+s+qu+" "+qu+OxyPath(f)+qu 'RUN COMPILER AS A SEPARATE PROCESS
end if
#file "LateBinding.exe"
extern
!* o2_abst (string s) as string
!* o2_asmo (string s) as sys
!* o2_assemble (string s) as sys
!* o2_basic (string s) as sys
!* o2_exec (sys p=0) as sys
!* o2_buf (sys n) as sys
!* o2_errno () as sys
!* o2_error () as string
!* o2_get () as string
!* o2_len () as sys
!* o2_link () as sys
!* o2_mode (sys m)
!* o2_pathcall (sys m)
!* o2_prep (string s) as string
!* o2_put (string s)
!* o2_varcall (sys m)
' !* o2_version () as string
!* o2_view (string s) as string
end extern
sys oxl=loadlibrary "oxygen.dll"
if oxl then
def link @%1=getprocaddress oxl, "%1"
'@o2_abst=getprocaddress oxl,"o2_abst"
link o2_abst
link o2_asmo
link o2_assemble
link o2_basic
link o2_exec
link o2_buf
link o2_errno
link o2_error
link o2_get
link o2_len
link o2_link
link o2_mode
link o2_pathcall
link o2_prep
link o2_put
link o2_varcall
' link o2_version
link o2_view
end if
if not oxl then
print "Cannot locate oxygen.dll"
end
end if
o2_mode 9 'for oxygenBasic ascii strings
o2_basic "print `helo`"
if o2_errno then
print o2_error
else
o2_exec
end if
#file "LateBinding.exe"
extern
!* o2_abst (string s) as string
!* o2_asmo (string s) as sys
!* o2_assemble (string s) as sys
!* o2_basic (string s) as sys
!* o2_exec (sys p=0) as sys
!* o2_buf (sys n) as sys
!* o2_errno () as sys
!* o2_error () as string
!* o2_get () as string
!* o2_len () as sys
!* o2_link () as sys
!* o2_mode (sys m)
!* o2_pathcall (sys m)
!* o2_prep (string s) as string
!* o2_put (string s)
!* o2_varcall (sys m)
!* o2_version () as string
!* o2_view (string s) as string
end extern
sys oxl=loadlibrary "oxygen.dll"
if oxl then
string errs
def link
@%1=getprocaddress oxl, "%1"
if not @%1 then errs+="%1 is missing"+chr(13,10)
end def
'@o2_abst=getprocaddress oxl,"o2_abst"
link o2_abst
link o2_asmo
link o2_assemble
link o2_basic
link o2_exec
link o2_buf
link o2_errno
link o2_error
link o2_get
link o2_len
link o2_link
link o2_mode
link o2_pathcall
link o2_prep
link o2_put
link o2_varcall
link o2_version
link o2_view
end if
if not oxl then
print "Cannot locate oxygen.dll"
end
end if
if errs then
print errs
end
end if
o2_mode 9 'for oxygenBasic ascii strings
o2_basic "print `helo`"
if o2_errno then
print o2_error
else
o2_exec
end if
Unfortuately the Find and Find/Replace dialog with Scintilla is a bit more complicated than I expected and will be a bit delayed.hi Arnold ..
SUB FindDialogProc
INT loc
SELECT @class
CASE @idinitdialog
SetWindowPos(findDialog.hWnd,-1,0,0,0,0,0x1 | 0x2) /*HWND_TOPMOST=-1,SWP_NOSIZE | SWP_NOMOVE*/
CENTERWINDOW findDialog
'__TooltipControl(findDialog,5,"Finds the next instance of string")
'__TooltipControl(findDialog,6,"Replaces matching string with new string")
'__TooltipControl(findDialog,7,"Replaces all matching strings with new string")
SETSTATE findDialog,12,1
SETFOCUS findDialog,2
CASE @idclosewindow
CLOSEDIALOG findDialog
CASE @idcontrol
IF @notifycode=0
SELECT @controlid
'----------------------------------------------------------
CASE 5
'MESSAGEBOX 0,"Control","5"
IF GETSTATE(findDialog,12)
loc=SENDMESSAGE(w1,SCI_GETSELECTIONEND,0,0,IDC_SCI)
ELSE
loc=SENDMESSAGE(w1,SCI_GETSELECTIONSTART,0,0,IDC_SCI)
ENDIF
SENDMESSAGE w1,SCI_SETANCHOR,loc,0,IDC_SCI
SENDMESSAGE w1,SCI_SETCURRENTPOS,loc,0,IDC_SCI
SENDMESSAGE w1,SCI_SEARCHANCHOR,0,0,IDC_SCI
temp=SCFIND_REGEXP
IF GETSTATE(findDialog,16) THEN temp=SCFIND_WHOLEWORD
IF GETSTATE(findDialog,15) THEN temp|=SCFIND_MATCHCASE
IF GETSTATE(findDialog,12)
loc=SENDMESSAGE(w1,SCI_SEARCHNEXT,temp,GETCONTROLTEXT(findDialog,2),IDC_SCI)
ELSE
loc=SENDMESSAGE(w1,SCI_SEARCHPREV,temp,GETCONTROLTEXT(findDialog,2),IDC_SCI)
ENDIF
IF loc>-1
SENDMESSAGE w1,SCI_SCROLLCARET,0,0,IDC_SCI
ELSE
SHOWWINDOW findDialog,@swhide
MESSAGEBOX 0,"No matches found","Search"
SHOWWINDOW findDialog,@swrestore
ENDIF
'-------------------------------------------------------------------
CASE 6
SENDMESSAGE(w1,SCI_REPLACESEL,0,GETCONTROLTEXT(findDialog,4),IDC_SCI)
'-------------------------------------------------------------------
'------------------------------------------------------
CASE 12 : CASE& 13
SETSTATE findDialog,12,(@controlid=12)
SETSTATE findDialog,13,(@controlid=13)
ENABLECONTROL findDialog,16,GETSTATE(findDialog,12)
ENDSELECT
ENDIF
ENDSELECT
RETURN
ENDSUB
Referring the flickering: I am waiting for some hints?In fact nothing special ,you must add in main window style WS_CLIPCHILDREN
At the moment I try Aurel's idea to start the editor in the OxygenBasic
'
function filenameHTM(string nn) as string
'=======
sys a,i
string s,n
n=lcase nn
for i=1 to len(n)
a=asc(n,i)
if a<97 or a>122 then
s+="a"+str(a-31) 'supports ascii symbol encoding (space=a1)
else
s+=chr(a)
end if
next
return s+".htm"
end function
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
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
int d[100], n
string w=ExtractData (s,"$dat ")
split(w,d, 100, n)
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
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.
AscEdit2.o2bas and AurelEdit.o2bas too
You should upload all the files which are necessary for running AurelEdityeah ..I agree but first i must fix things in awinh ,i cannot simply use minwin
'basic
function foo(int v) as int
foo=v*3
end function
print foo(14) '42
int a=43
select a
case '+' : print chr(a) 'print "+"
case '-' : print chr(a)
end select
some of the new advanced functions.which are ?...are they in log file ?
s_cfg= "$o2dir [" & o2dir & "]" & cr &
"$compiler [" & compiler & "]" & cr &
"$scilexer [" & SciLib & "]" & cr &
"$reslinker [" & ResLinker & "]" & cr &
"$rccompiler [" & RcCompiler & "]" & cr &
"$reseditor [" & ResEditor & "]" & cr &
"$editor [" & extEditor & "]" & cr &
"$oxyhlp [" & OxyHelp & "]" & cr &
"$winapihlp [" & WinapiHelp & "]" & cr &
"$dir [" & dir & "]" & cr &
"$tabspaces [" & tabspaces & "]" & cr &
"$font [" & fnt & "]" & cr &
"$fontsize [" & fnz & "]" & cr &
"$ln_style_bold [" & LN_style_bold & "]" & cr &
"$ln_style_italic [" & LN_style_italic & "]" & cr &
"$clrscheme [" & scheme & "]" & cr
putfile configdir & "\O2HEdit.cfg", s_cfg
SetCurrentDirectory appdir
mbox "O2HEdit.cfg saved"
SUB SaveConfig
string sConfig , dest
char cdBuff[256]
GetCurrentDir 256, strptr cdBuff
print cdBuff 'show current folder
sConfig = "~theme " + "[" + str(theme) + "]" ' res -> ~theme[1]
dest = cdBuff + "\AurelEditConf.cfg"
putfile dest, sConfig
END SUB
SUB LoadConfig
string sConfig , dest
char cdBuff[256]
GetCurrentDir 256, strptr cdBuff
'print cdBuff 'show current folder
'sConfig = "~theme" + "[" + str(theme) + "]" ' res -> ~theme[1]
dest = cdBuff + "\AurelEditConf.cfg"
's_cfg = getfile configdir & "\O2HEdit.cfg"
'if s_cfg then
' o2dir=extractData s_cfg, "$o2dir "
' compiler=extractData s_cfg, "$compiler "
sConfig = getfile dest
IF sConfig = ""
MsgBox "Configuration file is EMPTY" + crlf +
"create new file by opening Option Window!" , "AurelEdit::INFO"
Return
ELSE
MsgBox "Configuration file Exists" + crlf + sConfig + crlf +
"OK!" , "AurelEdit::INFO"
END IF
END SUB