[Tool/Web/Other] PAWN API Generator for Notepad++
#1

Hi,

I want to release a small tool that I made for myself recently. Im using Notepad++ as default pawn editor, as it offers some really nice things that pawno cant do. The code completion is a quite nice feature. I once used Slice's tutorial to set everything up, but got tired of the "limited" code completion after a while, as im used to code completions that update themselves whenever you add a new function to your code. Notepad++ just completes what you tell it to complete in a xml file.

And what my tool does, is automatically creating those xml files from your code. It is still in an experimental stage and a bit buggy, but it works as it should.
Its written in Java (hit me for that shit if you like) without a real GUI and distributed as .jar. To launch it, double-clicking should work for most people. If it doesnt, enter the console, jump to the .jar's directory, and type
Код:
java -jar PawnAPIGenerator.jar
It scans the given directory recursively for all include files. PWNs like gamemodes arent processed yet.
If everything goes fine, it will create two files, PAWN.xml and userDefineLang.xml. You might need to merge the userDefineLang.xml with yours, if you got several user defined languages for notepad++. Copy and install the files as explained in Slice's tutorial, but dont take the uploaded ones, but the generated files. This way you got your own API in notepad++, containing all functions you wrote (stock, public, native, and non-modified), all defines and custom tags, just like with modern IDEs. Whenever you like, run it again and overwrite the xmls with the up to date files.

You can also specify the file targets as optional parameters:
Код:
java -jar PawnAPIGenerator.jar <path to pawn source directory> <target for PAWN.xml> <target for userDefineLang.xml>
e.g. to overwrite them directly. This way you can add it to your notepad++ execute script for compiling, so the api is updated on every compile (note that it takes a restart of n++ anyways to reload the files).


Bugs
Already way less. Some of the known bugs:

Defines arent considered yet (#defines are added to the API, but not considered as replacements)
Functions with multitag parameters ( {_,Float}:... ) wont be detected correctly.
Some people got version problems with the jar, see the following:

Problems with running the jar?
Someone reported me a versioning problem with the jar. If you cant run the .jar file, try recompiling it. Therefore use this link to download the source, unzip it, and run build.bat to recompile it automatically. Note that you need the Java 7 SDK for that. If everything went fine, the new .jar should appear in the same directory and should work for your system.


Download
Github source (gonna be updated frequently)
.jar download

Feel free to give some feedback or suggestions.
Reply
#2

Really like it, great work. ( once you work out the kinks )
Reply
#3

I rewrote parts of the scanning code, and now using new regexes. Scanning now takes some seconds, but should find all functions and natives, and parse them correctly. At this point the tool actually is useful

Defines still arent working, as interpreting them correctly isnt easy, but Im working on that.

Ill also add some code statistics, and some time maybe a GUI.
Reply
#4

How to compile, and good work...again
Reply
#5

I added a build.bat for automatic recompiling. Needs the java 7 sdk of course, but then the jar shouldnt make any versioning problems.

Edit: The generator now also adds defines to the API (but still not replaces them, the define parameters are an ugly thing to parse). Next thing Ill add will be tags I think.
Edit2: Tags are also detected and added to the syntax now.
Reply
#6

i got some weird erros:
Код:
C:\Program Files (x86)\PAWN Compiler\include\a_mysql.inc(1) : error 010: invalid function or declaration
C:\Program Files (x86)\PAWN Compiler\include\sscanf2.inc(1) : error 010: invalid function or declaration
C:\Program Files (x86)\PAWN Compiler\include\whirlpool.inc(1) : error 010: invalid function or declaration
dreamgame.pwn(1376) : error 017: undefined symbol "WP_Hash"
dreamgame.pwn(1376) : warning 202: number of arguments does not match definition
dreamgame.pwn(1376) : warning 202: numbments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright (er of arguments does not match definition
dreamgame.pwn(1394) : error 017: undefined symbol "WP_Hash"
dreamgame.pwn(1394) : warning 202: number of arguments does not match definition
dreamgame.pwn(1394) : warning 202: number of arguc) 1997-2006, ITB CompuPhase
probably syntax ain't generated correctly

EDIT: never mind, works as charm! thx!
Reply
#7

Could you make it possible so that the program scans .pwn files also? In my gamemode I use "custom" includes which I gave the extension of .pwn.

Код:
#include "funcoes/utils.pwn"
#include "funcoes/geometry.pwn"
#include "funcoes/database.pwn"
#include "funcoes/game.pwn"
#include "funcoes/timers.pwn"
Reply
#8

I wish all of it could be done with a click of button. Nevertheless great work, will definitely come in handy.
Reply
#9

Does this still work? I'd really like this for adding all the YSI functions for auto-completion
Reply
#10

It should still do the job, as its all independent from the samp version. Just try it, theres nothing to lose.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)