cvcompiler.c (4b49587c3dd54aed8eb103d838a89ca79484a9b6) cvcompiler.c (6f1f1a6395c91c5a845727d7313921a6fe3d297b)
1/******************************************************************************
2 *
3 * Module Name: cvcompiler - ASL-/ASL+ converter functions
4 *
5 *****************************************************************************/
6
7/******************************************************************************
8 *

--- 179 unchanged lines hidden (view full) ---

188
189 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
190 {
191 *StringBuffer = (char) c1;
192 ++StringBuffer;
193 *StringBuffer = 0;
194
195 CvDbgPrint ("Multi-line comment\n");
1/******************************************************************************
2 *
3 * Module Name: cvcompiler - ASL-/ASL+ converter functions
4 *
5 *****************************************************************************/
6
7/******************************************************************************
8 *

--- 179 unchanged lines hidden (view full) ---

188
189 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
190 {
191 *StringBuffer = (char) c1;
192 ++StringBuffer;
193 *StringBuffer = 0;
194
195 CvDbgPrint ("Multi-line comment\n");
196 CommentString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1);
197 strcpy (CommentString, MsgBuffer);
196 CommentString = UtLocalCacheCalloc (strlen (AslGbl_MsgBuffer) + 1);
197 strcpy (CommentString, AslGbl_MsgBuffer);
198
199 CvDbgPrint ("CommentString: %s\n", CommentString);
200
201 /*
202 * Determine whether if this comment spans multiple lines. If so,
203 * break apart the comment by storing each line in a different node
204 * within the comment list. This allows the disassembler to
205 * properly indent a multi-line comment.

--- 102 unchanged lines hidden (view full) ---

308 char *CommentString;
309 char *FinalCommentString;
310
311
312 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
313 {
314 *StringBuffer = 0; /* null terminate */
315 CvDbgPrint ("Single-line comment\n");
198
199 CvDbgPrint ("CommentString: %s\n", CommentString);
200
201 /*
202 * Determine whether if this comment spans multiple lines. If so,
203 * break apart the comment by storing each line in a different node
204 * within the comment list. This allows the disassembler to
205 * properly indent a multi-line comment.

--- 102 unchanged lines hidden (view full) ---

308 char *CommentString;
309 char *FinalCommentString;
310
311
312 if (AcpiGbl_CaptureComments && CurrentState.CaptureComments)
313 {
314 *StringBuffer = 0; /* null terminate */
315 CvDbgPrint ("Single-line comment\n");
316 CommentString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1);
317 strcpy (CommentString, MsgBuffer);
316 CommentString = UtLocalCacheCalloc (strlen (AslGbl_MsgBuffer) + 1);
317 strcpy (CommentString, AslGbl_MsgBuffer);
318
319 /* If this comment lies on the same line as the latest parse op,
320 * assign it to that op's CommentAfter field. Saving in this field
321 * will allow us to support comments that come after code on the
322 * same line as the code itself. For example,
323 * Name(A,"") //comment
324 *
325 * will be retained rather than transformed into

--- 494 unchanged lines hidden (view full) ---

820
821void
822CvProcessCommentState (
823 char Input)
824{
825
826 if (Input != ' ')
827 {
318
319 /* If this comment lies on the same line as the latest parse op,
320 * assign it to that op's CommentAfter field. Saving in this field
321 * will allow us to support comments that come after code on the
322 * same line as the code itself. For example,
323 * Name(A,"") //comment
324 *
325 * will be retained rather than transformed into

--- 494 unchanged lines hidden (view full) ---

820
821void
822CvProcessCommentState (
823 char Input)
824{
825
826 if (Input != ' ')
827 {
828 Gbl_CommentState.SpacesBefore = 0;
828 AslGbl_CommentState.SpacesBefore = 0;
829 }
830
831 switch (Input)
832 {
833 case '\n':
834
829 }
830
831 switch (Input)
832 {
833 case '\n':
834
835 Gbl_CommentState.CommentType = ASL_COMMENT_STANDARD;
835 AslGbl_CommentState.CommentType = ASL_COMMENT_STANDARD;
836 break;
837
838 case ' ':
839
840 /* Keep the CommentType the same */
841
836 break;
837
838 case ' ':
839
840 /* Keep the CommentType the same */
841
842 Gbl_CommentState.SpacesBefore++;
842 AslGbl_CommentState.SpacesBefore++;
843 break;
844
845 case '(':
846
843 break;
844
845 case '(':
846
847 Gbl_CommentState.CommentType = ASL_COMMENT_OPEN_PAREN;
847 AslGbl_CommentState.CommentType = ASL_COMMENT_OPEN_PAREN;
848 break;
849
850 case ')':
851
848 break;
849
850 case ')':
851
852 Gbl_CommentState.CommentType = ASL_COMMENT_CLOSE_PAREN;
852 AslGbl_CommentState.CommentType = ASL_COMMENT_CLOSE_PAREN;
853 break;
854
855 case '{':
856
853 break;
854
855 case '{':
856
857 Gbl_CommentState.CommentType = ASL_COMMENT_STANDARD;
858 Gbl_CommentState.ParsingParenBraceNode = NULL;
857 AslGbl_CommentState.CommentType = ASL_COMMENT_STANDARD;
858 AslGbl_CommentState.ParsingParenBraceNode = NULL;
859 CvDbgPrint ("End Parsing paren/Brace node!\n");
860 break;
861
862 case '}':
863
859 CvDbgPrint ("End Parsing paren/Brace node!\n");
860 break;
861
862 case '}':
863
864 Gbl_CommentState.CommentType = ASL_COMMENT_CLOSE_BRACE;
864 AslGbl_CommentState.CommentType = ASL_COMMENT_CLOSE_BRACE;
865 break;
866
867 case ',':
868
865 break;
866
867 case ',':
868
869 Gbl_CommentState.CommentType = ASLCOMMENT_INLINE;
869 AslGbl_CommentState.CommentType = ASLCOMMENT_INLINE;
870 break;
871
872 default:
873
870 break;
871
872 default:
873
874 Gbl_CommentState.CommentType = ASLCOMMENT_INLINE;
874 AslGbl_CommentState.CommentType = ASLCOMMENT_INLINE;
875 break;
876 }
877}
878
879
880/*******************************************************************************
881 *
882 * FUNCTION: CvAddToCommentList

--- 7 unchanged lines hidden (view full) ---

890 *
891 ******************************************************************************/
892
893void
894CvAddToCommentList (
895 char *ToAdd)
896{
897
875 break;
876 }
877}
878
879
880/*******************************************************************************
881 *
882 * FUNCTION: CvAddToCommentList

--- 7 unchanged lines hidden (view full) ---

890 *
891 ******************************************************************************/
892
893void
894CvAddToCommentList (
895 char *ToAdd)
896{
897
898 if (Gbl_CommentListHead)
898 if (AslGbl_CommentListHead)
899 {
899 {
900 Gbl_CommentListTail->Next = CvCommentNodeCalloc ();
901 Gbl_CommentListTail = Gbl_CommentListTail->Next;
900 AslGbl_CommentListTail->Next = CvCommentNodeCalloc ();
901 AslGbl_CommentListTail = AslGbl_CommentListTail->Next;
902 }
903 else
904 {
902 }
903 else
904 {
905 Gbl_CommentListHead = CvCommentNodeCalloc ();
906 Gbl_CommentListTail = Gbl_CommentListHead;
905 AslGbl_CommentListHead = CvCommentNodeCalloc ();
906 AslGbl_CommentListTail = AslGbl_CommentListHead;
907 }
908
907 }
908
909 Gbl_CommentListTail->Comment = ToAdd;
909 AslGbl_CommentListTail->Comment = ToAdd;
910}
911
912
913/*******************************************************************************
914 *
915 * FUNCTION: CvAppendInlineComment
916 *
917 * PARAMETERS: InlineComment - Append to the end of this string.

--- 53 unchanged lines hidden (view full) ---

971CvPlaceComment(
972 UINT8 Type,
973 char *CommentString)
974{
975 ACPI_PARSE_OBJECT *LatestParseNode;
976 ACPI_PARSE_OBJECT *ParenBraceNode;
977
978
910}
911
912
913/*******************************************************************************
914 *
915 * FUNCTION: CvAppendInlineComment
916 *
917 * PARAMETERS: InlineComment - Append to the end of this string.

--- 53 unchanged lines hidden (view full) ---

971CvPlaceComment(
972 UINT8 Type,
973 char *CommentString)
974{
975 ACPI_PARSE_OBJECT *LatestParseNode;
976 ACPI_PARSE_OBJECT *ParenBraceNode;
977
978
979 LatestParseNode = Gbl_CommentState.LatestParseOp;
980 ParenBraceNode = Gbl_CommentState.ParsingParenBraceNode;
979 LatestParseNode = AslGbl_CommentState.LatestParseOp;
980 ParenBraceNode = AslGbl_CommentState.ParsingParenBraceNode;
981 CvDbgPrint ("Placing comment %s for type %d\n", CommentString, Type);
982
983 switch (Type)
984 {
985 case ASL_COMMENT_STANDARD:
986
987 CvAddToCommentList (CommentString);
988 break;
989
990 case ASLCOMMENT_INLINE:
991
992 LatestParseNode->Asl.InlineComment =
993 CvAppendInlineComment (LatestParseNode->Asl.InlineComment,
994 CommentString);
995 break;
996
997 case ASL_COMMENT_OPEN_PAREN:
998
981 CvDbgPrint ("Placing comment %s for type %d\n", CommentString, Type);
982
983 switch (Type)
984 {
985 case ASL_COMMENT_STANDARD:
986
987 CvAddToCommentList (CommentString);
988 break;
989
990 case ASLCOMMENT_INLINE:
991
992 LatestParseNode->Asl.InlineComment =
993 CvAppendInlineComment (LatestParseNode->Asl.InlineComment,
994 CommentString);
995 break;
996
997 case ASL_COMMENT_OPEN_PAREN:
998
999 Gbl_InlineCommentBuffer =
1000 CvAppendInlineComment(Gbl_InlineCommentBuffer,
999 AslGbl_InlineCommentBuffer =
1000 CvAppendInlineComment(AslGbl_InlineCommentBuffer,
1001 CommentString);
1002 break;
1003
1004 case ASL_COMMENT_CLOSE_PAREN:
1005
1006 if (ParenBraceNode)
1007 {
1008 ParenBraceNode->Asl.EndNodeComment =

--- 21 unchanged lines hidden ---
1001 CommentString);
1002 break;
1003
1004 case ASL_COMMENT_CLOSE_PAREN:
1005
1006 if (ParenBraceNode)
1007 {
1008 ParenBraceNode->Asl.EndNodeComment =

--- 21 unchanged lines hidden ---