Apache OpenOffice (AOO) Bugzilla – Issue 17992
dmake patch to enable && in .IF statement
Last modified: 2004-09-17 17:51:27 UTC
Patch enables the use of double-& to signify an AND condition for a .IF statement. Code has been compiled and tested on Mac OS X to verify that it does correctly parse operations, and one full build is in progress with this patch in dmake. However, since there are no && conditions in any makefiles, it is unknown exactly how this patch will work in a real build environment. Known bugs: you cannot have || and && on the same line in a .IF, nor can you nest conditions.
Created attachment 8321 [details] cd dmake, patch -p0 < /path/to/patchfile
mh->hjs: is this a candidate to test in one of your cws ?
I've developed a patch that allows nesting of expressions and a much more complex syntax for dmake. I've tested the patch on our tinderbox for OS X and it got through one complete build, so it doesn't break the current makefiles. I will attach this patch soon but don't have my computer up right now... :( It allows nesting of expressions with () and any combination of || and && that you can think of. Example: .IF (("$(OS)"=="MACOSX"&&"$(COM)"=="GCC")||"$(OS)"=="LINUX"||" $(OS)"=="SOLARIS") && "$(GUIBASE)"=="unx" ... .ENDIF Dan
Created attachment 8521 [details] cd dmake, patch -p0 < /path/to/patchfile
dmake.conditional patch adds a new routine, parse_complex_expression, that uses recursion to evaluate expressions nested with (). Also cleans up some parts of partcomp(). Dan
Any status on this getting tested and integrated? I think it could be useful in the future...
To my knowledge there is no working cws for OSS developers.
reassigned for integration
i checked a couple of expressions and it worked fine! just the handling of .IF $(ttt) .ENDIF changed in case "ttt" is not set. while it is false in the current version, the patched version evaluates it to true. just a minor quite uncommon issue ;-)
Correct you are, we probably shouldn't have it returning TRUE for undefined expressions though. How does the expanded string look when $(ttt) is not set?
as far as i can see by using an "echo -$(ttt)-", $(ttt) expands to an empty string if either unset or set with "ttt=".
Created attachment 12365 [details] cd dmake, patch -p0 < /path/to/patchfile
hjs: Attached update 2004-1-8 patch fixes the return issue. I had not dereferenced the 'lhs' pointer when checking for NULL, so we were always checking the pointer and not the value. lhs should always be a valid pointer, since it comes from the 'part' variable in the function above and is malloced there. if( op == NIL(char) ) - result = (lhs != NIL(char)); + result = (*lhs != NIL(char)); Can you please test with all your expressions again to verify that I've not broken anything else? Thanks, Dan
isn't if( op == NIL(char) ) - result = (*lhs != NIL(char)); + result = (*lhs != '\0'); the better way? btw.: it vanishes the warning about different indirection levels.
just to mention it, it works like a charm anyway.
That works for me. The reason I was using NIL(char) originally was that I saw the original code use it, and I decided that I should use the conventions of the original code for consistency's sake. But in any case, return (*lhs != '\0'); is as you say clearer, so lets do it. Hopefully this will allow us to clean up some makefiles and make the flow more apparent and readable. Dan
i'm planning to put this change into my child workspace and get it integrated into the master (SRC680) presumably mid of january. this means that it will be available in the first OOo branch afterwards. is this timeframe ok for you or would you like to get it into the version you're working on?
That schedule is perfectly fine with me. I don't have any changes waiting on this. We should make an announcement to the porting list at some point to say what the new syntax of the makefiles will be, so that people will know what new capabilities they will then have.
fix is part of CWS ause07 (getinp.c rev. 1.3.56.1)
.
Reopening to get some attention ;) I just added a new debugging switch to dmake and while I was updating the makefile I thought it would me nice of me to also integrate your (Ause: || and numeric comparisons) (Dan: the rest) .IF improvements. Please have a look at the following manpage patch. (It also includes the documentation changes for issue 31255.) OK?
Created attachment 16324 [details] Patch for dmake manpage
hm, might make people aware of this chage ;-) thanks for updating the man page.
Committed the documentation changes to cws_src680_ooo20040704.