ALDT (Arnulf's LaTeX Documentation Tool)

Check-in [ed313ac4cb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixes and new code
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ed313ac4cbc8e23f6d16d3bb139936b7db1df2ad
User & Date: arnulf 2012-08-26 13:18:23
Context
2012-08-26
13:31
initial version check-in: 081f7049b9 user: arnulf tags: trunk
13:18
fixes and new code check-in: ed313ac4cb user: arnulf tags: trunk
12:57
initial version check-in: 1fac9a39dd user: arnulf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to LatexObj.tcl.

32
33
34
35
36
37
38
39
40
41
42
43
44
45



















46
47
48
49
50
51
52
...
889
890
891
892
893
894
895
896

897
898

899
900
901
902
903

904
905
906
907
908

909
910
911
912
913

914
915
916
917
918
919
920
921
922

923
924
925
926
927
928
929

930
931
932
933
934
935


936
937
938
939

940
941
942

943
944
945


946
947
948

949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968

969
970
971
972
973
974
975
....
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
....
1438
1439
1440
1441
1442
1443
1444
1445



1446
1447

























































  public variable len
  public variable allocated
  public variable freed
  public variable incr_lst
  public variable decr_lst
  public variable check_allocate
  public variable ref_count

  public variable obj_type

  constructor {} {}
  public method mySelf {}
  public method toString {}
  public method toDebugString {}



















}

  # ==================== constructor ==================================
::itcl::body LatexObj::constructor {} {
    incr oid
    set id $oid

................................................................................
        break;
      }
    }
    len = p.length();
    dest_ptr.add(p.toString());
    return len;
  }


  /* ==================== isShared ================================== */
  public boolean isShared() {

    return (ref_count > 1);
  }

  /* ==================== isListObj ================================== */
  public boolean isListObj() {

    return (obj_type == OBJ_TYPE_LIST);
  }

  /* ==================== getIntRepPtr ================================== */
  public Object getIntRepPtr() {

     return ptrValue_GetPtr();
  }

  /* ==================== incrRefCount ================================== */
  public int  incrRefCount(String where) {

    ref_count++;
    if (check_allocate) {
      incr_lst.add(where);
    }
    return ref_count;
  }

  /* ==================== decrRefCount ================================== */
  public int decrRefCount(String where) {

    ref_count--;
    if (check_allocate) {
      decr_lst.add(where);
    }
    if (ref_count <= 0) {
      freeObj(where);
    }

    return ref_count;
  }

  /* ==================== getString ===================================== */
  public String getString() {
    if (bytes == null) {


      /* Invalid string repr. Generate it. */
if (obj_type == 0) {
print("obj!"+toDebugString()+"!");
}

if (!obj_type_base.haveUpdateString(obj_type)) {
print("obj!"+toDebugString()+"!");
}

      panic(obj_type == 0, "UpdateStringProc called against '<none>' type."+mySelf()+"!");
      panic(!obj_type_base.haveUpdateString(obj_type), "UpdateString called against '"+getObjTypeString(obj_type)+"' type."+mySelf()+"!");
      obj_type_base.callUpdateString(obj_type, this);


    }
    
    if (bytes == null) {

      strValue_SetCharLength(0);
      strValue_SetMaxLength(0);
      return "";
    }
//    strValue_SetCharLength(len);
//    strValue_SetMaxLength(len);
    return bytes.substring(0, len);
  }

  /* ==================== getStringLength ===================================== */
  public int getStringLength() {
    if (bytes == null) {
      /* Invalid string repr. Generate it. */
      panic(obj_type == 0, "UpdateStringProc called against '<none>' type."+mySelf()+"!");
      panic(!obj_type_base.haveUpdateString(obj_type), "UpdateString called against '"+getObjTypeString(obj_type)+"' type.");
      obj_type_base.callUpdateString(obj_type, this);
    }
    return len;
  }


  /* ==================== getStringFromArray ===================================== */
  public String getStringFromArray(ArrayList<LatexObj> list, int nested) {
    ArrayList<String> res = new ArrayList<String>();
    String str;

    for (int i = 0; i < list.size(); i++) {
      str = list.get(i).getString();
................................................................................
    l2 = second_obj_ptr.getStringLength();
    if (nocase != 0) {
      return stringCompareNoCase(s1, s2, -1);
    }
    return stringCompare(s1, l1, s2, l2);
  }

  /* ==================== stringEqObj ===================================== */
  public boolean stringEqObj(LatexObj second_obj_ptr) {
    String a_str;
    String b_str;
    int a_len;
    int b_len;

    if (this == second_obj_ptr) {
................................................................................
    b_len = second_obj_ptr.getStringLength();
    if (a_len != b_len) {
      return false;
    }
    return (a_str.equals(b_str));
  }
}




}

































































<






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>
|
<
>
|


|
<
>
|


|
<
>
|


|
<
>
|
|
|

|


|
<
>
|
|
|

|
|
|
>
|


|
<
<
>
>
|
|
|
<
>
|
|
<
>
|
<
<
>
>


<
>
|
|
|

<
<
|


|
|
|
|
|
|
|

|


>







 







|







 








>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
...
907
908
909
910
911
912
913
914
915
916

917
918
919
920
921

922
923
924
925
926

927
928
929
930
931

932
933
934
935
936
937
938
939
940

941
942
943
944
945
946
947
948
949
950
951
952
953


954
955
956
957
958

959
960
961

962
963


964
965
966
967

968
969
970
971
972


973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
....
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
....
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
  public variable len
  public variable allocated
  public variable freed
  public variable incr_lst
  public variable decr_lst
  public variable check_allocate
  public variable ref_count

  public variable obj_type

  constructor {} {}
  public method mySelf {}
  public method toString {}
  public method toDebugString {}
  public method isShared {}
  public method isListObj {}
  public method getIntRepPtr {}
  public method incrRefCount {where}
  public method decrRefCount {where}
  public method getString {}
  public method getStringLength {}
  public method setBytes {val}
  public method getBytes {}
  public method setLen {val}
  public method getLen {}
  public method setAllocated {val}
  public method getAllocated {}
  public method setFreed {val}
  public method getFreed {}
  public method setRefCount {val}
  public method getRefCount {}
  public method setObjType {val}
  public method getObjType {}
}

  # ==================== constructor ==================================
::itcl::body LatexObj::constructor {} {
    incr oid
    set id $oid

................................................................................
        break;
      }
    }
    len = p.length();
    dest_ptr.add(p.toString());
    return len;
  }
}

  # ==================== isShared ================================== */

::itcl::body LatexObj::isShared {} {
    return $ref_count > 1
  }

  # ==================== isListObj ================================== */

::itcl::body LatexObj::isListObj {} {
    return $obj_type == OBJ_TYPE_LIST
  }

  # ==================== getIntRepPtr ================================== */

::itcl::body LatexObj::getIntRepPtr {} {
     return [ptrValue_GetPtr]
  }

  # ==================== incrRefCount ================================== 

::itcl::body LatexObj::incrRefCount {where} {
    incr ref_count
    if {$check_allocate} {
      lappend incr_lst $where
    }
    return $ref_count
  }

  # ==================== decrRefCount ==================================

::itcl::body LatexObj::decrRefCount {where} {
    incr ref_count -1
    if {$check_allocate} {
      lappend decr_lst $where
    }
    if {$ref_count <= 0} {
      freeObj $where
       
    }
    return $ref_count
  }

  # ==================== getString =====================================


::itcl::body LatexObj::getString {} {
    if {$bytes eq [list]} {
      # Invalid string repr. Generate it.
#if (obj_type == 0) {
#print("obj!"+toDebugString()+"!");

#}
#if (!obj_type_base.haveUpdateString(obj_type)) {
#print("obj!"+toDebugString()+"!");

#}
      panic ($obj_type == 0) "UpdateStringProc called against '<none>' type.[mySelf]!"


      panic (![$obj_type_base haveUpdateString $obj_type]) "UpdateString called against '[getObjTypeString $obj_type]' type.[mySelf]!"
      $obj_type_base callUpdateString $obj_type $this
    }
    

    if {$bytes eq [list]} {
      strValue_SetCharLength 0
      strValue_SetMaxLength 0
      return ""
    }


    return [string range $bytes 0 len]
  }

  # ==================== getStringLength =====================================
