~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/snmp/src/compile/snmpc.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20090215164252-dxpjjuq108nz4noa
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
%%          {warnings,    bool()}                         true
110
110
%%          {outdir,      string()}                       "./"
111
111
%%          description
 
112
%%          reference
112
113
%%          imports
113
114
%%          module_identity
114
115
%%          {module, string()}
188
189
    get_options(Opts, ["~n   description: ~w"|Formats], [Val|Args]);
189
190
get_options([description|Opts], Formats, Args) ->
190
191
    get_options(Opts, ["~n   description"|Formats], Args);
 
192
get_options([{reference, Val}|Opts], Formats, Args) ->
 
193
    get_options(Opts, ["~n   reference: ~w"|Formats], [Val|Args]);
 
194
get_options([reference|Opts], Formats, Args) ->
 
195
    get_options(Opts, ["~n   reference"|Formats], Args);
191
196
get_options([{warnings, Val}|Opts], Formats, Args) ->
192
197
    get_options(Opts, ["~n   warnings:    ~w"|Formats], [Val|Args]);
193
198
get_options([{verbosity, Val}|Opts], Formats, Args) ->
263
268
    check_options(T);
264
269
check_options([description| T]) -> %% same as {description, true}
265
270
    check_options(T);
 
271
check_options([{reference, Bool}| T]) ->
 
272
    check_bool(reference, Bool),
 
273
    check_options(T);
 
274
check_options([reference| T]) -> %% same as {reference, true}
 
275
    check_options(T);
266
276
check_options([{verbosity, V} | T]) when atom(V) ->
267
277
    snmpc_lib:vvalidate(V),
268
278
    check_options(T);
282
292
    {error, {invalid_option, Opt}}.
283
293
 
284
294
 
285
 
check_bool(_Key, Bool) when Bool == true; Bool == false ->
 
295
check_bool(_Key, Bool) when (Bool =:= true) orelse (Bool =:= false) ->
286
296
    ok;
287
297
check_bool(Key, Val) ->
288
298
    {error, {invalid_option, {Key, Val}}}.
294
304
    snmpc_lib:key1search(deprecated, Options, true).
295
305
 
296
306
get_description(Options) ->
297
 
    case lists:member(description,Options) of
 
307
    get_bool_option(description, Options).
 
308
 
 
309
get_reference(Options) ->
 
310
    get_bool_option(reference, Options).
 
311
 
 
312
get_bool_option(Option, Options) ->
 
313
    case lists:member(Option, Options) of
298
314
        false ->
299
 
            snmpc_lib:key1search(description,Options,false);
 
315
            snmpc_lib:key1search(Option, Options, false);
300
316
        true ->
301
317
            true
302
318
    end.
309
325
            undefined
310
326
    end.
311
327
 
 
328
make_reference(undefined) ->
 
329
    [];
 
330
make_reference(Reference) ->
 
331
    case get(reference) of
 
332
        true ->
 
333
            [{reference, Reference}];
 
334
        _ -> 
 
335
            []
 
336
    end.
 
337
 
312
338
    
313
339
                
314
340
%%----------------------------------------------------------------------
363
389
    put(options,     Options),
364
390
    put(verbosity,   get_verbosity(Options)),
365
391
    put(description, get_description(Options)),
 
392
    put(reference,   get_reference(Options)),
366
393
    File = filename:rootname(MibFileName, ".mib"),
367
394
    put(filename, filename:basename(File ++ ".mib")),
368
395
    R = case catch c_impl(File) of
441
468
                                   status      = Tstatus,
442
469
                                   description = Desc1,
443
470
                                   units       = Tunits,
 
471
                                   reference   = Ref, 
444
472
                                   name_assign = Tindex},
445
473
                   Tline},
446
474
                  {#mc_object_type{name        = NameOfEntry,
470
498
      "   IndexingInfo: ~p~n"
471
499
      "   Estatus:      ~p~n"
472
500
      "   Eunits:       ~p~n"
 
501
      "   Ref:          ~p~n"
473
502
      "   Eline:        ~p~n"
474
503
      "   FieldList:    ~p~n"
475
504
      "   Sline:        ~p",
476
505
      [NameOfTable,SeqName,Taccess,Kind,Tstatus,
477
506
       Tindex,Tunits,Tline,
478
 
       NameOfEntry,TEline,IndexingInfo,Estatus,Eunits,Eline,
 
507
       NameOfEntry,TEline,IndexingInfo,Estatus,Eunits,Ref,Eline,
479
508
       FieldList,Sline]),
480
509
    update_status(NameOfTable, Tstatus),
481
510
    update_status(NameOfEntry, Estatus),
505
534
    snmpc_lib:add_cdata(#cdata.mes, 
506
535
                        [TableEntryME,
507
536
                         TableME#me{assocList=[{table_info, 
508
 
                                                TableInfo}]} |
 
537
                                                TableInfo} | make_reference(Ref)]} |
509
538
                                ColMEs]),
510
539
    definitions_loop(RestObjs, Deprecated);
511
540
 
516
545
                                   status      = Tstatus,
517
546
                                   description = Desc1,
518
547
                                   units       = Tunits,
 
548
                                   reference   = Ref, 
519
549
                                   name_assign = Tindex}, Tline},
520
550
                  {#mc_object_type{name        = NameOfEntry,
521
551
                                   syntax      = {{type, SeqName},_},
543
573
      "   Estatus:      ~p~n"
544
574
      "   BadOID:       ~p~n"
545
575
      "   Eunits:       ~p~n"
 
576
      "   Ref:          ~p~n"
546
577
      "   Eline:        ~p~n"
547
578
      "   FieldList:    ~p~n"
548
579
      "   Sline:        ~p",
549
580
      [NameOfTable,SeqName,Taccess,Kind,Tstatus,
550
581
       Tindex,Tunits,Tline,
551
 
       NameOfEntry,IndexingInfo,Estatus,BadOID,Eunits,Eline,
 
582
       NameOfEntry,IndexingInfo,Estatus,BadOID,Eunits,Ref,Eline,
552
583
       FieldList,Sline]),
553
584
    update_status(NameOfTable, Tstatus),
554
585
    update_status(NameOfEntry, Estatus),
579
610
    snmpc_lib:add_cdata(#cdata.mes, 
580
611
                               [TableEntryME,
581
612
                                TableME#me{assocList=[{table_info, 
582
 
                                                       TableInfo}]} |
 
613
                                                       TableInfo} | make_reference(Ref)]} |
583
614
                                ColMEs]),
584
615
    definitions_loop(RestObjs, Deprecated);
585
616