am 1643e97b: Merge "aidl: Pull main() into dedicated file"
* commit '1643e97b330d6c0f47e8643e52b12c6887a89f81': aidl: Pull main() into dedicated file
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#ifndef AIDL_AST_H
|
#ifndef AIDL_AST_H_
|
||||||
#define AIDL_AST_H
|
#define AIDL_AST_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -368,4 +368,4 @@ struct Document
|
|||||||
virtual void Write(FILE* to);
|
virtual void Write(FILE* to);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AIDL_AST_H
|
#endif // AIDL_AST_H_
|
||||||
|
|||||||
@@ -20,17 +20,18 @@ LOCAL_CFLAGS += -Wno-deprecated-register
|
|||||||
LOCAL_CFLAGS += -Wno-writable-strings
|
LOCAL_CFLAGS += -Wno-writable-strings
|
||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
aidl_language_l.l \
|
|
||||||
aidl_language_y.y \
|
|
||||||
aidl.cpp \
|
|
||||||
aidl_language.cpp \
|
|
||||||
options.cpp \
|
|
||||||
search_path.cpp \
|
|
||||||
AST.cpp \
|
AST.cpp \
|
||||||
Type.cpp \
|
Type.cpp \
|
||||||
|
aidl.cpp \
|
||||||
|
aidl_language.cpp \
|
||||||
|
aidl_language_l.l \
|
||||||
|
aidl_language_y.y \
|
||||||
generate_java.cpp \
|
generate_java.cpp \
|
||||||
generate_java_binder.cpp \
|
generate_java_binder.cpp \
|
||||||
generate_java_rpc.cpp
|
generate_java_rpc.cpp \
|
||||||
|
main.cpp \
|
||||||
|
options.cpp \
|
||||||
|
search_path.cpp \
|
||||||
|
|
||||||
LOCAL_MODULE := aidl
|
LOCAL_MODULE := aidl
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef AIDL_TYPE_H
|
#ifndef AIDL_TYPE_H_
|
||||||
#define AIDL_TYPE_H
|
#define AIDL_TYPE_H_
|
||||||
|
|
||||||
#include "AST.h"
|
#include "AST.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -539,4 +539,4 @@ extern Expression* FALSE_VALUE;
|
|||||||
|
|
||||||
void register_base_types();
|
void register_base_types();
|
||||||
|
|
||||||
#endif // AIDL_TYPE_H
|
#endif // AIDL_TYPE_H_
|
||||||
|
|||||||
@@ -933,7 +933,7 @@ check_and_assign_method_ids(const char * filename, interface_item_type* first_it
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================
|
// ==========================================================
|
||||||
static int
|
int
|
||||||
compile_aidl(Options& options)
|
compile_aidl(Options& options)
|
||||||
{
|
{
|
||||||
int err = 0, N;
|
int err = 0, N;
|
||||||
@@ -1063,7 +1063,7 @@ compile_aidl(Options& options)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
preprocess_aidl(const Options& options)
|
preprocess_aidl(const Options& options)
|
||||||
{
|
{
|
||||||
vector<string> lines;
|
vector<string> lines;
|
||||||
@@ -1135,24 +1135,3 @@ preprocess_aidl(const Options& options)
|
|||||||
close(fd);
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================
|
|
||||||
int
|
|
||||||
main(int argc, const char **argv)
|
|
||||||
{
|
|
||||||
Options options;
|
|
||||||
int result = parse_options(argc, argv, &options);
|
|
||||||
if (result) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (options.task)
|
|
||||||
{
|
|
||||||
case COMPILE_AIDL:
|
|
||||||
return compile_aidl(options);
|
|
||||||
case PREPROCESS_AIDL:
|
|
||||||
return preprocess_aidl(options);
|
|
||||||
}
|
|
||||||
fprintf(stderr, "aidl: internal error\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|||||||
9
tools/aidl/aidl.h
Normal file
9
tools/aidl/aidl.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef AIDL_AIDL_H_
|
||||||
|
#define AIDL_AIDL_H_
|
||||||
|
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
|
int compile_aidl(Options& options);
|
||||||
|
int preprocess_aidl(const Options& options);
|
||||||
|
|
||||||
|
#endif // AIDL_AIDL_H_
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef DEVICE_TOOLS_AIDL_AIDL_LANGUAGE_H
|
#ifndef AIDL_AIDL_LANGUAGE_H_
|
||||||
#define DEVICE_TOOLS_AIDL_AIDL_LANGUAGE_H
|
#define AIDL_AIDL_LANGUAGE_H_
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -169,4 +169,4 @@ void init_buffer_type(buffer_type* buf, int lineno);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // DEVICE_TOOLS_AIDL_AIDL_LANGUAGE_H
|
#endif // AIDL_AIDL_LANGUAGE_H_
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef GENERATE_JAVA_H
|
#ifndef AIDL_GENERATE_JAVA_H_
|
||||||
#define GENERATE_JAVA_H
|
#define AIDL_GENERATE_JAVA_H_
|
||||||
|
|
||||||
#include "aidl_language.h"
|
#include "aidl_language.h"
|
||||||
#include "AST.h"
|
#include "AST.h"
|
||||||
@@ -29,5 +29,5 @@ private:
|
|||||||
int m_index;
|
int m_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GENERATE_JAVA_H
|
#endif // AIDL_GENERATE_JAVA_H_
|
||||||
|
|
||||||
|
|||||||
23
tools/aidl/main.cpp
Normal file
23
tools/aidl/main.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#include "aidl.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char **argv)
|
||||||
|
{
|
||||||
|
Options options;
|
||||||
|
int result = parse_options(argc, argv, &options);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (options.task) {
|
||||||
|
case COMPILE_AIDL:
|
||||||
|
return compile_aidl(options);
|
||||||
|
case PREPROCESS_AIDL:
|
||||||
|
return preprocess_aidl(options);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "aidl: internal error\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef DEVICE_TOOLS_AIDL_H
|
#ifndef AIDL_OPTIONS_H_
|
||||||
#define DEVICE_TOOLS_AIDL_H
|
#define AIDL_OPTIONS_H_
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -33,4 +33,4 @@ struct Options
|
|||||||
// It also prints the usage statement on failure.
|
// It also prints the usage statement on failure.
|
||||||
int parse_options(int argc, const char* const* argv, Options *options);
|
int parse_options(int argc, const char* const* argv, Options *options);
|
||||||
|
|
||||||
#endif // DEVICE_TOOLS_AIDL_H
|
#endif // AIDL_OPTIONS_H_
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _FRAMEWORKS_BASE_TOOLS_AIDL_OS_SEP_H_
|
#ifndef AIDL_OS_H_
|
||||||
#define _FRAMEWORKS_BASE_TOOLS_AIDL_OS_SEP_H_
|
#define AIDL_OS_H_
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define OS_PATH_SEPARATOR '\\'
|
#define OS_PATH_SEPARATOR '\\'
|
||||||
@@ -23,4 +23,4 @@
|
|||||||
#define OS_PATH_SEPARATOR '/'
|
#define OS_PATH_SEPARATOR '/'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif // AIDL_OS_H_
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef DEVICE_TOOLS_AIDL_SEARCH_PATH_H
|
#ifndef AIDL_SEARCH_PATH_H_
|
||||||
#define DEVICE_TOOLS_AIDL_SEARCH_PATH_H
|
#define AIDL_SEARCH_PATH_H_
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -19,5 +19,4 @@ char* find_import_file(const char* given);
|
|||||||
void set_import_paths(const vector<string>& importPaths);
|
void set_import_paths(const vector<string>& importPaths);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // DEVICE_TOOLS_AIDL_SEARCH_PATH_H
|
#endif // AIDL_SEARCH_PATH_H_
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user