A few weeks ago i posted with version 2.0 of Project Builder (PB), well i've struggled (around exams and other minor obstacles) to produce the next version and here it is: version 2.1 I've added a dialog to allow you to edit the way it builds the project without having to fiddle with PInfo.dat. The last version couldn't deal with files from outside of the project folder - thats been fixed. Additionally it can now handle files with the same "stem" ie since 'pb2.asm' and 'pb2.rc' both build to 'pb2.obj', it just overwrote one before - this is now fixed. I've also commented it a bit better - as it was a mess before.

Unfortunately it can still only deal with MASM files, as i have not a clue as to how to use anything else. However, it has a small problem with creating Libraries (.LIB) when the commandline becomes large - it seems that lib.exe cannot handle long command lines - any suggestions for dealing with that?

Whilst writing PB, i noticed something that i felt could be added to RadASM: PB became rather large as i wrote it and so i closed up all the procedures - great feature btw. But as i continued i found that closing 50 odd procedures was rather time consuming. So it would be great if there was some feature to make them all close up (if there isn't one already)

Heres the source/DLL etc. If you find any bugs, let me know - it hasn't been tested too thoroughly yet.

Ossa

Edit:

100 downloads. Attachment deleted. New upload on next page.
Posted on 2003-06-22 14:51:12 by Ossa
Hi Ossa

Nice PB.
To close all procs hit Alt+Ctrl+PgUp or click one of the three buttons in lower left corner of edit window.

KetilO
Posted on 2003-06-22 15:12:25 by KetilO
Hi Ossa,

I am trying to checkyour adding, but I am not able. Can you explain me how does it work.

I have read your readme.txt but I do not know how to fill the diferents fields it show me without crash it.

Thank you very much indeed.
ipadilla
Posted on 2003-06-29 11:48:41 by ipadilla
ipadilla,

do you mean adding binaries, adding source files to binaries or adding source files?

if you mean adding source files, type in the path (or relative path) in the box or use the ... button to use the dialog to get it. Then click Add or what ever.

Sorry i can not be more helpful, but my computer is not working at the moment, so i can't check out what you mean... i will try to give a more comprehensive answer when i can

Ossa
Posted on 2003-06-30 11:46:17 by Ossa
Hi Ossa,

Thank you very much, you are very kind.
Take all the time you need, I am nor in a harry.
I`ll try again.

ipadilla
Posted on 2003-06-30 12:44:36 by ipadilla
Hi Ossa,

Could you email me a couple of paragraphs about your addin to include in the help file?
Posted on 2003-07-02 09:44:33 by donkey
Hi donkey,

Yeah i can do that - just give me a while to sort my computer out. Its completely messed up.

btw. Just a general thing: Don't try to use PB to make LIBs - its completely screwed up, i'll try to fix it soon (maybe at the week end)

Ossa
Posted on 2003-07-03 13:27:14 by Ossa
HI, could anyone tell me why the following might not work:



; ****************************************
; returns whether a project is open or not
; ****************************************

IsProjectOpen PROC

; =====================================
; Check appropriate member of ADDINDATA
; =====================================

mov edx, lpDStruct
mov eax, [edx][ADDINDATA.fProject]
ret
IsProjectOpen ENDP


the lpDStruct is global and was set in the InstallDLL procedure:



invoke SendMessage, hWin, AIM_GETDATA, 0, 0
mov lpDStruct, eax


The function seems not to work all of the time, but i seem unable to define eactly when this happens

I guess it could be something to do with the rest of the code, but i can't fiind anything. Any suggestions?

Ossa
Posted on 2003-07-04 15:15:11 by Ossa
I don't use that syntax so I'm not sure but try this:

mov edx, lpDStruct
mov eax, .ADDINDATA.fProject
Posted on 2003-07-04 15:28:50 by donkey
Thnx donkey,

I will try that.

The problem only occurs very rarely, so it will be a day or so before it will have been tested enough to say whether it works.

Ossa
Posted on 2003-07-04 15:32:48 by Ossa
Hi donkey,

I decided that it would be best for this to be in a FAQ/HowTo type format, hope this is ok. I am posting it here as it will answer ipadilla's question at the same time

I have also got a few more known issues:
- The LIB builder doesn't really build libs properly
- If you press OK, but have not fulfilled some requirement and cause the dialog to complain somehow, then press cancel, then go back into the dialog, some of the data will have been deleted
- The build will not work unless you have recreated the source directory structure in the build directory
- Clicking "OK" when a binary does not have name will cause RadASM to exit with PB giving a warning
- Sometimes the dialog will not recognise that a file is from inside the project directory and will give the full path instead
- Sometimes when a project open, PB seems to think that there is no project open & will not let the project be built
- Sometimes the project will not build at all, but when RadASM (and therefore PB) is closed and reopened, it builds fine

I suspect that the last 3 issues are connected, and am currently looking into why they occur (with little success).

The first 4 issues are being dealt with, and will be fixed shortly (will be inthe next release).

------------------------------------------------------

What is PB?
- PB stands for Project Builder
- It is an AddIn for KetilO's RadASM
- You can use it to build projects with one or many source files that produce 1 or many binary files.
- It can create binaries of types LIB, DLL and EXE (both Windows and Console)
- It currently only supports MASM, but this will hopefully be changed soon

How do i get PB to build my projects?
- First you must setup the project building options (see below)
- Then all you have to do, is simply click on the "PB: Build Projects" menu item in the "Project" menu in RAdASM, when you have the appropriate project open
- The output from the Build will then appear in the output window.
- Any errors will cause the build to stop with that file
- You can then double click on the errors to get RadASM to take you to the postion of the error in your code

How do i set up the project options?
- First, you must have a project created and open in RadASM
- Then select the "PB: Edit Project Settings" item in the "Project" menu of RadASM
- Next you must add the source files to the project (see below)
- The binaries must then be setup/added (see below)
- Finaly, just click OK

How do i add source files to my project?
- Unfortunately, currently source files must be added one at a time
- To add a source file:
- Either type in the file name in the "File Name" box in the "Add File" section, or click the "..." button to get the "Select source file" dialog, where you can select any file that you want
- When entering the source file names by hand, if the file is in the project directory, only the path relative to the project directory is needed. However,if it is outside this directory, a fully qualified path is required (eg C:\Projects\QuickProjects\LHT\Src\Hash.asm)
- Next, click the "Add File" button
- The file will then appear in the list box to the left

How do i remove source files from the build?
- Simply select the file that you want to remove in the listbox and then click on the "Delete File" button (no, this does not delete the file from you HDD)
- A note should be made that if you remove a source file, but leave it as part of the source for one of the binaries, when you come to click "OK", the dialog will inform you that this has happened and willnot let you exit using "OK" untilyou have fixed this problem

How do i add a new binary to the project?
- Just click the "Add Binary" button at the bottom of the dialog

How do i remove a binary from the project?
- make sure that the tab you have selected is the one that you want to delete, then click on the "Delete Binary" button
- note that there must be at least one binary in a project

How do i setup a binary?
- This depends a lot on what sort of binary you want to create, but some parts are common to all, for the specific parts, see below the "common" section below:
+ Common:
# You must enter a name for the binary in the "Binary Name (NO Extension)" field (and as you may guess, don't add the extension (eg .lib) here)
# You must add all of the source files needed for this binary to the source file list (above) and thenuse thatto add them to the binary source list:
> See above to add source files to the project
> To add the source files to the binary, they must be added one by one.
> Select the file that you want to add in the source file list at the top of the dialog
> Then press the "Add Source File" button
> Repeat this until all the source files are added
# The output sub directory must be set, this field can be blank in which case, it will appear in the project directory, or it can specify the subdir where the binary will be placed when built (this MUST be ended with a '\' character)
# Type: this is the type of binarythat you want to create (its a drop down box, just select the one that you want)
+ Windows EXE:
# no other fields are required, although the "extra switches" field can be used, the current commandline looks like this:
\masm32\bin\Link /OUT:<Output EXE File/Path> /nologo /MACHINE:IX86 /INCREMENTAL:YES /SUBSYSTEM:WINDOWS <Extra Switches> <Input OBJ File/Path List>
+ Console EXE:
# Basically the same as the windows EXE, the current commandline is:
\masm32\bin\Link /OUT:<Output EXE File/Path> /nologo /MACHINE:IX86 /INCREMENTAL:YES /SUBSYSTEM:CONSOLE <Extra Switches> <Input OBJ File/Path List>
+ DLL:
# A DEF file must be specified:
> Add the DEF file as a source file as specified above
> Select the def file in the source file list
> Click the "Use Current Selection" button
# Again the "Extra switches" field can be used, current commandline:
\masm32\bin\Link /OUT:<Output EXE File/Path> /nologo /MACHINE:IX86 /DLL /INCREMENTAL:YES /DEF:<Input DEF File/Path> /SUBSYSTEM:WINDOWS <Extra Switches> <Input OBJ File/Path List>
+ LIB:
# As stated above, there areproblems with this at the moment, but in the forthcoming version, the commandline is as follows ("Extra switches" can be used here as well):
\masm32\bin\Link -lib /INCREMENTAL:YES /nologo /OUT:<Output EXE File/Path> <Extra Switches> <Input OBJ File/Path List>

How do i save the changesto the project options?
- Just click the "OK" button

How do i set a build path?
- Type it in in the box at the bottom of the dialog (remember the trailing '\')

------------------------------------------------------

Can anyone who uses TASM or any other assembler/linker combination give me the equivalent commandlines? Sorry, but at the moment the code will only deal with source files with the "asm" extension, and resources with the "rc" extension

If you find any bugs (other than those mentioned above) could you please let me know.

Ossa
Posted on 2003-07-05 20:07:06 by Ossa
Thanks Ossa,

I'll put it in the next update of the help file. I have created your page and will proof it when I get a chance tomorrow. Do you want me to add the known issues or would you rather leave them out?
Posted on 2003-07-05 20:18:32 by donkey
donkey

could you just putin the last 3 known issues? The first 4 will be solved soon, so there's no need to have them there

soory, also thnx for the try to fix that procedure, but it doesn't seem to have worked.

Ossa
Posted on 2003-07-06 05:24:29 by Ossa
Hi Ossa,

Thankyou very much for your explanation that will be really helpful.

The best regards
ipadilla
Posted on 2003-07-06 10:22:46 by ipadilla
Hi Ossa,

The only other thing I can suggest for the problem is to make sure that all of your buffers are large enough to hold their respective data. I had an intermittent problem like this where a pointer was being overwritten by an undersized buffer sitting directly behind it in the data section. It was difficult to track down because there was ofcourse no error and the acutal location of the overwrite was unrelated to the pointer. In my case it depended on the legnth of a return string from GetPrivateProfileString.
Posted on 2003-07-06 12:07:18 by donkey
Hi,

ok, here's the latest version of PB.

I think i now know why some people might have been having troube using it: the directory structure in the build folder had to be manually created, this might not have been obvious, but i've sorted that out. The things fixed are:

- The LIB builder doesn't really build libs properly
- If you press OK, but have not fulfilled some requirement and cause the dialog to complain somehow, then press cancel, then go back into the dialog, some of the data will have been deleted
- The build will not work unless you have recreated the source directory structure in the build directory
- Clicking "OK" when a binary does not have name will cause RadASM to exit with PB giving a warning
- Sometimes the dialog will not recognise that a file is from inside the project directory and will give the full path instead

All now work/behave properly

Ossa
Posted on 2003-07-06 13:31:38 by Ossa
by the way, could someone get rid of the original file at the start of this thread?

Ossa
Posted on 2003-07-06 13:32:52 by Ossa
Hi (again),

I think i've discovered when the problem with the menu occurs:

Problem:
- Sometimes when a project open, PB seems to think that there is no project open & will not let the project be built

How to create it:
1) Open RadASM, make sure that you do this by choosing the link to the executablerather than by double clicking an associated file (eg .rap)
2) Open a project, do not let the "Project" popup menu open after the project is open
3) Open a source file from the project (ie by double clicking in the dockable "project" toolbar)
4) Click on the "Project" menu

+++ The PB menu itms will be grayed out +++

5) Close the source file window
6) Click on the "Project" menu

+++ The PB menu itms will be enabled +++

7) reopen the source file
8) Click on the "Project" menu

+++ The PB menu itms will be enabled +++


Has anyone (especially KetilO) got any ideas on why this occurs?

I have looked at donkey's suggestion that there might be a buffer before it that overflows into the lpDStruct variable (see code below), but have discounted this as the cause for 2 reasons:
1) The fact that the variable is not set again later, but does work later
2) The fact that all the global vaiables that would be used before the problem event occurs are defined after this global (with the exception of 2 paths (buffers for these are 300 bytes) defined about 3kB back in memory and the hInstance DWORD)

The relevent code for is below:

From the InstallDll function:


invoke SendMessage, hWin, AIM_GETDATA, 0, 0
mov lpDStruct, eax

From the DllProc function:


.elseif eax==AIM_INITMENUPOPUP

; =============================
; do appropriate enable/disable
; =============================

mov eax, lpHStruct
mov eax, [eax][ADDINHANDLES.hMenu]

invoke GetSubMenu, eax, 4
mov hMnu, eax

invoke IsProjectOpen
.if eax==TRUE
mov ecx, MF_ENABLED
.else
mov ecx, MF_GRAYED
.endif

push ecx
invoke EnableMenuItem, hMnu, nMenuDlgID, ecx
pop ecx
invoke EnableMenuItem, hMnu, nMenuID, ecx

The IsProjectOpen procedure:


; ****************************************
; returns whether a project is open or not
; ****************************************

IsProjectOpen PROC

; =====================================
; Check appropriate member of ADDINDATA
; =====================================


mov edx, lpDStruct
mov eax, [edx][ADDINDATA.fProject]

ret
IsProjectOpen ENDP

The global definition:


.data?
.
.
.
lpDStruct dd ?

Any ideas?

Ossa
Posted on 2003-07-06 15:58:43 by Ossa
Hi Ossa

This is the problem:



invoke GetSubMenu, eax, 4
mov hMnu, eax


If the project has an autoload file and the edit window is maximized you are enabeling the Format menu.

Do thie additional check:


mov edx,4
;Adjust topmost popup if maximized
mov eax,[lpDStruct]
.if [eax].ADDINDATA.fMaximized
inc edx
.endif
;Get handle of Project popup
mov eax,[lpHStruct]
invoke GetSubMenu,[eax].ADDINHANDLES.hMenu,edx
mov hMnu,eax


KetilO
Posted on 2003-07-07 02:25:10 by KetilO
Hi Ossa

One more suggestion.

Just before you start building the project, add this code:



IDM_FILE_SAVEALLFILES equ 40009
mov eax,lpHStruct
invoke SendMessage,[eax].ADDINHANDLES.hWnd,WM_COMMAND,IDM_FILE_SAVEALLFILES,0


And all changed files will be saved before build.

KetilO
Posted on 2003-07-07 07:00:08 by KetilO