News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

isolated file

Started by mabdelouahab, October 18, 2015, 12:39:10 AM

Previous topic - Next topic

mabdelouahab

Can I create  and generate an isolated file during assembling? - programmatically(Macro) not manual , (For example: create and generate IDL file while assembling). Please anyone has an idea let us help me,

nidud

#1
deleted

jj2007

Why don't you write from within your assembly code?

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  FileWrite "1.tmp", "hello mabdelouahab, how are you?"
  Inkey FileRead$("1.tmp")
EndOfCode

TouEnMasm


an  IDL file is a very special file only usable by midl.Midl generate .h .c and more with it.
You can't do that with masm or any asm compiler.
Need more explain of what you want to do and why you need an idl file.
Fa is a musical note to play with CL

jj2007

The idl file is plain text, no problem to generate it from Assembler code.

include \masm32\MasmBasic\MasmBasic.inc
  Init
  Open "O", #1, "tmp.idl"
  PrintLine #1, "module HelloApp"
  PrintLine #1, "{"
  PrintLine #1, "  interface Hello"
  PrintLine #1, "  {"
  PrintLine #1, "  string sayHello();"
  PrintLine #1, "  oneway void shutdown();"
  PrintLine #1, "  };"
  PrintLine #1, "};"
  Close
  Launch "idlcompilerorwhatever.exe tmp.idl"
  Inkey Err$()
EndOfCode

mabdelouahab

hi jj2007,ToutEnMasm,nidud,
I thank you for the idea but I'm looking for this  during assembling; not while executing :(
Of course if possible :P

TouEnMasm

ECHO with > textfile.txt (or better a pipe)  are able to do that at assembling time,no problem

The problem  is to generate the line of an IDL file who look like this:
Quote
//--------------------------------------------------------------------------------------------------------
// DXGI object hierarchy base interfaces
//--------------------------------------------------------------------------------------------------------

[
    object,
    uuid( aec22fb8-76f3-4639-9be0-28eb43a67a2e ),
    local,
    pointer_default(unique)
]
interface IDXGIObject :
    IUnknown
{
    //ULONG   Release();
    HRESULT SetPrivateData(
        [in, annotation("_In_")] REFGUID Name,
        [in] UINT DataSize,
        [in, annotation("_In_reads_bytes_(DataSize)")] const void *pData );
    HRESULT SetPrivateDataInterface(
        [in, annotation("_In_")] REFGUID Name,
        [in, annotation("_In_")] const IUnknown *pUnknown );
    HRESULT GetPrivateData(
        [in, annotation("_In_")] REFGUID Name,
        [in, out, annotation("_Inout_")] UINT *pDataSize,
        [out, annotation("_Out_writes_bytes_(*pDataSize)")] void *pData );
    HRESULT GetParent(
        [in, annotation("_In_")] REFIID riid,
        [out, retval, annotation("_COM_Outptr_")] void **ppParent );
};

Fa is a musical note to play with CL

GoneFishing

Why not use batch file for this purpose ?
It could be much more comfortable  for your task.

mabdelouahab

Quote from: ToutEnMasm on October 18, 2015, 05:01:56 AM
ECHO with > textfile.txt (or better a pipe)  are able to do that at assembling time,no problem
How do I use echo with textfile  in my macro code? :redface:

dedndave

this is an example i keep around, i think Jochen wrote it

include \masm32\include\masm32rt.inc

MBox MACRO pText, pTitle, MB_x
   invoke MessageBox, 0, reparg(pText), reparg(pTitle), MB_x
   EXITM <eax>
ENDM

IsOK MACRO args:VARARG
  cmp args, IDOK
  EXITM <Zero?>
ENDM

.code
start:
   TestCase=0
   if TestCase eq 0
      ; use echo to see the output of a macro - creates no code
      echo IsOK(MBox ("Hello World", "This is Masm32", MB_OKCANCEL))
   elseif TestCase eq 1
      ; echo with expansion operator - creates code
      % echo IsOK(MBox ("Hello World", "This is Masm32", MB_OKCANCEL))
   else
      ; the real thing
      .if IsOK(MBox ("Hello World", "This is Masm32", MB_OKCANCEL))
         MsgBox 0, "That was OK", "Hi", MB_OK
      .else
         MsgBox 0, "That was NOT OK", "Hi", MB_OK
      .endif
   endif
   exit

end start


it can create code, or just output text at assembly-time

mabdelouahab

Good morning dedndave
Quote from: dedndave on October 18, 2015, 09:31:55 AM
it can create code, or just output text at assembly-time

output text to Output window,I ask how to output it to textfile.txt ?
Of course if exist or if it possible :P

hutch--

What you CAN get is output to the console at assembly time which you can redirect to a file using the console, not MASM. To do any more you would need to write an application that you ran at assembly time to do what you require.

jj2007

Quote from: mabdelouahab on October 18, 2015, 04:51:01 PMoutput text to Output window,I ask how to output it to textfile.txt ?

As Hutch wrote, you need an application to do that. RichMasm has a built-in option to launch an executable (bat or exe) before calling the assembler (OPT_BatA). Here is an example:
include \masm32\MasmBasic\MasmBasic.inc
  Init
  Inkey FileRead$("~temp.txt") ; open in RichMasm and hit F6
  Kill "~temp.txt" ; make sure you create a fresh one on next build
EndOfCode

OPT_BatA MyBatA.exe Your path is "%path%" ; this creates a text file at assembly time


Sources attached. Open MyBatA.asc first and hit F6; then do the same with UseBatA.asc (of course, this requires a MasmBasic installation).

P.S.: Try OPT_BatA   MyBatA.exe %date%, %time%

mabdelouahab

I found this file : \masm32\bin\assmbl.bat

\masm32\bin\ml /c /coff %1.asm > \masm32\bin\asmbl.txt

I think it comes out the content to a file asmbl.txt
QuoteAssembling: FTest003.asm

*************
UNICODE Build
*************

---------------- this is a test by ECHO

Can I get rid of headline?

GoneFishing

Yes, use -q (-nologo) switch