::itcl::body LatexObj::getStringLength {} {
    if {$bytes eq [list]} {
      # Invalid string repr. Generate it. 
      panic ($obj_type == 0) "UpdateStringProc called against '<none>' type.[mySelf]!");
      panic (![$obj_type_base haveUpdateString $obj_type]) "UpdateString called against '[getObjTypeString $obj_type]' type."
      $obj_type_base callUpdateString $obj_type $this
    }
    return $len
  }

if {0} {
  /* ==================== getStringFromArray ===================================== */
  public String getStringFromArray(ArrayList<LatexObj> list, int nested) {
    ArrayList<String> res = new ArrayList<String>();
    String str;

    for (int i = 0; i < list.size(); i++) {
      str = list.get(i).getString();
................................................................................
    l2 = second_obj_ptr.getStringLength();
    if (nocase != 0) {
      return stringCompareNoCase(s1, s2, -1);
    }
    return stringCompare(s1, l1, s2, l2);
  }

  # ==================== stringEqObj =====================================
  public boolean stringEqObj(LatexObj second_obj_ptr) {
    String a_str;
    String b_str;
    int a_len;
    int b_len;

    if (this == second_obj_ptr) {
................................................................................
    b_len = second_obj_ptr.getStringLength();
    if (a_len != b_len) {
      return false;
    }
    return (a_str.equals(b_str));
  }
}

  # ==================== setBytes ==================================
::itcl::body LatexObj::setBytes {val} {
    set bytes $val
}

  # ==================== getBytes ==================================
::itcl::body LatexObj::getBytes {} {
    return $bytes
}

  # ==================== setLen ==================================
::itcl::body LatexObj::setLen {val} {
    set len $val
}

  # ==================== getLen ==================================
::itcl::body LatexObj::getLen {} {
    return $len
}

  # ==================== setAllocated ==================================
::itcl::body LatexObj::setAllocated {val} {
    set allocated $val
}

  # ==================== getAllocated ==================================
::itcl::body LatexObj::getAllocated {} {
    return $allocated
}

  # ==================== setFreed ==================================
::itcl::body LatexObj::setFreed {val} {
    set freed $val
}

  # ==================== getFreed ==================================
::itcl::body LatexObj::getFreed {} {
    return $freed
}

  # ==================== setRefCount ==================================
::itcl::body LatexObj::setRefCount {val} {
    set ref_count $val
}

  # ==================== getRefCount ==================================
::itcl::body LatexObj::getRefCount {} {
    return $ref_count
}

  # ==================== setObjType ==================================
::itcl::body LatexObj::setObjType {val} {
    set obj_type $val
}

  # ==================== getObjType ==================================
::itcl::body LatexObj::getObjType {} {
    return $obj_type
}

}

Changes to latex_parse.tcl.

18
19
20
21
22
23
24





25
26
27
28
29
30
31
source ./CommandInfo.tcl
source ./ParseInfo.tcl
source ./ParseResult.tcl
source ./Parse.tcl
source ./ParseToken.tcl
source ./ScriptToken.tcl
source ./ScriptObject.tcl





source ./Script.tcl
source ./ScriptObjType.tcl
source ./latex_parse_fcn.tcl
source ./latex_cmds.tcl

global gState
global gCmds







>
>
>
>
>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
source ./CommandInfo.tcl
source ./ParseInfo.tcl
source ./ParseResult.tcl
source ./Parse.tcl
source ./ParseToken.tcl
source ./ScriptToken.tcl
source ./ScriptObject.tcl
source ./ScriptLineObjType.tcl
source ./SourceObjType.tcl
source ./StringObjType.tcl
source ./LatexObj.tcl
source ./ObjTypeBase.tcl
source ./Script.tcl
source ./ScriptObjType.tcl
source ./latex_parse_fcn.tcl
source ./latex_cmds.tcl

global gState
global gCmds