NO

Author Topic: BARE bones editor for using w/Pelles C  (Read 5425 times)

James

  • Guest
BARE bones editor for using w/Pelles C
« on: January 12, 2009, 10:56:37 AM »
Hi, everybody, I'm sharing this editor program I made and like with everybody. You can do whatever you want with it.

It's simple. You type in code, and click Console, and it spits out an executable.

I put it in a folder with these 6 files:

polink.exe
porc.exe
cc.exe
pocc.exe
poasm.exe

bc.exe

(BCX Basic to C translator)

You 'compile' it with the free Just Basic compiler.

Code: [Select]
'------------ DON'T CHANGE THE FOLLOWING CODE !!!! ------------------------------
    bmphoofd$="66 77 182 1 0 0 0 0 0 0 62 0 0 0 40 0 0 0 50 0 0 0 47 0 0 0 1 0 1 0 0 0 0 0 120 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
    bmplijnen=4
    dim z$(bmplijnen)
    z$(1)="$4$!$3$ÿ!$6$ÿÀ!€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!"
    z$(2)="€$5$!@!Àø#24##15#€@!€aŒ#12##28#À@!€1†#12##24#!@!€ñ†#12##24#!@!ƒÀÃ#6##15#à@!ƒ!Ã#6##12#`@!ƒ€g#6##6#`@!€ü>#3##3#à@!€!!#3#!!@!€!!#3#!!@!€!!#1#€!@!€!!#15#€!@!€$5$!@!"
    z$(3)="€$5$!@!€$5$!@!ƒðøÆ!!@!‡#1#Œc!!@!†#1#†c!!@!†#1#†c!!@!ƒ!Ã1‡à@!ƒ!Ã1€!@!Àg=€!@!€~>#31#€!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!"
    z$(4)="€$5$!@!€$5$!@!€$5$!@!€$5$!@!€$5$!@!$6$ÿÀ$64$!!"
    bmplijnen=4
'--------------------------------------------------------------------------------

    bmphfd$=""
    for bmpt=1 to 54
        hoofd$=word$(bmphoofd$,bmpt," ")
        hoofd=val(hoofd$)
        hoofd$=chr$(hoofd)
        bmphfd$=bmphfd$+hoofd$
    next bmpt
    bmpl$=""
    for bmpln=1 to bmplijnen        'READING THE DATA AND RECALCULATING FILE
        punten=0:teller=1:herhaal=0:herhaalaantal=0:heraan=0
        if mid$(z$(bmpln),1,1)="%" then
            rdnlines=0
            [zelfdelijnherhaal]
                rdnlines=rdnlines+1
                hrhlntl$=mid$(z$(bmpln),teller+rdnlines+1,1)
                if hrhlntl$<>"%" then goto [zelfdelijnherhaal]
            herhaalaantal$=mid$(z$(bmpln),teller+1,rdnlines)
            herhaalaantal=val(herhaalaantal$)
            herhaal=1
            teller=teller+rdnlines+2
        end if
        bmpli$=""
[readinglines]
        bmpunt$=mid$(z$(bmpln),teller,1)
        if bmpunt$="$" then
            rdnlines=0
            [rdnglns]
                rdnlines=rdnlines+1
                bmpunt$=mid$(z$(bmpln),teller+rdnlines,1)
                if bmpunt$<>"$" then goto [rdnglns]
            bmpunt$=mid$(z$(bmpln),teller+1,rdnlines-1)
            bmpunt=val(bmpunt$)
            teller=teller+rdnlines+1
            bmpunt=val(bmpunt$)
            if mid$(z$(bmpln),teller,1)="#" then
                rdnlines=0
                [rdnglnstwee]
                    rdnlines=rdnlines+1
                    bmkleur$=mid$(z$(bmpln),teller+rdnlines,1)
                    if bmkleur$<>"#" then goto [rdnglnstwee]
                bmkleur$=mid$(z$(bmpln),teller+1,rdnlines-1)
                teller=teller+rdnlines
                bmkleur$=chr$(val(bmkleur$))
            else
                bmkleur$=mid$(z$(bmpln),teller,1)
                if bmkleur$="!" then bmkleur$=chr$(0)
            end if
            teller=teller+1
            for informatie=1 to bmpunt
                bmpli$=bmpli$+bmkleur$
            next informatie
            punten=punten+bmpunt
        else
            if bmpunt$="!" then bmpunt$=chr$(0)
            if bmpunt$="#" then
                rdnlines=0
                [rdnglnsdrie]
                    rdnlines=rdnlines+1
                    bmpunt$=mid$(z$(bmpln),teller+rdnlines,1)
                    if bmpunt$<>"#" then goto [rdnglnsdrie]
                bmpunt$=mid$(z$(bmpln),teller+1,rdnlines-1)
                bmpunt$=chr$(val(bmpunt$))
                teller=teller+rdnlines
            end if
            bmpli$=bmpli$+bmpunt$
            teller=teller+1
            punten=punten+1
        end if
        if punten<112 then goto [readinglines]
        [readinglinesherhaal]
            heraan=heraan+1
            bmpl$=bmpl$+bmpli$
            if heraan<herhaalaantal then goto [readinglinesherhaal]
    next bmpln
    open "xxqqyyzzrutger.qyx" for output as #opslaan
    print #opslaan, bmphfd$+bmpl$
    close #opslaan

