Issue 17992 - dmake patch to enable && in .IF statement
Summary: dmake patch to enable && in .IF statement
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: code (show other issues)
Version: current
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.0
Assignee: hjs
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-07 22:58 UTC by fa
Modified: 2004-09-17 17:51 UTC (History)
3 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
cd dmake, patch -p0 < /path/to/patchfile (1.79 KB, patch)
2003-08-07 23:00 UTC, fa
no flags Details | Diff
cd dmake, patch -p0 < /path/to/patchfile (11.20 KB, patch)
2003-08-18 06:08 UTC, fa
no flags Details | Diff
cd dmake, patch -p0 < /path/to/patchfile (11.08 KB, patch)
2004-01-08 19:07 UTC, fa
no flags Details | Diff
Patch for dmake manpage (3.26 KB, patch)
2004-07-08 18:08 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description fa 2003-08-07 22:58:16 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.
Comment 1 fa 2003-08-07 23:00:45 UTC
Created attachment 8321 [details]
cd dmake, patch -p0 < /path/to/patchfile
Comment 2 Martin Hollmichel 2003-08-15 10:37:20 UTC
mh->hjs: is this a candidate to test in one of your cws ?
Comment 3 fa 2003-08-15 16:46:30 UTC
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
Comment 4 fa 2003-08-18 06:08:05 UTC
Created attachment 8521 [details]
cd dmake, patch -p0 < /path/to/patchfile
Comment 5 fa 2003-08-18 06:09:38 UTC
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
Comment 6 fa 2003-09-26 15:17:58 UTC
Any status on this getting tested and integrated?  I think it could be
useful in the future...
Comment 7 foskey 2003-09-27 10:52:41 UTC
To my knowledge there is no working cws for OSS developers.
Comment 8 Martin Hollmichel 2003-12-19 18:13:06 UTC
reassigned for integration
Comment 9 hjs 2004-01-07 18:58:59 UTC
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 ;-)
Comment 10 fa 2004-01-07 20:47:17 UTC
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?
Comment 11 hjs 2004-01-08 12:02:35 UTC
as far as i can see by using an "echo -$(ttt)-", $(ttt) expands to an empty
string if either unset or set with "ttt=".
Comment 12 fa 2004-01-08 19:07:08 UTC
Created attachment 12365 [details]
cd dmake, patch -p0 < /path/to/patchfile
Comment 13 fa 2004-01-08 19:12:07 UTC
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
Comment 14 hjs 2004-01-08 20:06:45 UTC
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.
Comment 15 hjs 2004-01-08 20:07:48 UTC
just to mention it, it works like a charm anyway.
Comment 16 fa 2004-01-09 00:04:29 UTC
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
Comment 17 hjs 2004-01-09 11:31:18 UTC
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?
Comment 18 fa 2004-01-09 13:16:30 UTC
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.
Comment 19 hjs 2004-01-12 18:02:51 UTC
fix is part of CWS ause07 (getinp.c rev. 1.3.56.1)
Comment 20 hjs 2004-03-01 13:30:40 UTC
.
Comment 21 hjs 2004-03-03 16:46:37 UTC
.
Comment 22 quetschke 2004-07-08 18:07:13 UTC
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?
Comment 23 quetschke 2004-07-08 18:08:30 UTC
Created attachment 16324 [details]
Patch for dmake manpage
Comment 24 hjs 2004-07-08 19:00:51 UTC
hm, might make people aware of this chage ;-)
thanks for updating the man page.
Comment 25 quetschke 2004-07-11 16:17:25 UTC
Committed the documentation changes to cws_src680_ooo20040704.
Comment 26 hjs 2004-09-17 17:51:27 UTC
.