Module: Yast::SoundOptionsInclude

Defined in:
../../src/include/sound/options.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) AddPopup



397
398
399
# File '../../src/include/sound/options.rb', line 397

def AddPopup
  OptionPopup(_("Add a New Option"), "", "", true, "")
end

- (Object) ChangePopup(option, value, possible_values)



393
394
395
# File '../../src/include/sound/options.rb', line 393

def ChangePopup(option, value, possible_values)
  OptionPopup(_("Change the Option"), option, value, false, possible_values)
end

- (String) check_value(value, type, poss)

checks whether param #1 is if type of param #2 returns error message, empty string if ok

Parameters:

  • value (String)

    value

  • type (String)

    expected type. one of string

  • poss (Array<String>)

    if poss is nonempty, checks if value is one of them

Returns:

  • (String)

    error message



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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File '../../src/include/sound/options.rb', line 46

def check_value(value, type, poss)
  poss = deep_copy(poss)
  if type == "int"
    if Builtins.tolower(Builtins.substring(value, 0, 2)) == "0x" # hex number
      rest = Builtins.tolower(Builtins.substring(value, 2))
      if Builtins.filterchars(rest, "0123456789abcdef") != rest
        # To translators: popup message, wrong value
        return Builtins.sformat(_("The value: %1 must be a number"), value)
      end # decimal number
    else
      rest = value
      if Builtins.substring(value, 0, 1) == "-" # negative number
        rest = Builtins.substring(value, 1)
      end
      if Builtins.filterchars(rest, "0123456789") != rest
        # To translators: popup message, wrong value
        return Builtins.sformat(_("The value: %1 must be a number"), value)
      end
    end
  elsif type == "string"
    if Builtins.filterchars(
        Builtins.tolower(value),
        "abcdefghijklmnopqrstuvwxyz_0123456789-"
      ) != value
      wrong_pos = Builtins.findfirstnotof(
        Builtins.tolower(value),
        "abcdefghijklmnopqrstuvwxyz_0123456789-"
      )
      wrong_char = Builtins.substring(value, wrong_pos, 1)
      if wrong_char == " "
        # To translators: "space" means blank character
        wrong_char = Ops.add(Ops.add(wrong_char, " "), _("(space)"))
      end
      # To translators: popup message, wrong value
      return Builtins.sformat(_("String cannot contain: %1"), wrong_char)
    end
  end

  # now check for poss list
  if Ops.greater_than(Builtins.size(poss), 0)
    poss_list = []

    poss_list = Builtins.maplist(poss) { |v| value == v } if type != "int"

    if !Builtins.contains(poss_list, true)
      # popup message: wrong value; %1 is list of right values
      return Builtins.sformat(
        _("The value must be one of\n%1"),
        Builtins.mergestring(poss, ",")
      )
    end
  end

  "" # ok :-)
end

- (Object) create_table(lm, lk)

creates itemized table entries, @param [Array] lm list of maps to take keys from @param [Array] lk list of keys to look for in 1st param @return [Array] of items



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File '../../src/include/sound/options.rb', line 106

def create_table(lm, lk)
  lm = deep_copy(lm)
  lk = deep_copy(lk)
  res = []
  pos = 0
  Builtins.foreach(
    Convert.convert(lm, :from => "list", :to => "list <map <string, any>>")
  ) do |m|
    res = Builtins.add(
      res,
      Item(
        Id(pos),
        Ops.get_string(m, Ops.get_string(lk, 0, ""), ""),
        Ops.get_string(m, Ops.get_string(lk, 1, ""), ""),
        Ops.get_string(m, Ops.get_string(lk, 2, ""), "")
      )
    )
    pos = Ops.add(pos, 1)
  end
  deep_copy(res)
end

- (Yast::Term) defWidget

default widget when there are no known values

Returns:

  • (Yast::Term)

    widget



252
253
254
255
# File '../../src/include/sound/options.rb', line 252

def defWidget
  # label text
  Label(_("Possible value:\nnot known"))
end

- (Yast::Term) gen_list(vals, preselected)

widget for choosing one value from list

Parameters:

  • vals (Array<String>)

    string with values eg. “12,3,4,6”

  • preselected (String)

    string default value (preselected in combo)

Returns:

  • (Yast::Term)

    combobox widget



261
262
263
264
265
# File '../../src/include/sound/options.rb', line 261

def gen_list(vals, preselected)
  vals = deep_copy(vals)
  vls = Builtins.maplist(vals) { |e| Item(Id(e), e, preselected == e) }
  deep_copy(vls)
end

- (String) getDescr(arg)

Returns description of card module option

Parameters:

  • arg (Object)

    type of arg can be string or list

Returns:

  • (String)

    description



404
405
406
407
408
409
410
411
412
413
414
415
# File '../../src/include/sound/options.rb', line 404

def getDescr(arg)
  arg = deep_copy(arg)
  return Convert.to_string(arg) if Ops.is_string?(arg)
  if Ops.is_list?(arg)
    larg = Convert.to_list(arg)
    return Builtins.sformat(
      Ops.get_string(larg, 0, "%1"),
      Ops.get_string(larg, 1, "")
    )
  end
  _("No description available")
end

- (void) getPossibleValues(values, default_item)

This method returns an undefined value.

when the selected option in table is changed, we need to update combo with values

Parameters:

  • values (String)

    list of values

  • default_item (String)

    default item



272
273
274
275
276
277
278
279
280
281
# File '../../src/include/sound/options.rb', line 272

def getPossibleValues(values, default_item)
  values_list = string2vallist(values)

  if !Builtins.contains(values_list, default_item)
    values_list = Builtins.prepend(values_list, default_item)
  end

  widg = gen_list(values_list, default_item)
  deep_copy(widg)
end

- (Object) initialize_sound_options(include_target)



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File '../../src/include/sound/options.rb', line 24

def initialize_sound_options(include_target)
  Yast.import "UI"

  textdomain "sound"

  Yast.import "Sound"
  Yast.import "Wizard"
  Yast.import "Label"
  Yast.import "Popup"
  Yast.import "String"
  Yast.import "Report"

  Yast.include include_target, "sound/ui.rb"
  Yast.include include_target, "sound/routines.rb"
end

- (Object) OptionPopup(headline, name, value, new_option, possible_values)



283
284
285
286
287
288
289
290
291
292
293
294
295
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
# File '../../src/include/sound/options.rb', line 283

def OptionPopup(headline, name, value, new_option, possible_values)
  Builtins.y2milestone("possible_values: %1", possible_values)

  button_box = ButtonBox(
    PushButton(Id(:ok), Opt(:okButton, :default, :key_F10), Label.OKButton),
    PushButton(Id(:cancel), Opt(:cancelButton, :key_F9), Label.CancelButton)
  )

  items = getPossibleValues(possible_values, value)

  content = VBox(
    Heading(headline),
    VSpacing(0.2),
    new_option ?
      VBox(
        Left(TextEntry(Id(:option_name), _("Name of the &Option"), name)),
        VSpacing(0.2)
      ) :
      Empty(),
    Ops.greater_than(Builtins.size(string2vallist(possible_values)), 0) ?
      ComboBox(
        Id(:option_value),
        Opt(:editable, :hstretch),
        Ops.add(new_option ? _("&Value") : _("&Option: "), name),
        items
      ) :
      Left(
        TextEntry(
          Id(:option_value),
          Ops.add(new_option ? _("&Value") : _("&Option: "), name),
          value
        )
      ),
    VSpacing(0.2),
    button_box
  )

  UI.OpenDialog(Opt(:decorated), content)

  ret = nil
  option_name = ""
  option_value = ""

  while true
    ret = UI.UserInput

    # validate the input
    option_name = new_option ?
      Convert.to_string(UI.QueryWidget(Id(:option_name), :Value)) :
      name
    option_value = Convert.to_string(
      UI.QueryWidget(Id(:option_value), :Value)
    )

    # do not validate if the Cancel button has been pressed
    break if ret == :cancel

    # all non-ASCII characters from value
    extra_chars = Builtins.deletechars(option_value, String.CGraph)

    if extra_chars != ""
      Report.Error(
        Builtins.sformat(
          _(
            "Value of the option contains invalid\n" +
              "characters '%1'.\n" +
              "\n" +
              "Enter a valid value."
          ),
          extra_chars
        )
      )
      UI.SetFocus(Id(:option_value))
      next
    end

    # check the option name if it's entered by user
    if new_option
      # all non-ASCII characters from name
      extra_chars = Builtins.deletechars(option_name, String.CGraph)

      if extra_chars != ""
        Report.Error(
          Builtins.sformat(
            _(
              "Name of the option contains invalid\n" +
                "characters '%1'.\n" +
                "\n" +
                "Enter a valid name."
            ),
            extra_chars
          )
        )
        UI.SetFocus(Id(:option_name))
        next
      end
    end

    break
  end

  UI.CloseDialog

  {
    "ui"           => ret,
    "option_name"  => option_name,
    "option_value" => option_value
  }
end

- (Object) OptionsCon(cardlabel, itemized_descriptions, current_option_name, current_option_value)

UI controls for options setting dialog

@param [String] cardlabel card model string @param [Array] itemized_descriptions option list (preformated using 'create_table' with tripples: description, name, value) @param [String] current_option_name initially selected item name @param [String] current_option_value value of current option @return [Yast::Term] options dialog contents @see #options#OptionsDialog



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
# File '../../src/include/sound/options.rb', line 427

def OptionsCon(cardlabel, itemized_descriptions, current_option_name, current_option_value)
  itemized_descriptions = deep_copy(itemized_descriptions)
  HBox(
    HSpacing(3),
    VBox(
      VSquash(Top(Label(Opt(:outputField), cardlabel))),
      VSpacing(),
      Table(
        Id(:table),
        Opt(:notify, :immediate),
        Header(
          # Table header -- option description
          _("Description"),
          # Table header -- option name
          _("Option"),
          # Table header -- value of an option
          Right(_("Value"))
        ),
        itemized_descriptions
      ),
      VSpacing(0.5),
      HBox(
        PushButton(Id(:add), Label.AddButton),
        PushButton(Id(:edit), Label.EditButton),
        PushButton(Id(:delete), Label.DeleteButton),
        HStretch(),
        # restore original option values
        PushButton(Id(:reset), _("R&eset all"))
      ),
      VSpacing(1)
    ),
    HSpacing(3)
  )
end

- (Hash) OptionsDialog(cardlabel, opts, driver)

displays dialog with card options

  values in map are strings

Parameters:

  • cardlabel (String)

    string label for the card

  • opts (Hash)

    list. list where each item is map with keys: name, value, type, default, description.

Returns:

  • (Hash)

    result



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
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# File '../../src/include/sound/options.rb', line 488

