The MASM Forum

General => The Campus => Topic started by: Magnum on March 14, 2013, 08:02:22 AM

Title: Debug script not working
Post by: Magnum on March 14, 2013, 08:02:22 AM
Ithis works fine outside of Qeditor but not from within.


if not exist rsrc.rc goto over1

\masm32\bin\rc /v rsrc.rc
\masm32\bin\cvtres /machine:ix86 rsrc.res

:over1

\masm32\bin\ml /c /coff /Zi %1.asm
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /RELEASE /DEBUG /SUBSYSTEM:WINDOWS /OPT:NOREF %1.obj rsrc.obj
if errorlevel 1 goto errlink

dir %1.*
goto TheEnd

:nores
\masm32\bin\Link /RELEASE /DEBUG /SUBSYSTEM:WINDOWS /OPT:NOREF %1.obj
if errorlevel 1 goto errlink



&Debug_Bld,Build_Debug.bat "{b}"

Title: Re: Debug script not working
Post by: dedndave on March 14, 2013, 08:31:54 AM
your batch file is missing some labels

:errasm
:errlink
:TheEnd
Title: Re: Debug script not working
Post by: Magnum on March 14, 2013, 08:42:39 AM
They are in it, just not listed.


Title: Re: Debug script not working
Post by: dedndave on March 14, 2013, 12:31:26 PM
the problem may be related to the quotation marks around "{b}"
you can test that theory with
echo %1
if it is enclosed in double-quotes, then you wind up with things like
"myfile".asm

the double-quotes may be needed if the path (or filename) has space characters
the way to fix it is to remove the double-quotes, add the extension, then put the double-quotes back on

so - you need some batch code to remove the double-quotes
then, you can assign the resulting string to a temporary environment variable (let's use TEMPSTRING)
then, use it on a commandline as "%TEMPSTRING%.asm", "%TEMPSTRING%.obj", etc

as for the code to remove the double-quotes, i forget how - lol
it is a common task, so i am sure google can help

the fact is, i currently have a couple batch files i need to upgrade   :P
Title: Re: Debug script not working
Post by: Magnum on March 14, 2013, 12:33:06 PM
I forgot the masm32/bin path.

Title: Re: Debug script not working
Post by: dedndave on March 14, 2013, 12:47:13 PM
this demonstrates 2 methods of removing double-quotes - there is another way, also

btest.bat
@echo off
set TEMPSTR1="string 1"
set TEMPSTR2=%1
echo %TEMPSTR1%
echo %TEMPSTR2%
set TEMPSTR3=%TEMPSTR1:"=%
set TEMPSTR4=%~1
echo %TEMPSTR3%
echo %TEMPSTR4%


results:
C:\Documents and Settings\Dave\Desktop => btest "my string"
"string 1"
"my string"
string 1
my string