int ACPI_SYSTEM_XFACE main ( int argc, char *argv[]) { int j; ACPI_CONVERSION_TABLE *ConversionTable = NULL; char *SourcePath; char *TargetPath; UINT32 FileType; ACPI_DEBUG_INITIALIZE (); /* For debug version only */ AcpiOsInitialize (); printf (ACPI_COMMON_SIGNON (AS_UTILITY_NAME)); if (argc < 2) { AsDisplayUsage (); return (0); } /* Command line options */ while ((j = AcpiGetopt (argc, argv, AS_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch(j) { case 'l': /* Linux code generation */ printf ("Creating Linux source code\n"); ConversionTable = &LinuxConversionTable; Gbl_WidenDeclarations = TRUE; Gbl_IgnoreLoneLineFeeds = TRUE; break; case 'c': /* Cleanup code */ printf ("Code cleanup\n"); ConversionTable = &CleanupConversionTable; Gbl_Cleanup = TRUE; break; case 'h': /* Inject Dual-license header */ printf ("Inserting Dual-license header to all modules\n"); ConversionTable = &LicenseConversionTable; break; case 'i': /* Cleanup wrong indent result */ printf ("Cleaning up macro indentation\n"); ConversionTable = &IndentConversionTable; Gbl_IgnoreLoneLineFeeds = TRUE; Gbl_IgnoreTranslationEscapes = TRUE; break; case 's': /* Statistics only */ break; case 'u': /* custom conversion */ printf ("Custom source translation\n"); ConversionTable = &CustomConversionTable; break; case 'v': switch (AcpiGbl_Optarg[0]) { case '^': /* -v: (Version): signon already emitted, just exit */ exit (0); case 'b': /* Verbose mode */ Gbl_VerboseMode = TRUE; break; default: printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); return (-1); } break; case 'y': /* Batch mode */ Gbl_BatchMode = TRUE; break; case 'd': /* Leave debug statements in */ Gbl_DebugStatementsMode = TRUE; break; case 'q': /* Quiet mode */ Gbl_QuietMode = TRUE; break; default: AsDisplayUsage (); return (-1); } SourcePath = argv[AcpiGbl_Optind]; if (!SourcePath) { printf ("Missing source path\n"); AsDisplayUsage (); return (-1); } TargetPath = argv[AcpiGbl_Optind+1]; if (!ConversionTable) { /* Just generate statistics. Ignore target path */ TargetPath = SourcePath; printf ("Source code statistics only\n"); ConversionTable = &StatsConversionTable; } else if (!TargetPath) { TargetPath = SourcePath; } if (Gbl_DebugStatementsMode) { ConversionTable->SourceFunctions &= ~CVT_REMOVE_DEBUG_MACROS; } /* Check source and target paths and files */ if (AsExaminePaths (ConversionTable, SourcePath, TargetPath, &FileType)) { return (-1); } /* Source/target can be either directories or a files */ if (FileType == S_IFDIR) { /* Process the directory tree */ AsProcessTree (ConversionTable, SourcePath, TargetPath); } else { /* Process a single file */ /* Differentiate between source and header files */ if (strstr (SourcePath, ".h")) { AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_HEADER); } else if (strstr (SourcePath, ".c")) { AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_SOURCE); } else if (strstr (SourcePath, ".patch")) { AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_PATCH); } else { printf ("Unknown file type - %s\n", SourcePath); } } /* Always display final summary and stats */ AsDisplayStats (); return (0); }
int ACPI_SYSTEM_XFACE main ( int argc, char *argv[]) { int j; ACPI_CONVERSION_TABLE *ConversionTable = NULL; char *SourcePath; char *TargetPath; UINT32 FileType; printf (ACPI_COMMON_SIGNON ("ACPI Source Code Conversion Utility")); if (argc < 2) { AsDisplayUsage (); return 0; } /* Command line options */ while ((j = AcpiGetopt (argc, argv, "cdhlqsuvy")) != EOF) switch(j) { case 'l': /* Linux code generation */ printf ("Creating Linux source code\n"); ConversionTable = &LinuxConversionTable; Gbl_WidenDeclarations = TRUE; Gbl_IgnoreLoneLineFeeds = TRUE; break; case 'c': /* Cleanup code */ printf ("Code cleanup\n"); ConversionTable = &CleanupConversionTable; break; case 'h': /* Inject Dual-license header */ printf ("Inserting Dual-license header to all modules\n"); ConversionTable = &LicenseConversionTable; break; case 's': /* Statistics only */ break; case 'u': /* custom conversion */ printf ("Custom source translation\n"); ConversionTable = &CustomConversionTable; break; case 'v': /* Verbose mode */ Gbl_VerboseMode = TRUE; break; case 'y': /* Batch mode */ Gbl_BatchMode = TRUE; break; case 'd': /* Leave debug statements in */ Gbl_DebugStatementsMode = TRUE; break; case 'q': /* Quiet mode */ Gbl_QuietMode = TRUE; break; default: AsDisplayUsage (); return -1; } SourcePath = argv[AcpiGbl_Optind]; if (!SourcePath) { printf ("Missing source path\n"); AsDisplayUsage (); return -1; } TargetPath = argv[AcpiGbl_Optind+1]; if (!ConversionTable) { /* Just generate statistics. Ignore target path */ TargetPath = SourcePath; printf ("Source code statistics only\n"); ConversionTable = &StatsConversionTable; } else if (!TargetPath) { TargetPath = SourcePath; } if (Gbl_DebugStatementsMode) { ConversionTable->SourceFunctions &= ~CVT_REMOVE_DEBUG_MACROS; } /* Check source and target paths and files */ if (AsExaminePaths (ConversionTable, SourcePath, TargetPath, &FileType)) { return -1; } /* Source/target can be either directories or a files */ if (FileType == S_IFDIR) { /* Process the directory tree */ AsProcessTree (ConversionTable, SourcePath, TargetPath); } else { /* Process a single file */ /* Differentiate between source and header files */ if (strstr (SourcePath, ".h")) { AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_HEADER); } else { AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_SOURCE); } } /* Always display final summary and stats */ AsDisplayStats (); return 0; }