Re: Experimenting in C code
Jose Da Silva <[email protected]> Thu, 2 Jun 2016 00:43:17 -0700
| Newsgroups | gmane.comp.fonts.fontforge.devel |
|---|---|
| Message-ID | <[email protected]> |
Glad to hear you cloned the github source, this will make it easier to
push-back some pull requests....however...if you are experimenting at this
point, this isn't really much to worry about at the moment.
For myself I tend to hold the git clone copy as my local origin, and then
work on copy of this so I don't mess-up the origin copy.
git clone https://github.com/JoesCat/fontforge ~/ff_local
cp -pR ~/ff_local ~/ff1 <-(experimental copy ff1, or ffX)
A piece of advice is if you plan on making edits and using git pull
requests to push-back edits, then it is best to start a branch on your
cloned copy and put your mods in the branch, and not in the master branch.
cd ~/ff_local
git -b checkout my_PCX_1
cd ~
cp -pR ~/ff_local ~/ff2 <-(experimental copy ff2)
This allows you the flexibility to toss-out code that might not be to your
liking, or to the main-line's, and if you had made the changes to your
master branch, you would be stuck in a sort of limbo waiting for mainline
to pull-in your pull-request, otherwise it messes-up your cloned branch.
When you're satisfied with your edits...
diff ~/ff_local ~/ff2
copy the edits back to ~/ff_local
and test again to be sure you did okay
cp -pR ~/ff_local ~/ff3
cd ~/ff3 ...build it to be sure it works, if no, fix further, if works ok,
then push the branch to your "origin"
cd ~/ff_local
git push -u origin my_PCX_1
(you will be able to pull request the new my_PCX_1 branch on your webpage)
If satified, then change your local copy back to master
git checkout master
These allow you to fetch "upstream" and merge with you copy.
cd ~/ff_local
git fetch upstream
git merge upstream/master
I'll assume you cloned fontforge/fontforge to your own github user page,
therefore making your copy "origin" and the fontforge/fontforge "upstream"
inside the git clone, you will find a config file in .git/config
You can use a plain text editor to modify it (I use the KDE desktop,
therefore use Kwrite...I'm guessing you may be using gnome, and probably
default to gedit)...the references of most interest are "origin" and
"upstream", and you will need to setup ssl if you plan to push-back to your
origin page using the commandline. This is a short list giving you some
idea of what the .git/config file looks like, which can/will be different for
you.
....if url=git@ then it expects to use ssl, if it is url=http...then it's a
pull-only branch
This is a short list, but yours will have a different "origin" if you setup
a github account and cloned fontforge to your webpage...
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:JoesCat/fontforge.git
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "upstream"]
url = https://github.com/fontforge/fontforge.git
fetch = +refs/heads/*:refs/remotes/upstream/*
[remote "jtanx"]
url = https://github.com/jtanx/fontforge.git
fetch = +refs/heads/*:refs/remotes/jtanx/*
[remote "monkeyiq"]
url = https://github.com/monkeyiq/fontforge-fork
fetch = +refs/heads/*:refs/remotes/monkeyiq/*
A lot of the above is easier to handle with UI git tools.
In KDE, this would be gitk ...I don't know what it is for Gnome, but
suspect a similar name.
At this point, if you are just experimenting, don't worry too much about
the git system, but best to work on a copy of your ~/ff_local instead of
messing-up/getting-it-dirty with all the extra files generated during
./bootstrap, configure, make.
Another tool you may find handy, is grep for finding files holding key words.
For example...
cd ~/ff_local
grep "\.gif" -R *
more answered below
On June 1, 2016 07:43:53 PM Martin B. Brilliant wrote:
> Next step, configure, ran without any problems. The list of optional
> libraries at the end showed that libgif and libreadline were missing.
> QUESTION: after I install those libraries, can I include them by just
> running bootstrap, configure, etc., from the beginning?
In your search for missing libraries the first time around, a lot of it is
now installed and not to worry about. ./bootstrap is a bit of a strange
beast, which seems to import a bunch more stuff, but you won't need to worry
about things like libtool,X, gif, tiff, etc now.
configure is built using ./bootstrap, but it will find the optional libraries
which you installed, such as libgif libtool, etc.
> The make step also ran without trouble. I noticed as the messages flew
> by that there were a lot of return values ignored. I’m sure at least
> some of those return values should be used in the code to make sure
> requested memory is actually allocated and that unallocated memory is
> not addressed.
Glad you noticed a lot of missing return values such as malloc, etc.
There's a lot of potential fixes that can be done here.
Pay some attention to "when" alloc and chunkalloc are used as they have
some reasoning behind the two types of memory allocations, likewise
realloc, free, chunkrealloc, chunkfree (a lot of realloc loses the earlier
reference if it returns NULL, this needs TLC too).
> Next: make install, ldconfig, and now FontForge is in the application
> menu and starts up when its menu entry is clicked. I didn’t try to load
> any fonts, just verified that it exists and can be invoked.
If your plan is to experiment with creating a PCX import/export, I'd find a
copy of monotone gif or bmp tiny pictures of a couple of letters to
experiment with, or simply make a monotone 8x8 pixel copy using GIMP and
save it as A.gif and another copy as A.pcx.
This way, when you run fontforge, you only need to state it's a new font
(therefore don't need to load one yet), then when fontforge is running, I'd
select and empty font, say... "A", and then go import your 8x8 A.gif
picture.
To experiment in adding pcx, I'd start simple, by globbing-on your test
code to an existing file structure, let's say, for example in:
gutils/gimagereadgif.c
looking at the gif file, maybe might be easier to start with
gutils/gimagereadbmp.c by adding a secondary file-open to your A.bmp
then close the file. add plenty of "I'm here" code to make your testing
easier...
looking at gutils/gimagereadbmp.c, you may note that the file name is opened
in GImageReadBmp() and a file handle given to GImageRead_Bmp() which might
not make much sense at first, but if you grep for "bmp" you'll find some stuff
dealing with drag-n-drop, so the file-input-stream nature of
GImageRead_Bmp() makes more sense why it's seperate from GImageReadBmp()
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
fontforge-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fontforge-devel
http://fontforge.10959.n7.nabble.com/Developer-f3.html