PageRenderTime 6ms CodeModel.GetById 3ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/skeleton/php-math.el

http://github.com/ejmr/php-mode
Lisp | 349 lines | 270 code | 57 blank | 22 comment | 0 complexity | 6eb7899eab0ea7df76b01968fb749f70 MD5 | raw file
  1;; Copyright (C) 2015  David Arroyo Menéndez
  2
  3;; Author: David Arroyo Menéndez <davidam@gnu.org>
  4;; Maintainer: David Arroyo Menéndez <davidam@gnu.org>
  5
  6;; This file is free software; you can redistribute it and/or modify
  7;; it under the terms of the GNU General Public License as published by
  8;; the Free Software Foundation; either version 3, or (at your option)
  9;; any later version.
 10
 11;; This file is distributed in the hope that it will be useful,
 12;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 13;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14;; GNU General Public License for more details.
 15
 16;; You should have received a copy of the GNU General Public License
 17;; along with GNU Emacs; see the file COPYING.  If not, write to
 18;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
 19;; Boston, MA 02110-1301 USA,
 20
 21;; To install php-ext.el:
 22;; You can add (load "path/php-ext/php-ext.el") to your .emacs
 23
 24;; Description:
 25;; Php ext is some skeleton templates for extend php-mode
 26
 27;; Math functions
 28;; http://php.net/manual/en/ref.math.php
 29;; file:///usr/share/doc/php-doc/html/ref.math.html
 30
 31(define-skeleton php-abs
 32  "Insert an abs statement"
 33  ""
 34  > "abs(" (skeleton-read "Number to round? ") ");" \n
 35  )
 36
 37(define-skeleton php-acos
 38  "Insert an acos statement"
 39  ""
 40  > "acos(" (skeleton-read "Number? ") ");" \n
 41)
 42
 43(define-skeleton php-acosh
 44  "Insert an acosh statement"
 45  ""
 46  > "acosh(" (skeleton-read "Number? ") ");" \n
 47)
 48
 49(define-skeleton php-asin
 50  "Insert an asin statement"
 51  ""
 52  > "asin(" (skeleton-read "Number? ") ");" \n
 53)
 54
 55(define-skeleton php-asinh
 56  "Insert an asinh statement"
 57  ""
 58  > "asinh(" (skeleton-read "Number? ") ");" \n
 59)
 60
 61(define-skeleton php-atan
 62  "Insert an atan statement"
 63  ""
 64  > "atan(" (skeleton-read "Number? ") ");" \n
 65)
 66
 67(define-skeleton php-atan2
 68  "Insert an atan2 statement"
 69  ""
 70  > "atan2(" (skeleton-read "Number? ") ", " (skeleton-read "Number? ") ");" \n
 71)
 72
 73(define-skeleton php-atanh
 74  "Insert an atanh statement"
 75  ""
 76  > "atanh(" (skeleton-read "Number? ") ");" \n
 77)
 78
 79(define-skeleton php-base_convert
 80  "Insert a base_convert statement"
 81  ""
 82  > "base_convert(" (skeleton-read "Number? ") ", " (skeleton-read "Base number? ") ", " (skeleton-read "Base number? ") ");" \n
 83)
 84
 85(define-skeleton php-bcadd
 86  "Insert a bcadd statement"
 87  ""
 88  > "bcadd(" (skeleton-read "Number? ") ", " (skeleton-read "Number? ") ");" \n
 89)
 90
 91(define-skeleton php-gmp_add
 92  "Insert a bcadd statement"
 93  ""
 94  > "gmp_add(" (skeleton-read "Number? ") ", " (skeleton-read "Number? ") ");" \n
 95)
 96
 97(define-skeleton php-bindec
 98  "Insert a bindec statement"
 99  ""
100  > "bindec(" (skeleton-read "Number? ") ");" \n
101)
102
103(define-skeleton php-ceil
104  "Insert a ceil statement"
105  ""
106  > "ceil(" (skeleton-read "Number? ") ");" \n
107)
108
109(define-skeleton php-cos
110  "Insert a cos statement"
111  ""
112  > "cos(" (skeleton-read "Number? ") ");" \n
113)
114
115(define-skeleton php-cosh
116  "Insert a cosh statement"
117  ""
118  > "cosh(" (skeleton-read "Number? ") ");" \n
119)
120
121(define-skeleton php-decbin
122  "Insert a decbin statement"
123  ""
124  > "decbin(" (skeleton-read "Number? ") ");" \n
125)
126
127(define-skeleton php-dechex
128  "Insert a dechex statement"
129  ""
130  > "dechex(" (skeleton-read "Number? ") ");" \n
131)
132
133(define-skeleton php-decoct
134  "Insert a dechex statement"
135  ""
136  > "decoct(" (skeleton-read "Number? ") ");" \n
137)
138
139(define-skeleton php-deg2rad
140  "Insert a dechex statement"
141  ""
142  > "deg2rad(" (skeleton-read "Number? ") ");" \n
143)
144
145(define-skeleton php-exp
146  "Insert an exp statement"
147  ""
148  > "exp(" (skeleton-read "Number? ") ");" \n
149)
150
151(define-skeleton php-expm1
152  "Insert an expm1 statement"
153  ""
154  > "expm1(" (skeleton-read "Number? ") ");" \n
155)
156
157(define-skeleton php-floor
158  "Insert a floor statement"
159  ""
160  > "floor(" (skeleton-read "Number? ") ");" \n
161)
162
163(define-skeleton php-fmod
164  "Insert a fmod statement"
165  ""
166  > "fmod(" (skeleton-read "Number? ") ");" \n
167)
168
169(define-skeleton php-getrandmax
170  "Insert an getrandmax statement"
171  ""
172  > "getrandmax(" (skeleton-read "Number? ") ");" \n
173)
174
175(define-skeleton php-mt_rand
176  "Insert an mt_rand statement"
177  ""
178  > "mt_rand(" (skeleton-read "Number? ") ");" \n
179)
180
181(define-skeleton php-mt_srand
182  "Insert an mt_rand statement"
183  ""
184  > "mt_srand(" (skeleton-read "Number? ") ");" \n
185)
186
187(define-skeleton php-hexdec
188  "Insert a hexdec statement"
189  ""
190  > "hexdec(" (skeleton-read "Number? ") ");" \n
191)
192
193(define-skeleton php-hypot
194  "Insert a hypot statement"
195  ""
196  > "hypot(" (skeleton-read "Number? ") ", " (skeleton-read "Number? ") ");" \n
197)
198
199(define-skeleton php-is_finite
200  "Insert a is_finite statement"
201  ""
202  > "is_finite(" (skeleton-read "Number? ") ");" \n
203)
204
205(define-skeleton php-is_infinite
206  "Insert a is_infinite statement"
207  ""
208  > "is_infinite(" (skeleton-read "Number? ") ");" \n
209)
210
211(define-skeleton php-is_nan
212  "Insert a is_nan statement"
213  ""
214  > "is_nan(" (skeleton-read "Number? ") ");" \n
215)
216
217(define-skeleton php-lcg_value
218  "Insert a lcg_value statement"
219  ""
220  > "lcg_value(" (skeleton-read "Number? ") ");" \n
221)
222
223(define-skeleton php-log10
224  "Insert a log10 statement"
225  ""
226  > "log10(" (skeleton-read "Number? ") ");" \n
227)
228
229(define-skeleton php-log1p
230  "Insert a log1p statement"
231  ""
232  > "log1p(" (skeleton-read "Number? ") ");" \n
233)
234
235(define-skeleton php-log
236  "Insert a log statement"
237  ""
238  > "log(" (skeleton-read "Number? ") ");" \n
239)
240
241(define-skeleton php-max
242  "Insert a max statement"
243  ""
244  > "max(" (skeleton-read "Number? ") ", " (skeleton-read "Number? ") \n
245   ( "Another number %s: "
246   > ", " str)
247  > ");" \n
248)
249
250(define-skeleton php-min
251  "Insert a min statement"
252  ""
253  > "min(" (skeleton-read "Number? ") ", " (skeleton-read "Number? ") \n
254   ( "Another number %s: "
255   > ", " str)
256  > ");" \n
257)
258
259(define-skeleton php-mt_getrandmax
260  "Insert a mt_getrandmax statement"
261  ""
262  > "mt_getrandmax(); " \n
263)
264
265(define-skeleton php-number_format
266  "Insert a number_format statement"
267  ""
268  '(setq number (skeleton-read "Number? "))
269  > "number_format(" number ", " 
270  ( "Another argument %s: "
271   > ", " str)
272)
273
274(define-skeleton php-pi
275  "Insert a pi statement"
276  ""
277  > "pi();" \n
278)
279
280(define-skeleton php-pow
281  "Insert a pow statement"
282  ""
283  '(setq base (skeleton-read "Base? "))
284  '(setq exp (skeleton-read "Exponent? "))
285  > "pow(" base ", " exp ");" \n
286)
287
288(define-skeleton php-rad2deg
289  "Insert a pow statement"
290  ""
291  '(setq base (skeleton-read "Radians? "))
292  '(setq exp (skeleton-read "Degrees? "))
293  > "rad2deg(" base  ");" \n
294)
295
296(define-skeleton php-rand_weighted
297  "Insert an rand_weighted statement"
298  ""
299  > "rand_weighted(" (skeleton-read "Number? ") ");" \n
300)
301
302(define-skeleton php-round
303  "Insert a round statement"
304  ""
305  '(setq number (skeleton-read "Number to round? "))
306  > "round(" number ");" \n
307)
308
309(define-skeleton php-sin
310  "Insert a sin statement"
311  ""
312  '(setq number (skeleton-read "Number? "))
313  > "sin(" number ");" \n
314)
315
316(define-skeleton php-sinh
317  "Insert a sin statement"
318  ""
319  '(setq number (skeleton-read "Number? "))
320  > "sinh(" number ");" \n
321)
322
323(define-skeleton php-sqrt
324  "Insert a sqrt statement"
325  ""
326  '(setq number (skeleton-read "Number? "))
327  > "sqrt(" number ");" \n
328)
329
330(define-skeleton php-srand
331  "Insert a sqrt statement"
332  ""
333  '(setq number (skeleton-read "Number? "))
334  > "srand(" number ");" \n
335)
336
337(define-skeleton php-tan
338  "Insert a tan statement"
339  ""
340  '(setq number (skeleton-read "Number? "))
341  > "tan(" number ");" \n
342)
343
344(define-skeleton php-tanh
345  "Insert a tan statement"
346  ""
347  '(setq number (skeleton-read "Number? "))
348  > "tanh(" number ");" \n
349)