@@ -11,7 +11,7 @@ type ROSPackage
11
11
name:: ASCIIString
12
12
msg:: ROSModule
13
13
srv:: ROSModule
14
- function ROSPackage (pkgname:: String )
14
+ function ROSPackage (pkgname:: ASCIIString )
15
15
pkg = new (pkgname)
16
16
pkg. msg = ROSMsgModule (pkg)
17
17
pkg. srv = ROSSrvModule (pkg)
@@ -110,7 +110,7 @@ function _pkgtype_import(input::Expr)
110
110
return ps,msb,ts
111
111
end
112
112
# Import a set of types from a single package
113
- function _usepkg (package:: String , ismsg:: Bool , names:: String ... )
113
+ function _usepkg (package:: ASCIIString , ismsg:: Bool , names:: ASCIIString ... )
114
114
global _rospy_imports
115
115
if ! haskey (_rospy_imports, package)
116
116
@debug (" Creating new package: " ,package," ." , ismsg ? " msg" : " srv" )
@@ -148,7 +148,7 @@ cleartypes() = error("cleartypes() renamed to rostypereset()")
148
148
149
149
# Populate the module with a new message type. Import and add dependencies first
150
150
# so they will appear first in the generated code.
151
- function addtype! (mod:: ROSMsgModule , typ:: String )
151
+ function addtype! (mod:: ROSMsgModule , typ:: ASCIIString )
152
152
global _rospy_objects
153
153
if ! (typ in mod. members)
154
154
@debug (" Message type import: " , _fullname (mod), " ." , typ)
164
164
165
165
# Populate the module with a new service type. Import and add dependencies
166
166
# first.
167
- function addtype! (mod:: ROSSrvModule , typ:: String )
167
+ function addtype! (mod:: ROSSrvModule , typ:: ASCIIString )
168
168
global _rospy_objects
169
169
if ! (typ in mod. members)
170
170
@debug (" Service type import: " , _fullname (mod), " ." , typ)
@@ -190,7 +190,7 @@ function addtype!(mod::ROSSrvModule, typ::String)
190
190
end
191
191
192
192
# Return the python module and python object for a particular type
193
- function _pyvars (modname:: String , typ:: String )
193
+ function _pyvars (modname:: ASCIIString , typ:: ASCIIString )
194
194
pymod = _import_rospy_pkg (modname)
195
195
pyobj =
196
196
try pymod[typ]
@@ -234,7 +234,7 @@ function _importdeps!(mod::ROSModule, deps::Vector)
234
234
end
235
235
236
236
# Bring in the python modules as needed
237
- function _import_rospy_pkg (package:: String )
237
+ function _import_rospy_pkg (package:: ASCIIString )
238
238
global _rospy_modules
239
239
if ! haskey (_rospy_modules, package)
240
240
@debug (" Importing python package: " , package)
@@ -352,7 +352,7 @@ function _exportexpr(mod::ROSSrvModule)
352
352
end
353
353
354
354
# All the generated code for a generated message type
355
- function buildtype (mod:: ROSMsgModule , typename:: String )
355
+ function buildtype (mod:: ROSMsgModule , typename:: ASCIIString )
356
356
global _rospy_objects
357
357
fulltypestr = _rostypestr (mod, typename)
358
358
pyobj = _rospy_objects[fulltypestr]
370
370
371
371
# All the generated code for a generated service type
372
372
# Will create 3 different composite types.
373
- function buildtype (mod:: ROSSrvModule , typename:: String )
373
+ function buildtype (mod:: ROSSrvModule , typename:: ASCIIString )
374
374
global _rospy_objects
375
375
376
376
req_typestr = _rostypestr (mod, string (typename," Request" ))
407
407
# (2) Default outer constructer with no arguments
408
408
# (3) convert(PyObject, ...)
409
409
# (4) convert(..., o::PyObject)
410
- function typecode (rosname:: String , super:: Symbol , members:: Vector )
410
+ function typecode (rosname:: ASCIIString , super:: Symbol , members:: Vector )
411
411
tname = _splittypestr (rosname)[2 ]
412
412
@debug (" Type: " , tname)
413
413
tsym = symbol (tname)
@@ -522,11 +522,11 @@ end
522
522
523
523
# Build a String => Iterable{String} object from the individual package
524
524
# dependencies.
525
- function _collectdeps {S<:String } (pkgs:: Dict{S, ROSPackage} )
526
- deps = Dict {ASCIIString , Set{ASCIIString }} ()
525
+ function _collectdeps {S<:AbstractString } (pkgs:: Dict{S, ROSPackage} )
526
+ deps = Dict {S , Set{S }} ()
527
527
for pname in keys (pkgs)
528
528
if ! haskey (deps, pname)
529
- deps[pname] = Set {ASCIIString } ()
529
+ deps[pname] = Set {S } ()
530
530
end
531
531
union! (deps[pname], pkgs[pname]. msg. deps)
532
532
union! (deps[pname], pkgs[pname]. srv. deps)
@@ -557,36 +557,36 @@ function _order(d::Dict)
557
557
tlist
558
558
end
559
559
560
- _rostypestr (mod:: ROSModule , name:: String ) = string (_name (mod)," /" ,name)
561
- function _splittypestr (typestr:: String )
560
+ _rostypestr (mod:: ROSModule , name:: ASCIIString ) = string (_name (mod)," /" ,name)
561
+ function _splittypestr (typestr:: ASCIIString )
562
562
if ! _isrostype (typestr)
563
563
error (string (" Invalid message type '$typestr ', " ,
564
564
" use 'package_name/type_name'" ))
565
565
end
566
- rospkg, typ = split (typestr, ' /' )
566
+ rospkg, typ = map (ascii, split (typestr, ' /' ) )
567
567
rospkg, typ
568
568
end
569
569
# Valid ROS type string is all word chars split by a single forward slash, with
570
570
# optional square brackets for array types
571
- _isrostype (s:: String ) = ismatch (r" ^\w +/\w +(?:\[\d *\] )?$" , s)
571
+ _isrostype (s:: ASCIIString ) = ismatch (r" ^\w +/\w +(?:\[\d *\] )?$" , s)
572
572
573
573
# Sanitize a string by checking for and removing brackets if they are present
574
574
# Return the sanitized type and the number inside the brackets if it is a fixed
575
575
# size type. Returns 0 if variable size (no number), -1 if no brackets
576
- function _check_array_type (typ:: String )
576
+ function _check_array_type (typ:: ASCIIString )
577
577
arraylen = - 1
578
578
m = match (r" ^([\w /]+)\[ (\d *)\] $" , typ)
579
579
if m != nothing
580
580
btype = m. captures[1 ]
581
581
if isempty (m. captures[2 ])
582
582
arraylen = 0
583
583
else
584
- arraylen = int ( m. captures[2 ])
584
+ arraylen = parse (Int, m. captures[2 ])
585
585
end
586
586
else
587
587
btype = typ
588
588
end
589
- btype, arraylen
589
+ ascii ( btype) , arraylen
590
590
end
591
591
592
592
# Get the rospy PyObject corresponding to a generated type
607
607
608
608
# Check if the type name conflicts with a Julia builtin. Currently this is only
609
609
# some of the messages from the std_msgs.msg package
610
- _nameconflicts (typename:: String ) = isdefined (Base, symbol (typename))
610
+ _nameconflicts (typename:: ASCIIString ) = isdefined (Base, symbol (typename))
611
611
612
612
# Get a default value for any builtin ROS type
613
613
_typedefault {T<:Real} (:: Type{T} ) = zero (T)
0 commit comments