From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- sys/qpoe/qpctoi.x | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sys/qpoe/qpctoi.x (limited to 'sys/qpoe/qpctoi.x') diff --git a/sys/qpoe/qpctoi.x b/sys/qpoe/qpctoi.x new file mode 100644 index 00000000..9ac70ddb --- /dev/null +++ b/sys/qpoe/qpctoi.x @@ -0,0 +1,34 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include + +# QP_CTOI -- Decode an integer token from the input string, advancing the +# input pointer the the first character following the decoded number, and +# returning the number of numeric characters decoded as the function value. +# This is equivalent to the standard CTOI except that it calls LEXNUM first +# to determine the radix of the input number, hence can deals with hex and +# octal numbers as well as decimal. + +int procedure qp_ctoi (str, ip, ival) + +char str[ARB] #I input string +int ip #U pointer into input string +int ival #O integer value + +int ip_save, base, nchars +int gctol(), lexnum() + +begin + ip_save = ip + switch (lexnum (str, ip, nchars)) { + case LEX_OCTAL: + base = 8 + case LEX_HEX: + base = 16 + default: + base = 10 + } + + ip = ip_save + return (gctol (str, ip, ival, base)) +end -- cgit