blob: 4d7333c50511967dd413db84f45d7f104a115565 [file] [log] [blame]
Dave Barach8d0f2f02018-03-12 09:31:36 -04001;;; Copyright (c) 2016 Cisco and/or its affiliates.
2;;; Licensed under the Apache License, Version 2.0 (the "License");
3;;; you may not use this file except in compliance with the License.
4;;; You may obtain a copy of the License at:
5;;;
6;;; http://www.apache.org/licenses/LICENSE-2.0
7;;;
8;;; Unless required by applicable law or agreed to in writing, software
9;;; distributed under the License is distributed on an "AS IS" BASIS,
10;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11;;; See the License for the specific language governing permissions and
12;;; limitations under the License.
13
Dave Barachb852bfa2016-01-04 15:27:42 -050014(defun make-plugin ()
15 "Create a plugin"
16 (interactive)
17 (save-excursion
18 (let (cd-args cmd-args start-dir)
19 (setq start-dir default-directory)
20 (makunbound 'plugin-name)
21 (makunbound 'PLUGIN-NAME)
Dave Barachd7a37a72018-08-10 16:22:48 -040022 (makunbound 'plugin-flavor)
Dave Barachb852bfa2016-01-04 15:27:42 -050023 (setq plugin-name (read-string "Plugin name: "))
Dave Barachd7a37a72018-08-10 16:22:48 -040024 (setq plugin-flavor
25 (read-string "Dispatch type [dual or qs]: "))
Dave Barachb852bfa2016-01-04 15:27:42 -050026 (setq PLUGIN-NAME (upcase plugin-name))
Dave Barach605c6362017-01-02 12:22:48 -050027 (setq cmd-args (concat "mkdir -p " plugin-name))
Dave Barachb852bfa2016-01-04 15:27:42 -050028 (shell-command cmd-args)
Dave Barach605c6362017-01-02 12:22:48 -050029 (setq cd-args (concat start-dir "/" plugin-name))
Dave Barachb852bfa2016-01-04 15:27:42 -050030 (setq default-directory cd-args)
Dave Barach3f2e7752018-10-03 16:10:04 -040031 (find-file "CMakeLists.txt")
32 (skel-plugin-cmakelists-text-fragment)
Dave Barachb852bfa2016-01-04 15:27:42 -050033 (find-file (concat plugin-name ".api"))
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070034 (skel-plugin-api)
Dave Barachb852bfa2016-01-04 15:27:42 -050035 (find-file (concat plugin-name "_all_api_h.h"))
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070036 (skel-plugin-all-apih)
Dave Barachb852bfa2016-01-04 15:27:42 -050037 (find-file (concat plugin-name ".h"))
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070038 (skel-plugin-h)
Dave Barachb852bfa2016-01-04 15:27:42 -050039 (find-file (concat plugin-name ".c"))
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070040 (skel-plugin-main)
Dave Barachb852bfa2016-01-04 15:27:42 -050041 (find-file (concat plugin-name "_msg_enum.h"))
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070042 (skel-plugin-msg-enum)
Dave Barachb852bfa2016-01-04 15:27:42 -050043 (find-file "node.c")
Dave Barachd7a37a72018-08-10 16:22:48 -040044 (if (string= plugin-flavor "qs")
45 (skel-plugin-qsnode) (skel-plugin-node))
Dave Barachb852bfa2016-01-04 15:27:42 -050046 (find-file (concat plugin-name "_test.c"))
Keith Burns (alagalah)ca46d8c2016-03-18 07:22:15 -070047 (skel-plugin-test)
Dave Barachf4addbd2018-04-30 13:03:46 -040048 (find-file (concat plugin-name "_periodic.c"))
49 (skel-plugin-periodic)
Dave Barachd7a37a72018-08-10 16:22:48 -040050 (find-file "setup.pg")
51 (skel-plugin-setup)
Dave Barachb852bfa2016-01-04 15:27:42 -050052 (cd start-dir))))
53