' January 12, 1999, Compile macro for KEIL MicroVision IDE
' Multiple file(s) in project version
' updated to work with Wizard
' Define constant variables
Dim Maxfile As Integer ' Max. Number of Sources in project
Dim Source$() ' Array for Source filename(s) in project file
Const TimeOut = 16 ' Used for Timeout wait for IDE
' to compile application
Const EXTEN$ = ".lst" ' file to parse for errors
Const LoadPath$ = "i:\pk166\" ' path to source
Const FileName$ = "time" ' loadable filename same as project name
Const SeehauBase$ = "c:\nohau\seehau16x" ' path to Seehau software (root)
Const IdeAppName$ = "µVision" ' Compilers IDE if windows driven
Sub FindSources(FN$, ext$) ' project filename/extension
fcount = 1 ' source file sub counter
Open FN$+ext$ For Input As #1 ' open project file to locate sources
While Not EOF(1)
Line Input #1, L$ ' Read a line
StrConv$ (L$, vbUpperCase) ' Force string to uppercase
If (InStr(L$,"NumFiles=") > 0) Then
Maxfile = Val(Mid$(L$,InStr(l$,"=")+1,Len(L$)-InStr(l$,"=")+1)) ' Set Maxfile
ReDim Source$(Maxfile+1) ' adjust string array for source(s)
end if
KeyS$ = "F"+LTrim(Str$(fcount))+"=" ' Set key to look for Source(s)
If (InStr(L$, KeyS$)> 0) Then ' here is a source file ID string
fend = InStr(L$,".C") ' locate the end of the filename
Source$(fcount-1) = Mid(L$,InStr(L$,"=")+2,fend-5) ' get filename stored in array
fcount = fcount+1 ' point to next array location
End If
Wend
Close #1 ' close the project file
End Sub
Sub FindError(FN$, ext$) ' read in the filename / extension
Open SeehauBase$+"\CmpErr.Log" For Append As #2 ' Open the Error log
Open FN$ + EXTEN$ For Input As #1 ' Open the filename .LST file
While Not EOF(1) ' loop until end of LST file
Line Input #1, L$ ' read input line string
If InStr(L$, "ERROR") Or InStr(L$, "Error") Then 'process for error message
I = InStr(L$, "LINE") + 5 ' Get source line # of Error
If I > 5 Then
LL$ = Mid(L$, I, 4)
Lx = Val(LL$)
Print #2, FN$ + ext$ + "#"; Str$(Lx) + "#"; L$ ' print log entry / error info.
End If
End If
Wend
Close #1 ' close LST file
Close #2 ' close LOG file
End Sub
Sub Main ' Main program entry
Maxfile = 0 ' Maximum files in project
File_RmvSymbols ' Remove symbols so the loader will not lock
' the source and object files
Wait 1 ' pause slightly to let Seehau get ready
' after removing symbols
FindSources LoadPath$ + FileName$, ".prj" ' project file name and extension
AppActivate IdeAppName$ ' select active application
SendKeys "%Ha~" ' if minimized restore the window
' using about box
Wait 1 ' Wait for window to maximize
SendKeys "%{F8}",1 ' force project build
Wait (TimeOut) ' wait for IDE to compile
SendKeys "~",1 ' acknowledge the end of compile
For counter = 0 To Maxfile Step 1 ' Close all possible source files
SendKeys "%FC",1 ' Alt+F+C
Next counter
SendKeys "%FC",1 ' also the possible ERROR window
AppActivate "Seehau" ' re-active Nohau's Seehau interface
ChDir SeehauBase$ ' Select the Seehau main directory
Open SeehauBase$+"\CmpErr.Log" For Output As #2 ' Clear the Error log file
Close #2 ' Close it.
Wait 2
For counter = 1 To Maxfile Step 1
FindError LoadPath$ + Source$(counter-1), ".c" ' Parse the .LST file(s) for Errors
Next counter
Flen = FileLen(SeehauBase$+"\CmpErr.Log") ' check if error log > 0 bytes
if Flen > 0 Then ' We have errors to view
Src_GoToError ' point to error in Seehau Source
' window
Else ' -OR-
ChDir LoadPath$ ' Load code no errors found
File_LdCode LoadPath$ + FileName$
End If
End Sub
Ice Technology, 430 Peninsula Ave, Suite 6,
San Mateo, CA 94401
Ph:1-800.68.NOHAU (1-800-686-6428) or (650) 375-0409 - Fax:(650) 375-8666
Ice Technology, 1324 White Oaks Road, Campbell CA, 95008
Ph: (408) 626-7893 - Fax: (408) 626-9473
E-mail:
Support: support@icetech.com
Sales: sales@icetech.com
EMUL51-PC, EMUL68-PCEMUL-ST10/SUPER10/C166S V2-PC, EMUL12-PC, EMUL-and EMUL-ARM-PC are trademarks of Ice Technology a dba of Enable Engineering Co., Inc.. Other products and brand names are trademarks or registered trademarks of their respective holders.