def OptionsDialog(cardlabel, opts, driver)
  opts = deep_copy(opts)
  help_text = Ops.get_string(Sound.STRINGS, "OptionsDialog", "")

  origOptions = deep_copy(opts)

  module_params = get_module_params(driver)
  all_options = Builtins.maplist(
    Convert.convert(
      module_params,
      :from => "map",
      :to   => "map <string, map>"
    )
  ) { |name, o| name }

  options = Builtins.maplist(
    Convert.convert(
      opts,
      :from => "map",
      :to   => "map <string, map <string, any>>"
    )
  ) do |name, o|
    {
      # label: description of option is not available
      "description" => getDescr(
        Ops.get(o, "descr")
      ),
      "name"        => name,
      "value"       => Ops.get_string(o, "value", ""),
      "type"        => Ops.get_string(o, "type", "string"),
      "default"     => Ops.get_string(o, "default", "")
    }
  end

  itemized_descriptions = create_table(
    options,
    ["description", "name", "value"]
  )

  current_option = 0
  current_option_name = Ops.get_string(
    options,
    [current_option, "name"],
    ""
  )

  con = OptionsCon(
    cardlabel,
    itemized_descriptions,
    current_option_name,
    Ops.get_string(options, [current_option, "value"], "")
  )

  # dialog title
  Wizard.SetContents(
    _("Sound Card Advanced Options"),
    con,
    help_text,
    true,
    true
  )

  if Ops.greater_than(Builtins.size(itemized_descriptions), 0)
    UI.ChangeWidget(Id(:table), :CurrentItem, 0)
    UI.SetFocus(Id(:table))
  else
    Popup.Message(_("There are no options for this module"))
  end


  # set initial Delete state
  ui = :table

  ui = :no if Builtins.size(itemized_descriptions) == 0
  begin
    current_option = Convert.to_integer(
      UI.QueryWidget(Id(:table), :CurrentItem)
    )
    curr_opt = Convert.to_term(
      UI.QueryWidget(Id(:table), term(:Item, current_option))
    )
    current_option_name = Ops.get_string(curr_opt, 2, "")
    current_option_value = Ops.get_string(curr_opt, 3, "")

    if ui == :table
      # enable/disable Delete button
      RefreshDelete(!Builtins.contains(all_options, current_option_name))
    elsif ui == :add
      result = AddPopup()
      Builtins.y2milestone("New option: %1", result)

      if Ops.get_symbol(result, "ui", :cancel) == :ok
        # update table
        value = Ops.get_string(result, "option_value", "")
        name = Ops.get_string(result, "option_name", "")

        if name != ""
          index = Builtins.size(itemized_descriptions)

          # remember the new value
          itemized_descriptions = Builtins.add(
            itemized_descriptions,
            Item(Id(index), "", name, value)
          )

          RefreshUI(
            itemized_descriptions,
            index,
            !Builtins.contains(all_options, name)
          )
        end
      end
    elsif ui == :edit
      possible_values = Ops.get_string(
        origOptions,
        [current_option_name, "allows"],
        ""
      )

      while true
        result = ChangePopup(
          current_option_name,
          current_option_value,
          possible_values
        )
        Builtins.y2milestone("Modified option: %1", result)

        if Ops.get_symbol(result, "ui", :cancel) == :ok
          value = Ops.get_string(result, "option_value", "")

          # check the value
          err = check_value(
            value,
            Ops.get_string(options, [current_option, "type"], "string"),
            string2vallist(possible_values)
          )
          if Ops.greater_than(Builtins.size(err), 0) # error - wrong value
            # display message and display the popup again in the loop
            Popup.Message(err)
          else
            UI.ChangeWidget(
              Id(:table),
              term(:Item, current_option, 2),
              value
            )

            # update the value
            tmp = []
            Builtins.maplist(itemized_descriptions) do |e|
              if current_option == Ops.get_integer(e, [0, 0], 0)
                tmp = Builtins.add(
                  tmp,
                  Item(
                    Id(current_option),
                    Ops.get_string(e, 1, ""),
                    Ops.get_string(e, 2, ""),
                    value
                  )
                )
              else
                tmp = Builtins.add(tmp, e)
              end
            end
            itemized_descriptions = deep_copy(tmp)
            break
          end
        else
          break
        end
      end
    elsif ui == :delete
      Builtins.y2milestone("Removed option: %1", current_option_name)

      # update the value
      tmp = []
      Builtins.maplist(itemized_descriptions) do |e|
        if current_option != Ops.get_integer(e, [0, 0], 0)
          tmp = Builtins.add(tmp, e)
        end
      end
      itemized_descriptions = deep_copy(tmp)

      Builtins.y2milestone(
        "itemized_descriptions[0,2]: %1",
        Ops.get_string(itemized_descriptions, [0, 2], "")
      )
      # set Delete status according to the new first item
      RefreshUI(
        itemized_descriptions,
        nil,
        !Builtins.contains(
          all_options,
          Ops.get_string(itemized_descriptions, [0, 2], "")
        )
      )
    elsif ui == :reset &&
        # popup question
        Popup.YesNo(_("Do you really want to reset all values?"))
      i = 0
      while Ops.less_than(i, Builtins.size(itemized_descriptions))
        UI.ChangeWidget(
          Id(:table),
          term(:Item, i, 2),
          Ops.get_string(options, [i, "default"], "")
        )
        # reset the values in items list
        e = Ops.get(itemized_descriptions, i) { Item(Id(i), "", "", "") }
        Ops.set(
          itemized_descriptions,
          i,
          Item(
            Ops.get_term(e, 0) { Id(i) },
            Ops.get_string(e, 1, ""),
            Ops.get_string(e, 2, ""),
            Ops.get_string(options, [i, "default"], "")
          )
        )
        i = Ops.add(i, 1)
      end
    elsif ui == :abort || ui == :cancel
      if ReallyAbort()
        ui = :abort
        break
      end
    end
    ui = Convert.to_symbol(UI.UserInput)
  end until ui == :back || ui == :next || ui == :cancel

  Builtins.y2milestone(
    "ui: %1, itemized_descriptions: %2",
    ui,
    itemized_descriptions
  )

  { "ui" => ui, "return" => itemized_descriptions }
