Revision 456

trunk/utilities/.gdbinit (revision 456)
1
#
2
#   ADMB gdb utilities version 1.00
3
#
4
#  Printing of ADMB structures
5
#
6
#  Author - Chris Grandin (chrisgrandin@gmail.com)
7

  
8
printf "Loaded .gdbinit\n"
9

  
10
printf "ADMB debugging enabled.\n"
11
printf "  Printing of ADMB structures:\n"
12
printf "  dvariable       - pdv dvariableName\n"
13
printf "  vector, dvector - pvec vectorName\n"
14
printf "  ivector         - pivec ivectorName\n"
15
printf "  dvar_vector     - pdvec dvar_vectorName\n"
16
printf "  matrix, dmatrix - pmat matrixName\n"
17
printf "  imatrix         - pimat imatrixName\n"
18
printf "  dvar_matrix     - pdmat dvar_matrixName\n"
19
printf "  3d_array        - p3d 3darrayName\n"
20
printf " For help on commands, type command name without arguments.\n"
21
set print pretty
22

  
23
define pdv
24
  if $argc == 0 | $argc > 1
25
    help pdv
26
  end
27
  if $argc == 1
28
    printf "pdv: dvariable value = %f\n", $arg0->v->x
29
  end
30
end
31

  
32
document pdv
33
  Prints ADMB dvariable contents.
34
  Syntax: pdv <ADMB dvariable>
35
  Examples:
36
  pdv f - Prints value of dvariable f
37
end
38

  
39
define pvec
40
  if $argc == 0 | $argc > 2
41
    help pvec
42
  end
43
  if $argc == 1
44
    set $i = $arg0->index_min
45
    while $i <= $arg0->index_max
46
      printf "%f\t", *&$arg0[$i]
47
      set $i = $i + 1
48
    end
49
    printf "\n"
50
  end
51
  if $argc == 2
52
    if $arg0 == 1
53
      set $i = $arg1->index_min
54
      while $i <= $arg1->index_max
55
        printf "%f\n", *&$arg1[$i]
56
        set $i = $i + 1
57
      end
58
    end
59
    if $arg0 == 2
60
      printf "pvec: (d)vector '$arg1' dimensions: min = %u, max = %u\n",\
61
      $arg1->index_min, $arg1->index_max
62
    end
63
    if $arg0 != 1 & $arg0 !=2
64
      help pvec
65
    end
66
  end
67
end
68

  
69
document pvec
70
  Prints ADMB vector and dvector contents.
71
  Syntax: pvec <ADMB vector or dvector>
72
  Examples:
73
  pvec v   - Prints vector contents in row form
74
  pvec 1 v - Prints vector contents in column form
75
  pvec 2 v - Prints vector dimensions
76
end
77

  
78
define pivec
79
  if $argc == 0 | $argc > 2
80
    help pivec
81
  end
82
  if $argc == 1
83
    set $i = $arg0->index_min
84
    while $i <= $arg0->index_max
85
      printf "%u\t", $arg0->v[$i]
86
      set $i = $i + 1
87
    end
88
    printf "\n"
89
  end
90
  if $argc == 2
91
    if $arg0 == 1
92
      set $i = $arg1->index_min
93
      while $i <= $arg1->index_max
94
        printf "%u\n", $arg1->v[$i]
95
        set $i = $i + 1
96
      end
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff