Page 1 of 2
Code Explorer [jaPBe plugin]
Posted: Mon Jun 28, 2004 8:13 am
by gnozal
Code Explorer (jaPBe standalone plugin) Last update : SEPT 10th 2008
Description :
Code Explorer is an enhanced version of the PBI's Code Templates plugin for jaPBe.
I use it to view / find code templates in my purebasic code archives (some are
zipped).
Major changes (new features) :
Code: Select all
- ZIP archive support in file explorer panel.
- new search panel to find text in files (ZIP archive supported) with favorite
directories and search history support.
- syntax highlighting (not so fast that I hoped, so it can be disabled).
- find text function.
- added compile/run (jaPBe plugin).
- added Win32 help in viewer context-menu (search for selected text)
(the file win32.hlp must be located in %PUREBASIC%\HELP).
Minor changes :
- it can be used as a jaPBe plugin (Options\'Register jaPBe Plugin' button)
or not : just run CodeExplorer.exe from any directory. You will have all
the features minus the jaPBe copy/insert functions.
- files list is now sorted.
- right-click context menu in viewer (if used as a jaPBe plugin).
- the jaPBe functions now work with >64 text (using pointers and not strings).
- code loading through RichEdit stream callback (faster).
Download :
http://gnozal.ucoz.com/CodeExplorer.zip
Posted: Wed Apr 20, 2005 8:08 am
by gnozal
Update
Fixed some installation problems
Posted: Tue May 10, 2005 7:58 am
by gnozal
Update
Fixed CopyToJaPBe function
This message was lost during the forum crash
Posted: Sun Jul 31, 2005 4:17 pm
by Jan2004
Could you explain 2 options in Options tab:
"Load keywords from PureBasic.exe"
"Start PBCompiler if necessary"
Thanks in advance:
Jan2004
Posted: Mon Aug 01, 2005 8:14 am
by gnozal
Jan2004 wrote:Could you explain 2 options in Options tab:
"Load keywords from PureBasic.exe"
"Start PBCompiler if necessary"
"Load keywords from PureBasic.exe"
Search for purebasic keywords in the Purebasic.exe (editor) for the syntax highlighting.
"Start PBCompiler if necessary"
The functions names (for the syntax highlighting) are loaded from file PBFunctionListing.txt created by the compiler. If this file does not exist and the option is checked, CoodeExplorer will launch the compiler to create the file.
Posted: Mon Aug 01, 2005 9:59 am
by Jan2004
All clear.
Thanks again.
Posted: Fri Oct 14, 2005 7:50 am
by gnozal
Update
Changes
- Updated keywords extraction code (compatible with the new editor)
Posted: Fri Oct 21, 2005 6:57 pm
by blueznl
gnozal, i would like to know how you did the update keywords thingy exactly, would you be willing to share the info / code?
Posted: Sat Oct 22, 2005 8:03 am
by gnozal
blueznl wrote:gnozal, i would like to know how you did the update keywords thingy exactly, would you be willing to share the info / code?
I don't have the CodeExplorer code at hand right now, but here is the code from PureSynPlus
viewtopic.php?t=14343 wich should be the same (old code, not very clean, it has been updated many times to match with every new PB Editor version, but seems to work).
Code: Select all
Procedure.l ExtractPBFunctions()
Protected FunctionsFile.s, Stream.l
FunctionsFile = GetPBFolder() + "Compilers\PBFunctionListing.txt"
If FileSize(FunctionsFile) < 1
; Call PBCompiler to create the file
#PB_MSG_Compiler_Ready = 10157
PB_MSG_ID = RegisterWindowMessage_("PB_MSG_ID")
PBCompiler.s = GetPBFolder() + "Compilers\PBCompiler.exe"
Parameters.s = Str(GetCurrentThreadId_()) + " /STANDBY"
CompilerProcessID = RunProgram(PBCompiler, Parameters, "", 2)
If CompilerProcessID
Repeat
Event = WindowEvent()
If Event = PB_MSG_ID
If EventwParam() = #PB_MSG_Compiler_Ready
CompilerThreadID = EventlParam()
TerminateProcess_(CompilerProcessID,0)
Break
EndIf
EndIf
ForEver
EndIf
EndIf
Stream = ReadFile(#PB_Any, FunctionsFile)
If Stream
; Load functions
NbBasicFunctions = Val(ReadString())
If NbBasicFunctions < 60000 And NbBasicFunctions > 0
ClearList(PurebasicFunctions())
; Charger fonctions
CurrentFunction = 1
*MotsClefs_Fonctions_AllocMem = GlobalAlloc_(#GMEM_FIXED | #GMEM_ZEROINIT, Lof() + 2)
*ProgressionMem.BYTE = *MotsClefs_Fonctions_AllocMem
If *ProgressionMem
ReadData(*ProgressionMem, Lof())
Repeat
OldProgressionMem = *ProgressionMem
Repeat
*ProgressionMem = *ProgressionMem + 1
Until *ProgressionMem\b = 32 Or *ProgressionMem\b = 10 Or *ProgressionMem\b = 0
If *ProgressionMem\b = 32
*ProgressionMem\b = 0
AddElement(PurebasicFunctions())
PurebasicFunctions()= PeekS(OldProgressionMem)
Repeat
*ProgressionMem = *ProgressionMem + 1
Until *ProgressionMem\b = 10 Or *ProgressionMem\b = 0
ElseIf *ProgressionMem\b = 10
*ProgressionMem\b = 0
AddElement(PurebasicFunctions())
PurebasicFunctions()= PeekS(OldProgressionMem)
Else
Break
EndIf
*ProgressionMem = *ProgressionMem + 1
Until CurrentFunction > NbBasicFunctions Or *ProgressionMem\b = 0
GlobalFree_(*MotsClefs_Fonctions_AllocMem)
EndIf
EndIf
CloseFile(Stream)
EndIf
ProcedureReturn CountList(PurebasicFunctions())
EndProcedure
;
Procedure.l ExtractPBKeywords()
Protected PurebasicEXEFile.s, Stream.l
PurebasicEXEFile = GetPBFolder() + "purebasic.exe"
TailleFichier.l = FileSize(PurebasicEXEFile)
If TailleFichier > 4
Stream = ReadFile(#PB_Any, PurebasicEXEFile)
If Stream
ClearList(PurebasicKeywords())
*MotsClefs_Fonctions_AllocMem = GlobalAlloc_(#GMEM_FIXED | #GMEM_ZEROINIT, Lof() + 2)
*ProgressionMem1.LONG = *MotsClefs_Fonctions_AllocMem
FinProgressionMem = *ProgressionMem1 + Lof()
If *ProgressionMem1
ReadData(*ProgressionMem1, Lof())
; Recherche début
Repeat
If *ProgressionMem1\l = $00646E41 ; '<Nul>dnA'
*ProgressionMem1 = *ProgressionMem1 + 4
If *ProgressionMem1\l = $00646E61 ; '<Nul>dna'
*ProgressionMem2.BYTE = *ProgressionMem1 - 5
Debug "found : " + Str(*ProgressionMem1 - 4 - *MotsClefs_Fonctions_AllocMem)
Break
EndIf
EndIf
*ProgressionMem1 = *ProgressionMem1 + 1
Until *ProgressionMem1 = FinProgressionMem
; Extraction des mots clés
If *ProgressionMem2
MotClef.s = ""
MotClefToggle.l = 1
LastMotClef.l = -1
Repeat
*ProgressionMem2 = *ProgressionMem2 + 1
If *ProgressionMem2\b = 0 And LastMotClef <> 0
MotClef = Trim(MotClef)
If UCase(MotClef) = "AAA"
; on s'arrête aux mot clés ASM [en majuscules]
Break
EndIf
If MotClef
If CountList(PurebasicKeywords())
ExisteDeja = #FALSE
ForEach PurebasicKeywords()
If UCase(PurebasicKeywords()) = UCase(MotClef)
ExisteDeja = #TRUE
Break
EndIf
Next
If ExisteDeja = #FALSE
AddElement(PurebasicKeywords())
PurebasicKeywords()= MotClef
Debug MotClef
EndIf
Else
AddElement(PurebasicKeywords())
PurebasicKeywords()= MotClef
Debug MotClef
EndIf
MotClef = ""
EndIf
ElseIf (*ProgressionMem2\b > 96 And *ProgressionMem2\b < 123) Or (*ProgressionMem2\b > 64 And *ProgressionMem2\b < 91)
MotClef = MotClef + Chr(*ProgressionMem2\b)
EndIf
LastMotClef = *ProgressionMem2\b
Until *ProgressionMem2 = FinProgressionMem
EndIf
GlobalFree_(*MotsClefs_Fonctions_AllocMem)
EndIf
CloseFile(Stream)
EndIf
EndIf
ProcedureReturn CountList(PurebasicKeywords())
EndProcedure
Posted: Sat Dec 02, 2006 1:38 am
by oryaaaaa
Launch Error
No drive E: !
My Drive Setting
A: Floppy
C: & D: SD&CF Memory slot
E: DVD-RW
F: Windows
G: External HDD
<ADD&Solved)
Special Directry Remove Example
Restart
Posted: Sat Sep 08, 2007 10:34 am
by gnozal
Update
- added PB4.1x support
I mostly use PureTemplate now :
http://www.purebasic.fr/english/viewtopic.php?t=28477
Posted: Wed Oct 10, 2007 7:33 am
by gnozal
Update (build 12)
Changes :
- updated PB folder detection for PB4.10 beta 4
- fixed crash with Vista
Posted: Tue Apr 15, 2008 1:44 pm
by gnozal
Update
Changes :
- update for PB4.20 beta
Problems with CodeExplorer
Posted: Thu Jun 19, 2008 11:26 am
by mjwiech
Running CodeExplorer from any directory (even from within the IDE) gives error message: "Purebasic not found".
Regards
mjw
Posted: Tue Jun 24, 2008 5:20 pm
by gnozal
CodeExplorer uses this code to get the PB directory :
Code: Select all
Procedure.s GetPBFolder() ; Retrieves Purebasic folder [empty string if not installed]
Protected hKey1.l, Type.l, Res.l, Folder$, lpbData.l, cbData.l, WindowsVersion.l
cbData = (#MAX_PATH * 2) + 2
lpbData = AllocateMemory(cbData)
Folder$=""
hKey1=0
Type=0
Res=-1
WindowsVersion = OSVersion()
If WindowsVersion = #PB_OS_Windows_95 Or WindowsVersion = #PB_OS_Windows_98 Or WindowsVersion = #PB_OS_Windows_ME
Debug "Detected OS : Windows 95/98/ME"
Res=RegOpenKeyEx_(#HKEY_LOCAL_MACHINE, "Software\Classes\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS, @hKey1)
ElseIf WindowsVersion = #PB_OS_Windows_NT3_51 Or WindowsVersion = #PB_OS_Windows_NT_4 Or WindowsVersion = #PB_OS_Windows_2000 Or WindowsVersion = #PB_OS_Windows_XP Or WindowsVersion = #PB_OS_Windows_Server_2003
Debug "Detected OS : Windows NT/2000/XP"
Res=RegOpenKeyEx_(#HKEY_CLASSES_ROOT, "Applications\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS, @hKey1)
Else
Debug "Detected OS : Windows Vista/Server 2008"
Res=RegOpenKeyEx_(#HKEY_CURRENT_USER, "Software\Classes\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS , @hKey1)
EndIf
If Res = #ERROR_SUCCESS And hKey1
If RegQueryValueEx_(hKey1, "", 0, @Type, lpbData, @cbData)=#ERROR_SUCCESS
Folder$ = PeekS(lpbData)
Folder$ = GetPathPart(StringField(Folder$,2,Chr(34)))
EndIf
RegCloseKey_(hKey1)
EndIf
If lpbData
FreeMemory(lpbData)
lpbData=0
EndIf
ProcedureReturn Folder$
EndProcedure
Does it work for you ?
The PB registry keys are changing with every version lately ...
<EDIT>
Update : updated PB folder detection code