end

- (Array) parse_bracket(input)

parses string (eg. '{0,2,0,100,20}') to a list (in this case [0,1,2,0,20,40,60,80,100])

Parameters:

  • input (String)

    input string

Returns:

  • (Array)

    of possible values



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File '../../src/include/sound/options.rb', line 132

def parse_bracket(input)
  inner = input # substring(input, 1, size(input)-2);
  siz = Builtins.size(inner)
  pos = 0
  oldpos = 0
  output = []

  while Ops.less_than(pos, siz)
    if Builtins.substring(inner, pos, 1) == "{"
      oldpos = pos
      pos = Ops.add(pos, 1)
      cnter = 1
      # let's find the pair bracket for '{'
      while Ops.greater_than(cnter, 0) && Ops.less_than(pos, siz)
        if Builtins.substring(inner, pos, 1) == "}"
          cnter = Ops.subtract(cnter, 1)
        elsif Builtins.substring(inner, pos, 1) == "{"
          cnter = Ops.add(cnter, 1)
        end
        pos = Ops.add(pos, 1)
      end
      output = Builtins.add(
        output,
        parse_bracket(
          Builtins.substring(
            inner,
            Ops.add(oldpos, 1),
            Ops.subtract(Ops.subtract(pos, oldpos), 2)
          )
        )
      )
      pos = Ops.add(pos, 1)
    else
      oldpos = pos
      while Builtins.substring(inner, pos, 1) != "," &&
          Ops.less_than(pos, siz)
        pos = Ops.add(pos, 1)
      end
      output = Builtins.add(
        output,
        Builtins.substring(inner, oldpos, Ops.subtract(pos, oldpos))
      )
      pos = Ops.add(pos, 1)
    end
  end
  deep_copy(output)
end

- (Object) RefreshDelete(enabled)



462
463
464
465
466
467
# File '../../src/include/sound/options.rb', line 462

def RefreshDelete(enabled)
  Builtins.y2milestone("Delete button enabled: %1", enabled)
  UI.ChangeWidget(Id(:delete), :Enabled, enabled)

  nil
end

- (Object) RefreshUI(items, index, enable_delete)



469
470
471
472
473
474
475
476
477
478
479
# File '../../src/include/sound/options.rb', line 469

def RefreshUI(items, index, enable_delete)
  items = deep_copy(items)
  # refresh the table
  UI.ChangeWidget(Id(:table), :Items, items)

  UI.ChangeWidget(Id(:table), :CurrentItem, index) if index != nil

  RefreshDelete(enable_delete)

  nil
end

- (Hash) sound_options(save_entry)

just calls options dialog

Parameters:

  • save_entry (Hash)

    map with card configuration

Returns:

  • (Hash)

    result



728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
# File '../../src/include/sound/options.rb', line 728

def sound_options(save_entry)
  save_entry = deep_copy(save_entry)
  modname = Ops.get_string(save_entry, "module", "")
  label = Ops.get_string(save_entry, "model", "")
  params = get_module_params(modname)
  Builtins.y2milestone("params: %1", params)
  params = restore_mod_params(
    params,
    Ops.get_map(save_entry, "options", {})
  )
  Builtins.y2milestone("params: %1", params)

  Wizard.RestoreNextButton

  # now show the dialog
  result = OptionsDialog(label, params, modname)
  vals = Ops.get_list(result, "return", [])

  # convert from table entries (items) back to card
  opts = {}
  Builtins.foreach(vals) do |it|
    if Ops.get_string(it, 3, "") != ""
      opts = Builtins.add(
        opts,
        Ops.get_string(it, 2, ""),
        Ops.get_string(it, 3, "")
      )
    end
  end

  Builtins.y2milestone("New options: %1", opts)

  save_entry = Builtins.add(save_entry, "options", opts)

  { "ui" => Ops.get_symbol(result, "ui", :cancel), "return" => save_entry }
end

- (Array) string2vallist(input)

gets an 'modules.generic_string' like options description string and returns a list of possible values

Parameters:

  • input (String)

    string

Returns:

  • (Array)

    of values



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File '../../src/include/sound/options.rb', line 184

def string2vallist(input)
  parse_error = false
  l = Builtins.flatten(
    Convert.convert(
      parse_bracket(input),
      :from => "list",
      :to   => "list <list>"
    )
  )

  l = Builtins.maplist(
    Convert.convert(l, :from => "list", :to => "list <list>")
  ) do |e|
    next [] if Builtins.size(e) == 0
    next deep_copy(e) if Builtins.size(e) == 1
    step = 1
    if Builtins.size(e) == 3
      step = Builtins.tointeger(Ops.get_string(e, 2, "1"))
    end
    if Ops.less_than(step, 1)
      parse_error = true
      next []
    end
    hex = false
    if Builtins.regexpmatch(Ops.get_string(e, 1, ""), "^-[0-9]*$") ||
        Builtins.regexpmatch(Ops.get_string(e, 1, ""), "^[0-9]*$")
      hex = false
    elsif Builtins.regexpmatch(Ops.get_string(e, 1, ""), "^-0x[0-9a-fA-F]*") ||
        Builtins.regexpmatch(Ops.get_string(e, 1, ""), "^0x[0-9a-fA-F]*")
      hex = true
    else
      if Builtins.contains(
          ["Disabled", "Enabled"],
          Ops.get_string(e, 1, "")
        )
        next [Ops.get_string(e, 0, "")]
      end
    end
    from = Builtins.tointeger(Ops.get_string(e, 0, ""))
    to = Builtins.tointeger(Ops.get_string(e, 1, ""))
    if Ops.greater_than(Ops.divide(Ops.subtract(to, from), step), 50)
      # too many values :(
      parse_error = true
      next []
    end
    outlist = []
    while Ops.less_or_equal(from, to)
      if hex
        outlist = Builtins.add(outlist, Builtins.tohexstring(from))
      else
        outlist = Builtins.add(outlist, Builtins.sformat("%1", from))
      end
      from = Ops.add(from, step)
    end
    deep_copy(outlist)
  end

  l = Builtins.flatten(
    Convert.convert(l, :from => "list", :to => "list <list>")
  )

  Builtins.y2debug("parse error: %1", input) if parse_error

  Convert.convert(l, :from => "list", :to => "list <string>")
end