summaryrefslogtreecommitdiff
path: root/usr.bin/make/for.c
AgeCommit message (Collapse)Author
2000-11-24Take advantage of VarModifiers_Apply, which can parse a variable specMarc Espie
and expand it directly, without needing a variable context. Use it in Var_SubstVar, so that .for loops values don't need to be entered into any context nor looked up. This speeds up .for loops some, and avoids nasty variable capture side-effects. Ok'd millert@, miod@, naddy@ (naddy spotted a problem with the first version of that change).
2000-09-14Two new functions:Marc Espie
iterate_words: light-weight equivalent to brk_string, which does not need to copy the string, and does not do \ interpretation which are only needed for the string. escape_dup: handles escape sequence in a systematic way. This speeds up variable modifiers. This also makes .for loops more consistent, as they use the same definition of `a word' as the rest of make.
2000-09-14Some systematic clean-up.Marc Espie
- UNUSED macro that expands to __attribute__((unused)) for gcc - move rcsid around so that they can be tagged UNUSED. - activate -Wunused. - use UNUSED instead of kludgy junk for function arguments. - add extern to all extern prototypes. - update comments in lst.h. - clean up var.c a little bit, constifying arguments, updating comments...
2000-07-17Consistency bug: for substitution should look in the same places otherMarc Espie
variable substitution is.
2000-06-23This patch separates local contexts from global contexts for good.Marc Espie
Apart from a few casts, VAR_GLOBAL and friends are separate data structures, so we use a small array for local variables. We also junk allVars, since TargFreeGN can release local nodes, and var.c has explicit lists for its variables already. Reviewed millert@ and miod@.
2000-06-17This patch introduces a distinction betweenMarc Espie
Lst_Init (constructor) and Lst_New (allocation + construction) Lst_Destroy (destructor) and Lst_Delete (deallocation + destruction), and uses that to turn most dynamic allocation of lists (Lst pointers) into static structures (LIST). Most of this is mundane, except for allGNs in targ.c, where the code must be checked to verify that Targ_Init is called soon enough. Lst_New is a temporary addition. All lists will soon be static. Reviewed by millert@, like the previous patch.
2000-06-10Clean-up patch: use `void *' instead of old-fashioned ClientData/Address.Marc Espie
2000-06-10Thus, Lst_ForEach no longer needs returning a status.Marc Espie
In fact, it can become a macro based on Lst_ForEachFrom. This also introduces Lst_Every, as a shortcut for the very common case where Lst_ForEach does not need any user data. Finally, make consistent use of a few function typedefs, instead of having explicit void (*)(Lst) arguments all over the place.
2000-03-26Remove idiotic, braindead casts T* -> void*Marc Espie
They serve no purpose, except hiding potential bugs. In particular, remove (ClientData) cast from macro, showing potentially troublesome use of Hashes to store time_t.
1999-12-18make does not use circular lists, get rid of the extra weight.Marc Espie
1999-12-16Var_Subst is actually two distinct functions folded into one:Marc Espie
split the function specific to for.c out, and give them more sensible arguments at the same time. This makes .for loop handling more efficient, as we have some heuristic to evaluate the size of the buffer needed...
1999-12-16remaining part of the previous patch... patch got confused somehow.Marc Espie
1999-12-16for.c becomes sane.Marc Espie
- split For_Eval into For_Eval (first line of loop) / For_Accumulate (remaining lines). - encapsulate state into a For structure, instead of brain damaged static variables that need copy. Very minor performance hit, specifically, For structure is allocated with malloc/free, instead of playing tricks with static/auto variables.
1999-12-16Allocate buffers as static data structures.Marc Espie
This cuts down quite a lot of malloc, since in actual use, buffer usage is mostly static.
1999-12-16Split Buf_GetAll into Buf_Retrieve/Buf_Size.Marc Espie
(idiotic to retrieve size every time when it's used half the time)
1999-12-09Introduce `common usage' buf patterns and use them.Marc Espie
1999-12-06Clean up buffers interface somewhat:Marc Espie
- buf.c deals exclusively with chars. Be explicit about it, and remove extraneous dumb casts to char (can hide real type errors). - buffer sizes are size_t. Note that bp->left can never become NULL. - Buf_GetAll is happy with a NULL pointer for the size, remove unneeded extra pointers. - Propagate size_t to all places where buffer functions are used.
1999-12-06- introduce interval_dup in str.cMarc Espie
- use it to replace .for parsing with something approaching sanity. (this removes one of the few most blatant misuses of Bufs in make. More changes to come... patch reviewed by ho@
1999-11-11Communicate line numbers between parse.c and for.c.Marc Espie
Parse_String starts in the current line, but at a given line number. .for loops yield correct line numbers, much easier to debug !
1998-12-05Modifications from netbsd:Marc Espie
- don't interfere with MACHINE/MACHINE_ARCH defines for bootstrap - type clean-up, time_t, and printing `unknown' ints - fix TARGET/MEMBER bug in archive rules - memmove... - cleaner Error handler. - reentrant brk_string - .MAKE env variable - preliminary scaffolding for .NOPATH Other improvements: - efree - shellneed streamlined - display Stop in .CURDIR after an error. - document most features and misfeatures. - add a few OpenBSD notes to the tutorial.
1996-11-30Sync with NetBSD:Todd C. Miller
- Merge in FreeBSD and Lite2 changes. - Fix bug where a non-archive target with a .a suffix would always be considered to be out of date, since it does not have a TOC. - Fix NetBSD PR #2930: declare missing variable.
1996-06-26rcsidTheo de Raadt
1995-10-18initial import of NetBSD treeTheo de Raadt