Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
079f6393
Kaydet (Commit)
079f6393
authored
Nis 18, 2001
tarafından
Nils Fuhrmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added makedepend
üst
46af0a5e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1381 additions
and
0 deletions
+1381
-0
cppsetup.c
soltools/mkdepend/cppsetup.c
+244
-0
def.h
soltools/mkdepend/def.h
+152
-0
ifparser.c
soltools/mkdepend/ifparser.c
+0
-0
ifparser.h
soltools/mkdepend/ifparser.h
+76
-0
imakemdep.h
soltools/mkdepend/imakemdep.h
+0
-0
include.c
soltools/mkdepend/include.c
+308
-0
main.c
soltools/mkdepend/main.c
+0
-0
makefile.mk
soltools/mkdepend/makefile.mk
+95
-0
mkdepend.man
soltools/mkdepend/mkdepend.man
+368
-0
parse.c
soltools/mkdepend/parse.c
+0
-0
pr.c
soltools/mkdepend/pr.c
+132
-0
build.lst
soltools/prj/build.lst
+3
-0
d.lst
soltools/prj/d.lst
+3
-0
No files found.
soltools/mkdepend/cppsetup.c
0 → 100644
Dosyayı görüntüle @
079f6393
/* $XConsortium: cppsetup.c,v 1.13 94/04/17 20:10:32 gildea Exp $ */
/*
Copyright (c) 1993, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
#include "def.h"
#ifdef CPP
/*
* This file is strictly for the sake of cpy.y and yylex.c (if
* you indeed have the source for cpp).
*/
#define IB 1
#define SB 2
#define NB 4
#define CB 8
#define QB 16
#define WB 32
#define SALT '#'
#if pdp11 | vax | ns16000 | mc68000 | ibm032
#define COFF 128
#else
#define COFF 0
#endif
/*
* These variables used by cpy.y and yylex.c
*/
extern
char
*
outp
,
*
inp
,
*
newp
,
*
pend
;
extern
char
*
ptrtab
;
extern
char
fastab
[];
extern
char
slotab
[];
/*
* cppsetup
*/
struct
filepointer
*
currentfile
;
struct
inclist
*
currentinc
;
cppsetup
(
line
,
filep
,
inc
)
register
char
*
line
;
register
struct
filepointer
*
filep
;
register
struct
inclist
*
inc
;
{
register
char
*
p
,
savec
;
static
boolean
setupdone
=
FALSE
;
boolean
value
;
if
(
!
setupdone
)
{
cpp_varsetup
();
setupdone
=
TRUE
;
}
currentfile
=
filep
;
currentinc
=
inc
;
inp
=
newp
=
line
;
for
(
p
=
newp
;
*
p
;
p
++
)
;
/*
* put a newline back on the end, and set up pend, etc.
*/
*
p
++
=
'\n'
;
savec
=
*
p
;
*
p
=
'\0'
;
pend
=
p
;
ptrtab
=
slotab
+
COFF
;
*--
inp
=
SALT
;
outp
=
inp
;
value
=
yyparse
();
*
p
=
savec
;
return
(
value
);
}
struct
symtab
*
lookup
(
symbol
)
char
*
symbol
;
{
static
struct
symtab
undefined
;
struct
symtab
*
sp
;
sp
=
isdefined
(
symbol
,
currentinc
,
NULL
);
if
(
sp
==
NULL
)
{
sp
=
&
undefined
;
sp
->
s_value
=
NULL
;
}
return
(
sp
);
}
pperror
(
tag
,
x0
,
x1
,
x2
,
x3
,
x4
)
int
tag
,
x0
,
x1
,
x2
,
x3
,
x4
;
{
warning
(
"
\"
%s
\"
, line %d: "
,
currentinc
->
i_file
,
currentfile
->
f_line
);
warning
(
x0
,
x1
,
x2
,
x3
,
x4
);
}
yyerror
(
s
)
register
char
*
s
;
{
fatalerr
(
"Fatal error: %s
\n
"
,
s
);
}
#else
/* not CPP */
#include "ifparser.h"
struct
_parse_data
{
struct
filepointer
*
filep
;
struct
inclist
*
inc
;
const
char
*
line
;
};
static
const
char
*
_my_if_errors
(
ip
,
cp
,
expecting
)
IfParser
*
ip
;
const
char
*
cp
;
const
char
*
expecting
;
{
#ifdef DEBUG_MKDEPEND
struct
_parse_data
*
pd
=
(
struct
_parse_data
*
)
ip
->
data
;
int
lineno
=
pd
->
filep
->
f_line
;
char
*
filename
=
pd
->
inc
->
i_file
;
char
prefix
[
300
];
int
prefixlen
;
int
i
;
sprintf
(
prefix
,
"
\"
%s
\"
:%d"
,
filename
,
lineno
);
prefixlen
=
strlen
(
prefix
);
fprintf
(
stderr
,
"%s: %s"
,
prefix
,
pd
->
line
);
i
=
cp
-
pd
->
line
;
if
(
i
>
0
&&
pd
->
line
[
i
-
1
]
!=
'\n'
)
{
putc
(
'\n'
,
stderr
);
}
for
(
i
+=
prefixlen
+
3
;
i
>
0
;
i
--
)
{
putc
(
' '
,
stderr
);
}
fprintf
(
stderr
,
"^--- expecting %s
\n
"
,
expecting
);
#endif
/* DEBUG_MKDEPEND */
return
NULL
;
}
#define MAXNAMELEN 256
static
struct
symtab
*
_lookup_variable
(
ip
,
var
,
len
)
IfParser
*
ip
;
const
char
*
var
;
int
len
;
{
char
tmpbuf
[
MAXNAMELEN
+
1
];
struct
_parse_data
*
pd
=
(
struct
_parse_data
*
)
ip
->
data
;
if
(
len
>
MAXNAMELEN
)
return
0
;
strncpy
(
tmpbuf
,
var
,
len
);
tmpbuf
[
len
]
=
'\0'
;
return
isdefined
(
tmpbuf
,
pd
->
inc
,
NULL
);
}
static
int
_my_eval_defined
(
ip
,
var
,
len
)
IfParser
*
ip
;
const
char
*
var
;
int
len
;
{
if
(
_lookup_variable
(
ip
,
var
,
len
))
return
1
;
else
return
0
;
}
#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_')
static
int
_my_eval_variable
(
ip
,
var
,
len
)
IfParser
*
ip
;
const
char
*
var
;
int
len
;
{
struct
symtab
*
s
;
s
=
_lookup_variable
(
ip
,
var
,
len
);
if
(
!
s
)
return
0
;
do
{
var
=
s
->
s_value
;
if
(
!
isvarfirstletter
(
*
var
))
break
;
s
=
_lookup_variable
(
ip
,
var
,
strlen
(
var
));
}
while
(
s
);
return
atoi
(
var
);
}
cppsetup
(
line
,
filep
,
inc
)
register
char
*
line
;
register
struct
filepointer
*
filep
;
register
struct
inclist
*
inc
;
{
IfParser
ip
;
struct
_parse_data
pd
;
int
val
=
0
;
pd
.
filep
=
filep
;
pd
.
inc
=
inc
;
pd
.
line
=
line
;
ip
.
funcs
.
handle_error
=
_my_if_errors
;
ip
.
funcs
.
eval_defined
=
_my_eval_defined
;
ip
.
funcs
.
eval_variable
=
_my_eval_variable
;
ip
.
data
=
(
char
*
)
&
pd
;
(
void
)
ParseIfExpression
(
&
ip
,
line
,
&
val
);
if
(
val
)
return
IF
;
else
return
IFFALSE
;
}
#endif
/* CPP */
soltools/mkdepend/def.h
0 → 100644
Dosyayı görüntüle @
079f6393
/* $XConsortium: def.h,v 1.25 94/04/17 20:10:33 gildea Exp $ */
/*
Copyright (c) 1993, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
#ifndef NO_X11
#include <X11/Xosdefs.h>
#ifdef WIN32
#include <X11/Xw32defs.h>
#endif
#ifndef SUNOS4
#include <X11/Xfuncproto.h>
#endif
/* SUNOS4 */
#endif
/* NO_X11 */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#ifndef X_NOT_POSIX
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#endif
#endif
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#define MAXDEFINES 512
#define MAXFILES 1024
/* Increased from 512. -mcafee */
#define MAXDIRS 64
#define SYMTABINC 10
/* must be > 1 for define() to work right */
#define TRUE 1
#define FALSE 0
/* the following must match the directives table in main.c */
#define IF 0
#define IFDEF 1
#define IFNDEF 2
#define ELSE 3
#define ENDIF 4
#define DEFINE 5
#define UNDEF 6
#define INCLUDE 7
#define LINE 8
#define PRAGMA 9
#define ERROR 10
#define IDENT 11
#define SCCS 12
#define ELIF 13
#define EJECT 14
#define IFFALSE 15
/* pseudo value --- never matched */
#define ELIFFALSE 16
/* pseudo value --- never matched */
#define INCLUDEDOT 17
/* pseudo value --- never matched */
#define IFGUESSFALSE 18
/* pseudo value --- never matched */
#define ELIFGUESSFALSE 19
/* pseudo value --- never matched */
#ifdef DEBUG
extern
int
_debugmask
;
/*
* debug levels are:
*
* 0 show ifn*(def)*,endif
* 1 trace defined/!defined
* 2 show #include
* 3 show #include SYMBOL
* 4-6 unused
*/
#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
#else
#define debug(level,arg)
/**/
#endif
/* DEBUG */
typedef
unsigned
char
boolean
;
struct
symtab
{
char
*
s_name
;
char
*
s_value
;
};
struct
inclist
{
char
*
i_incstring
;
/* string from #include line */
char
*
i_file
;
/* path name of the include file */
struct
inclist
**
i_list
;
/* list of files it itself includes */
int
i_listlen
;
/* length of i_list */
struct
symtab
*
i_defs
;
/* symbol table for this file */
int
i_ndefs
;
/* current # defines */
int
i_deflen
;
/* amount of space in table */
boolean
i_defchecked
;
/* whether defines have been checked */
boolean
i_notified
;
/* whether we have revealed includes */
boolean
i_marked
;
/* whether it's in the makefile */
boolean
i_searched
;
/* whether we have read this */
boolean
i_included_sym
;
/* whether #include SYMBOL was found */
/* Can't use i_list if TRUE */
};
struct
filepointer
{
char
*
f_p
;
char
*
f_base
;
char
*
f_end
;
long
f_len
;
long
f_line
;
};
#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
#if defined(macII) && !defined(__STDC__)
/* stdlib.h fails to define these */
char
*
malloc
(),
*
realloc
();
#endif
/* macII */
#else
char
*
malloc
();
char
*
realloc
();
#endif
char
*
copy
();
char
*
base_name
();
char
*
getline
();
struct
symtab
*
slookup
();
struct
symtab
*
isdefined
();
struct
symtab
*
fdefined
();
struct
filepointer
*
getfile
();
struct
inclist
*
newinclude
();
struct
inclist
*
inc_path
();
#if NeedVarargsPrototypes
extern
fatalerr
(
char
*
,
...);
extern
warning
(
char
*
,
...);
extern
warning1
(
char
*
,
...);
#endif
soltools/mkdepend/ifparser.c
0 → 100644
Dosyayı görüntüle @
079f6393
This diff is collapsed.
Click to expand it.
soltools/mkdepend/ifparser.h
0 → 100644
Dosyayı görüntüle @
079f6393
/*
* $XConsortium: ifparser.h,v 1.1 92/08/22 13:05:39 rws Exp $
*
* Copyright 1992 Network Computing Devices, Inc.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Network Computing Devices may not be
* used in advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. Network Computing Devices makes
* no representations about the suitability of this software for any purpose.
* It is provided ``as is'' without express or implied warranty.
*
* NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Author: Jim Fulton
* Network Computing Devices, Inc.
*
* Simple if statement processor
*
* This module can be used to evaluate string representations of C language
* if constructs. It accepts the following grammar:
*
* EXPRESSION := VALUE
* | VALUE BINOP EXPRESSION
*
* VALUE := '(' EXPRESSION ')'
* | '!' VALUE
* | '-' VALUE
* | 'defined' '(' variable ')'
* | variable
* | number
*
* BINOP := '*' | '/' | '%'
* | '+' | '-'
* | '<<' | '>>'
* | '<' | '>' | '<=' | '>='
* | '==' | '!='
* | '&' | '|'
* | '&&' | '||'
*
* The normal C order of precidence is supported.
*
*
* External Entry Points:
*
* ParseIfExpression parse a string for #if
*/
#include <stdio.h>
#define const
/**/
typedef
int
Bool
;
#define False 0
#define True 1
typedef
struct
_if_parser
{
struct
{
/* functions */
char
*
(
*
handle_error
)
(
/* struct _if_parser *, const char *,
const char * */
);
int
(
*
eval_variable
)
(
/* struct _if_parser *, const char *, int */
);
int
(
*
eval_defined
)
(
/* struct _if_parser *, const char *, int */
);
}
funcs
;
char
*
data
;
}
IfParser
;
char
*
ParseIfExpression
(
/* IfParser *, const char *, int * */
);
soltools/mkdepend/imakemdep.h
0 → 100644
Dosyayı görüntüle @
079f6393
This diff is collapsed.
Click to expand it.
soltools/mkdepend/include.c
0 → 100644
Dosyayı görüntüle @
079f6393
/* $XConsortium: include.c,v 1.17 94/12/05 19:33:08 gildea Exp $ */
/*
Copyright (c) 1993, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
#include "def.h"
extern
struct
inclist
inclist
[
MAXFILES
],
*
inclistp
;
extern
char
*
includedirs
[
];
extern
char
*
notdotdot
[
];
extern
boolean
show_where_not
;
extern
boolean
warn_multiple
;
struct
inclist
*
inc_path
(
file
,
include
,
dot
)
register
char
*
file
,
*
include
;
boolean
dot
;
{
static
char
path
[
BUFSIZ
];
register
char
**
pp
,
*
p
;
register
struct
inclist
*
ip
;
struct
stat
st
;
boolean
found
=
FALSE
;
/*
* Check all previously found include files for a path that
* has already been expanded.
*/
for
(
ip
=
inclist
;
ip
->
i_file
;
ip
++
)
if
((
strcmp
(
ip
->
i_incstring
,
include
)
==
0
)
&&
!
ip
->
i_included_sym
)
{
found
=
TRUE
;
break
;
}
/*
* If the path was surrounded by "" or is an absolute path,
* then check the exact path provided.
*/
if
(
!
found
&&
(
dot
||
*
include
==
'/'
))
{
if
(
stat
(
include
,
&
st
)
==
0
)
{
ip
=
newinclude
(
include
,
include
);
found
=
TRUE
;
}
else
if
(
show_where_not
)
warning1
(
"
\t
not in %s
\n
"
,
include
);
}
/*
* See if this include file is in the directory of the
* file being compiled.
*/
if
(
!
found
)
{
for
(
p
=
file
+
strlen
(
file
);
p
>
file
;
p
--
)
if
(
*
p
==
'/'
)
break
;
if
(
p
==
file
)
strcpy
(
path
,
include
);
else
{
strncpy
(
path
,
file
,
(
p
-
file
)
+
1
);
path
[
(
p
-
file
)
+
1
]
=
'\0'
;
strcpy
(
path
+
(
p
-
file
)
+
1
,
include
);
}
remove_dotdot
(
path
);
if
(
stat
(
path
,
&
st
)
==
0
)
{
ip
=
newinclude
(
path
,
include
);
found
=
TRUE
;
}
else
if
(
show_where_not
)
warning1
(
"
\t
not in %s
\n
"
,
path
);
}
/*
* Check the include directories specified. (standard include dir
* should be at the end.)
*/
if
(
!
found
)
for
(
pp
=
includedirs
;
*
pp
;
pp
++
)
{
sprintf
(
path
,
"%s/%s"
,
*
pp
,
include
);
remove_dotdot
(
path
);
if
(
stat
(
path
,
&
st
)
==
0
)
{
ip
=
newinclude
(
path
,
include
);
found
=
TRUE
;
break
;
}
else
if
(
show_where_not
)
warning1
(
"
\t
not in %s
\n
"
,
path
);
}
if
(
!
found
)
ip
=
NULL
;
return
(
ip
);
}
/*
* Occasionally, pathnames are created that look like .../x/../y
* Any of the 'x/..' sequences within the name can be eliminated.
* (but only if 'x' is not a symbolic link!!)
*/
remove_dotdot
(
path
)
char
*
path
;
{
register
char
*
end
,
*
from
,
*
to
,
**
cp
;
char
*
components
[
MAXFILES
],
newpath
[
BUFSIZ
];
boolean
component_copied
;
/*
* slice path up into components.
*/
to
=
newpath
;
if
(
*
path
==
'/'
)
*
to
++
=
'/'
;
*
to
=
'\0'
;
cp
=
components
;
for
(
from
=
end
=
path
;
*
end
;
end
++
)
if
(
*
end
==
'/'
)
{
while
(
*
end
==
'/'
)
*
end
++
=
'\0'
;
if
(
*
from
)
*
cp
++
=
from
;
from
=
end
;
}
*
cp
++
=
from
;
*
cp
=
NULL
;
/*
* Recursively remove all 'x/..' component pairs.
*/
cp
=
components
;
while
(
*
cp
)
{
if
(
!
isdot
(
*
cp
)
&&
!
isdotdot
(
*
cp
)
&&
isdotdot
(
*
(
cp
+
1
))
&&
!
issymbolic
(
newpath
,
*
cp
))
{
char
**
fp
=
cp
+
2
;
char
**
tp
=
cp
;
do
*
tp
++
=
*
fp
;
/* move all the pointers down */
while
(
*
fp
++
);
if
(
cp
!=
components
)
cp
--
;
/* go back and check for nested ".." */
}
else
{
cp
++
;
}
}
/*
* Concatenate the remaining path elements.
*/
cp
=
components
;
component_copied
=
FALSE
;
while
(
*
cp
)
{
if
(
component_copied
)
*
to
++
=
'/'
;
component_copied
=
TRUE
;
for
(
from
=
*
cp
;
*
from
;
)
*
to
++
=
*
from
++
;
*
to
=
'\0'
;
cp
++
;
}
*
to
++
=
'\0'
;
/*
* copy the reconstituted path back to our pointer.
*/
strcpy
(
path
,
newpath
);
}
isdot
(
p
)
register
char
*
p
;
{
if
(
p
&&
*
p
++
==
'.'
&&
*
p
++
==
'\0'
)
return
(
TRUE
);
return
(
FALSE
);
}
isdotdot
(
p
)
register
char
*
p
;
{
if
(
p
&&
*
p
++
==
'.'
&&
*
p
++
==
'.'
&&
*
p
++
==
'\0'
)
return
(
TRUE
);
return
(
FALSE
);
}
issymbolic
(
dir
,
component
)
register
char
*
dir
,
*
component
;
{
#ifdef S_IFLNK
struct
stat
st
;
char
buf
[
BUFSIZ
],
**
pp
;
sprintf
(
buf
,
"%s%s%s"
,
dir
,
*
dir
?
"/"
:
""
,
component
);
for
(
pp
=
notdotdot
;
*
pp
;
pp
++
)
if
(
strcmp
(
*
pp
,
buf
)
==
0
)
return
(
TRUE
);
if
(
lstat
(
buf
,
&
st
)
==
0
&&
(
st
.
st_mode
&
S_IFMT
)
==
S_IFLNK
)
{
*
pp
++
=
copy
(
buf
);
if
(
pp
>=
&
notdotdot
[
MAXDIRS
])
fatalerr
(
"out of .. dirs, increase MAXDIRS
\n
"
);
return
(
TRUE
);
}
#endif
return
(
FALSE
);
}
/*
* Add an include file to the list of those included by 'file'.
*/
struct
inclist
*
newinclude
(
newfile
,
incstring
)
register
char
*
newfile
,
*
incstring
;
{
register
struct
inclist
*
ip
;
/*
* First, put this file on the global list of include files.
*/
ip
=
inclistp
++
;
if
(
inclistp
==
inclist
+
MAXFILES
-
1
)
fatalerr
(
"out of space: increase MAXFILES
\n
"
);
ip
->
i_file
=
copy
(
newfile
);
ip
->
i_included_sym
=
FALSE
;
if
(
incstring
==
NULL
)
ip
->
i_incstring
=
ip
->
i_file
;
else
ip
->
i_incstring
=
copy
(
incstring
);
return
(
ip
);
}
included_by
(
ip
,
newfile
)
register
struct
inclist
*
ip
,
*
newfile
;
{
register
i
;
if
(
ip
==
NULL
)
return
;
/*
* Put this include file (newfile) on the list of files included
* by 'file'. If 'file' is NULL, then it is not an include
* file itself (i.e. was probably mentioned on the command line).
* If it is already on the list, don't stick it on again.
*/
if
(
ip
->
i_list
==
NULL
)
ip
->
i_list
=
(
struct
inclist
**
)
malloc
(
sizeof
(
struct
inclist
*
)
*
++
ip
->
i_listlen
);
else
{
for
(
i
=
0
;
i
<
ip
->
i_listlen
;
i
++
)
if
(
ip
->
i_list
[
i
]
==
newfile
)
{
i
=
strlen
(
newfile
->
i_file
);
if
(
!
ip
->
i_included_sym
&&
!
(
i
>
2
&&
newfile
->
i_file
[
i
-
1
]
==
'c'
&&
newfile
->
i_file
[
i
-
2
]
==
'.'
))
{
/* only complain if ip has */
/* no #include SYMBOL lines */
/* and is not a .c file */
if
(
warn_multiple
)
{
warning
(
"%s includes %s more than once!
\n
"
,
ip
->
i_file
,
newfile
->
i_file
);
warning1
(
"Already have
\n
"
);
for
(
i
=
0
;
i
<
ip
->
i_listlen
;
i
++
)
warning1
(
"
\t
%s
\n
"
,
ip
->
i_list
[
i
]
->
i_file
);
}
}
return
;
}
ip
->
i_list
=
(
struct
inclist
**
)
realloc
(
ip
->
i_list
,
sizeof
(
struct
inclist
*
)
*
++
ip
->
i_listlen
);
}
ip
->
i_list
[
ip
->
i_listlen
-
1
]
=
newfile
;
}
inc_clean
()
{
register
struct
inclist
*
ip
;
for
(
ip
=
inclist
;
ip
<
inclistp
;
ip
++
)
{
ip
->
i_marked
=
FALSE
;
}
}
soltools/mkdepend/main.c
0 → 100644
Dosyayı görüntüle @
079f6393
This diff is collapsed.
Click to expand it.
soltools/mkdepend/makefile.mk
0 → 100644
Dosyayı görüntüle @
079f6393
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: nf $ $Date: 2001-04-18 09:10:59 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
TARGET
=
make_makedepend
PRJ
=
..
TARGETTYPE
=
CUI
LIBTARGET
=
NO
NO_DEFAULT_STL
=
TRUE
.INCLUDE
:
settings.mk
dot
=
.
CDEFS
+=
-DNO_X11
-DOBJSUFFIX
=
\"
.obj
\"
-DXP_PC
-DHW_THREADS
-DINCLUDEDIR
=
\"
.
\"
OBJFILES
=
\
$(OBJ)$/
cppsetup.obj
\
$(OBJ)$/
ifparser.obj
\
$(OBJ)$/
include.obj
\
$(OBJ)$/
main.obj
\
$(OBJ)$/
parse.obj
\
$(OBJ)$/
pr.obj
\
$(NULL)
APP1TARGET
=
makedepend
APP1OBJS
=
$(OBJFILES)
APP1STDLIBS
=
$(LIBSTLPORTST)
.IF
"$(OS)"
==
"MACOSX"
NOSHAREDSTATICLIB
=
TRUE
.ENDIF
.INCLUDE
:
target.mk
soltools/mkdepend/mkdepend.man
0 → 100644
Dosyayı görüntüle @
079f6393
.\" $XConsortium: mkdepend.man,v 1.15 94/04/17 20:10:37 gildea Exp $
.\" Copyright (c) 1993, 1994 X Consortium
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining a
.\" copy of this software and associated documentation files (the "Software"),
.\" to deal in the Software without restriction, including without limitation
.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
.\" and/or sell copies of the Software, and to permit persons to whom the
.\" Software furnished to do so, subject to the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
.\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
.\" SOFTWARE.
.\"
.\" Except as contained in this notice, the name of the X Consortium shall not
.\" be used in advertising or otherwise to promote the sale, use or other
.\" dealing in this Software without prior written authorization from the
.\" X Consortium.
.TH MAKEDEPEND 1 "Release 6" "X Version 11"
.UC 4
.SH NAME
makedepend \- create dependencies in makefiles
.SH SYNOPSIS
.B makedepend
[
.B \-Dname=def
] [
.B \-Dname
] [
.B \-Iincludedir
] [
.B \-Yincludedir
] [
.B \-a
] [
.B \-fmakefile
] [
.B \-oobjsuffix
] [
.B \-pobjprefix
] [
.B \-sstring
] [
.B \-wwidth
] [
.B \-v
] [
.B \-m
] [
\-\^\-
.B otheroptions
\-\^\-
]
sourcefile .\|.\|.
.br
.SH DESCRIPTION
.B Makedepend
reads each
.I sourcefile
in sequence and parses it like a C-preprocessor,
processing all
.I #include,
.I #define,
.I #undef,
.I #ifdef,
.I #ifndef,
.I #endif,
.I #if
and
.I #else
directives so that it can correctly tell which
.I #include,
directives would be used in a compilation.
Any
.I #include,
directives can reference files having other
.I #include
directives, and parsing will occur in these files as well.
.PP
Every file that a
.I sourcefile
includes,
directly or indirectly,
is what
.B makedepend
calls a "dependency".
These dependencies are then written to a
.I makefile
in such a way that
.B make(1)
will know which object files must be recompiled when a dependency has changed.
.PP
By default,
.B makedepend
places its output in the file named
.I makefile
if it exists, otherwise
.I Makefile.
An alternate makefile may be specified with the
.B \-f
option.
It first searches the makefile for
the line
.sp
# DO NOT DELETE THIS LINE \-\^\- make depend depends on it.
.sp
or one provided with the
.B \-s
option,
as a delimiter for the dependency output.
If it finds it, it will delete everything
following this to the end of the makefile
and put the output after this line.
If it doesn't find it, the program
will append the string to the end of the makefile
and place the output following that.
For each
.I sourcefile
appearing on the command line,
.B makedepend
puts lines in the makefile of the form
.sp
sourcefile.o:\0dfile .\|.\|.
.sp
Where "sourcefile.o" is the name from the command
line with its suffix replaced with ".o",
and "dfile" is a dependency discovered in a
.I #include
directive while parsing
.I sourcefile
or one of the files it included.
.SH EXAMPLE
Normally,
.B makedepend
will be used in a makefile target so that typing "make depend" will
bring the dependencies up to date for the makefile.
For example,
.nf
SRCS\0=\0file1.c\0file2.c\0.\|.\|.
CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
depend:
makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
.fi
.SH OPTIONS
.B Makedepend
will ignore any option that it does not understand so that you may use
the same arguments that you would for
.B cc(1).
.TP 5
.B \-Dname=def or \-Dname
Define.
This places a definition for
.I name
in
.B makedepend's
symbol table.
Without
.I =def
the symbol becomes defined as "1".
.TP 5
.B \-Iincludedir
Include directory.
This option tells
.B makedepend
to prepend
.I includedir
to its list of directories to search when it encounters
a
.I #include
directive.
By default,
.B makedepend
only searches the standard include directories (usually /usr/include
and possibly a compiler-dependent directory).
.TP 5
.B \-Yincludedir
Replace all of the standard include directories with the single specified
include directory; you can omit the
.I includedir
to simply prevent searching the standard include directories.
.TP 5
.B \-a
Append the dependencies to the end of the file instead of replacing them.
.TP 5
.B \-fmakefile
Filename.
This allows you to specify an alternate makefile in which
.B makedepend
can place its output.
.TP 5
.B \-oobjsuffix
Object file suffix.
Some systems may have object files whose suffix is something other
than ".o".
This option allows you to specify another suffix, such as
".b" with
.I -o.b
or ":obj"
with
.I -o:obj
and so forth.
.TP 5
.B \-pobjprefix
Object file prefix.
The prefix is prepended to the name of the object file. This is
usually used to designate a different directory for the object file.
The default is the empty string.
.TP 5
.B \-sstring
Starting string delimiter.
This option permits you to specify
a different string for
.B makedepend
to look for in the makefile.
.TP 5
.B \-wwidth
Line width.
Normally,
.B makedepend
will ensure that every output line that it writes will be no wider than
78 characters for the sake of readability.
This option enables you to change this width.
.TP 5
.B \-v
Verbose operation.
This option causes
.B makedepend
to emit the list of files included by each input file on standard output.
.TP 5
.B \-m
Warn about multiple inclusion.
This option causes
.B makedepend
to produce a warning if any input file includes another file more than
once. In previous versions of
.B makedepend
this was the default behavior; the default has been changed to better
match the behavior of the C compiler, which does not consider multiple
inclusion to be an error. This option is provided for backward
compatibility, and to aid in debugging problems related to multiple
inclusion.
.TP 5
.B "\-\^\- options \-\^\-"
If
.B makedepend
encounters a double hyphen (\-\^\-) in the argument list,
then any unrecognized argument following it
will be silently ignored; a second double hyphen terminates this
special treatment.
In this way,
.B makedepend
can be made to safely ignore esoteric compiler arguments that might
normally be found in a CFLAGS
.B make
macro (see the
.B EXAMPLE
section above).
All options that
.B makedepend
recognizes and appear between the pair of double hyphens
are processed normally.
.SH ALGORITHM
The approach used in this program enables it to run an order of magnitude
faster than any other "dependency generator" I have ever seen.
Central to this performance are two assumptions:
that all files compiled by a single
makefile will be compiled with roughly the same
.I -I
and
.I -D
options;
and that most files in a single directory will include largely the
same files.
.PP
Given these assumptions,
.B makedepend
expects to be called once for each makefile, with
all source files that are maintained by the
makefile appearing on the command line.
It parses each source and include
file exactly once, maintaining an internal symbol table
for each.
Thus, the first file on the command line will take an amount of time
proportional to the amount of time that a normal C preprocessor takes.
But on subsequent files, if it encounter's an include file
that it has already parsed, it does not parse it again.
.PP
For example,
imagine you are compiling two files,
.I file1.c
and
.I file2.c,
they each include the header file
.I header.h,
and the file
.I header.h
in turn includes the files
.I def1.h
and
.I def2.h.
When you run the command
.sp
makedepend\0file1.c\0file2.c
.sp
.B makedepend
will parse
.I file1.c
and consequently,
.I header.h
and then
.I def1.h
and
.I def2.h.
It then decides that the dependencies for this file are
.sp
file1.o:\0header.h\0def1.h\0def2.h
.sp
But when the program parses
.I file2.c
and discovers that it, too, includes
.I header.h,
it does not parse the file,
but simply adds
.I header.h,
.I def1.h
and
.I def2.h
to the list of dependencies for
.I file2.o.
.SH "SEE ALSO"
cc(1), make(1)
.SH BUGS
.B makedepend
parses, but does not currently evaluate, the SVR4
#predicate(token-list) preprocessor expression;
such expressions are simply assumed to be true.
This may cause the wrong
.I #include
directives to be evaluated.
.PP
Imagine you are parsing two files,
say
.I file1.c
and
.I file2.c,
each includes the file
.I def.h.
The list of files that
.I def.h
includes might truly be different when
.I def.h
is included by
.I file1.c
than when it is included by
.I file2.c.
But once
.B makedepend
arrives at a list of dependencies for a file,
it is cast in concrete.
.SH AUTHOR
Todd Brunhoff, Tektronix, Inc. and MIT Project Athena
soltools/mkdepend/parse.c
0 → 100644
Dosyayı görüntüle @
079f6393
This diff is collapsed.
Click to expand it.
soltools/mkdepend/pr.c
0 → 100644
Dosyayı görüntüle @
079f6393
/* $XConsortium: pr.c,v 1.17 94/04/17 20:10:38 gildea Exp $ */
/*
Copyright (c) 1993, 1994 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
*/
#include "def.h"
extern
struct
inclist
inclist
[
MAXFILES
],
*
inclistp
;
extern
char
*
objprefix
;
extern
char
*
objsuffix
;
extern
int
width
;
extern
boolean
printed
;
extern
boolean
verbose
;
extern
boolean
show_where_not
;
add_include
(
filep
,
file
,
file_red
,
include
,
dot
,
failOK
)
struct
filepointer
*
filep
;
struct
inclist
*
file
,
*
file_red
;
char
*
include
;
boolean
dot
;
{
register
struct
inclist
*
newfile
;
register
struct
filepointer
*
content
;
/*
* First decide what the pathname of this include file really is.
*/
newfile
=
inc_path
(
file
->
i_file
,
include
,
dot
);
if
(
newfile
==
NULL
)
{
if
(
failOK
)
return
;
if
(
file
!=
file_red
)
warning
(
"%s (reading %s, line %d): "
,
file_red
->
i_file
,
file
->
i_file
,
filep
->
f_line
);
else
warning
(
"%s, line %d: "
,
file
->
i_file
,
filep
->
f_line
);
warning1
(
"cannot find include file
\"
%s
\"\n
"
,
include
);
show_where_not
=
TRUE
;
newfile
=
inc_path
(
file
->
i_file
,
include
,
dot
);
show_where_not
=
FALSE
;
}
if
(
newfile
)
{
/* Only add new dependency files if they don't have "/usr/include" in them. */
if
(
!
(
newfile
&&
newfile
->
i_file
&&
strstr
(
newfile
->
i_file
,
"/usr/"
)))
{
included_by
(
file
,
newfile
);
}
if
(
!
newfile
->
i_searched
)
{
newfile
->
i_searched
=
TRUE
;
content
=
getfile
(
newfile
->
i_file
);
find_includes
(
content
,
newfile
,
file_red
,
0
,
failOK
);
freefile
(
content
);
}
}
}
recursive_pr_include
(
head
,
file
,
base
)
register
struct
inclist
*
head
;
register
char
*
file
,
*
base
;
{
register
int
i
;
if
(
head
->
i_marked
)
return
;
head
->
i_marked
=
TRUE
;
if
(
head
->
i_file
!=
file
)
pr
(
head
,
file
,
base
);
for
(
i
=
0
;
i
<
head
->
i_listlen
;
i
++
)
recursive_pr_include
(
head
->
i_list
[
i
],
file
,
base
);
}
pr
(
ip
,
file
,
base
)
register
struct
inclist
*
ip
;
char
*
file
,
*
base
;
{
static
char
*
lastfile
;
static
int
current_len
;
register
int
len
,
i
;
char
buf
[
BUFSIZ
];
printed
=
TRUE
;
len
=
strlen
(
ip
->
i_file
)
+
1
;
if
(
current_len
+
len
>
width
||
file
!=
lastfile
)
{
lastfile
=
file
;
sprintf
(
buf
,
"
\n
%s%s%s: %s"
,
objprefix
,
base
,
objsuffix
,
ip
->
i_file
);
len
=
current_len
=
strlen
(
buf
);
}
else
{
buf
[
0
]
=
' '
;
strcpy
(
buf
+
1
,
ip
->
i_file
);
current_len
+=
len
;
}
fwrite
(
buf
,
len
,
1
,
stdout
);
/*
* If verbose is set, then print out what this file includes.
*/
if
(
!
verbose
||
ip
->
i_list
==
NULL
||
ip
->
i_notified
)
return
;
ip
->
i_notified
=
TRUE
;
lastfile
=
NULL
;
printf
(
"
\n
# %s includes:"
,
ip
->
i_file
);
for
(
i
=
0
;
i
<
ip
->
i_listlen
;
i
++
)
printf
(
"
\n
#
\t
%s"
,
ip
->
i_list
[
i
]
->
i_incstring
);
}
soltools/prj/build.lst
0 → 100644
Dosyayı görüntüle @
079f6393
so soltools usr1 - all so_usr1 NULL
so soltools\ldump nmake - n so_ldump NULL
so soltools\mkdepend nmake - all so_mkdep NULL
soltools/prj/d.lst
Dosyayı görüntüle @
079f6393
..\%__SRC%\bin\ldump.exe %_DEST%\bin%_EXT%\ldump.exe
..\%__SRC%\bin\makedepend.exe %_DEST%\bin%_EXT%\makedepend.exe
..\%__SRC%\bin\makedepend %_DEST%\bin%_EXT%\makedepend
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment