Page 2 of 3

Re:creating an IDE for DJGPP

Posted: Sun Jan 05, 2003 12:43 pm
by engine252
that's a good id Tom but what if the user want's to delete a word or part of the word then i would have to count how many time hy hitted the delete or backspace and i would have to search the letters in that list i made
if the code of the user become long my code will be very slow and the textbox whould flicker.So i might pass that approuch but i could use the listing part for other puposses like undoing.

Re:creating an IDE for DJGPP

Posted: Sun Jan 05, 2003 12:46 pm
by engine252
i'm thinking about creating a function for searching and replacing if you know some realy fast code to do so please let me know if possible in vb.net or vb

Re:creating an IDE for DJGPP

Posted: Sun Jan 05, 2003 12:47 pm
by jrfritz
No...don't you know what a linked list is? You can just remove stuff using a linked list...with alot of data too...linked lists are fast.

Re:creating an IDE for DJGPP

Posted: Sun Jan 05, 2003 5:36 pm
by Jonathan
Nedit also has syntax highlightning.
Check it out at: http://www.nedit.org/

And by the way a friend of mine have been developing an NASM IDE that is pretty good. Its made in Delphi and currently runs under windows. Hmm but the sad thing is that he is not home at the moment. But I can drop an link to the hompage with it later in the week!

Re:creating an IDE for DJGPP

Posted: Mon Jan 06, 2003 5:22 am
by engine252
but in delphi there's a component for syntax highlighting
that's why a lot off ide are written in delphi becauls it's already in it "i think" at least if read it on the internet
and i really want to do this in vb or vb.net i want to make a sollid base here for an ide that everybody can help on eventualy.

my main goal is to make a good solid and free ide for c++ using djgpp since this compiler is free and it's (one of) the best on the internet

and for the linked list no i have never worked with a linked list i didn't mean to insult you if i did i'm sorry
i hope you still want to help me on the syntax highlighting part.

Re:creating an IDE for DJGPP

Posted: Mon Jan 06, 2003 12:40 pm
by jrfritz
I don't remember my VB...all I see now because of OS dev are loading adresses...hex....binary....sectors....

Linked lists are only something I know how to do in C/C++.

Re:creating an IDE for DJGPP

Posted: Tue Jan 07, 2003 1:33 am
by engine252
ok now i'm almost finiched with a working syntax highlighting function or functions is there anyone who knows how to get the outbut from a dos program?

when i do

shell "gcc c:\myprog.cpp -o c:\myprog.exe -lm > c:\output.txt" '<--this should put the output in output.txt

i get a blanc file. my conclosion is that i can't have a output from the djgpp compiler my there is an other way ?

my goul is to display the outpu from the compiler in a textbox or something simular.
if you know a sollution ones again please let me know

thnx in advance.

Re:creating an IDE for DJGPP

Posted: Wed Jan 08, 2003 1:23 am
by engine252
is there actualy nobody who has a sollution for my question
cm'on some people make OS's out here this should be a nutshell
i'm if you guis can't help me??? :'(

Re:creating an IDE for DJGPP

Posted: Wed Jan 08, 2003 10:41 am
by Schol-R-LEA
engine252 wrote: is there actualy nobody who has a sollution for my question
cm'on some people make OS's out here this should be a nutshell
i'm if you guis can't help me??? :'(
The problem is that gcc error messages are written to stderr, not stdout; ISTR that the usual approach in Unix is to use "2>" instead of ">", like this:

[tt]shell "gcc c:\myprog.cpp -o c:\myprog.exe -lm 2> c:\output.txt" '[/tt]

However, I tried this under Windows 98 in the DOS window and it didn't work, so either I'm mistaken, or the Windows 9x console doesn't support it (whether the NT/2k/XP console does, I cannot say).

Re:creating an IDE for DJGPP

Posted: Wed Jan 08, 2003 3:45 pm
by engine252
i must say that dous do the trick althou not always
way i don't know id like to know why thou. ???

Re:creating an IDE for DJGPP

Posted: Wed Jan 08, 2003 4:09 pm
by engine252
in visual basic whith the shell function it does not work
shell "gcc c:\myprog.cpp -o c:\myprog.exe -lm 2> output.txt",vb_whatever

that dous not work all i get is an empty file
any suggestions the command works in a normal commandpromtbox

strange...... very strange.......

Re:creating an IDE for DJGPP

Posted: Wed Jan 08, 2003 5:00 pm
by jrfritz
I don't think you can do a:

output.txt,vb_whatever but you can do this:
> output.txt

...

Re:creating an IDE for DJGPP

Posted: Thu Jan 09, 2003 2:01 am
by engine252
well i tryed that as well and that doysn't work either so maybe it's my computer but since every computer takes this commmand different i better not use this way no???

