aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ghdldrv/ghdlxml.adb5
-rw-r--r--src/vhdl/disp_tree.adb28
-rw-r--r--src/vhdl/disp_tree.ads1
-rw-r--r--src/vhdl/iirs.ads2
4 files changed, 32 insertions, 4 deletions
diff --git a/src/ghdldrv/ghdlxml.adb b/src/ghdldrv/ghdlxml.adb
index 6641202a0..eb6eceec9 100644
--- a/src/ghdldrv/ghdlxml.adb
+++ b/src/ghdldrv/ghdlxml.adb
@@ -20,7 +20,6 @@ with GNAT.OS_Lib; use GNAT.OS_Lib;
with Types; use Types;
with Name_Table; use Name_Table;
with Nodes_Meta; use Nodes_Meta;
-with Str_Table;
with Files_Map;
with Disp_Tree; use Disp_Tree;
with Ghdlprint; use Ghdlprint;
@@ -429,9 +428,7 @@ package body Ghdlxml is
begin
Put_Stag (Get_Field_Image (F));
Put_Attribute ("length", Strip (Int32'Image (Len)));
- Put_Attribute ("content",
- To_XML (Str_Table.String_String8
- (Get_String8_Id (N), Len)));
+ Put_Attribute ("content", To_XML (Image_String8 (N)));
Put_Empty_Stag_End;
end;
when others =>
diff --git a/src/vhdl/disp_tree.adb b/src/vhdl/disp_tree.adb
index e254bb883..9aed6c3f9 100644
--- a/src/vhdl/disp_tree.adb
+++ b/src/vhdl/disp_tree.adb
@@ -20,6 +20,7 @@
with Ada.Text_IO; use Ada.Text_IO;
with Name_Table;
+with Str_Table;
with Files_Map;
with PSL.Dump_Tree;
with Nodes_Meta;
@@ -315,6 +316,33 @@ package body Disp_Tree is
function Image_Token_Type (Tok : Tokens.Token_Type) return String
renames Tokens.Image;
+ function Image_String8 (N : Iir) return String
+ is
+ use Str_Table;
+ T : constant Iir := Get_Type (N);
+ Str : constant String8_Id := Get_String8_Id (N);
+ Len : constant Int32 := Get_String_Length (N);
+ begin
+ if Is_Null (T) then
+ -- Not yet analyzed, the string is the ASCII image.
+ return Str_Table.String_String8 (Str, Len);
+ else
+ declare
+ El : constant Iir := Get_Base_Type (Get_Element_Subtype (T));
+ Lits : constant Iir_List := Get_Enumeration_Literal_List (El);
+ Res : String (1 .. Natural (Len));
+ C : Natural;
+ begin
+ for I in 1 .. Len loop
+ C := Natural (Element_String8 (Str, I));
+ Res (Natural (I)) := Name_Table.Get_Character
+ (Get_Identifier (Get_Nth_Element (Lits, C)));
+ end loop;
+ return Res;
+ end;
+ end if;
+ end Image_String8;
+
procedure Header (Str : String; Indent : Natural) is
begin
Put_Indent (Indent);
diff --git a/src/vhdl/disp_tree.ads b/src/vhdl/disp_tree.ads
index 0ea056a6a..e6a10fcea 100644
--- a/src/vhdl/disp_tree.ads
+++ b/src/vhdl/disp_tree.ads
@@ -47,4 +47,5 @@ package Disp_Tree is
function Image_Location_Type (Loc : Location_Type) return String;
function Image_Iir_Direction (Dir : Iir_Direction) return String;
function Image_Token_Type (Tok : Tokens.Token_Type) return String;
+ function Image_String8 (N : Iir) return String;
end Disp_Tree;
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index 79356b3cd..3c33aeecc 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -310,6 +310,8 @@ package Iirs is
-- Number of literals in the expanded string.
-- Get/Set_String_Length (Field4)
--
+ -- Before analysis, this is the ASCII code of each character in the string.
+ -- After analysis, this is the position of each literal.
-- Get/Set_String8_Id (Field5)
--
-- Base of the bit_string (corresponds to letters 'b', 'o', 'd' or 'x' in
='#n296'>296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613