-
Notifications
You must be signed in to change notification settings - Fork 10
/
_maxbootscript.txt
405 lines (348 loc) · 11.4 KB
/
_maxbootscript.txt
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
Program maXbox_bootscript_loader_functester_2;
//****************************************************************************
//with an include example, loc's=393
//var date1: TDateTime;
//#head:max: APSN21: 02.12.2013 10:06:24 D:\kleiner2005\TestApp\maxbox2\maxbox2\source_2007\maxbox29\maxbox36beta\maxbox3\maxbootscript.txt
Function Absf(E : Extended):Extended;
begin
result:=Abs(E);
//A:=Abs(-2); {A will equal 2}
//A:=Abs(2); {A will equal 2}
end;
Function Chrf(B : Byte) : Char;
begin
result:=Chr(B);
//C:=Chr(65); {C will equal 'A'}
//C:=Chr(97); {C will equal 'a'}
end;
Function Copyf(S : String; Indx, Count : Integer) : String;
begin
//S:='Hi There';
result:=Copy(S,indx,count); {S2 will equal 'There'}
//result:=Copy(S,4,5); {S2 will equal 'There'}
end;
Function Cos(E : Extended ): Extended;
begin
result:=Cos(E);{E will equal 0.8623 (the cosine of 100)}
//E2:=Cos(100);{E will equal 0.8623 (the cosine of 100)}
end;
Function myDate: string;
begin
result:=DateToStr(Date); {S would be the current date in string form}
//S:=DateToStr(Date); {S would be the current date in string form}
end;
Function DateToStrf(D: TDateTime) : string;
begin
result:=DateToStr(Date); {S would be the date in string form}
end;
Function DayOfWeekf(Const DateTime: TDateTime) : Word;
begin
result:= DayOfWeek(Date); {D would be 4 if today was Wednesday (Sunday=1)}
end;
Procedure DecodeDatef(Const DateTime: TDateTime; var Yr, Mn, Dy: Word);
begin
DecodeDate(Date,Yr,Mn,Dy); {If today was 11/27/06 then Yr=6, Mn=11, Day=27}
end;
Procedure DecodeTimef(Const DateTime: TDateTime; var Hr, Mn, Sc, Mis: Word);
begin
//DecodeTime(Now,Hr,Mn,Sc,Mis);{If it was 3:01:02.001 pm then Hr=15, Mn=1, Sc=2, Ms=1}
end;
Procedure Delete(Var S : String; Indx, Count : Integer);
begin
S:='The Big Bad Wolf';
Delete(S,9,4); {S would be 'The Big Wolf'}
end;
Function EncodeDatef(Year, Month, Day: Word) : string;
Var
MylDate: TDateTime;
begin
MylDate:= EncodeDate(1997,11,27);
result:= DateToStr(MylDate); {S would be '11/27/1997'}
end;
Function EncodeTimef(Hour, Min, Sec, MSec: Word) : string;
Var
MyTime : TDateTime;
begin
MyTime:=EncodeTime(15,0,0,0);
result:=TimeToStr(MyTime); {S would be '3:00:00 PM'}
end;
Function FloatToStrf(E :Extended ) : String;
Var
mE : double;
begin
mE:=12.4508;
result:=FloatToStr(mE); {S would be '12.4508'}
mE:=9 / 5;
result:=FloatToStr(E); {S would be '1.8'}
end;
Function FormatDateTimef(Const fmt: string; D: TDateTime) : string;
Var
MyDateTime : TDateTime;
begin
MyDateTime:=StrToDate('20.06.1959'); //EU
//MyDateTime:=StrToDate('06/20/1959'); //AM Format
//MyDateTime:=StrToDate('07.11.1991');
//MyDateTime:=MyDateTime+StrToTime('12:45:10 pm');
result:=FormatDateTime('"Her birthday is on " dddd, mmmm d,yyyy,"'+
'at "hh:mm AM/PM', MyDateTime);
{S would be 'Her birthday is on Monday, November 27, 2006 at 12:45 PM'}
end;
Function GetArrayLengthf(Var u: array of integer) : string;
Var
AnArray : Array of integer;
begin
//AnArray[123]:=4;
result:=IntToStr(GetArrayLength(AnArray)); {S should equal '123'}
end;
Procedure Insertf(Source : String; var Dest : String; Indx : Integer);
var s: string;
begin
S:='The Big Wolf';
Insert('Bad ',S,9); {S would be 'The Big Bad Wolf';}
end;
Function IntToStrf(I : Longint) : String;
begin
I:=123;
result:=IntToStr(I);{S would be '123'}
end;
Function Lengthf(S : String) : Longint;
begin
S:='The Big Bad Wolf';
result:=Length(S); {I would be 16}
end;
Function Lowercasef(S : String) : string;
begin
S:='The Big Bad Wolf';
result:=Lowercase(S); {S2 would be 'the big bad wolf'}
end;
Function Nowf: string;
begin
result:= 'It is now '+TimeToStr(Now)+' on '+(DateToStr(Date));
{S would look like: 'It is now 12:01 PM on 11/27/06'}
end;
Function Ordf(C : Char) : Byte;
begin
result:=Ord('A'); {I would be 65}
end;
Function Padlf(S : string;I : longInt) : string;
begin
S:='123';
result:=Padl(S,12); {S2 would have 12 spaces before the 123}
end;
Function Padrf(S : string;I : longInt) : string;
begin
S:='123';
result:=Padr(S,12); {S2 would have 12 spaces after the 123}
end;
Function Padzf(S : string;I : longInt) : string;
begin
S:='123';
result:=Padz(S,12); {S2 would have 12 zeros before the 123}
end;
Function Pif : string;
begin
result:=Copy(FloatToStr(pi),1,6); {S='3.1415'}
end;
Function Posf(SubStr, S : String) : Integer;
begin
result:=Pos('Big','The Big Bad Wolf'); {I=9}
end;
Function Replicatef(C: Char; I: longInt): string;
begin
//result:=Replicate('D',7); {S would be 'AAAAAA'}
result:= Replicate(C,I);
end;
Function Roundf(E : Extended) : Longint;
begin
result:=Round(Pi); {I would be 3}
result:=Round(3.6); {I would be 4}
end;
Procedure SetLengthf(Var S: String; L: Longint);
begin
S:='The Big Bad Wolf';
SetLength(S,7); {S would be 'The Big'}
end;
Function Sinf(E : Extended) : string;
Var
mE : double;
begin
mE:=Sin(12);
result:=Copy(FloatToStr(mE),1,6);{S='0.536'}
end;
Function Sqrtf(E : Extended) : Extended;
begin
result:=Sqrt(9); {E would be 3.0}
end;
Function StrGetf(S : String; I : Integer) : Char;
begin
S:='4567';
result:=StrGet(S,3); {S2 would be '6'}
end;
Function StringOfCharf(C : Char;I : longInt) : string;
begin
result:=StringOfChar('A',6); {S would be 'AAAAAA'}
end;
Function StrToDatef(Const s: string) : TDateTime;
begin
result:=StrToDate('11/27/2006');
end;
Function StrToIntDeff(Const S: string; Def: LongInt) : LongInt;
{Converts a string to an integer.}
begin
S:='hi there';
result:=StrToIntDef(S, 1); {I would be 1}
S:='123';
result:=StrToIntDef(S, 1); {I would be 123}
end;
Function Timef: TDateTime;
begin
//result:='The time is '+timeToStr(Time);
end;
Function Trimf(S : String) : String;
begin
S:=' This has a space in front and behind ';
result:=Trim(S); {S2 would be 'This has a space in front and behind'}
end;
Function Truncf(E : Extended) : Longint;
begin
E:=2.34;
result:=Trunc(E); {I would be 2}
result:=Round(E); {I2 would be 2}
E:=2.98;
result:=Trunc(E); {I would be 2}
result:=Round(E); {I2 would be 3}
end;
Function TryEncodeDatef(Year, Month, Day: Word; out Date: TDateTime) : Boolean;
begin
result:= TryEncodeDate(2006,11,27,date); {B should be true}
end;
Function TryEncodeTimef(Hour, Min, Sec, MSec: Word; out Time: TDateTime) : Boolean;
begin
result:= TryEncodeTime(15,10,01,00, time); {B should be true}
end;
Function Uppercasef(S : String) : string;
begin
S:='The Big Bad Wolf';
result:=Uppercase(S); {S2 would be 'THE BIG BAD WOLF'}
end;
//if fileExists('..\maxbox3\pas_includebox.inc') then
//{$I ..\maxbox3\pas_includebox.inc}
{function IntToBin(my: integer): string
begin
// double name tester
end;}
Procedure HTTPDecode1(vurl: string);
var
myuri: TIdURI;
idhttp1: TIdHttp;
xs: TstringList;
i: integer;
begin
myuri:= TIdURI.Create(vurl);
IdHTTP1:= TIdHTTP.create(self);
try
Writeln('Utf8ToAnsi: '+Utf8ToAnsi(myuri.URLEncode(IdHttp1.Get(vurl))));
Try
Writeln(Utf8ToAnsi((IdHttp1.Get(vurl))));
xs:= TStringlist.Create;
xs.Text:= IdHttp1.Get(vurl);
for I:= 0 to xs.Count - 1 do
Writeln(UTF8toAnsi(HTTPDecode(xs[0])));
//dddguidtostring
Finally
myuri.Free;
IdHTTP1.Free;
xs.Free;
end;
except
//silent in case of no internet
end;
end;
function ExtractUrlPath1(const vFileName: string): string;
var
I: Integer;
begin
I:= LastDelimiter('/:', vFileName);
Result:= Copy(vFileName, 1, I);
end;
function ExtractUrlName1(const FileName: string): string;
var
I: Integer;
begin
I:= LastDelimiter('/:', FileName);
Result:= Copy(FileName, I + 1, 255);
end;
var
AnArray : Array of integer;
//myCRC: string;
mstream: TMemorystream;
begin //main of function tester
//writeln(extracturlpath1('http://www.softwareschule.ch/maxbox.htm'))
writeln((IntToBin(149)))
writeln(IntToHex(149,8))
writeln(IntToStr(bintoint('10010101')))
writeln(HexToBin2('0095')) //HexToBin from include pas_includebox.inc
writeln(BinToHex2('10010101'))
writeln(IntToStr(hextoint('0095')))
writeln(Chr(149))
writeln(IntToStr(Ord('')))
//writeln(CRC16('E93650'))
//myCRC:= CRC16('E93650')
//writeln(myCRC)
//writeln(hextobin('FFFF',8))
writeln(Replicatef('C',15))
//writeln(Uppercasef(''));
// writeln(FormatDateTimef('',0));
writeln(GetArrayLengthf(anarray)); //out of range test
writeln(charToHexStr('A')) //inc and inbuilt
writeln(NowF)
//HTTPDecode1('http://www.softwareschule.ch/examples/245_formapp2.txt');
//Iliacos intra muros peccatur et extra!
//writeln(extracturlpath1('http://www.softwareschule.ch/maxbox.htm'))
//writeln(extracturlname1('http://www.softwareschule.ch/maxbox.htm'))
{mstream:= TMemorystream.create;
AnsiString_to_stream('A a this is my stream', mstream)
Writeln(Stream_to_decimalbytes(mstream))
RandomFillStream(mstream)
Writeln(StreamToByte(mstream))
//Writeln(Stream_To_AnsiString(mstream))
mstream.Seek(0,0);
Writeln(StreamToAnsiString(mstream))}
//writeln(inttostr(constrain(40,20,30)))
with maxForm1 do begin
caption:= caption +'Boot Loader Script2 maxbootscript.txt';
//maxform1.caption:= 'tester';
color:= clteal;
//IntfNavigator1Click(self);
tbtnCompile.caption:= '&Compile!';
//tbtncompile.imageindex:= 6;
tbtnUsecase.caption:= 'UML &UC';
//maxform1.tbtncompile.imageindex:= 5;
maxform1.ShellStyle1Click(self);
memo2.font.size:= 15;
//Application.HintPause:= 50; //default : 500
//Application.HintShortPause:= 250; //default : 50
//Application.HintHidePause:= 2000; //default : 2500
Application.HintColor:= clYellow;
//writeln('found back: '+intToString(memo1.searchReplace('const',Uppercase('CONST'),
// [ssoWholeWord,ssoEntireScope,ssoReplaceAll])));
writeln('found sExtended: '+intToString(memo1.searchReplace('clYellow; ','',
[ssoWholeWord,ssoBackwards])));
memo1.tabwidth:= 4; //!
//memo1.search
// memo2.color:= clwebgold;
//memo2.font.size:= 18;
Info1Click(self);
//maxform1.ActiveLineColor1Click(Self)
memo1.activeLineColor:= clskyblue;
maxform1.setactivelinecolor(clskyblue)
maxform1.memo1.gutter.color:= clmoneygreen;
SynPasSyn1.KeyAttri.Foreground:= clNavy;
SynPasSyn1.SymbolAttribute.Foreground:= clRed;
SynPasSyn1.FloatAttri.Foreground:= cllime;
application.icon.loadfromresourcename(hinstance,'newunit')
end;
Writeln('BOOTSCRIPT2A ' +BOOTSCRIPT+ ' loaded at: '+ DateTimeToStr(Now))
End.
{new functions
timetostr and strtotime detected}