Dave Barach | 8d0f2f0 | 2018-03-12 09:31:36 -0400 | [diff] [blame] | 1 | ;;; 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 Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 14 | (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 Barach | d7a37a7 | 2018-08-10 16:22:48 -0400 | [diff] [blame] | 22 | (makunbound 'plugin-flavor) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 23 | (setq plugin-name (read-string "Plugin name: ")) |
Dave Barach | d7a37a7 | 2018-08-10 16:22:48 -0400 | [diff] [blame] | 24 | (setq plugin-flavor |
| 25 | (read-string "Dispatch type [dual or qs]: ")) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 26 | (setq PLUGIN-NAME (upcase plugin-name)) |
Dave Barach | 605c636 | 2017-01-02 12:22:48 -0500 | [diff] [blame] | 27 | (find-file (concat plugin-name ".am")) |
| 28 | (skel-plugin-makefile-am-fragment) |
| 29 | (setq cmd-args (concat "mkdir -p " plugin-name)) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 30 | (shell-command cmd-args) |
Dave Barach | 605c636 | 2017-01-02 12:22:48 -0500 | [diff] [blame] | 31 | (setq cd-args (concat start-dir "/" plugin-name)) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 32 | (setq default-directory cd-args) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 33 | (find-file (concat plugin-name ".api")) |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 34 | (skel-plugin-api) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 35 | (find-file (concat plugin-name "_all_api_h.h")) |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 36 | (skel-plugin-all-apih) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 37 | (find-file (concat plugin-name ".h")) |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 38 | (skel-plugin-h) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 39 | (find-file (concat plugin-name ".c")) |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 40 | (skel-plugin-main) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 41 | (find-file (concat plugin-name "_msg_enum.h")) |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 42 | (skel-plugin-msg-enum) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 43 | (find-file "node.c") |
Dave Barach | d7a37a7 | 2018-08-10 16:22:48 -0400 | [diff] [blame] | 44 | (if (string= plugin-flavor "qs") |
| 45 | (skel-plugin-qsnode) (skel-plugin-node)) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 46 | (find-file (concat plugin-name "_test.c")) |
Keith Burns (alagalah) | ca46d8c | 2016-03-18 07:22:15 -0700 | [diff] [blame] | 47 | (skel-plugin-test) |
Dave Barach | f4addbd | 2018-04-30 13:03:46 -0400 | [diff] [blame] | 48 | (find-file (concat plugin-name "_periodic.c")) |
| 49 | (skel-plugin-periodic) |
Dave Barach | d7a37a7 | 2018-08-10 16:22:48 -0400 | [diff] [blame] | 50 | (find-file "setup.pg") |
| 51 | (skel-plugin-setup) |
Dave Barach | b852bfa | 2016-01-04 15:27:42 -0500 | [diff] [blame] | 52 | (cd start-dir)))) |
| 53 | |