Subversion Repositories Kolibri OS

Rev

Rev 1498 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 7... Line 7...
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
16
 * 2.1. This is your license from Intel Corp. under its intellectual property
16
 * 2.1. This is your license from Intel Corp. under its intellectual property
Line 239... Line 239...
239
    UINT32                  SourceColumn;
239
    UINT32                  SourceColumn;
240
    UINT32                  ErrorColumn;
240
    UINT32                  ErrorColumn;
241
    FILE                    *OutputFile;
241
    FILE                    *OutputFile;
242
    FILE                    *SourceFile;
242
    FILE                    *SourceFile;
243
 
243
    long                    FileSize;
-
 
244
    BOOLEAN                 PrematureEOF = FALSE;
-
 
245
 
Line 244... Line 246...
244
 
246
 
245
    if (Gbl_NoErrors)
247
    if (Gbl_NoErrors)
246
    {
248
    {
Line 278... Line 280...
278
 
280
 
Line 279... Line 281...
279
    /* Get the file handles */
281
    /* Get the file handles */
Line 280... Line 282...
280
 
282
 
-
 
283
    OutputFile = Gbl_Files[FileId].Handle;
-
 
284
 
-
 
285
    /* Use the merged header/source file if present, otherwise use input file */
281
    OutputFile = Gbl_Files[FileId].Handle;
286
 
-
 
287
    SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
-
 
288
    if (!SourceFile)
-
 
289
    {
-
 
290
        SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
-
 
291
    }
-
 
292
 
-
 
293
    if (SourceFile)
-
 
294
    {
-
 
295
        /* Determine if the error occurred at source file EOF */
-
 
296
 
-
 
297
        fseek (SourceFile, 0, SEEK_END);
-
 
298
        FileSize = ftell (SourceFile);
-
 
299
 
-
 
300
        if ((long) Enode->LogicalByteOffset >= FileSize)
-
 
301
        {
-
 
302
            PrematureEOF = TRUE;
-
 
303
        }
Line 282... Line 304...
282
    SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
304
    }
283
 
305
 
284
    if (Header)
306
    if (Header)
285
    {
307
    {
Line 298... Line 320...
298
            {
320
            {
299
                fprintf (OutputFile, "%6u: ", Enode->LineNumber);
321
                fprintf (OutputFile, " %6u: ", Enode->LineNumber);
300
 
322
 
Line 301... Line 323...
301
                /*
323
                /*
-
 
324
                 * If not at EOF, get the corresponding source code line and
-
 
325
                 * display it. Don't attempt this if we have a premature EOF
-
 
326
                 * condition.
-
 
327
                 */
-
 
328
                if (!PrematureEOF)
-
 
329
                {
-
 
330
                    /*
302
                 * Seek to the offset in the combined source file, read the source
331
                     * Seek to the offset in the combined source file, read
303
                 * line, and write it to the output.
332
                     * the source line, and write it to the output.
304
                 */
333
                     */
305
                Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
334
                    Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
306
                            (int) SEEK_SET);
335
                                (int) SEEK_SET);
307
                if (Actual)
336
                    if (Actual)
308
                {
337
                    {
Line 325... Line 354...
325
                        fwrite (&SourceByte, 1, 1, OutputFile);
354
                            fwrite (&SourceByte, 1, 1, OutputFile);
326
                        RActual = fread (&SourceByte, 1, 1, SourceFile);
355
                            RActual = fread (&SourceByte, 1, 1, SourceFile);
327
                    }
356
                        }
328
                }
357
                    }
329
                fprintf (OutputFile, "\n");
358
                }
-
 
359
 
-
 
360
                fprintf (OutputFile, "\n");
330
            }
361
            }
331
        }
362
        }
332
        else
363
        else
333
        {
364
        {
334
            fprintf (OutputFile, "%s", Enode->Filename);
365
            fprintf (OutputFile, "%s", Enode->Filename);
Line 367... Line 398...
367
                MsgLength = strlen (MainMessage);
398
                MsgLength = strlen (MainMessage);
368
                ExtraMessage = NULL;
399
                ExtraMessage = NULL;
369
            }
400
            }
Line 370... Line 401...
370
 
401
 
371
            if (Gbl_VerboseErrors)
402
            if (Gbl_VerboseErrors && !PrematureEOF)
372
            {
403
            {
373
                SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
404
                SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
Line 374... Line 405...
374
                ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
405
                ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
Line 397... Line 428...
397
            {
428
            {
398
                fprintf (OutputFile, " (%s)", ExtraMessage);
429
                fprintf (OutputFile, " (%s)", ExtraMessage);
399
            }
430
            }
400
 
431
 
Line -... Line 432...
-
 
432
            if (PrematureEOF)
-
 
433
            {
-
 
434
                fprintf (OutputFile, " and premature End-Of-File");
-
 
435
            }
-
 
436
 
401
            fprintf (OutputFile, "\n");
437
            fprintf (OutputFile, "\n");
402
            if (Gbl_VerboseErrors)
438
            if (Gbl_VerboseErrors)
403
            {
439
            {
404
                fprintf (OutputFile, "\n");
440
                fprintf (OutputFile, "\n");
405
            }
441
            }
Line 654... Line 690...
654
 ******************************************************************************/
690
 ******************************************************************************/
655
 
691
 
Line 656... Line 692...
656
int
692
int
657
AslCompilererror (
693
AslCompilererror (
658
    char                    *CompilerMessage)
694
    const char              *CompilerMessage)
659
{
695
{
Line 660... Line 696...
660
 
696
 
661
    AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber,
697
    AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber,
662
                    Gbl_LogicalLineNumber, Gbl_CurrentLineOffset,
698
        Gbl_LogicalLineNumber, Gbl_CurrentLineOffset,
663
                    Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename,
699
        Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename,
Line 664... Line 700...
664
                    CompilerMessage);
700
        ACPI_CAST_PTR (char, CompilerMessage));
665
 
701