83 lines
6.8 KiB
Plaintext
83 lines
6.8 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="generator" content="TempleOS V5.03">
|
||
|
<meta name="viewport" content="width=device-width">
|
||
|
<link rel="stylesheet" href="/style/templeos.css">
|
||
|
<script src="/script/templeos.js"></script>
|
||
|
<style type="text/css">
|
||
|
.cF0{color:#000000;background-color:#ffffff;}
|
||
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
||
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
||
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
||
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
||
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
||
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
||
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
||
|
.cF8{color:#555555;background-color:#ffffff;}
|
||
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
||
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
||
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
||
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
||
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
||
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
||
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<pre id="content">
|
||
|
<a name="l1"></a><span class=cF1>class</span><span class=cF0> FDStruct
|
||
|
<a name="l2"></a>{</span><span class=cF2>//Use <CTRL-l> and sel "Data", "List" or "Check Box"</span><span class=cF0>
|
||
|
<a name="l3"></a></span><span class=cF2>//to generate the formats.</span><span class=cF0>
|
||
|
<a name="l4"></a> </span><span class=cF1>F64</span><span class=cF0> num1 format </span><span class=cF6>"$DA-TRM,A=\"Float 1:%12.8f\"$\n"</span><span class=cF0>;
|
||
|
<a name="l5"></a> </span><span class=cF1>F64</span><span class=cF0> num2 format </span><span class=cF6>"$DA-TRM,A=\"Float 2:%12e\"$\n"</span><span class=cF0>;
|
||
|
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> num3 format </span><span class=cF6>"$DA-TRM,A=\"Int 1:0x%016X\"$\n"</span><span class=cF0>;
|
||
|
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> num4 format </span><span class=cF6>"$DA-TRM,A=\"Int 2:%12d\"$\n"</span><span class=cF0>;
|
||
|
<a name="l8"></a> </span><span class=cF9>I64</span><span class=cF0> type format </span><span class=cF6>"$LS,D=\"ST_PERSON_TYPE\"$\n"</span><span class=cF0>;
|
||
|
<a name="l9"></a> </span><span class=cF1>U8</span><span class=cF0> name[32] format </span><span class=cF6>"$DA-P,A=\"Name :%s\"$\n"</span><span class=cF0>;
|
||
|
<a name="l10"></a> </span><span class=cF1>U8</span><span class=cF0> *address1 format </span><span class=cF6>"$DA+M,A=\"Address:%s\"$\n"</span><span class=cF0>; </span><span class=cF2>//+M is unlimited len U8 *.</span><span class=cF0>
|
||
|
<a name="l11"></a> </span><span class=cF1>U8</span><span class=cF0> *address2 format </span><span class=cF6>"$DA+M,A=\"Address:%s\"$\n"</span><span class=cF0>; </span><span class=cF2>//+M is unlimited len U8 *.</span><span class=cF0>
|
||
|
<a name="l12"></a> </span><span class=cF9>CDate</span><span class=cF0> datetime format </span><span class=cF6>"$DA-TRM,A=\"Date :%8D\"$\n"</span><span class=cF0>;
|
||
|
<a name="l13"></a> </span><span class=cF1>Bool</span><span class=cF0> check format </span><span class=cF6>"$CB,\"Check\"$\n"</span><span class=cF0>;
|
||
|
<a name="l14"></a>};
|
||
|
<a name="l15"></a>
|
||
|
<a name="l16"></a></span><span class=cF1>U0</span><span class=cF0> FormDemo()
|
||
|
<a name="l17"></a>{
|
||
|
<a name="l18"></a> FDStruct fds;
|
||
|
<a name="l19"></a> </span><span class=cF5>DefineLstLoad</span><span class=cF0>(</span><span class=cF6>"ST_PERSON_TYPE"</span><span class=cF0>,</span><span class=cF6>"Child\0Teen\0Adult\0"</span><span class=cF0>);
|
||
|
<a name="l20"></a> fds.num1=12.3e-4; </span><span class=cF2>//Set defaults</span><span class=cF0>
|
||
|
<a name="l21"></a> fds.num2=4.5e3;
|
||
|
<a name="l22"></a> fds.num3=0x1234;
|
||
|
<a name="l23"></a> fds.num4=-567;
|
||
|
<a name="l24"></a> fds.type=1;
|
||
|
<a name="l25"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(&fds.name,</span><span class=cF6>"John"</span><span class=cF0>);
|
||
|
<a name="l26"></a> fds.address1=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"1234 Pine St."</span><span class=cF0>);
|
||
|
<a name="l27"></a> fds.address2=</span><span class=cF3>NULL</span><span class=cF0>; </span><span class=cF2>//Init to NULL if empty.</span><span class=cF0>
|
||
|
<a name="l28"></a> fds.datetime=</span><span class=cF5>Now</span><span class=cF0>;
|
||
|
<a name="l29"></a> fds.check=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocForm</span><span class=cF7>(</span><span class=cF0>&fds</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l31"></a> </span><span class=cF6>"#1\t=%e\n"</span><span class=cF0>,fds.num1;
|
||
|
<a name="l32"></a> </span><span class=cF6>"#2\t=%e\n"</span><span class=cF0>,fds.num2;
|
||
|
<a name="l33"></a> </span><span class=cF6>"#3\t=%d\n"</span><span class=cF0>,fds.num3;
|
||
|
<a name="l34"></a> </span><span class=cF6>"#4\t=%d\n"</span><span class=cF0>,fds.num4;
|
||
|
<a name="l35"></a> </span><span class=cF6>"Type\t=%s\n"</span><span class=cF0>,</span><span class=cF5>DefineSub</span><span class=cF0>(fds.type,</span><span class=cF6>"ST_PERSON_TYPE"</span><span class=cF0>);
|
||
|
<a name="l36"></a> </span><span class=cF6>"Name\t=%s\n"</span><span class=cF0>,fds.name;
|
||
|
<a name="l37"></a> </span><span class=cF6>"Address1=%s\n"</span><span class=cF0>,fds.address1;
|
||
|
<a name="l38"></a> </span><span class=cF6>"Address2=%s\n"</span><span class=cF0>,fds.address2;
|
||
|
<a name="l39"></a> </span><span class=cF6>"Date\t=%D\n"</span><span class=cF0>,fds.datetime;
|
||
|
<a name="l40"></a> </span><span class=cF6>"Check\t=%d\n"</span><span class=cF0>,fds.check;
|
||
|
<a name="l41"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l42"></a> </span><span class=cF6>"Cancel\n"</span><span class=cF0>;
|
||
|
<a name="l43"></a>
|
||
|
<a name="l44"></a> </span><span class=cF6>"\n\nClassRep Example\n"</span><span class=cF0>;
|
||
|
<a name="l45"></a> </span><span class=cF5>ClassRep</span><span class=cF0>(&fds);
|
||
|
<a name="l46"></a> </span><span class=cF5>Free</span><span class=cF0>(fds.address1);
|
||
|
<a name="l47"></a> </span><span class=cF5>Free</span><span class=cF0>(fds.address2);
|
||
|
<a name="l48"></a> </span><span class=cF2>//See also </span><a href="/Wb/Adam/ADbg.HC.HTML#l183"><span class=cF4>ClassRepD</span></a><span class=cF2>().</span><span class=cF0>
|
||
|
<a name="l49"></a>}
|
||
|
<a name="l50"></a>
|
||
|
<a name="l51"></a>FormDemo;
|
||
|
</span></pre></body>
|
||
|
</html>
|