When you're using a scripting mode - "-s", "-m" or "-i" - it now automatically includes all the system headers for you.
This fixes issue 101 git-svn-id: http://picoc.googlecode.com/svn/trunk@475 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
c0a21f5c37
commit
0ffbd21f2e
10
include.c
10
include.c
|
@ -5,7 +5,7 @@
|
||||||
/* a list of libraries we can include */
|
/* a list of libraries we can include */
|
||||||
struct IncludeLibrary
|
struct IncludeLibrary
|
||||||
{
|
{
|
||||||
const char *IncludeName;
|
char *IncludeName;
|
||||||
void (*SetupFunction)(void);
|
void (*SetupFunction)(void);
|
||||||
struct LibraryFunction *FuncList;
|
struct LibraryFunction *FuncList;
|
||||||
const char *SetupCSource;
|
const char *SetupCSource;
|
||||||
|
@ -57,6 +57,14 @@ void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struc
|
||||||
IncludeLibList = NewLib;
|
IncludeLibList = NewLib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* include all of the system headers */
|
||||||
|
void IncludeAllSystemHeaders()
|
||||||
|
{
|
||||||
|
struct IncludeLibrary *ThisInclude = IncludeLibList;
|
||||||
|
|
||||||
|
for (; ThisInclude != NULL; ThisInclude = ThisInclude->NextLib)
|
||||||
|
IncludeFile(ThisInclude->IncludeName);
|
||||||
|
}
|
||||||
|
|
||||||
/* include one of a number of predefined libraries, or perhaps an actual file */
|
/* include one of a number of predefined libraries, or perhaps an actual file */
|
||||||
void IncludeFile(char *FileName)
|
void IncludeFile(char *FileName)
|
||||||
|
|
8
picoc.c
8
picoc.c
|
@ -67,21 +67,25 @@ int main(int argc, char **argv)
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
printf("Format: picoc <csource1.c>... [- <arg1>...] : run a program (calls main() to start it)\n"
|
printf("Format: picoc <csource1.c>... [- <arg1>...] : run a program (calls main() to start it)\n"
|
||||||
" picoc -m <csource1.c>... [- <arg1>...] : run a program without calling main()\n"
|
" picoc -s <csource1.c>... [- <arg1>...] : script mode - runs the program without calling main()\n"
|
||||||
" picoc -i : interactive mode\n");
|
" picoc -i : interactive mode\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Initialise();
|
Initialise();
|
||||||
|
|
||||||
if (strcmp(argv[ParamCount], "-m") == 0)
|
if (strcmp(argv[ParamCount], "-s") == 0 || strcmp(argv[ParamCount], "-m") == 0)
|
||||||
{
|
{
|
||||||
DontRunMain = TRUE;
|
DontRunMain = TRUE;
|
||||||
|
IncludeAllSystemHeaders();
|
||||||
ParamCount++;
|
ParamCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[ParamCount], "-i") == 0)
|
if (strcmp(argv[ParamCount], "-i") == 0)
|
||||||
|
{
|
||||||
|
IncludeAllSystemHeaders();
|
||||||
ParseInteractive();
|
ParseInteractive();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (PlatformSetExitPoint())
|
if (PlatformSetExitPoint())
|
||||||
|
|
1
picoc.h
1
picoc.h
|
@ -437,6 +437,7 @@ void IncludeInit();
|
||||||
void IncludeCleanup();
|
void IncludeCleanup();
|
||||||
void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struct LibraryFunction *FuncList, const char *SetupCSource);
|
void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struct LibraryFunction *FuncList, const char *SetupCSource);
|
||||||
void IncludeFile(char *Filename);
|
void IncludeFile(char *Filename);
|
||||||
|
void IncludeAllSystemHeaders();
|
||||||
|
|
||||||
/* stdio.c */
|
/* stdio.c */
|
||||||
extern const char StdioDefs[];
|
extern const char StdioDefs[];
|
||||||
|
|
Loading…
Reference in a new issue