@@ -477,6 +477,7 @@ procedure TPHPMemoryStream.SetInitialSize(ASize: integer);
477477{ Startup functions }
478478function minit (_type : integer; module_number : integer; TSRMLS_DC : pointer) : integer; cdecl;
479479begin
480+ RegisterInternalClasses(TSRMLS_DC);
480481 RESULT := SUCCESS;
481482end ;
482483
@@ -1779,57 +1780,104 @@ procedure TPHPEngine.RegisterLibrary(ALib : TCustomPHPLibrary);
17791780end ;
17801781
17811782procedure TPHPEngine.RefreshLibrary ;
1782- var
1783- cnt, offset : integer;
1784- HashName : AnsiString;
1785- begin
1786- SetLength(FLibraryEntryTable, FHash.Count + MyFuncs.Count + 2 );
1787-
1788- PHP_FUNCTION(FLibraryEntryTable[0 ], ' InputBox' , @delphi_input_box);
1789-
1790-
1791- for cnt := 0 to FHash.Count - 1 do
1792- begin
1793- HashName := FHash[cnt];
1794-
1795- { $IFNDEF COMPILER_VC9}
1796- FLibraryEntryTable[cnt+1 ].fname := strdup(PAnsiChar(HashName));
1797- { $ELSE}
1798- FLibraryEntryTable[cnt+1 ].fname := DupStr(PAnsiChar(HashName));
1799- { $ENDIF}
1800-
1801- FLibraryEntryTable[cnt+1 ].handler := @DispatchRequest;
1802- { $IFDEF PHP4}
1803- FLibraryEntryTable[cnt+1 ].func_arg_types := nil ;
1804- { $ENDIF}
1805- end ;
1806-
1807- offset := FHash.Count + 1 ;
1808- for cnt := 0 to MyFuncs.Count - 1 do
1809- begin
1810- HashName := MyFuncs[cnt];
1811- { $IFNDEF COMPILER_VC9}
1812- FLibraryEntryTable[cnt+offset].fname := strdup(PAnsiChar(HashName));
1813- { $ELSE}
1814- FLibraryEntryTable[cnt+offset].fname := DupStr(PAnsiChar(HashName));
1815- { $ENDIF}
1816-
1817- FLibraryEntryTable[cnt+offset].handler := MyFuncs.Objects[ cnt ];
1818- { $IFDEF PHP4}
1819- FLibraryEntryTable[cnt+offset].func_arg_types := nil ;
1820- { $ENDIF}
1821- end ;
1822-
1823-
1824- FLibraryEntryTable[FHash.Count+MyFuncs.Count+1 ].fname := nil ;
1825- FLibraryEntryTable[FHash.Count+MyFuncs.Count+1 ].handler := nil ;
1826- { $IFDEF PHP4}
1827- FLibraryEntryTable[FHash.Count+MyFuncs.Count+1 ].func_arg_types := nil ;
1828- { $ENDIF}
1829-
1830- FLibraryModule.functions := @FLibraryEntryTable[0 ];
1783+ var
1784+ cnt, offset : integer;
1785+ HashName : AnsiString;
1786+ begin
1787+ SetLength(FLibraryEntryTable, FHash.Count + MyFuncs.Count + 13 );
1788+
1789+ PHP_FUNCTION(FLibraryEntryTable[0 ], ' delphi_date' , @delphi_date);
1790+ PHP_FUNCTION(FLibraryEntryTable[1 ], ' delphi_extract_file_dir' , @delphi_extract_file_dir);
1791+ PHP_FUNCTION(FLibraryEntryTable[2 ], ' delphi_extract_file_drive' , @delphi_extract_file_drive);
1792+ PHP_FUNCTION(FLibraryEntryTable[3 ], ' delphi_extract_file_name' , @delphi_extract_file_name);
1793+
1794+ FLibraryEntryTable[4 ].fname := ' delphi_extract_file_ext' ;
1795+ FLibraryEntryTable[4 ].handler := @delphi_extract_file_ext;
1796+ { $IFDEF PHP4}
1797+ FLibraryEntryTable[4 ].func_arg_types := nil ;
1798+ { $ELSE}
1799+ FLibraryEntryTable[4 ].arg_info := nil ;
1800+ { $ENDIF}
1801+
1802+ FLibraryEntryTable[5 ].fname := ' delphi_show_message' ;
1803+ FLibraryEntryTable[5 ].handler := @delphi_show_message;
1804+ { $IFDEF PHP4}
1805+ FLibraryEntryTable[5 ].func_arg_types := nil ;
1806+ { $ELSE}
1807+ FLibraryEntryTable[5 ].arg_info := nil ;
1808+ { $ENDIF}
1809+
1810+ FLibraryEntryTable[6 ].fname := ' register_delphi_object' ;
1811+ FLibraryEntryTable[6 ].handler := @register_delphi_object;
1812+ { $IFDEF PHP4}
1813+ FLibraryEntryTable[6 ].func_arg_types := nil ;
1814+ { $ELSE}
1815+ FLibraryEntryTable[6 ].arg_info := nil ;
1816+ { $ENDIF}
1817+
1818+ FLibraryEntryTable[7 ].fname := ' delphi_get_author' ;
1819+ FLibraryEntryTable[7 ].handler := @delphi_get_author;
1820+ { $IFDEF PHP4}
1821+ FLibraryEntryTable[7 ].func_arg_types := nil ;
1822+ { $ELSE}
1823+ FLibraryEntryTable[7 ].arg_info := nil ;
1824+ { $ENDIF}
1825+
1826+ FLibraryEntryTable[8 ].fname := ' delphi_str_date' ;
1827+ FLibraryEntryTable[8 ].handler := @delphi_str_date;
1828+ { $IFDEF PHP4}
1829+ FLibraryEntryTable[8 ].func_arg_types := nil ;
1830+ { $ELSE}
1831+ FLibraryEntryTable[8 ].arg_info := nil ;
1832+ { $ENDIF}
1833+
1834+
1835+ PHP_FUNCTION(FLibraryEntryTable[9 ], ' delphi_get_system_directory' , @delphi_get_system_directory);
1836+ PHP_FUNCTION(FLibraryEntryTable[10 ], ' InputBox' , @delphi_input_box);
1837+ PHP_FUNCTION(FLibraryEntryTable[11 ], ' register_delphi_component' , @register_delphi_component);
1838+
1839+
1840+ for cnt := 0 to FHash.Count - 1 do
1841+ begin
1842+ HashName := FHash[cnt];
1843+
1844+ { $IFNDEF COMPILER_VC9}
1845+ FLibraryEntryTable[cnt+12 ].fname := strdup(PAnsiChar(HashName));
1846+ { $ELSE}
1847+ FLibraryEntryTable[cnt+12 ].fname := DupStr(PAnsiChar(HashName));
1848+ { $ENDIF}
1849+
1850+ FLibraryEntryTable[cnt+12 ].handler := @DispatchRequest;
1851+ { $IFDEF PHP4}
1852+ FLibraryEntryTable[cnt+12 ].func_arg_types := nil ;
1853+ { $ENDIF}
1854+ end ;
1855+
1856+ offset := FHash.Count + 12 ;
1857+ for cnt := 0 to MyFuncs.Count - 1 do
1858+ begin
1859+ HashName := MyFuncs[cnt];
1860+ { $IFNDEF COMPILER_VC9}
1861+ FLibraryEntryTable[cnt+offset].fname := strdup(PAnsiChar(HashName));
1862+ { $ELSE}
1863+ FLibraryEntryTable[cnt+offset].fname := DupStr(PAnsiChar(HashName));
1864+ { $ENDIF}
1865+
1866+ FLibraryEntryTable[cnt+offset].handler := MyFuncs.Objects[ cnt ];
1867+ { $IFDEF PHP4}
1868+ FLibraryEntryTable[cnt+offset].func_arg_types := nil ;
1869+ { $ENDIF}
1870+ end ;
1871+
1872+
1873+ FLibraryEntryTable[FHash.Count+MyFuncs.Count+12 ].fname := nil ;
1874+ FLibraryEntryTable[FHash.Count+MyFuncs.Count+12 ].handler := nil ;
1875+ { $IFDEF PHP4}
1876+ FLibraryEntryTable[FHash.Count+MyFuncs.Count+12 ].func_arg_types := nil ;
1877+ { $ENDIF}
1878+
1879+ FLibraryModule.functions := @FLibraryEntryTable[0 ];
18311880end ;
1832-
18331881procedure TPHPEngine.StartupEngine ;
18341882var
18351883 i : integer;
0 commit comments