MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Specifics",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "32": {
                "pageid": 32,
                "ns": 0,
                "title": "Recursive filesearch",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "Another small code example i wanted to 'rescue' from aros-exec 'haystack'.\n\nOriginal code was pasted in [http://aros-exec.org/modules/newbb/viewtopic.php?post_id=75487#forumpost75487 this] post.\n\n== Recursive file matching, using AROS native functions ==\n\nThe code does a recursive file search using amigados specific calls to do so.\n\n<source lang=\"pascal\">\nProgram RecursiveFileMatchAROS;\n \n{$MODE OBJFPC}{$H+} \n \nuses \n  exec, \n  amigados, \n  SysUtils; \n \n \n \nProcedure FileSearchAROS(const pathname, FileMask: string; const DoRecursive: boolean);\n{ \n  Routine based on thomas-rapps post ->  \n   http://eab.abime.net/showpost.php?p=660659&postcount=5 \n  FileSearch routine that can search directories recursive (no restrictions) \n  and match a given file pattern. The FileMask pattern is not applied to the \n  directory, only to the file.\n  This routine is by no means foolproof and definitely needs a bit more TLC. \n} \n\nVar\n  level       : longint;    // Indentation level for printing \nvar  \n  ap          : PAnchorPath; \n  error       : longint;    // Holds return code for AROS' match-functions\n  s           : String;     // Temp storage used for post entry-type printing\n  filename    : String;     // String holds current filename entry (only filename part) \n  filemaskTOK : pChar;      // C-String, hold tokenized mask needed by AROS API\n  isMatch     : Longbool;   // Temp boolean placeholder to hold the match result \n  i           : longint;    // used for counting \nbegin \n  ap := AllocVec(sizeof(TAnchorPath) + 1024, MEMF_CLEAR); \n  if (ap <> nil) then \n  begin \n    ap^.ap_BreakBits := SIGBREAKF_CTRL_C; \n    ap^.ap_StrLen    := 1024;   \n  end; \n \n  level := 0; \n \n  error := MatchFirst(pchar(pathname), ap); \n \n  if (error = 0) and (ap^.ap_Info.fib_DirEntryType >= 0) \n    then ap^.ap_Flags := ap^.ap_Flags or APF_DODIR; \n \n  while (error = 0) do \n  begin \n    if ((ap^.ap_Flags and APF_DIDDIR) <> 0) then \n    begin \n      { Leaving a directory entered below (APF_DODIR) } \n      dec(level); \n      ap^.ap_Flags := ap^.ap_Flags and not(APF_DIDDIR);     \n    end \n    else \n    begin \n      { \n        Soft linked objects are returned by the scanner but they need \n        special treatments; we are merely ignoring them here in order \n        to keep this example simple\n      } \n      if (ap^.ap_Info.fib_DirEntryType <> ST_SOFTLINK) then \n      begin \n        {  \n          provide for some indentation  \n        } \n        for i := 0 to pred(level) do write(' '); \n \n        if (ap^.ap_Info.fib_DirEntryType < 0) then \n        begin \n          { Initial postfix printing string is empty (=file) }\n          s := '';  \n \n          { \n            According to AutoDocs/FileInfoBlock struct, we can now be certain \n            that we do not deal with a directory, but are dealing with an \n            actual file. \n          } \n\n          { Use FileInfoBlock struct to retrieve filename of current entry } \n          Filename := ap^.ap_Info.fib_FileName; \n\n          { do something nice, and emit the filename } \n          writeln('filename = ',filename); \n \n          { \n            Now we have a real filename (only) to work with. But  \n            what should we do with it ? Is it even useful ? \n            We know we need the filename to match the given  \n            filemask. \n            Is there perhaps a way to do this ? Lets try:                   \n          } \n\n          { allocate heapmem for pchar: fpc business. Size taken from AutoDocs } \n          FileMaskTOK := stralloc((Length(FileMask) * 2) + 2); \n\n          { create a tokenized filemask with a trickery cast. Size taken from AutoDocs } \n          ParsePatternNoCase(pchar(FileMask), FileMaskTOK, (Length(FileMask) * 2) + 2); \n\n          { match a pattern } \n          IsMatch := MatchPatternNoCase(FileMaskTOK, pchar(FileName)); \n\n          { check the result, if matched then emit something }  \n          if IsMatch then writeln('It seems that the above printed filename matches the filemask o/');           \n\n          { return allocated heapmem for pchar: fpc business }           \n          strdispose(FileMaskTOK); \n        end   \n        else s := ' (Dir)'; // Change postfix printing string to read directory\n \n        // Emit the current entry. ap_Buf contains the full path + filename\n        writeln(format('%s%s',[ap^.ap_Buf, s])); \n \n        { If this is a directory, enter it } \n        if ((ap^.ap_Info.fib_DirEntryType >= 0) and DoRecursive) then \n        begin \n          ap^.ap_Flags := (ap^.ap_Flags or APF_DODIR);\n\n          { For every directory entered, update indentation level accordingly }\n          inc(level); \n        end; \n \n      end; \n    end; \n    error := MatchNext(ap); \n \n  end; \n  MatchEnd(ap); \n  FreeVec(ap); \nend; \n \n \n \nBegin \n  WriteLn('enter'); \n \n  FileSearchAROS('Ram:','#?.info', true); \n \n  Writeln('leave'); \nEnd.\n</source>\n\n== Recursive file matching, using Pascal functions (for comparison) ==\n<source lang=\"pascal\">\nprogram RecursiveFileMatchPAS;\n\n{$MODE OBJFPC}{$H+}\n\nuses\n  SysUtils, \n  fpMasks;\n\nConst\n  AllWildMask = '#?';\n\nProcedure FileSearchPAS(const pathname, FileMask: String; const DoRecursive: boolean);\n{\n  Pascal recursive filesearch routine, based on the AROS' native version to\n  show the differences.\n  FileSearch routine that can search directories recursive (no restrictions) \n  and match a given file pattern. The FileMask pattern is not applied to the \n  directory, only to the file.\n  This routine is by no means foolproof and definitely needs a bit more TLC.\n}\n\nConst\n  Level       : LongInt= 0; // Indentation level for printing\nvar\n  SR          : TSearchRec; // FileSearch record, similar to AROS' AnchorPath\n  sPath       : String;     // Corrected path which is required for FPC\n  S           : String;     // Temp storage used for post entry-type printing\n  filename    : String;     // String holds current filename entry (only filename part) \n  FilemaskTOK : TMask;      // Pascal class to hold mask needed by FPC to Match a wildcard\n  isMatch     : Boolean;    // Temp boolean placeholder to hold the match result\n  i           : Longint;    // used for counting\nbegin\n  {\n    Pascal's FindFirst/FindNext requires proper path ending, so provide it.\n  }\n  sPath := IncludeTrailingPathDelimiter(pathname);\n\n  { \n    small workaround to match AROS' native counterpart as FPC's native\n    implementation does not start matching the root path, rather files within.\n  }\n  if ( level = 0 ) then\n  begin\n    Writeln(sPath + ' (Dir)');\n    inc(level);\n  end;\n\n  {\n    Find anyfile on the given Path matching All possible filenames\n  }\n  if ( FindFirst(sPath + AllWildMask, faAnyFile, SR) = 0 ) then\n  repeat\n    { \n      Soft linked objects are returned by the scanner but they need \n      special treatments; we are merely ignoring them here in order \n      to keep this example simple\n    } \n    If ((SR.Attr and faSymLink) = 0) then\n    begin\n      {  \n        provide for some indentation  \n      } \n      for i := 0 to Pred(level) do write(' ');\n\n      {\n        If not directory (= FPC cross platform Alert!) then assume file.\n        It is not foolproof to assume we deal with a file as there are other \n        possible directory entry types on other platforms. As long as you run \n        this implementation on AROS things should work correctly )\n      }\n      if ((SR.Attr and faDirectory) = 0) then \n      begin\n        { Initial postfix printing string is empty (=file) }\n        S := '';  \n\n        { Use TSearchRec struct to retrieve the name of the current entry }\n        Filename := SR.Name;\n\n        { do something nice, and emit the filename } \n        writeln('filename = ', filename); \n    \n        { create mask in pascal to compare mask against current filename }\n        FilemaskTOK := TMask.Create(FileMask);\n\n        { match the mask against the curent filename } \n        IsMatch := FileMaskTOK.Matches(FileName);\n\n        { free mask memory. Very inefficient, comparable to AROS counterpart }\n        FileMaskTOK.Free;\n\n        { check the result, if matched then emit something } \n        if IsMatch then writeln('It seems that the above printed filename matches the filemask o/'); \n      end\n      else S := ' (Dir)'; // Change postfix printing string to read directory\n\n      {\n        Emit the current entry. name entry of TSearchrec contains only the \n        name, therefor construct things ourselves in order to get a complete \n        path + filename\n      }\n      Writeln(sPath + SR.Name + S);\n\n      { If this is a directory, enter it } \n      if ((SR.Attr and faDirectory) <> 0) and DoRecursive then \n      begin\n\n        { For every directory entered, update indentation level accordingly }\n        inc(level);\n\n        { \n          In opposite to AROS native implementation, for FPC we manually need \n          to call ourselves recursively. \n          Note that this can lead to stack issues. Increase stack accordingly.\n        }  \n        FileSearchPAS(sPath + SR.Name, FileMask, DoRecursive);\n\n        { For every directory leaving, update indentation level accordingly } \n        dec(level);\n      end;\n\n    end;\n  until ( FindNext(SR) <> 0 );\n\n  FindClose(SR);\nend;\n\n\n\nBegin \n  WriteLn('enter'); \n \n  FileSearchPAS('Ram:','*.info', true); \n \n  Writeln('leave'); \nEnd.\n</source>"
                    }
                ]
            },
            "4": {
                "pageid": 4,
                "ns": 0,
                "title": "Source Examples",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "=== Source Examples ===\n\nOn this page Source example are going to collect (or links to it) which working on AROS freepascal\n----\n==== Examples with own pages ====\n* [[Call Library]] - How to call a library function\n* [[MUI Helper]] - How to write MUI/Zune application like in C using muihelper\n* ...\n----\n\n==== Hello World ====\n<source lang=\"pascal\">\nProgram HelloWorld;\nBegin\n  Writeln('Hello World');\nEnd.\n</source>\n\n==== Started from Workbench/Wanderer ====\nHow to check if the program started from Wanderer/Workbench\n<source lang=\"pascal\">\n  program WBStart;\n  begin\n    if assigned(AOS_WbMsg) then\n      writeln('Started from WB')\n    else\n      writeln('Started from CLI');\n  end.\n</source>\n\n==== Put a message to a named port ====\n\n<source lang=\"pascal\">\n function SafePutToPort(Msg: PMessage; Portname: string): Integer;\n var\n   Port: PMsgPort;\n   PName: PChar;\n begin\n   Result := -1;\n   PName := PChar(Portname + #0);\n   Forbid();\n   Port := FindPort(PName);\n   if Assigned(Port) then\n   begin\n     PutMsg(Port, Msg);\n     Result := 0;\n   end;\n   Permit();\n end;\n</source>"
                    }
                ]
            }
        }
    }
}