so maybe there's an other way???
:-\

Re:creating an IDE for DJGPP

Posted: Thu Jan 09, 2003 2:46 am
by engine252
i ve just read something about pipes this could help me but all the example read from stdout mine sjould read from both stderr and stdout right ?????

if you olready worked whith pipes and you can even help me just a litle bit let me know

thx

Re:creating an IDE for DJGPP

Posted: Thu Jan 09, 2003 3:38 pm
by engine252
this puts out the output of any normal command but no djgpp what's wrong ?????



part 1

Code: Select all

Option Explicit

'The CreatePipe function creates an anonymous pipe,
'and returns handles to the read and write ends of the pipe.
Private Declare Function CreatePipe Lib "kernel32" ( _
    phReadPipe As Long, _
    phWritePipe As Long, _
    lpPipeAttributes As Any, _
    ByVal nSize As Long) As Long

'Used to read the the pipe filled by the process create
'with the CretaProcessA function
Private Declare Function ReadFile Lib "kernel32" ( _
    ByVal hFile As Long, _
    ByVal lpBuffer As String, _
    ByVal nNumberOfBytesToRead As Long, _
    lpNumberOfBytesRead As Long, _
    ByVal lpOverlapped As Any) As Long

'Structure used by the CreateProcessA function
Private Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
End Type

'Structure used by the CreateProcessA function
Private Type STARTUPINFO
    cb As Long
    lpReserved As Long
    lpDesktop As Long
    lpTitle As Long
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Long
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
End Type

'Structure used by the CreateProcessA function
Private Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessID As Long
    dwThreadID As Long
End Type

'This function launch the the commend and return the relative process
'into the PRECESS_INFORMATION structure
Private Declare Function CreateProcessA Lib "kernel32" ( _
    ByVal lpApplicationName As Long, _
    ByVal lpCommandLine As String, _
    lpProcessAttributes As SECURITY_ATTRIBUTES, _
    lpThreadAttributes As SECURITY_ATTRIBUTES, _
    ByVal bInheritHandles As Long, _
    ByVal dwCreationFlags As Long, _
    ByVal lpEnvironment As Long, _
    ByVal lpCurrentDirectory As Long, _
    lpStartupInfo As STARTUPINFO, _
    lpProcessInformation As PROCESS_INFORMATION) As Long

'Close opened handle
Private Declare Function CloseHandle Lib "kernel32" ( _
    ByVal hHandle As Long) As Long

'Consts for the above functions
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const STARTF_USESTDHANDLES = &H100&
Private Const STARTF_USESHOWWINDOW = &H1


Private mCommand As String          'Private variable for the CommandLine property
Private mOutputs As String          'Private variable for the ReadOnly Outputs property

'Event that notify the temporary buffer to the object
Public Event ReceiveOutputs(CommandOutputs As String)

'This property set and get the DOS command line
'It's possible to set this property directly from the
'parameter of the ExecuteCommand method
Public Property Let CommandLine(DOSCommand As String)
    mCommand = DOSCommand
End Property

Public Property Get CommandLine() As String
    CommandLine = mCommand
End Property

'This property ReadOnly get the complete output after
'a command execution
Public Property Get Outputs()
    Outputs = mOutputs
End Property

Public Function ExecuteCommand(Optional CommandLine As String) As String
    Dim proc As PROCESS_INFORMATION     'Process info filled by CreateProcessA
    Dim ret As Long                     'long variable for get the return value of the
                                        'API functions
    Dim start As STARTUPINFO            'StartUp Info passed to the CreateProceeeA
                                        'function
    Dim sa As SECURITY_ATTRIBUTES       'Security Attributes passeed to the
                                        'CreateProcessA function
    Dim hReadPipe As Long               'Read Pipe handle created by CreatePipe
    Dim hWritePipe As Long              'Write Pite handle created by CreatePipe
    Dim lngBytesread As Long            'Amount of byte read from the Read Pipe handle
    Dim strBuff As String * 256         'String buffer reading the Pipe

    'if the parameter is not empty update the CommandLine property
    If Len(CommandLine) > 0 Then
        mCommand = CommandLine
    End If
    
    'if the command line is empty then exit whit a error message
    If Len(mCommand) = 0 Then
        MsgBox "Command Line empty", vbCritical
        Exit Function
    End If
    
    'Create the Pipe
    sa.nLength = Len(sa)
    sa.bInheritHandle = 1&
    sa.lpSecurityDescriptor = 0&
    ret = CreatePipe(hReadPipe, hWritePipe, sa, 0)
    
    If ret = 0 Then
        'If an error occur during the Pipe creation exit
        MsgBox "CreatePipe failed. Error: " & Err.LastDllError, vbCritical
        Exit Function
    End If

see page 2 for the rest of the code