Error loading `rutils` from Lispworks - common-lisp

I can swear this used to work earlier.
CL-USER 7 > (ql:quickload 'rutils)
To load "rutils":
Load 1 ASDF system:
rutils
; Loading "rutils"
[package editor-hints.named-readtables]..
.........
[package rutils.readtable]........................
[package rutils.core].............................
[package rutils.misc].............................
[package rutils.anaphora].........................
[package rutils.list].............................
[package rutils.string]...........................
[package rutils.hash-table].......................
[package rutils.hash-set].........................
[package rutils.array]............................
[package rutils.sequence].........................
[package rutils.pair].............................
[package rutils.tree].............................
[package rutils.abbr].............................
[package rutils]..................................
[package rutil]......
......
...
..
.
Error: Redefining macro := visible from package KEYWORD { *handle-warn-on-redefinition* is :ERROR }
1 (continue) Redefine it anyway.
2 Try loading /Users/agam/.cache/common-lisp/lw-7.1.0-macosx-x64/Users/agam/quicklisp/dists/quicklisp/software/rutils-20180228-git/core/abbr.64xfasl again.
3 Give up loading /Users/agam/.cache/common-lisp/lw-7.1.0-macosx-x64/Users/agam/quicklisp/dists/quicklisp/software/rutils-20180228-git/core/abbr.64xfasl.
4 Try loading another file instead of /Users/agam/.cache/common-lisp/lw-7.1.0-macosx-x64/Users/agam/quicklisp/dists/quicklisp/software/rutils-20180228-git/core/abbr.64xfasl.
5 Recompile abbr and try loading it again
6 Retry loading FASL for
#.
7 Continue, treating loading FASL for
#
as having been successful.
8 Retry ASDF operation.
9 Retry ASDF operation after resetting the configuration.
10 Retry ASDF operation.
11 Retry ASDF operation after resetting the configuration.
12 (abort) Give up on "rutils"
13 Return to top loop level 0.
Type :b for backtrace or :c to proceed.
Type :bug-form "" for a bug report template or :? for other options.
Any clues?

I can make it go away by running CL-USER 10 > (setf *handle-warn-on-redefinition* :warn) but is that the right way?
Yes, that's one way to get rid of that problem. You can set that for example in your home directory in the file .lispworks . By default LispWorks tries to protect the keyword package (and a bunch of others) against user changes.
Note also that you can use the first restart to redefine it anyway and to continue.

Related

what is the '0' meaning in rpm conditional macros

When reading some rpmbuild spec files, I come across some of the conditional macros which puzzle me.
example1
%if 0%{?rhel} > 7
blah blah
%endif
# I understand the above block tries to check if the
# red hat enterprise linux version is above 7, then blah blah
# But what is the usage of the '0'?
example 2
%if 0%{!?pkg_name:1}
%define pkg_name foo
%endif
# I understand the above block tries to check if the pkg_name
# is not defined, then define it with the value foo.
# But what is the usage of the '0'?
My guess is that '0' indicates the next expression to be either 'nil' or a number so that rpm would consider them as a number (such as 06, 0, or 01 in above examples) instead of a string or empty string. But I am not sure about it.
Unfortunatly, most of the online tutorial materials did not cover this topic.
You got it right; it's a safeguard. The %{?rhel} says "replace with the rhel macro if it exists and it is OK if it does not (the ?)."
So, if rpmbuild replaced it with nothing, the resulting if > 7 would barf.

Frama-C reports "invalid ghost in extern linkage specification" while loading .C files

I am very new to Frama-C so perhaps I'm missing something obvious. As I try to load my project files (with some .C files among them) Frama-C reports the following error in the Console window and stops processing
[kernel] FRAMAC_SHARE/libc/__fc_alloc_axiomatic.h:30:
invalid ghost in extern linkage specification:
Location: between lines 30 and 45, before or at token: }
28 #include "__fc_define_wchar_t.h"
29
30 __BEGIN_DECLS
31
32 /*# ghost extern int __fc_heap_status __attribute__((FRAMA_C_MODEL)); */
33
34 /*# axiomatic dynamic_allocation {
35 # predicate is_allocable{L}(integer n) // Can a block of n bytes be allocated?
36 # reads __fc_heap_status;
37 # // The logic label L is not used, but it must be present because the
38 # // predicate depends on the memory state
39 # axiom never_allocable{L}:
40 # \forall integer i;
41 # i < 0 || i > __FC_SIZE_MAX ==> !is_allocable(i);
42 # }
43 */
44
45 __END_DECLS
46
47 __POP_FC_STDLIB
It seems like the error is in Frama-C function spec library, maybe? I'm running Frama-C 20.0 (Calcium) on Ubuntu 19.10. Frama-C was installed via opam. Any insight into what this means would be very useful.
tl; dr: don't use .C instead of .c as a suffix for a C file. In particular gcc recognizes by default that suffix as C++ instead of C source.
longer answer with gory technical details:
If you launch frama-c (without the very experimental frama-clang plug-in) on a file named file.C (with an uppercase C as suffix), the preprocessor called by Frama-C will consider that it is handling a C++ source file. Technically, this means that it will define the standard _cplusplus macro, which in turn implies that the __BEGIN_DECL macro found in the stdlib.h file of Frama-C's libc will be expanded as if included in a C++ (i.e. as extern "C" {).
Had frama-clang been installed, it would have taken care of parsing the file, and should have succeeded. When this is not the case, the normal Frama-C parser is called. It has some limited support for handling extern "C" linkage specifications, as they can appear in the wild in some shared C/C++ headers, even though strictly speaking this is not standard C, but not all constructions are handled in this context.

