Changeset 40 for trunk/src/kmk
- Timestamp:
- Mar 27, 2003, 3:42:39 AM (22 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/Makefile.emx.mak
r35 r40 3 3 4 4 CC = gcc 5 #CC = gcc -Zomf 5 6 CFLAGS = -g -I. -I./include -I../kLib/Generic/include \ 6 # -DUSE_KLIB \ 7 # -DUSE_KLIB \ 8 -Dregister= \ 7 9 -DOS2 -D__i386__ -D__32BIT__ -DNMAKE -DMACHINE=\"ibmos2\" -DMACHINE_ARCH=\"x86\" -DMACHINE_CPU=\"386\" \ 8 10 -
trunk/src/kmk/Makefile.icc.mak
r35 r40 3 3 4 4 CC = icc 5 CFLAGS = /Q /Ti+ /Ss+ /Ge+ /I . /I./include /I../kLib/Generic/include \5 CFLAGS = /Q /Ti+ /Ss+ /Ge+ /Ig:\ktaskmgr\tree\generic\include\klibcrt /I. /I./include /I../kLib/Generic/include \ 6 6 -DUSE_KLIB -DOS2 -D__i386__ -D__32BIT__ -DNMAKE=1 -DMACHINE=\"ibmos2\" -DMACHINE_ARCH=\"x86\" -DMACHINE_CPU=\"386\" \ 7 7 … … 44 44 $(OBJDIR)\for.obj\ 45 45 $(OBJDIR)\hash.obj\ 46 $(OBJDIR)\job.obj\46 #$(OBJDIR)\job.obj\ 47 47 $(OBJDIR)\main.obj\ 48 48 $(OBJDIR)\make.obj\ -
trunk/src/kmk/main.c
r39 r40 305 305 debug |= DEBUG_MAKE; 306 306 break; 307 case 's': 307 case 'p': /*kso*/ 308 debug |= DEBUG_PARSE; 309 break; 310 case 's': 308 311 debug |= DEBUG_SUFF; 309 312 break; -
trunk/src/kmk/make.h
r27 r40 370 370 #define DEBUG_FOR 0x0400 371 371 #define DEBUG_LOUD 0x0800 372 #define DEBUG_PARSE 0x8000 /*kso*/ 372 373 373 374 /*#ifdef __STDC__*/ -
trunk/src/kmk/parse.c
r36 r40 103 103 #include "pathnames.h" 104 104 105 #if defined(NMAKE) || defined(KMK) 106 #define SUPPORT_INLINEFILES 1 107 #endif 108 105 109 /* 106 110 * These values are returned by ParseEOF to tell Parse_File whether to … … 111 115 #define DONE 0 112 116 static Lst targets; /* targets we're working on */ 113 static Lst targCmds;/* command lines for targets */117 /*static Lst targCmds; */ /* command lines for targets */ 114 118 static Boolean inLine; /* true if currently in a dependency 115 119 * line or its commands */ 120 #if defined(NMAKE) || defined(KMK) 121 static Boolean inInlineFile; /* true if currently in a inline file.*/ 122 #endif 116 123 typedef struct { 117 124 char *str; … … 249 256 static void ParseDoDependency __P((char *)); 250 257 static int ParseAddCmd __P((ClientData, ClientData)); 258 #ifdef SUPPORT_INLINEFILES 259 static int ParseAppendInline __P((ClientData, ClientData)); 260 static Boolean ParseCmdIsComponent __P((const char *, const char *)); 261 #endif 251 262 static int ParseReadc __P((void)); 252 263 static void ParseUnreadc __P((int)); … … 1510 1521 } 1511 1522 1523 1524 1525 #ifdef SUPPORT_INLINEFILES 1526 /*- 1527 * ParseAppendInline -- 1528 * Lst_ForEach function to append the line to the last command 1529 * 1530 * Results: 1531 * Always 0 1532 * 1533 * Side Effects: 1534 * A new element is added to the last commands list of the node. 1535 */ 1536 static int 1537 ParseAppendInline(gnp, line) 1538 ClientData gnp; /* the node to which the command is to be added */ 1539 ClientData line; /* the command to add */ 1540 { 1541 GNode *gn = (GNode *)gnp; 1542 /* if target already supplied, ignore commands */ 1543 if (!(gn->type & OP_HAS_COMMANDS)) 1544 { 1545 unsigned cch; 1546 char * cmd; 1547 unsigned cchNew; 1548 cmd = (char*)Lst_Datum(Lst_Last(gn->commands)); 1549 cch = strlen(cmd); 1550 cchNew = strlen(line); 1551 cmd = erealloc(cmd, cch + 1 + cchNew + 1); 1552 cmd[cch] = '\n'; 1553 memcpy(&cmd[cch + 1], line, cchNew + 1); 1554 Lst_Replace(Lst_Last(gn->commands), cmd); 1555 } 1556 return(0); 1557 } 1558 1559 /*- 1560 *----------------------------------------------------------------------- 1561 * ParseCmdIsComponent -- 1562 * Checks if the comp is a component in the cmdline. 1563 * 1564 * Results: 1565 * returns TRUE if it is, FALSE if not. 1566 * 1567 * Side Effects: 1568 * OP_HAS_COMMANDS may be set for the target. 1569 * 1570 *----------------------------------------------------------------------- 1571 */ 1572 static Boolean 1573 ParseCmdIsComponent(cmdline, comp) 1574 const char *cmdline; 1575 const char *comp; 1576 { 1577 #if 0 /* @todo FIX THIS */ 1578 const char * psz; 1579 char chQuote; 1580 int cchComp; 1581 register char ch; 1582 1583 /** ASSUMES NOT ESCAPED (but then the shell doesn't support escaping anyway) */ 1584 if (!strstr(cmdline, comp)) 1585 return FALSE; 1586 1587 cchComp = strlen(comp); 1588 for (chQuote = '\0', ch = *cmdline, psz = NULL; ch; ch = *++cmdline) 1589 { 1590 if (ch == '\'' || ch == '\"') 1591 { 1592 if (chQuote) 1593 { /* end of story */ 1594 if (cmdline - psz == cchComp && !strncmp(psz, comp, cchComp)) 1595 return TRUE; 1596 chQuote = '\0'; 1597 psz = NULL; 1598 } 1599 else 1600 { 1601 chQuote = ch; 1602 if (!psz) 1603 psz = cmdline + 1; 1604 } 1605 } else if (!chQuote && !psz && !isspace(ch)) 1606 psz = cmdline; 1607 } 1608 1609 return FALSE; 1610 1611 #else 1612 return strstr(cmdline, comp) != NULL; 1613 1614 #endif 1615 } 1616 #endif 1617 1512 1618 /*- 1513 1619 *----------------------------------------------------------------------- … … 2145 2251 semiNL = FALSE; 2146 2252 ignDepOp = FALSE; 2253 #ifdef SUPPORT_INLINEFILES 2254 ignComment = inInlineFile; 2255 #else 2147 2256 ignComment = FALSE; 2257 #endif 2148 2258 2149 2259 /* … … 2156 2266 for (;;) { 2157 2267 c = ParseReadc(); 2268 #ifdef SUPPORT_INLINEFILES 2269 if (inInlineFile) 2270 break; 2271 #endif 2158 2272 2159 2273 if (c == '\t') { … … 2177 2291 buf = Buf_Init(MAKE_BSIZE); 2178 2292 2293 /* @todo any inline changes here? */ 2179 2294 #ifdef NMAKE 2180 2295 while (((c = ParseReadc ()) != '\n' || (lastc == '\\') || (lastc == '^')) && (c != EOF)) … … 2186 2301 switch(c) { 2187 2302 case '\n': 2188 /* 2303 #ifdef SUPPORT_INLINEFILES 2304 /* No newline escaping in inline files, unless it's a directive. */ 2305 if (inInlineFile) { 2306 int cb; 2307 char *psz = Buf_GetAll(buf, &cb); 2308 #ifdef NMAKE 2309 if (cb > 0 && *psz != '.' && *psz != '!') 2310 #else 2311 if (cb > 0 && *psz != '.') 2312 #endif 2313 break; 2314 } 2315 #endif 2316 2317 /* 2189 2318 * Escaped newline: read characters until a non-space or an 2190 2319 * unescaped newline and replace them all by a single space. … … 2230 2359 break; 2231 2360 2361 /* We don't need this, and don't want it! */ 2362 #ifndef KMK 2232 2363 case ';': 2364 #ifdef SUPPORT_INLINEFILES 2365 if (inInlineFile) 2366 break; 2367 #endif 2233 2368 /* 2234 2369 * Semi-colon: Need to see if it should be interpreted as a … … 2249 2384 break; 2250 2385 case '=': 2251 if (!semiNL) { 2386 #ifdef SUPPORT_INLINEFILES 2387 if (inInlineFile) 2388 break; 2389 #endif 2390 if (!semiNL) { 2252 2391 /* 2253 2392 * Haven't seen a dependency operator before this, so this … … 2298 2437 case ':': 2299 2438 case '!': 2439 #ifdef SUPPORT_INLINEFILES 2440 if (inInlineFile) 2441 break; 2442 #endif 2300 2443 if (!ignDepOp && (c == ':' || c == '!')) { 2301 2444 /* … … 2307 2450 } 2308 2451 break; 2452 #endif /* !KMK */ 2309 2453 } 2310 2454 /* … … 2366 2510 break; 2367 2511 case COND_INVALID: 2368 2512 if (For_Eval(line)) { 2369 2513 int ok; 2370 2514 efree(line); … … 2449 2593 2450 2594 inLine = FALSE; 2595 #if defined(NMAKE) || defined(KMK) 2596 inInlineFile = FALSE; 2597 #endif 2451 2598 fname = name; 2452 2599 curFILE = stream; … … 2456 2603 do { 2457 2604 while ((line = ParseReadLine ()) != NULL) { 2458 //debugkso: fprintf(stderr, "%s(%d): inLine=%d line=%s\n", fname, lineno, inLine, line); 2605 if (DEBUG(PARSE)) 2606 printf("%s(%d): inLine=%d inInlineFile=%d\n%s\n", fname, lineno, inLine, inInlineFile, line); 2459 2607 #ifdef NMAKE 2460 2608 if (*line == '.' || *line == '!') { … … 2492 2640 } 2493 2641 } 2642 2643 #ifdef SUPPORT_INLINEFILES 2644 if (inInlineFile) 2645 { 2646 cp = line; 2647 if (*cp == '<' && cp[1] == '<') 2648 { 2649 inInlineFile = FALSE; 2650 for (cp = line + 2; isspace(*cp); cp++) { 2651 continue; 2652 } 2653 if (!*cp || *cp == '#') { /* no flag */ 2654 line[2] = '\0'; 2655 cp = line; 2656 } else if (!strncmp(cp, "KEEP", 4) && 2657 (!cp[4] || isspace(cp[4]) || cp[4] == '#')) { 2658 cp[4] = '\0'; 2659 *--cp = '<'; 2660 *--cp = '<'; 2661 } else if (!strncmp(cp, "NOKEEP", 6) && 2662 (!cp[6] || isspace(cp[6]) || cp[6] == '#')) { 2663 cp[6] = '\0'; 2664 *--cp = '<'; 2665 *--cp = '<'; 2666 } 2667 else 2668 { 2669 Parse_Error(PARSE_FATAL, "Invalid termination of inline file \"%s\"", cp); 2670 cp = NULL; 2671 } 2672 } 2673 /* Append to last command */ 2674 if (cp) 2675 { 2676 Lst_ForEach(targets, ParseAppendInline, cp); 2677 /*Lst_AtEnd(targCmds, (ClientData) line); */ 2678 } 2679 goto nextLine; 2680 } 2681 #endif 2682 2494 2683 if (*line == '#') { 2495 2684 /* If we're this far, the line must be a comment. */ … … 2510 2699 if (*cp) { 2511 2700 if (inLine) { 2701 #ifdef SUPPORT_INLINEFILES 2702 if (ParseCmdIsComponent(cp, "<<")) 2703 { 2704 inInlineFile = TRUE; 2705 Lst_ForEach(targets, ParseAddCmd, estrdup(cp)); 2706 /*Lst_AtEnd(targCmds, (ClientData) line);*/ 2707 goto nextLine; 2708 } 2709 #endif 2512 2710 /* 2513 2711 * So long as it's not a blank line and we're actually … … 2516 2714 */ 2517 2715 Lst_ForEach (targets, ParseAddCmd, cp); 2518 Lst_AtEnd(targCmds, (ClientData) line);2716 /*Lst_AtEnd(targCmds, (ClientData) line);*/ 2519 2717 continue; 2520 2718 } else { … … 2548 2746 * and add it to the current list of targets. 2549 2747 */ 2550 #if !defined(POSIX) || defined(NMAKE) 2748 #if !defined(POSIX) || defined(NMAKE) || defined(KMK) 2551 2749 Boolean nonSpace = FALSE; 2552 2750 #endif … … 2560 2758 goto nextLine; 2561 2759 } 2562 #if !defined(POSIX) || defined(NMAKE) 2760 #if !defined(POSIX) || defined(NMAKE) || defined(KMK) 2563 2761 while ((*cp != ':') && (*cp != '!') && (*cp != '\0')) { 2564 2762 nonSpace = TRUE; … … 2568 2766 } 2569 2767 2570 #if !defined(POSIX) || defined(NMAKE) 2768 #if !defined(POSIX) || defined(NMAKE) || defined(KMK) 2571 2769 if (*cp == '\0') { 2572 2770 if (inLine) { 2573 #if ndef NMAKE2771 #if !defined(NMAKE) && !defined(KMK) 2574 2772 Parse_Error (PARSE_WARNING, 2575 2773 "Shell command needs a leading tab"); … … 2597 2795 2598 2796 ParseDoDependency (line); 2599 #if !defined(POSIX) || defined(NMAKE) 2797 #if !defined(POSIX) || defined(NMAKE) || defined(KMK) 2600 2798 } 2601 2799 #endif … … 2639 2837 sysIncPath = Lst_Init (FALSE); 2640 2838 includes = Lst_Init (FALSE); 2641 targCmds = Lst_Init (FALSE);2839 /*targCmds = Lst_Init (FALSE);*/ 2642 2840 } 2643 2841 … … 2645 2843 Parse_End() 2646 2844 { 2647 Lst_Destroy(targCmds, (void (*) __P((ClientData))) efree);2845 /*Lst_Destroy(targCmds, (void (*) __P((ClientData))) efree);*/ 2648 2846 if (targets) 2649 2847 Lst_Destroy(targets, NOFREE);
Note:
See TracChangeset
for help on using the changeset viewer.