'--------------------end of rutger's extract code-----------------------------

name "xxqqyyzzrutger.qyx" as "console.bmp"

dim fcheck$(10, 10) ' for filecheck operation

global check$ ' for filecheck operation

fraction = 1000 ' a fraction of a minute
biggerfraction = 5000 ' a bigger fraction of a minute

[setup.main.Window]

    '-----Begin code for #main

    nomainwin
    WindowWidth = 920
    WindowHeight = 630
    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)


    '-----Begin GUI objects code

    TexteditorColor$ = "white"
    menu #main, "Program", "Open", [popen], "Save As...", [saveas]
    texteditor #main.textedit1,   5,   5, 835, 570
    bmpbutton #main.console, "console.bmp", [console], UL, 850, 2

    '-----End GUI objects code

    '-----Begin menu code

    menu #main, "Edit"  ' <-- Texteditor menu.


    '-----End menu code

    open "BCX - Editor - 1.1" for window as #main
    print #main, "font lucida_console bold 14"
    print #main, "trapclose [quit.main]"

    kill "console.bmp"

[main.inputLoop]   'wait here for input event
    wait



[console]   'Perform action for the bmpbutton named 'console'

print #main.console, "disable"

open "text.bat" for output as #afile
print #afile, "bc.exe basic"
print #afile, "cc.exe /Ze /Zx basic.c"
print #afile, "basic.exe"
close #afile

open "basic.bas" for output as #afile
print #main.textedit1, "!contents? program$"
print #afile, program$;
close #afile

run "text.bat" ' start batch file

timer fraction, [cleanup]

wait ' stop here mates!

[popen]

filedialog "Open Program ...", "*.bcx", afile$
if afile$ = "" then wait

open afile$ for input as #afile

print #main.textedit1, "!contents #afile"
close #afile

wait

[saveas]

filedialog "Save Program As ...", "*.bcx", afile$
if afile$ = "" then wait

open afile$ for output as #afile
print #main.textedit1, "!contents? program$"
print #afile, program$;
close #afile

wait

[quit.main] 'End the program
    close #main
    end

function fexists()
cfile$ = DefaultDir$ + "\" + check$
files DefaultDir$, cfile$, fcheck$( ' check for file
fexists = val(fcheck$(0, 0))
end function

[cleanup]

if cleaned = 0 then
check$ = "basic.bas"
timer biggerfraction, [cleanup]
if fexists() then kill check$
cleaned = cleaned + 1
wait ' wait
end if

if cleaned = 1 then
check$ = "basic.c"
timer fraction, [cleanup]
if fexists() then kill check$
cleaned = cleaned + 1
wait ' wait
end if

if cleaned = 2 then
check$ = "basic.obj"
if fexists() then kill check$
cleaned = cleaned + 1
wait ' wait
end if

if cleaned = 3 then
check$ = "text.bat"
if fexists() then kill check$
cleaned = cleaned + 1
wait ' wait
end if

if cleaned = 4 then
print #main.console, "enable"
cleaned = 0 ' reset cleaner
timer 0 ' stop cleaning
wait ' wait
end if

wait

« Last Edit: January 12, 2009, 04:07:25 PM by James »

James

  • Guest
Re: BARE bones editor for using w/Pelles C
« Reply #1 on: January 12, 2009, 11:09:43 AM »
If it doesn't work on your PC, you can change the fraction or biggerfraction variable to a larger amount for sufficient compile time. :)
« Last Edit: January 12, 2009, 04:08:40 PM by James »

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 191
    • Bcx Basic to C/C++ Translator
Re: BARE bones editor for using w/Pelles C
« Reply #2 on: January 13, 2009, 12:24:09 AM »
Admittedly a presumption on my part, but I think your contribution
would be more suitable in a "JUST BASIC" forum.  Many (most) veteran
C programmers hold the BASIC programming language in fairly low regard.

Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

James

  • Guest
Re: BARE bones editor for using w/Pelles C
« Reply #3 on: January 13, 2009, 07:58:11 AM »
 OOPS! :P
« Last Edit: January 13, 2009, 09:20:01 AM by James »