limit number of watchers in asterisk BLF/subscriptions

Our asterisk have been taking toll since number of subscriptions are too many.
is there is way to limit "watchers"
I have looked on internet but nothing specifically touches this topic of limiting number of subscriptions.
E.g.
Only max of 3 phones can subscribe to BLF/monitor to phone 001
Below is part output from our console.
asterisk -rx 'core show hints'
641#25550094-Default : SIP/6172 State:Idle Watchers 7
643#25550094-Default : SIP/6172 State:Idle Watchers 7
279#25790053-Default : SIP/6128 State:Idle Watchers 5
777#81560062-DEFAULT : SIP/6188 State:Unavailable Watchers 1
799#81560105-DEFAULT : SIP/6188 State:Unavailable Watchers 0
387#81560085-DEFAULT : SIP/6187 State:Idle Watchers 8
683#81560037-DEFAULT : SIP/6188 State:Unavailable Watchers 0
544#81560083-DEFAULT : SIP/6188 State:Unavailable Watchers 0
001#25550042-Default : SIP/6129 State:Idle Watchers 13
002#25550042-Default : SIP/6129 State:Idle Watchers 13
No, there are no way.
You should think about moving to kamailio/opensips and clustering.

Running into DVTAssertions: ASSERTION FAILURE error with ios-sim

I'm trying get ionic up and running using my mac by following the simple instructions on the website (http://ionicframework.com/getting-started/)
Everything is working until i need to emulate
$ ionic emulate ios
I did a little deeper and I realized the same error lies in when I tried to run ios-sim
Here is what I see
$ ios-sim start
2015-02-27 14:01:57.361 ios-sim[1810:208272] [MT] DVTAssertions: ASSERTION FAILURE in /SourceCache/DVTiOSFrameworks/DVTiOSFrameworks-6274/DVTiPhoneSimulatorRemoteClient/DTiPhoneSimulatorSessionConfig.m:143
Details: (runtime) should not be nil.
Object: <DTiPhoneSimulatorSystemRoot>
Method: +rootWithSimRuntime:
Thread: <NSThread: 0x7ff44a5105f0>{number = 1, name = main}
Hints: None
Backtrace:
0 0x0000000110abe24a -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation)
1 0x0000000110abdc9f _DVTAssertionHandler (in DVTFoundation)
2 0x0000000110abdf8e _DVTAssertionFailureHandler (in DVTFoundation)
3 0x0000000111062614 +[DTiPhoneSimulatorSystemRoot rootWithSimRuntime:] (in DVTiPhoneSimulatorRemoteClient)
4 0x0000000111061897 -[DTiPhoneSimulatorSessionConfig simulatedSystemRoot] (in DVTiPhoneSimulatorRemoteClient)
5 0x000000010ebadab0 -[iPhoneSimulator launchApp:withFamily:uuid:environment:stdoutPath:stderrPath:timeout:args:] (in ios-sim)
6 0x000000010ebaecfd -[iPhoneSimulator runWithArgc:argv:] (in ios-sim)
7 0x000000010ebaefbb main (in ios-sim)
8 0x000000010ebac37c start (in ios-sim)
9 0x0000000000000002
Abort trap: 6
Please advice

