aboutsummaryrefslogtreecommitdiff
path: root/doc/language/function/cpsc-function-is_num.7.md
blob: a1fe34e43b18b4c7806a804bef820225cfe12363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

% CPSC-FUNCTION-IS_NUM(7)

# NAME

cpsc-function-is_num - test whether text represents a number

# SYNOPSIS

```text
IS_NUM(text : STRING) RETURNS BOOLEAN
```

# DESCRIPTION

Return true for a nonempty string fully consumed by the runtime's numeric conversion. Leading whitespace is accepted; trailing whitespace or other trailing text is rejected.

# EXAMPLE

```text
OUTPUT IS_NUM("12.5")
```

# SEE ALSO

[cpsc-language-overview(7)](../cpsc-language-overview.7.md), [cpsc-function-str_to_num(7)](cpsc-function-str_to_num.7.md).
llvm::Value *FunctionGen::emitCall(const FuncSig &Sig, const std::vector<llvm::Value*> &Args) { if (BeforeCall) BeforeCall(Sig); if (!Sig.IsExternal) return emitCall(Sig.LinkName, Args); FunctionCallee Callee(Sig.ExternType, Module.getNamedValue(Sig.LinkName)); Value *Call = Sig.ExternType->getReturnType()->isVoidTy() ? Exceptions.emitCall(Callee, Args) : Exceptions.emitCall(Callee, Args, "calltmp"); cast<CallBase>(Call)->setAttributes(Sig.ExternAttrs); return Call; } void FunctionGen::emitReturn(ReturnStmtAST *Ret, llvm::Value *RetVal) { Instruction *CatchCleanup = Exceptions.emitReturnCleanup(); Instruction *RetInst = RetVal ? Builder.CreateRet(RetVal) : Builder.CreateRetVoid(); Exceptions.recordExit(CatchCleanup ? CatchCleanup : RetInst); }