Why "Reference to undefined global `Moduletest'" in OCaml?

I wrote
let fact x =
let result = ref 1 in
for i = 1 to x do
result := !result * i;
Printf.printf "%d %d %d\n" x i !result;
done;
!result;;
in a file named "Moduletest.ml", and
val fact : int -> int
in a file named "Moduletest.mli".
But, why don't they work?
When I tried to use in ocaml,
Moduletest.fact 3
it told me:
Error: Reference to undefined global `Moduletest'
What's happening?
Thanks.
OCaml toplevel is linked only with a standard library. There're several options on how to make other code visible to it:
copy-pasting
evaluating from the editor
loading files #use directive
making custom toplevel
loading with ocamlfind
Copy-pasting
This self-describing, you just copy code from some source and paste it into toplevel. Don't forget that toplevel won't evaluate your code until you add ;;
Evaluating from the editor
Where the editor is of course Emacs... Well, indeed it can be any other capable editor, like vim for example. This method is an elaboration of the previous, where the editor is actually responsible for copying and pasting the code for you. In Emacs you can evaluate the whole file with C-c C-b command, or you can narrow it to a selected area with C-c C-r, and the most granular is to use C-c C-e, i.e., evaluate an expression. Although it is slightly buggy.
Loading with #use directive.
This directive accepts a filename, and it will essentially copy and paste the code from the file. Notice, that it won't create a file-module for you/ For example, if you have file test.ml with this contents:
(* file test.ml *)
let sum x y = x + y
then loading it with the #use directive, will actually bring to your scope, sum value:
# #use "test.ml";;
# let z = sum 2 2
You mustn't to qualify sum with Test., because no Test module is actually created. #use directive merely copies the contents of the file to the toplevel. Nothing more.
Making custom toplevels
You can create your own toplevel with your code compiled in. It is an advanced theme, so I will skip it.
Loading libraries with ocamlfind
ocamlfind is a tool that allows you to find and load libraries, installed on your system, into your toplevel. By default, toplevel is not linked with any code except standard library. Even, not all parts of the library are actually linked, e.g., Unix module is not available, and needed to be loaded explicitly. There're primitive directives that can load any library, like #load and #include, but they are not for a casual user, especially if you have excellent ocamlfind at your disposal. Before using it, you need to load it, since it is also not available by default. The following command, will load ocamlfind and add few new directives:
# #use "topfind";;
In a process of loading it will show you a little hint on how to use it. The most interesting directive, that is added is #require. It accepts a library name, and loads (i.e., links) its code into toplevel:
# #require "unix";;
This will load a unix library. If you're not sure, about the name of the library you can always view all libraries with a #list command. The #require directive is clever and it will automatically load all dependencies of the library.
If you do not want to type all this directives every time you start OCaml top-level, then you cam create .ocamlinit file in your home directory, and put them there. This file will be loaded automatically on a top-level startup.
I have tested your code and it looks fine. You should "load" it from the OCaml toplevel (launched from the same directory as your .ml and .mli files) in the following way:
# #use "Moduletest.ml";;
val fact : int -> int = <fun>
# fact 4;;
4 1 1
4 2 2
4 3 6
4 4 24
- : int = 24

Resources